Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.10.11.
  1// SPDX-License-Identifier: GPL-2.0
  2//
  3// Copyright (c) 2018 MediaTek Inc.
  4
  5#include <linux/bitops.h>
  6#include <linux/clk.h>
  7#include <linux/clk-provider.h>
  8#include <linux/dma-mapping.h>
  9#include <linux/errno.h>
 10#include <linux/interrupt.h>
 11#include <linux/io.h>
 12#include <linux/iopoll.h>
 13#include <linux/kernel.h>
 14#include <linux/module.h>
 15#include <linux/platform_device.h>
 16#include <linux/mailbox_controller.h>
 17#include <linux/mailbox/mtk-cmdq-mailbox.h>
 18#include <linux/of_device.h>
 19
 20#define CMDQ_OP_CODE_MASK		(0xff << CMDQ_OP_CODE_SHIFT)
 21#define CMDQ_NUM_CMD(t)			(t->cmd_buf_size / CMDQ_INST_SIZE)
 22
 23#define CMDQ_CURR_IRQ_STATUS		0x10
 24#define CMDQ_SYNC_TOKEN_UPDATE		0x68
 25#define CMDQ_THR_SLOT_CYCLES		0x30
 26#define CMDQ_THR_BASE			0x100
 27#define CMDQ_THR_SIZE			0x80
 28#define CMDQ_THR_WARM_RESET		0x00
 29#define CMDQ_THR_ENABLE_TASK		0x04
 30#define CMDQ_THR_SUSPEND_TASK		0x08
 31#define CMDQ_THR_CURR_STATUS		0x0c
 32#define CMDQ_THR_IRQ_STATUS		0x10
 33#define CMDQ_THR_IRQ_ENABLE		0x14
 34#define CMDQ_THR_CURR_ADDR		0x20
 35#define CMDQ_THR_END_ADDR		0x24
 36#define CMDQ_THR_WAIT_TOKEN		0x30
 37#define CMDQ_THR_PRIORITY		0x40
 38
 39#define CMDQ_THR_ACTIVE_SLOT_CYCLES	0x3200
 40#define CMDQ_THR_ENABLED		0x1
 41#define CMDQ_THR_DISABLED		0x0
 42#define CMDQ_THR_SUSPEND		0x1
 43#define CMDQ_THR_RESUME			0x0
 44#define CMDQ_THR_STATUS_SUSPENDED	BIT(1)
 45#define CMDQ_THR_DO_WARM_RESET		BIT(0)
 46#define CMDQ_THR_IRQ_DONE		0x1
 47#define CMDQ_THR_IRQ_ERROR		0x12
 48#define CMDQ_THR_IRQ_EN			(CMDQ_THR_IRQ_ERROR | CMDQ_THR_IRQ_DONE)
 49#define CMDQ_THR_IS_WAITING		BIT(31)
 50
 51#define CMDQ_JUMP_BY_OFFSET		0x10000000
 52#define CMDQ_JUMP_BY_PA			0x10000001
 53
 54struct cmdq_thread {
 55	struct mbox_chan	*chan;
 56	void __iomem		*base;
 57	struct list_head	task_busy_list;
 58	u32			priority;
 59};
 60
 61struct cmdq_task {
 62	struct cmdq		*cmdq;
 63	struct list_head	list_entry;
 64	dma_addr_t		pa_base;
 65	struct cmdq_thread	*thread;
 66	struct cmdq_pkt		*pkt; /* the packet sent from mailbox client */
 67};
 68
 69struct cmdq {
 70	struct mbox_controller	mbox;
 71	void __iomem		*base;
 72	int			irq;
 73	u32			thread_nr;
 74	u32			irq_mask;
 75	struct cmdq_thread	*thread;
 76	struct clk		*clock;
 77	bool			suspended;
 78	u8			shift_pa;
 79};
 80
 81struct gce_plat {
 82	u32 thread_nr;
 83	u8 shift;
 84};
 85
 86u8 cmdq_get_shift_pa(struct mbox_chan *chan)
 87{
 88	struct cmdq *cmdq = container_of(chan->mbox, struct cmdq, mbox);
 89
 90	return cmdq->shift_pa;
 91}
 92EXPORT_SYMBOL(cmdq_get_shift_pa);
 93
 94static int cmdq_thread_suspend(struct cmdq *cmdq, struct cmdq_thread *thread)
 95{
 96	u32 status;
 97
 98	writel(CMDQ_THR_SUSPEND, thread->base + CMDQ_THR_SUSPEND_TASK);
 99
100	/* If already disabled, treat as suspended successful. */
101	if (!(readl(thread->base + CMDQ_THR_ENABLE_TASK) & CMDQ_THR_ENABLED))
102		return 0;
103
104	if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_CURR_STATUS,
105			status, status & CMDQ_THR_STATUS_SUSPENDED, 0, 10)) {
106		dev_err(cmdq->mbox.dev, "suspend GCE thread 0x%x failed\n",
107			(u32)(thread->base - cmdq->base));
108		return -EFAULT;
109	}
110
111	return 0;
112}
113
114static void cmdq_thread_resume(struct cmdq_thread *thread)
115{
116	writel(CMDQ_THR_RESUME, thread->base + CMDQ_THR_SUSPEND_TASK);
117}
118
119static void cmdq_init(struct cmdq *cmdq)
120{
121	int i;
122
123	WARN_ON(clk_enable(cmdq->clock) < 0);
124	writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES);
125	for (i = 0; i <= CMDQ_MAX_EVENT; i++)
126		writel(i, cmdq->base + CMDQ_SYNC_TOKEN_UPDATE);
127	clk_disable(cmdq->clock);
128}
129
130static int cmdq_thread_reset(struct cmdq *cmdq, struct cmdq_thread *thread)
131{
132	u32 warm_reset;
133
134	writel(CMDQ_THR_DO_WARM_RESET, thread->base + CMDQ_THR_WARM_RESET);
135	if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_WARM_RESET,
136			warm_reset, !(warm_reset & CMDQ_THR_DO_WARM_RESET),
137			0, 10)) {
138		dev_err(cmdq->mbox.dev, "reset GCE thread 0x%x failed\n",
139			(u32)(thread->base - cmdq->base));
140		return -EFAULT;
141	}
142
143	return 0;
144}
145
146static void cmdq_thread_disable(struct cmdq *cmdq, struct cmdq_thread *thread)
147{
148	cmdq_thread_reset(cmdq, thread);
149	writel(CMDQ_THR_DISABLED, thread->base + CMDQ_THR_ENABLE_TASK);
150}
151
152/* notify GCE to re-fetch commands by setting GCE thread PC */
153static void cmdq_thread_invalidate_fetched_data(struct cmdq_thread *thread)
154{
155	writel(readl(thread->base + CMDQ_THR_CURR_ADDR),
156	       thread->base + CMDQ_THR_CURR_ADDR);
157}
158
159static void cmdq_task_insert_into_thread(struct cmdq_task *task)
160{
161	struct device *dev = task->cmdq->mbox.dev;
162	struct cmdq_thread *thread = task->thread;
163	struct cmdq_task *prev_task = list_last_entry(
164			&thread->task_busy_list, typeof(*task), list_entry);
165	u64 *prev_task_base = prev_task->pkt->va_base;
166
167	/* let previous task jump to this task */
168	dma_sync_single_for_cpu(dev, prev_task->pa_base,
169				prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
170	prev_task_base[CMDQ_NUM_CMD(prev_task->pkt) - 1] =
171		(u64)CMDQ_JUMP_BY_PA << 32 |
172		(task->pa_base >> task->cmdq->shift_pa);
173	dma_sync_single_for_device(dev, prev_task->pa_base,
174				   prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
175
176	cmdq_thread_invalidate_fetched_data(thread);
177}
178
179static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread)
180{
181	return readl(thread->base + CMDQ_THR_WAIT_TOKEN) & CMDQ_THR_IS_WAITING;
182}
183
184static void cmdq_task_exec_done(struct cmdq_task *task, int sta)
185{
186	struct cmdq_task_cb *cb = &task->pkt->async_cb;
187	struct cmdq_cb_data data;
188
189	WARN_ON(cb->cb == (cmdq_async_flush_cb)NULL);
190	data.sta = sta;
191	data.data = cb->data;
192	data.pkt = task->pkt;
193	if (cb->cb)
194		cb->cb(data);
195
196	mbox_chan_received_data(task->thread->chan, &data);
197
198	list_del(&task->list_entry);
199}
200
201static void cmdq_task_handle_error(struct cmdq_task *task)
202{
203	struct cmdq_thread *thread = task->thread;
204	struct cmdq_task *next_task;
205	struct cmdq *cmdq = task->cmdq;
206
207	dev_err(cmdq->mbox.dev, "task 0x%p error\n", task);
208	WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
209	next_task = list_first_entry_or_null(&thread->task_busy_list,
210			struct cmdq_task, list_entry);
211	if (next_task)
212		writel(next_task->pa_base >> cmdq->shift_pa,
213		       thread->base + CMDQ_THR_CURR_ADDR);
214	cmdq_thread_resume(thread);
215}
216
217static void cmdq_thread_irq_handler(struct cmdq *cmdq,
218				    struct cmdq_thread *thread)
219{
220	struct cmdq_task *task, *tmp, *curr_task = NULL;
221	u32 curr_pa, irq_flag, task_end_pa;
222	bool err;
223
224	irq_flag = readl(thread->base + CMDQ_THR_IRQ_STATUS);
225	writel(~irq_flag, thread->base + CMDQ_THR_IRQ_STATUS);
226
227	/*
228	 * When ISR call this function, another CPU core could run
229	 * "release task" right before we acquire the spin lock, and thus
230	 * reset / disable this GCE thread, so we need to check the enable
231	 * bit of this GCE thread.
232	 */
233	if (!(readl(thread->base + CMDQ_THR_ENABLE_TASK) & CMDQ_THR_ENABLED))
234		return;
235
236	if (irq_flag & CMDQ_THR_IRQ_ERROR)
237		err = true;
238	else if (irq_flag & CMDQ_THR_IRQ_DONE)
239		err = false;
240	else
241		return;
242
243	curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) << cmdq->shift_pa;
244
245	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
246				 list_entry) {
247		task_end_pa = task->pa_base + task->pkt->cmd_buf_size;
248		if (curr_pa >= task->pa_base && curr_pa < task_end_pa)
249			curr_task = task;
250
251		if (!curr_task || curr_pa == task_end_pa - CMDQ_INST_SIZE) {
252			cmdq_task_exec_done(task, 0);
253			kfree(task);
254		} else if (err) {
255			cmdq_task_exec_done(task, -ENOEXEC);
256			cmdq_task_handle_error(curr_task);
257			kfree(task);
258		}
259
260		if (curr_task)
261			break;
262	}
263
264	if (list_empty(&thread->task_busy_list)) {
265		cmdq_thread_disable(cmdq, thread);
266		clk_disable(cmdq->clock);
267	}
268}
269
270static irqreturn_t cmdq_irq_handler(int irq, void *dev)
271{
272	struct cmdq *cmdq = dev;
273	unsigned long irq_status, flags = 0L;
274	int bit;
275
276	irq_status = readl(cmdq->base + CMDQ_CURR_IRQ_STATUS) & cmdq->irq_mask;
277	if (!(irq_status ^ cmdq->irq_mask))
278		return IRQ_NONE;
279
280	for_each_clear_bit(bit, &irq_status, cmdq->thread_nr) {
281		struct cmdq_thread *thread = &cmdq->thread[bit];
282
283		spin_lock_irqsave(&thread->chan->lock, flags);
284		cmdq_thread_irq_handler(cmdq, thread);
285		spin_unlock_irqrestore(&thread->chan->lock, flags);
286	}
287
288	return IRQ_HANDLED;
289}
290
291static int cmdq_suspend(struct device *dev)
292{
293	struct cmdq *cmdq = dev_get_drvdata(dev);
294	struct cmdq_thread *thread;
295	int i;
296	bool task_running = false;
297
298	cmdq->suspended = true;
299
300	for (i = 0; i < cmdq->thread_nr; i++) {
301		thread = &cmdq->thread[i];
302		if (!list_empty(&thread->task_busy_list)) {
303			task_running = true;
304			break;
305		}
306	}
307
308	if (task_running)
309		dev_warn(dev, "exist running task(s) in suspend\n");
310
311	clk_unprepare(cmdq->clock);
312
313	return 0;
314}
315
316static int cmdq_resume(struct device *dev)
317{
318	struct cmdq *cmdq = dev_get_drvdata(dev);
319
320	WARN_ON(clk_prepare(cmdq->clock) < 0);
321	cmdq->suspended = false;
322	return 0;
323}
324
325static int cmdq_remove(struct platform_device *pdev)
326{
327	struct cmdq *cmdq = platform_get_drvdata(pdev);
328
329	clk_unprepare(cmdq->clock);
330
331	return 0;
332}
333
334static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
335{
336	struct cmdq_pkt *pkt = (struct cmdq_pkt *)data;
337	struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
338	struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
339	struct cmdq_task *task;
340	unsigned long curr_pa, end_pa;
341
342	/* Client should not flush new tasks if suspended. */
343	WARN_ON(cmdq->suspended);
344
345	task = kzalloc(sizeof(*task), GFP_ATOMIC);
346	if (!task)
347		return -ENOMEM;
348
349	task->cmdq = cmdq;
350	INIT_LIST_HEAD(&task->list_entry);
351	task->pa_base = pkt->pa_base;
352	task->thread = thread;
353	task->pkt = pkt;
354
355	if (list_empty(&thread->task_busy_list)) {
356		WARN_ON(clk_enable(cmdq->clock) < 0);
357		/*
358		 * The thread reset will clear thread related register to 0,
359		 * including pc, end, priority, irq, suspend and enable. Thus
360		 * set CMDQ_THR_ENABLED to CMDQ_THR_ENABLE_TASK will enable
361		 * thread and make it running.
362		 */
363		WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
364
365		writel(task->pa_base >> cmdq->shift_pa,
366		       thread->base + CMDQ_THR_CURR_ADDR);
367		writel((task->pa_base + pkt->cmd_buf_size) >> cmdq->shift_pa,
368		       thread->base + CMDQ_THR_END_ADDR);
369
370		writel(thread->priority, thread->base + CMDQ_THR_PRIORITY);
371		writel(CMDQ_THR_IRQ_EN, thread->base + CMDQ_THR_IRQ_ENABLE);
372		writel(CMDQ_THR_ENABLED, thread->base + CMDQ_THR_ENABLE_TASK);
373	} else {
374		WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
375		curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR) <<
376			cmdq->shift_pa;
377		end_pa = readl(thread->base + CMDQ_THR_END_ADDR) <<
378			cmdq->shift_pa;
379		/* check boundary */
380		if (curr_pa == end_pa - CMDQ_INST_SIZE ||
381		    curr_pa == end_pa) {
382			/* set to this task directly */
383			writel(task->pa_base >> cmdq->shift_pa,
384			       thread->base + CMDQ_THR_CURR_ADDR);
385		} else {
386			cmdq_task_insert_into_thread(task);
387			smp_mb(); /* modify jump before enable thread */
388		}
389		writel((task->pa_base + pkt->cmd_buf_size) >> cmdq->shift_pa,
390		       thread->base + CMDQ_THR_END_ADDR);
391		cmdq_thread_resume(thread);
392	}
393	list_move_tail(&task->list_entry, &thread->task_busy_list);
394
395	return 0;
396}
397
398static int cmdq_mbox_startup(struct mbox_chan *chan)
399{
400	return 0;
401}
402
403static void cmdq_mbox_shutdown(struct mbox_chan *chan)
404{
405	struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
406	struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
407	struct cmdq_task *task, *tmp;
408	unsigned long flags;
409
410	spin_lock_irqsave(&thread->chan->lock, flags);
411	if (list_empty(&thread->task_busy_list))
412		goto done;
413
414	WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
415
416	/* make sure executed tasks have success callback */
417	cmdq_thread_irq_handler(cmdq, thread);
418	if (list_empty(&thread->task_busy_list))
419		goto done;
420
421	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
422				 list_entry) {
423		cmdq_task_exec_done(task, -ECONNABORTED);
424		kfree(task);
425	}
426
427	cmdq_thread_disable(cmdq, thread);
428	clk_disable(cmdq->clock);
429done:
430	/*
431	 * The thread->task_busy_list empty means thread already disable. The
432	 * cmdq_mbox_send_data() always reset thread which clear disable and
433	 * suspend statue when first pkt send to channel, so there is no need
434	 * to do any operation here, only unlock and leave.
435	 */
436	spin_unlock_irqrestore(&thread->chan->lock, flags);
437}
438
439static int cmdq_mbox_flush(struct mbox_chan *chan, unsigned long timeout)
440{
441	struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
442	struct cmdq_task_cb *cb;
443	struct cmdq_cb_data data;
444	struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
445	struct cmdq_task *task, *tmp;
446	unsigned long flags;
447	u32 enable;
448
449	spin_lock_irqsave(&thread->chan->lock, flags);
450	if (list_empty(&thread->task_busy_list))
451		goto out;
452
453	WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
454	if (!cmdq_thread_is_in_wfe(thread))
455		goto wait;
456
457	list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
458				 list_entry) {
459		cb = &task->pkt->async_cb;
460		data.sta = -ECONNABORTED;
461		data.data = cb->data;
462		data.pkt = task->pkt;
463		if (cb->cb)
464			cb->cb(data);
465
466		mbox_chan_received_data(task->thread->chan, &data);
467		list_del(&task->list_entry);
468		kfree(task);
469	}
470
471	cmdq_thread_resume(thread);
472	cmdq_thread_disable(cmdq, thread);
473	clk_disable(cmdq->clock);
474
475out:
476	spin_unlock_irqrestore(&thread->chan->lock, flags);
477	return 0;
478
479wait:
480	cmdq_thread_resume(thread);
481	spin_unlock_irqrestore(&thread->chan->lock, flags);
482	if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_ENABLE_TASK,
483				      enable, enable == 0, 1, timeout)) {
484		dev_err(cmdq->mbox.dev, "Fail to wait GCE thread 0x%x done\n",
485			(u32)(thread->base - cmdq->base));
486
487		return -EFAULT;
488	}
489	return 0;
490}
491
492static const struct mbox_chan_ops cmdq_mbox_chan_ops = {
493	.send_data = cmdq_mbox_send_data,
494	.startup = cmdq_mbox_startup,
495	.shutdown = cmdq_mbox_shutdown,
496	.flush = cmdq_mbox_flush,
497};
498
499static struct mbox_chan *cmdq_xlate(struct mbox_controller *mbox,
500		const struct of_phandle_args *sp)
501{
502	int ind = sp->args[0];
503	struct cmdq_thread *thread;
504
505	if (ind >= mbox->num_chans)
506		return ERR_PTR(-EINVAL);
507
508	thread = (struct cmdq_thread *)mbox->chans[ind].con_priv;
509	thread->priority = sp->args[1];
510	thread->chan = &mbox->chans[ind];
511
512	return &mbox->chans[ind];
513}
514
515static int cmdq_probe(struct platform_device *pdev)
516{
517	struct device *dev = &pdev->dev;
518	struct resource *res;
519	struct cmdq *cmdq;
520	int err, i;
521	struct gce_plat *plat_data;
522
523	cmdq = devm_kzalloc(dev, sizeof(*cmdq), GFP_KERNEL);
524	if (!cmdq)
525		return -ENOMEM;
526
527	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
528	cmdq->base = devm_ioremap_resource(dev, res);
529	if (IS_ERR(cmdq->base))
530		return PTR_ERR(cmdq->base);
531
532	cmdq->irq = platform_get_irq(pdev, 0);
533	if (cmdq->irq < 0)
534		return cmdq->irq;
535
536	plat_data = (struct gce_plat *)of_device_get_match_data(dev);
537	if (!plat_data) {
538		dev_err(dev, "failed to get match data\n");
539		return -EINVAL;
540	}
541
542	cmdq->thread_nr = plat_data->thread_nr;
543	cmdq->shift_pa = plat_data->shift;
544	cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
545	err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
546			       "mtk_cmdq", cmdq);
547	if (err < 0) {
548		dev_err(dev, "failed to register ISR (%d)\n", err);
549		return err;
550	}
551
552	dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n",
553		dev, cmdq->base, cmdq->irq);
554
555	cmdq->clock = devm_clk_get(dev, "gce");
556	if (IS_ERR(cmdq->clock)) {
557		dev_err(dev, "failed to get gce clk\n");
558		return PTR_ERR(cmdq->clock);
559	}
560
561	cmdq->mbox.dev = dev;
562	cmdq->mbox.chans = devm_kcalloc(dev, cmdq->thread_nr,
563					sizeof(*cmdq->mbox.chans), GFP_KERNEL);
564	if (!cmdq->mbox.chans)
565		return -ENOMEM;
566
567	cmdq->mbox.num_chans = cmdq->thread_nr;
568	cmdq->mbox.ops = &cmdq_mbox_chan_ops;
569	cmdq->mbox.of_xlate = cmdq_xlate;
570
571	/* make use of TXDONE_BY_ACK */
572	cmdq->mbox.txdone_irq = false;
573	cmdq->mbox.txdone_poll = false;
574
575	cmdq->thread = devm_kcalloc(dev, cmdq->thread_nr,
576					sizeof(*cmdq->thread), GFP_KERNEL);
577	if (!cmdq->thread)
578		return -ENOMEM;
579
580	for (i = 0; i < cmdq->thread_nr; i++) {
581		cmdq->thread[i].base = cmdq->base + CMDQ_THR_BASE +
582				CMDQ_THR_SIZE * i;
583		INIT_LIST_HEAD(&cmdq->thread[i].task_busy_list);
584		cmdq->mbox.chans[i].con_priv = (void *)&cmdq->thread[i];
585	}
586
587	err = devm_mbox_controller_register(dev, &cmdq->mbox);
588	if (err < 0) {
589		dev_err(dev, "failed to register mailbox: %d\n", err);
590		return err;
591	}
592
593	platform_set_drvdata(pdev, cmdq);
594	WARN_ON(clk_prepare(cmdq->clock) < 0);
595
596	cmdq_init(cmdq);
597
598	return 0;
599}
600
601static const struct dev_pm_ops cmdq_pm_ops = {
602	.suspend = cmdq_suspend,
603	.resume = cmdq_resume,
604};
605
606static const struct gce_plat gce_plat_v2 = {.thread_nr = 16};
607static const struct gce_plat gce_plat_v3 = {.thread_nr = 24};
608static const struct gce_plat gce_plat_v4 = {.thread_nr = 24, .shift = 3};
609
610static const struct of_device_id cmdq_of_ids[] = {
611	{.compatible = "mediatek,mt8173-gce", .data = (void *)&gce_plat_v2},
612	{.compatible = "mediatek,mt8183-gce", .data = (void *)&gce_plat_v3},
613	{.compatible = "mediatek,mt6779-gce", .data = (void *)&gce_plat_v4},
614	{}
615};
616
617static struct platform_driver cmdq_drv = {
618	.probe = cmdq_probe,
619	.remove = cmdq_remove,
620	.driver = {
621		.name = "mtk_cmdq",
622		.pm = &cmdq_pm_ops,
623		.of_match_table = cmdq_of_ids,
624	}
625};
626
627static int __init cmdq_drv_init(void)
628{
629	return platform_driver_register(&cmdq_drv);
630}
631
632static void __exit cmdq_drv_exit(void)
633{
634	platform_driver_unregister(&cmdq_drv);
635}
636
637subsys_initcall(cmdq_drv_init);
638module_exit(cmdq_drv_exit);
639
640MODULE_LICENSE("GPL v2");