blob: 49ee990b4d1fbd97cec55ab8c85637f4cb94c78a [file] [log] [blame]
Sascha Haueraecfbdb2012-09-21 10:07:49 +02001/*
2 * Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>
3 * Copyright (C) 2005-2009 Freescale Semiconductor, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15#include <linux/module.h>
16#include <linux/export.h>
17#include <linux/types.h>
Philipp Zabel6c641552013-03-28 17:35:21 +010018#include <linux/reset.h>
Sascha Haueraecfbdb2012-09-21 10:07:49 +020019#include <linux/platform_device.h>
20#include <linux/err.h>
21#include <linux/spinlock.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h>
24#include <linux/io.h>
25#include <linux/clk.h>
26#include <linux/list.h>
27#include <linux/irq.h>
Catalin Marinasde88cbb2013-01-18 15:31:37 +000028#include <linux/irqchip/chained_irq.h>
Philipp Zabelb7287662013-06-21 10:27:39 +020029#include <linux/irqdomain.h>
Sascha Haueraecfbdb2012-09-21 10:07:49 +020030#include <linux/of_device.h>
Sascha Haueraecfbdb2012-09-21 10:07:49 +020031
Philipp Zabel7cb17792013-10-10 16:18:38 +020032#include <drm/drm_fourcc.h>
33
Philipp Zabel39b90042013-09-30 16:13:39 +020034#include <video/imx-ipu-v3.h>
Sascha Haueraecfbdb2012-09-21 10:07:49 +020035#include "ipu-prv.h"
36
37static inline u32 ipu_cm_read(struct ipu_soc *ipu, unsigned offset)
38{
39 return readl(ipu->cm_reg + offset);
40}
41
42static inline void ipu_cm_write(struct ipu_soc *ipu, u32 value, unsigned offset)
43{
44 writel(value, ipu->cm_reg + offset);
45}
46
Sascha Haueraecfbdb2012-09-21 10:07:49 +020047void ipu_srm_dp_sync_update(struct ipu_soc *ipu)
48{
49 u32 val;
50
51 val = ipu_cm_read(ipu, IPU_SRM_PRI2);
52 val |= 0x8;
53 ipu_cm_write(ipu, val, IPU_SRM_PRI2);
54}
55EXPORT_SYMBOL_GPL(ipu_srm_dp_sync_update);
56
Philipp Zabel7cb17792013-10-10 16:18:38 +020057enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc)
58{
59 switch (drm_fourcc) {
60 case DRM_FORMAT_RGB565:
61 case DRM_FORMAT_BGR565:
62 case DRM_FORMAT_RGB888:
63 case DRM_FORMAT_BGR888:
64 case DRM_FORMAT_XRGB8888:
65 case DRM_FORMAT_XBGR8888:
66 case DRM_FORMAT_RGBX8888:
67 case DRM_FORMAT_BGRX8888:
68 case DRM_FORMAT_ARGB8888:
69 case DRM_FORMAT_ABGR8888:
70 case DRM_FORMAT_RGBA8888:
71 case DRM_FORMAT_BGRA8888:
72 return IPUV3_COLORSPACE_RGB;
73 case DRM_FORMAT_YUYV:
74 case DRM_FORMAT_UYVY:
75 case DRM_FORMAT_YUV420:
76 case DRM_FORMAT_YVU420:
77 return IPUV3_COLORSPACE_YUV;
78 default:
79 return IPUV3_COLORSPACE_UNKNOWN;
80 }
81}
82EXPORT_SYMBOL_GPL(ipu_drm_fourcc_to_colorspace);
83
Sascha Haueraecfbdb2012-09-21 10:07:49 +020084enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
85{
86 switch (pixelformat) {
87 case V4L2_PIX_FMT_YUV420:
Philipp Zabeld3e4e612012-11-12 16:29:00 +010088 case V4L2_PIX_FMT_YVU420:
Sascha Haueraecfbdb2012-09-21 10:07:49 +020089 case V4L2_PIX_FMT_UYVY:
Michael Olbrichc096ae12012-11-12 16:28:59 +010090 case V4L2_PIX_FMT_YUYV:
Sascha Haueraecfbdb2012-09-21 10:07:49 +020091 return IPUV3_COLORSPACE_YUV;
92 case V4L2_PIX_FMT_RGB32:
93 case V4L2_PIX_FMT_BGR32:
94 case V4L2_PIX_FMT_RGB24:
95 case V4L2_PIX_FMT_BGR24:
96 case V4L2_PIX_FMT_RGB565:
97 return IPUV3_COLORSPACE_RGB;
98 default:
99 return IPUV3_COLORSPACE_UNKNOWN;
100 }
101}
102EXPORT_SYMBOL_GPL(ipu_pixelformat_to_colorspace);
103
Steve Longerbeamae0e9702014-06-25 18:05:36 -0700104enum ipu_color_space ipu_mbus_code_to_colorspace(u32 mbus_code)
105{
106 switch (mbus_code & 0xf000) {
107 case 0x1000:
108 return IPUV3_COLORSPACE_RGB;
109 case 0x2000:
110 return IPUV3_COLORSPACE_YUV;
111 default:
112 return IPUV3_COLORSPACE_UNKNOWN;
113 }
114}
115EXPORT_SYMBOL_GPL(ipu_mbus_code_to_colorspace);
116
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200117struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned num)
118{
119 struct ipuv3_channel *channel;
120
121 dev_dbg(ipu->dev, "%s %d\n", __func__, num);
122
123 if (num > 63)
124 return ERR_PTR(-ENODEV);
125
126 mutex_lock(&ipu->channel_lock);
127
128 channel = &ipu->channel[num];
129
130 if (channel->busy) {
131 channel = ERR_PTR(-EBUSY);
132 goto out;
133 }
134
Valentina Manea89bc5be2013-10-25 11:52:20 +0300135 channel->busy = true;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200136 channel->num = num;
137
138out:
139 mutex_unlock(&ipu->channel_lock);
140
141 return channel;
142}
143EXPORT_SYMBOL_GPL(ipu_idmac_get);
144
145void ipu_idmac_put(struct ipuv3_channel *channel)
146{
147 struct ipu_soc *ipu = channel->ipu;
148
149 dev_dbg(ipu->dev, "%s %d\n", __func__, channel->num);
150
151 mutex_lock(&ipu->channel_lock);
152
Valentina Manea89bc5be2013-10-25 11:52:20 +0300153 channel->busy = false;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200154
155 mutex_unlock(&ipu->channel_lock);
156}
157EXPORT_SYMBOL_GPL(ipu_idmac_put);
158
159#define idma_mask(ch) (1 << (ch & 0x1f))
160
161void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
162 bool doublebuffer)
163{
164 struct ipu_soc *ipu = channel->ipu;
165 unsigned long flags;
166 u32 reg;
167
168 spin_lock_irqsave(&ipu->lock, flags);
169
170 reg = ipu_cm_read(ipu, IPU_CHA_DB_MODE_SEL(channel->num));
171 if (doublebuffer)
172 reg |= idma_mask(channel->num);
173 else
174 reg &= ~idma_mask(channel->num);
175 ipu_cm_write(ipu, reg, IPU_CHA_DB_MODE_SEL(channel->num));
176
177 spin_unlock_irqrestore(&ipu->lock, flags);
178}
179EXPORT_SYMBOL_GPL(ipu_idmac_set_double_buffer);
180
181int ipu_module_enable(struct ipu_soc *ipu, u32 mask)
182{
183 unsigned long lock_flags;
184 u32 val;
185
186 spin_lock_irqsave(&ipu->lock, lock_flags);
187
188 val = ipu_cm_read(ipu, IPU_DISP_GEN);
189
190 if (mask & IPU_CONF_DI0_EN)
191 val |= IPU_DI0_COUNTER_RELEASE;
192 if (mask & IPU_CONF_DI1_EN)
193 val |= IPU_DI1_COUNTER_RELEASE;
194
195 ipu_cm_write(ipu, val, IPU_DISP_GEN);
196
197 val = ipu_cm_read(ipu, IPU_CONF);
198 val |= mask;
199 ipu_cm_write(ipu, val, IPU_CONF);
200
201 spin_unlock_irqrestore(&ipu->lock, lock_flags);
202
203 return 0;
204}
205EXPORT_SYMBOL_GPL(ipu_module_enable);
206
207int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
208{
209 unsigned long lock_flags;
210 u32 val;
211
212 spin_lock_irqsave(&ipu->lock, lock_flags);
213
214 val = ipu_cm_read(ipu, IPU_CONF);
215 val &= ~mask;
216 ipu_cm_write(ipu, val, IPU_CONF);
217
218 val = ipu_cm_read(ipu, IPU_DISP_GEN);
219
220 if (mask & IPU_CONF_DI0_EN)
221 val &= ~IPU_DI0_COUNTER_RELEASE;
222 if (mask & IPU_CONF_DI1_EN)
223 val &= ~IPU_DI1_COUNTER_RELEASE;
224
225 ipu_cm_write(ipu, val, IPU_DISP_GEN);
226
227 spin_unlock_irqrestore(&ipu->lock, lock_flags);
228
229 return 0;
230}
231EXPORT_SYMBOL_GPL(ipu_module_disable);
232
Philipp Zabele9046092012-05-16 17:28:29 +0200233int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
234{
235 struct ipu_soc *ipu = channel->ipu;
236 unsigned int chno = channel->num;
237
238 return (ipu_cm_read(ipu, IPU_CHA_CUR_BUF(chno)) & idma_mask(chno)) ? 1 : 0;
239}
240EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
241
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200242void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
243{
244 struct ipu_soc *ipu = channel->ipu;
245 unsigned int chno = channel->num;
246 unsigned long flags;
247
248 spin_lock_irqsave(&ipu->lock, flags);
249
250 /* Mark buffer as ready. */
251 if (buf_num == 0)
252 ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF0_RDY(chno));
253 else
254 ipu_cm_write(ipu, idma_mask(chno), IPU_CHA_BUF1_RDY(chno));
255
256 spin_unlock_irqrestore(&ipu->lock, flags);
257}
258EXPORT_SYMBOL_GPL(ipu_idmac_select_buffer);
259
260int ipu_idmac_enable_channel(struct ipuv3_channel *channel)
261{
262 struct ipu_soc *ipu = channel->ipu;
263 u32 val;
264 unsigned long flags;
265
266 spin_lock_irqsave(&ipu->lock, flags);
267
268 val = ipu_idmac_read(ipu, IDMAC_CHA_EN(channel->num));
269 val |= idma_mask(channel->num);
270 ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel->num));
271
272 spin_unlock_irqrestore(&ipu->lock, flags);
273
274 return 0;
275}
276EXPORT_SYMBOL_GPL(ipu_idmac_enable_channel);
277
Philipp Zabel17075502014-04-14 23:53:17 +0200278bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno)
279{
280 return (ipu_idmac_read(ipu, IDMAC_CHA_BUSY(chno)) & idma_mask(chno));
281}
282EXPORT_SYMBOL_GPL(ipu_idmac_channel_busy);
283
Sascha Hauerfb822a32013-10-10 16:18:41 +0200284int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms)
285{
286 struct ipu_soc *ipu = channel->ipu;
287 unsigned long timeout;
288
289 timeout = jiffies + msecs_to_jiffies(ms);
290 while (ipu_idmac_read(ipu, IDMAC_CHA_BUSY(channel->num)) &
291 idma_mask(channel->num)) {
292 if (time_after(jiffies, timeout))
293 return -ETIMEDOUT;
294 cpu_relax();
295 }
296
297 return 0;
298}
299EXPORT_SYMBOL_GPL(ipu_idmac_wait_busy);
300
Philipp Zabel17075502014-04-14 23:53:17 +0200301int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms)
302{
303 unsigned long timeout;
304
305 timeout = jiffies + msecs_to_jiffies(ms);
306 ipu_cm_write(ipu, BIT(irq % 32), IPU_INT_STAT(irq / 32));
307 while (!(ipu_cm_read(ipu, IPU_INT_STAT(irq / 32) & BIT(irq % 32)))) {
308 if (time_after(jiffies, timeout))
309 return -ETIMEDOUT;
310 cpu_relax();
311 }
312
313 return 0;
314}
315EXPORT_SYMBOL_GPL(ipu_wait_interrupt);
316
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200317int ipu_idmac_disable_channel(struct ipuv3_channel *channel)
318{
319 struct ipu_soc *ipu = channel->ipu;
320 u32 val;
321 unsigned long flags;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200322
323 spin_lock_irqsave(&ipu->lock, flags);
324
325 /* Disable DMA channel(s) */
326 val = ipu_idmac_read(ipu, IDMAC_CHA_EN(channel->num));
327 val &= ~idma_mask(channel->num);
328 ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel->num));
329
330 /* Set channel buffers NOT to be ready */
331 ipu_cm_write(ipu, 0xf0000000, IPU_GPR); /* write one to clear */
332
333 if (ipu_cm_read(ipu, IPU_CHA_BUF0_RDY(channel->num)) &
334 idma_mask(channel->num)) {
335 ipu_cm_write(ipu, idma_mask(channel->num),
336 IPU_CHA_BUF0_RDY(channel->num));
337 }
338
339 if (ipu_cm_read(ipu, IPU_CHA_BUF1_RDY(channel->num)) &
340 idma_mask(channel->num)) {
341 ipu_cm_write(ipu, idma_mask(channel->num),
342 IPU_CHA_BUF1_RDY(channel->num));
343 }
344
345 ipu_cm_write(ipu, 0x0, IPU_GPR); /* write one to set */
346
347 /* Reset the double buffer */
348 val = ipu_cm_read(ipu, IPU_CHA_DB_MODE_SEL(channel->num));
349 val &= ~idma_mask(channel->num);
350 ipu_cm_write(ipu, val, IPU_CHA_DB_MODE_SEL(channel->num));
351
352 spin_unlock_irqrestore(&ipu->lock, flags);
353
354 return 0;
355}
356EXPORT_SYMBOL_GPL(ipu_idmac_disable_channel);
357
Philipp Zabel6c641552013-03-28 17:35:21 +0100358static int ipu_memory_reset(struct ipu_soc *ipu)
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200359{
360 unsigned long timeout;
361
362 ipu_cm_write(ipu, 0x807FFFFF, IPU_MEM_RST);
363
364 timeout = jiffies + msecs_to_jiffies(1000);
365 while (ipu_cm_read(ipu, IPU_MEM_RST) & 0x80000000) {
366 if (time_after(jiffies, timeout))
367 return -ETIME;
368 cpu_relax();
369 }
370
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200371 return 0;
372}
373
Steve Longerbeamba079752014-06-25 18:05:30 -0700374/*
375 * Set the source mux for the given CSI. Selects either parallel or
376 * MIPI CSI2 sources.
377 */
378void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2)
379{
380 unsigned long flags;
381 u32 val, mask;
382
383 mask = (csi_id == 1) ? IPU_CONF_CSI1_DATA_SOURCE :
384 IPU_CONF_CSI0_DATA_SOURCE;
385
386 spin_lock_irqsave(&ipu->lock, flags);
387
388 val = ipu_cm_read(ipu, IPU_CONF);
389 if (mipi_csi2)
390 val |= mask;
391 else
392 val &= ~mask;
393 ipu_cm_write(ipu, val, IPU_CONF);
394
395 spin_unlock_irqrestore(&ipu->lock, flags);
396}
397EXPORT_SYMBOL_GPL(ipu_set_csi_src_mux);
398
399/*
400 * Set the source mux for the IC. Selects either CSI[01] or the VDI.
401 */
402void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi)
403{
404 unsigned long flags;
405 u32 val;
406
407 spin_lock_irqsave(&ipu->lock, flags);
408
409 val = ipu_cm_read(ipu, IPU_CONF);
410 if (vdi) {
411 val |= IPU_CONF_IC_INPUT;
412 } else {
413 val &= ~IPU_CONF_IC_INPUT;
414 if (csi_id == 1)
415 val |= IPU_CONF_CSI_SEL;
416 else
417 val &= ~IPU_CONF_CSI_SEL;
418 }
419 ipu_cm_write(ipu, val, IPU_CONF);
420
421 spin_unlock_irqrestore(&ipu->lock, flags);
422}
423EXPORT_SYMBOL_GPL(ipu_set_ic_src_mux);
424
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200425struct ipu_devtype {
426 const char *name;
427 unsigned long cm_ofs;
428 unsigned long cpmem_ofs;
429 unsigned long srm_ofs;
430 unsigned long tpm_ofs;
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700431 unsigned long csi0_ofs;
432 unsigned long csi1_ofs;
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200433 unsigned long ic_ofs;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200434 unsigned long disp0_ofs;
435 unsigned long disp1_ofs;
436 unsigned long dc_tmpl_ofs;
437 unsigned long vdi_ofs;
438 enum ipuv3_type type;
439};
440
441static struct ipu_devtype ipu_type_imx51 = {
442 .name = "IPUv3EX",
443 .cm_ofs = 0x1e000000,
444 .cpmem_ofs = 0x1f000000,
445 .srm_ofs = 0x1f040000,
446 .tpm_ofs = 0x1f060000,
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700447 .csi0_ofs = 0x1f030000,
448 .csi1_ofs = 0x1f038000,
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200449 .ic_ofs = 0x1f020000,
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200450 .disp0_ofs = 0x1e040000,
451 .disp1_ofs = 0x1e048000,
452 .dc_tmpl_ofs = 0x1f080000,
453 .vdi_ofs = 0x1e068000,
454 .type = IPUV3EX,
455};
456
457static struct ipu_devtype ipu_type_imx53 = {
458 .name = "IPUv3M",
459 .cm_ofs = 0x06000000,
460 .cpmem_ofs = 0x07000000,
461 .srm_ofs = 0x07040000,
462 .tpm_ofs = 0x07060000,
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700463 .csi0_ofs = 0x07030000,
464 .csi1_ofs = 0x07038000,
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200465 .ic_ofs = 0x07020000,
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200466 .disp0_ofs = 0x06040000,
467 .disp1_ofs = 0x06048000,
468 .dc_tmpl_ofs = 0x07080000,
469 .vdi_ofs = 0x06068000,
470 .type = IPUV3M,
471};
472
473static struct ipu_devtype ipu_type_imx6q = {
474 .name = "IPUv3H",
475 .cm_ofs = 0x00200000,
476 .cpmem_ofs = 0x00300000,
477 .srm_ofs = 0x00340000,
478 .tpm_ofs = 0x00360000,
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700479 .csi0_ofs = 0x00230000,
480 .csi1_ofs = 0x00238000,
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200481 .ic_ofs = 0x00220000,
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200482 .disp0_ofs = 0x00240000,
483 .disp1_ofs = 0x00248000,
484 .dc_tmpl_ofs = 0x00380000,
485 .vdi_ofs = 0x00268000,
486 .type = IPUV3H,
487};
488
489static const struct of_device_id imx_ipu_dt_ids[] = {
490 { .compatible = "fsl,imx51-ipu", .data = &ipu_type_imx51, },
491 { .compatible = "fsl,imx53-ipu", .data = &ipu_type_imx53, },
492 { .compatible = "fsl,imx6q-ipu", .data = &ipu_type_imx6q, },
493 { /* sentinel */ }
494};
495MODULE_DEVICE_TABLE(of, imx_ipu_dt_ids);
496
497static int ipu_submodules_init(struct ipu_soc *ipu,
498 struct platform_device *pdev, unsigned long ipu_base,
499 struct clk *ipu_clk)
500{
501 char *unit;
502 int ret;
503 struct device *dev = &pdev->dev;
504 const struct ipu_devtype *devtype = ipu->devtype;
505
Steve Longerbeam7d2691d2014-06-25 18:05:47 -0700506 ret = ipu_cpmem_init(ipu, dev, ipu_base + devtype->cpmem_ofs);
507 if (ret) {
508 unit = "cpmem";
509 goto err_cpmem;
510 }
511
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700512 ret = ipu_csi_init(ipu, dev, 0, ipu_base + devtype->csi0_ofs,
513 IPU_CONF_CSI0_EN, ipu_clk);
514 if (ret) {
515 unit = "csi0";
516 goto err_csi_0;
517 }
518
519 ret = ipu_csi_init(ipu, dev, 1, ipu_base + devtype->csi1_ofs,
520 IPU_CONF_CSI1_EN, ipu_clk);
521 if (ret) {
522 unit = "csi1";
523 goto err_csi_1;
524 }
525
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200526 ret = ipu_ic_init(ipu, dev,
527 ipu_base + devtype->ic_ofs,
528 ipu_base + devtype->tpm_ofs);
529 if (ret) {
530 unit = "ic";
531 goto err_ic;
532 }
533
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200534 ret = ipu_di_init(ipu, dev, 0, ipu_base + devtype->disp0_ofs,
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200535 IPU_CONF_DI0_EN, ipu_clk);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200536 if (ret) {
537 unit = "di0";
538 goto err_di_0;
539 }
540
541 ret = ipu_di_init(ipu, dev, 1, ipu_base + devtype->disp1_ofs,
542 IPU_CONF_DI1_EN, ipu_clk);
543 if (ret) {
544 unit = "di1";
545 goto err_di_1;
546 }
547
548 ret = ipu_dc_init(ipu, dev, ipu_base + devtype->cm_ofs +
549 IPU_CM_DC_REG_OFS, ipu_base + devtype->dc_tmpl_ofs);
550 if (ret) {
551 unit = "dc_template";
552 goto err_dc;
553 }
554
555 ret = ipu_dmfc_init(ipu, dev, ipu_base +
556 devtype->cm_ofs + IPU_CM_DMFC_REG_OFS, ipu_clk);
557 if (ret) {
558 unit = "dmfc";
559 goto err_dmfc;
560 }
561
562 ret = ipu_dp_init(ipu, dev, ipu_base + devtype->srm_ofs);
563 if (ret) {
564 unit = "dp";
565 goto err_dp;
566 }
567
Philipp Zabel35de9252012-05-09 16:59:01 +0200568 ret = ipu_smfc_init(ipu, dev, ipu_base +
569 devtype->cm_ofs + IPU_CM_SMFC_REG_OFS);
570 if (ret) {
571 unit = "smfc";
572 goto err_smfc;
573 }
574
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200575 return 0;
576
Philipp Zabel35de9252012-05-09 16:59:01 +0200577err_smfc:
578 ipu_dp_exit(ipu);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200579err_dp:
580 ipu_dmfc_exit(ipu);
581err_dmfc:
582 ipu_dc_exit(ipu);
583err_dc:
584 ipu_di_exit(ipu, 1);
585err_di_1:
586 ipu_di_exit(ipu, 0);
587err_di_0:
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200588 ipu_ic_exit(ipu);
589err_ic:
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700590 ipu_csi_exit(ipu, 1);
591err_csi_1:
592 ipu_csi_exit(ipu, 0);
593err_csi_0:
Steve Longerbeam7d2691d2014-06-25 18:05:47 -0700594 ipu_cpmem_exit(ipu);
595err_cpmem:
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200596 dev_err(&pdev->dev, "init %s failed with %d\n", unit, ret);
597 return ret;
598}
599
600static void ipu_irq_handle(struct ipu_soc *ipu, const int *regs, int num_regs)
601{
602 unsigned long status;
Philipp Zabelb7287662013-06-21 10:27:39 +0200603 int i, bit, irq;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200604
605 for (i = 0; i < num_regs; i++) {
606
607 status = ipu_cm_read(ipu, IPU_INT_STAT(regs[i]));
608 status &= ipu_cm_read(ipu, IPU_INT_CTRL(regs[i]));
609
Philipp Zabelb7287662013-06-21 10:27:39 +0200610 for_each_set_bit(bit, &status, 32) {
Antoine Schweitzer-Chaput838201a2014-04-18 23:20:06 +0200611 irq = irq_linear_revmap(ipu->domain,
612 regs[i] * 32 + bit);
Philipp Zabelb7287662013-06-21 10:27:39 +0200613 if (irq)
614 generic_handle_irq(irq);
615 }
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200616 }
617}
618
619static void ipu_irq_handler(unsigned int irq, struct irq_desc *desc)
620{
621 struct ipu_soc *ipu = irq_desc_get_handler_data(desc);
622 const int int_reg[] = { 0, 1, 2, 3, 10, 11, 12, 13, 14};
623 struct irq_chip *chip = irq_get_chip(irq);
624
625 chained_irq_enter(chip, desc);
626
627 ipu_irq_handle(ipu, int_reg, ARRAY_SIZE(int_reg));
628
629 chained_irq_exit(chip, desc);
630}
631
632static void ipu_err_irq_handler(unsigned int irq, struct irq_desc *desc)
633{
634 struct ipu_soc *ipu = irq_desc_get_handler_data(desc);
635 const int int_reg[] = { 4, 5, 8, 9};
636 struct irq_chip *chip = irq_get_chip(irq);
637
638 chained_irq_enter(chip, desc);
639
640 ipu_irq_handle(ipu, int_reg, ARRAY_SIZE(int_reg));
641
642 chained_irq_exit(chip, desc);
643}
644
Philipp Zabel861a50c2014-04-14 23:53:16 +0200645int ipu_map_irq(struct ipu_soc *ipu, int irq)
646{
647 int virq;
648
649 virq = irq_linear_revmap(ipu->domain, irq);
650 if (!virq)
651 virq = irq_create_mapping(ipu->domain, irq);
652
653 return virq;
654}
655EXPORT_SYMBOL_GPL(ipu_map_irq);
656
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200657int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
658 enum ipu_channel_irq irq_type)
659{
Philipp Zabel861a50c2014-04-14 23:53:16 +0200660 return ipu_map_irq(ipu, irq_type + channel->num);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200661}
662EXPORT_SYMBOL_GPL(ipu_idmac_channel_irq);
663
664static void ipu_submodules_exit(struct ipu_soc *ipu)
665{
Philipp Zabel35de9252012-05-09 16:59:01 +0200666 ipu_smfc_exit(ipu);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200667 ipu_dp_exit(ipu);
668 ipu_dmfc_exit(ipu);
669 ipu_dc_exit(ipu);
670 ipu_di_exit(ipu, 1);
671 ipu_di_exit(ipu, 0);
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200672 ipu_ic_exit(ipu);
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700673 ipu_csi_exit(ipu, 1);
674 ipu_csi_exit(ipu, 0);
Steve Longerbeam7d2691d2014-06-25 18:05:47 -0700675 ipu_cpmem_exit(ipu);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200676}
677
678static int platform_remove_devices_fn(struct device *dev, void *unused)
679{
680 struct platform_device *pdev = to_platform_device(dev);
681
682 platform_device_unregister(pdev);
683
684 return 0;
685}
686
687static void platform_device_unregister_children(struct platform_device *pdev)
688{
689 device_for_each_child(&pdev->dev, NULL, platform_remove_devices_fn);
690}
691
692struct ipu_platform_reg {
693 struct ipu_client_platformdata pdata;
694 const char *name;
Philipp Zabeld6ca8ca2012-05-23 17:08:19 +0200695 int reg_offset;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200696};
697
698static const struct ipu_platform_reg client_reg[] = {
699 {
700 .pdata = {
701 .di = 0,
702 .dc = 5,
703 .dp = IPU_DP_FLOW_SYNC_BG,
704 .dma[0] = IPUV3_CHANNEL_MEM_BG_SYNC,
Philipp Zabelb8d181e2013-10-10 16:18:45 +0200705 .dma[1] = IPUV3_CHANNEL_MEM_FG_SYNC,
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200706 },
707 .name = "imx-ipuv3-crtc",
708 }, {
709 .pdata = {
710 .di = 1,
711 .dc = 1,
712 .dp = -EINVAL,
713 .dma[0] = IPUV3_CHANNEL_MEM_DC_SYNC,
714 .dma[1] = -EINVAL,
715 },
716 .name = "imx-ipuv3-crtc",
Philipp Zabeld6ca8ca2012-05-23 17:08:19 +0200717 }, {
718 .pdata = {
719 .csi = 0,
720 .dma[0] = IPUV3_CHANNEL_CSI0,
721 .dma[1] = -EINVAL,
722 },
723 .reg_offset = IPU_CM_CSI0_REG_OFS,
724 .name = "imx-ipuv3-camera",
725 }, {
726 .pdata = {
727 .csi = 1,
728 .dma[0] = IPUV3_CHANNEL_CSI1,
729 .dma[1] = -EINVAL,
730 },
731 .reg_offset = IPU_CM_CSI1_REG_OFS,
732 .name = "imx-ipuv3-camera",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200733 },
734};
735
Russell King4ae078d2013-12-16 11:34:25 +0000736static DEFINE_MUTEX(ipu_client_id_mutex);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200737static int ipu_client_id;
738
Philipp Zabeld6ca8ca2012-05-23 17:08:19 +0200739static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200740{
Russell King4ae078d2013-12-16 11:34:25 +0000741 struct device *dev = ipu->dev;
742 unsigned i;
743 int id, ret;
744
745 mutex_lock(&ipu_client_id_mutex);
746 id = ipu_client_id;
747 ipu_client_id += ARRAY_SIZE(client_reg);
748 mutex_unlock(&ipu_client_id_mutex);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200749
750 for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
751 const struct ipu_platform_reg *reg = &client_reg[i];
Russell King4ae078d2013-12-16 11:34:25 +0000752 struct platform_device *pdev;
Philipp Zabeld6ca8ca2012-05-23 17:08:19 +0200753 struct resource res;
Russell King4ae078d2013-12-16 11:34:25 +0000754
Philipp Zabeld6ca8ca2012-05-23 17:08:19 +0200755 if (reg->reg_offset) {
756 memset(&res, 0, sizeof(res));
757 res.flags = IORESOURCE_MEM;
758 res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset;
759 res.end = res.start + PAGE_SIZE - 1;
760 pdev = platform_device_register_resndata(dev, reg->name,
761 id++, &res, 1, &reg->pdata, sizeof(reg->pdata));
762 } else {
763 pdev = platform_device_register_data(dev, reg->name,
764 id++, &reg->pdata, sizeof(reg->pdata));
765 }
Russell King4ae078d2013-12-16 11:34:25 +0000766
767 if (IS_ERR(pdev))
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200768 goto err_register;
769 }
770
771 return 0;
772
773err_register:
Russell King4ae078d2013-12-16 11:34:25 +0000774 platform_device_unregister_children(to_platform_device(dev));
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200775
776 return ret;
777}
778
Philipp Zabelb7287662013-06-21 10:27:39 +0200779
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200780static int ipu_irq_init(struct ipu_soc *ipu)
781{
Philipp Zabel379cdec2013-06-21 14:52:17 +0200782 struct irq_chip_generic *gc;
783 struct irq_chip_type *ct;
Philipp Zabel37f85b262013-06-21 14:52:18 +0200784 unsigned long unused[IPU_NUM_IRQS / 32] = {
785 0x400100d0, 0xffe000fd,
786 0x400100d0, 0xffe000fd,
787 0x400100d0, 0xffe000fd,
788 0x4077ffff, 0xffe7e1fd,
789 0x23fffffe, 0x8880fff0,
790 0xf98fe7d0, 0xfff81fff,
791 0x400100d0, 0xffe000fd,
792 0x00000000,
793 };
Philipp Zabel379cdec2013-06-21 14:52:17 +0200794 int ret, i;
795
Philipp Zabelb7287662013-06-21 10:27:39 +0200796 ipu->domain = irq_domain_add_linear(ipu->dev->of_node, IPU_NUM_IRQS,
Philipp Zabel379cdec2013-06-21 14:52:17 +0200797 &irq_generic_chip_ops, ipu);
Philipp Zabelb7287662013-06-21 10:27:39 +0200798 if (!ipu->domain) {
799 dev_err(ipu->dev, "failed to add irq domain\n");
800 return -ENODEV;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200801 }
802
Philipp Zabel379cdec2013-06-21 14:52:17 +0200803 ret = irq_alloc_domain_generic_chips(ipu->domain, 32, 1, "IPU",
Antoine Schweitzer-Chaput838201a2014-04-18 23:20:06 +0200804 handle_level_irq, 0,
805 IRQF_VALID, 0);
Philipp Zabel379cdec2013-06-21 14:52:17 +0200806 if (ret < 0) {
807 dev_err(ipu->dev, "failed to alloc generic irq chips\n");
808 irq_domain_remove(ipu->domain);
809 return ret;
810 }
811
812 for (i = 0; i < IPU_NUM_IRQS; i += 32) {
813 gc = irq_get_domain_generic_chip(ipu->domain, i);
814 gc->reg_base = ipu->cm_reg;
Philipp Zabel37f85b262013-06-21 14:52:18 +0200815 gc->unused = unused[i / 32];
Philipp Zabel379cdec2013-06-21 14:52:17 +0200816 ct = gc->chip_types;
817 ct->chip.irq_ack = irq_gc_ack_set_bit;
818 ct->chip.irq_mask = irq_gc_mask_clr_bit;
819 ct->chip.irq_unmask = irq_gc_mask_set_bit;
820 ct->regs.ack = IPU_INT_STAT(i / 32);
821 ct->regs.mask = IPU_INT_CTRL(i / 32);
822 }
823
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200824 irq_set_chained_handler(ipu->irq_sync, ipu_irq_handler);
825 irq_set_handler_data(ipu->irq_sync, ipu);
826 irq_set_chained_handler(ipu->irq_err, ipu_err_irq_handler);
827 irq_set_handler_data(ipu->irq_err, ipu);
828
829 return 0;
830}
831
832static void ipu_irq_exit(struct ipu_soc *ipu)
833{
Philipp Zabelb7287662013-06-21 10:27:39 +0200834 int i, irq;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200835
836 irq_set_chained_handler(ipu->irq_err, NULL);
837 irq_set_handler_data(ipu->irq_err, NULL);
838 irq_set_chained_handler(ipu->irq_sync, NULL);
839 irq_set_handler_data(ipu->irq_sync, NULL);
840
Philipp Zabel379cdec2013-06-21 14:52:17 +0200841 /* TODO: remove irq_domain_generic_chips */
842
Philipp Zabelb7287662013-06-21 10:27:39 +0200843 for (i = 0; i < IPU_NUM_IRQS; i++) {
844 irq = irq_linear_revmap(ipu->domain, i);
845 if (irq)
846 irq_dispose_mapping(irq);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200847 }
848
Philipp Zabelb7287662013-06-21 10:27:39 +0200849 irq_domain_remove(ipu->domain);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200850}
851
Bill Pembertonc4aabf82012-11-19 13:22:11 -0500852static int ipu_probe(struct platform_device *pdev)
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200853{
854 const struct of_device_id *of_id =
855 of_match_device(imx_ipu_dt_ids, &pdev->dev);
856 struct ipu_soc *ipu;
857 struct resource *res;
858 unsigned long ipu_base;
859 int i, ret, irq_sync, irq_err;
860 const struct ipu_devtype *devtype;
861
862 devtype = of_id->data;
863
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200864 irq_sync = platform_get_irq(pdev, 0);
865 irq_err = platform_get_irq(pdev, 1);
866 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
867
Fabio Estevamfd563db2012-10-24 21:36:46 -0200868 dev_dbg(&pdev->dev, "irq_sync: %d irq_err: %d\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200869 irq_sync, irq_err);
870
871 if (!res || irq_sync < 0 || irq_err < 0)
872 return -ENODEV;
873
874 ipu_base = res->start;
875
876 ipu = devm_kzalloc(&pdev->dev, sizeof(*ipu), GFP_KERNEL);
877 if (!ipu)
878 return -ENODEV;
879
880 for (i = 0; i < 64; i++)
881 ipu->channel[i].ipu = ipu;
882 ipu->devtype = devtype;
883 ipu->ipu_type = devtype->type;
884
885 spin_lock_init(&ipu->lock);
886 mutex_init(&ipu->channel_lock);
887
Fabio Estevamfd563db2012-10-24 21:36:46 -0200888 dev_dbg(&pdev->dev, "cm_reg: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200889 ipu_base + devtype->cm_ofs);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200890 dev_dbg(&pdev->dev, "idmac: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200891 ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200892 dev_dbg(&pdev->dev, "cpmem: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200893 ipu_base + devtype->cpmem_ofs);
Steve Longerbeam2ffd48f2014-08-19 10:52:40 -0700894 dev_dbg(&pdev->dev, "csi0: 0x%08lx\n",
895 ipu_base + devtype->csi0_ofs);
896 dev_dbg(&pdev->dev, "csi1: 0x%08lx\n",
897 ipu_base + devtype->csi1_ofs);
Steve Longerbeam1aa8ea02014-08-11 13:04:50 +0200898 dev_dbg(&pdev->dev, "ic: 0x%08lx\n",
899 ipu_base + devtype->ic_ofs);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200900 dev_dbg(&pdev->dev, "disp0: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200901 ipu_base + devtype->disp0_ofs);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200902 dev_dbg(&pdev->dev, "disp1: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200903 ipu_base + devtype->disp1_ofs);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200904 dev_dbg(&pdev->dev, "srm: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200905 ipu_base + devtype->srm_ofs);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200906 dev_dbg(&pdev->dev, "tpm: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200907 ipu_base + devtype->tpm_ofs);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200908 dev_dbg(&pdev->dev, "dc: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200909 ipu_base + devtype->cm_ofs + IPU_CM_DC_REG_OFS);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200910 dev_dbg(&pdev->dev, "ic: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200911 ipu_base + devtype->cm_ofs + IPU_CM_IC_REG_OFS);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200912 dev_dbg(&pdev->dev, "dmfc: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200913 ipu_base + devtype->cm_ofs + IPU_CM_DMFC_REG_OFS);
Fabio Estevamfd563db2012-10-24 21:36:46 -0200914 dev_dbg(&pdev->dev, "vdi: 0x%08lx\n",
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200915 ipu_base + devtype->vdi_ofs);
916
917 ipu->cm_reg = devm_ioremap(&pdev->dev,
918 ipu_base + devtype->cm_ofs, PAGE_SIZE);
919 ipu->idmac_reg = devm_ioremap(&pdev->dev,
920 ipu_base + devtype->cm_ofs + IPU_CM_IDMAC_REG_OFS,
921 PAGE_SIZE);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200922
Steve Longerbeam7d2691d2014-06-25 18:05:47 -0700923 if (!ipu->cm_reg || !ipu->idmac_reg)
Fabio Estevambe798b22013-07-20 18:22:09 -0300924 return -ENOMEM;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200925
926 ipu->clk = devm_clk_get(&pdev->dev, "bus");
927 if (IS_ERR(ipu->clk)) {
928 ret = PTR_ERR(ipu->clk);
929 dev_err(&pdev->dev, "clk_get failed with %d", ret);
Fabio Estevambe798b22013-07-20 18:22:09 -0300930 return ret;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200931 }
932
933 platform_set_drvdata(pdev, ipu);
934
Fabio Estevam62645a22013-07-20 18:22:10 -0300935 ret = clk_prepare_enable(ipu->clk);
936 if (ret) {
937 dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret);
938 return ret;
939 }
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200940
941 ipu->dev = &pdev->dev;
942 ipu->irq_sync = irq_sync;
943 ipu->irq_err = irq_err;
944
945 ret = ipu_irq_init(ipu);
946 if (ret)
947 goto out_failed_irq;
948
Philipp Zabel6c641552013-03-28 17:35:21 +0100949 ret = device_reset(&pdev->dev);
950 if (ret) {
951 dev_err(&pdev->dev, "failed to reset: %d\n", ret);
952 goto out_failed_reset;
953 }
954 ret = ipu_memory_reset(ipu);
Lothar Waßmann4d27b2c2012-12-25 15:58:37 +0100955 if (ret)
956 goto out_failed_reset;
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200957
958 /* Set MCU_T to divide MCU access window into 2 */
959 ipu_cm_write(ipu, 0x00400000L | (IPU_MCU_T_DEFAULT << 18),
960 IPU_DISP_GEN);
961
962 ret = ipu_submodules_init(ipu, pdev, ipu_base, ipu->clk);
963 if (ret)
964 goto failed_submodules_init;
965
Philipp Zabeld6ca8ca2012-05-23 17:08:19 +0200966 ret = ipu_add_client_devices(ipu, ipu_base);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200967 if (ret) {
968 dev_err(&pdev->dev, "adding client devices failed with %d\n",
969 ret);
970 goto failed_add_clients;
971 }
972
Fabio Estevam9c2c4382012-10-24 21:36:47 -0200973 dev_info(&pdev->dev, "%s probed\n", devtype->name);
974
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200975 return 0;
976
977failed_add_clients:
978 ipu_submodules_exit(ipu);
979failed_submodules_init:
Lothar Waßmann4d27b2c2012-12-25 15:58:37 +0100980out_failed_reset:
Philipp Zabel6c641552013-03-28 17:35:21 +0100981 ipu_irq_exit(ipu);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200982out_failed_irq:
983 clk_disable_unprepare(ipu->clk);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200984 return ret;
985}
986
Bill Pemberton8aa1be42012-11-19 13:26:38 -0500987static int ipu_remove(struct platform_device *pdev)
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200988{
989 struct ipu_soc *ipu = platform_get_drvdata(pdev);
Sascha Haueraecfbdb2012-09-21 10:07:49 +0200990
991 platform_device_unregister_children(pdev);
992 ipu_submodules_exit(ipu);
993 ipu_irq_exit(ipu);
994
995 clk_disable_unprepare(ipu->clk);
996
997 return 0;
998}
999
1000static struct platform_driver imx_ipu_driver = {
1001 .driver = {
1002 .name = "imx-ipuv3",
1003 .of_match_table = imx_ipu_dt_ids,
1004 },
1005 .probe = ipu_probe,
Bill Pemberton99c28f12012-11-19 13:20:51 -05001006 .remove = ipu_remove,
Sascha Haueraecfbdb2012-09-21 10:07:49 +02001007};
1008
1009module_platform_driver(imx_ipu_driver);
1010
Fabio Estevam10f22682013-07-20 18:22:11 -03001011MODULE_ALIAS("platform:imx-ipuv3");
Sascha Haueraecfbdb2012-09-21 10:07:49 +02001012MODULE_DESCRIPTION("i.MX IPU v3 driver");
1013MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
1014MODULE_LICENSE("GPL");