15 #include <linux/module.h>
18 #include <linux/slab.h>
20 #include <linux/errno.h>
24 #include <linux/kernel.h>
28 #include <linux/time.h>
29 #include <linux/device.h>
41 #include <linux/videodev2.h>
44 #include <mach/hardware.h>
48 #define MX2_CAM_DRV_NAME "mx2-camera"
49 #define MX2_CAM_VERSION "0.0.6"
50 #define MX2_CAM_DRIVER_DESCRIPTION "i.MX2x_Camera"
53 #define CSICR1_RESET_VAL 0x40000800
54 #define CSICR2_RESET_VAL 0x0
55 #define CSICR3_RESET_VAL 0x0
58 #define CSICR1_SWAP16_EN (1 << 31)
59 #define CSICR1_EXT_VSYNC (1 << 30)
60 #define CSICR1_EOF_INTEN (1 << 29)
61 #define CSICR1_PRP_IF_EN (1 << 28)
62 #define CSICR1_CCIR_MODE (1 << 27)
63 #define CSICR1_COF_INTEN (1 << 26)
64 #define CSICR1_SF_OR_INTEN (1 << 25)
65 #define CSICR1_RF_OR_INTEN (1 << 24)
66 #define CSICR1_STATFF_LEVEL (3 << 22)
67 #define CSICR1_STATFF_INTEN (1 << 21)
68 #define CSICR1_RXFF_LEVEL(l) (((l) & 3) << 19)
69 #define CSICR1_FB2_DMA_INTEN (1 << 20)
70 #define CSICR1_FB1_DMA_INTEN (1 << 19)
71 #define CSICR1_RXFF_INTEN (1 << 18)
72 #define CSICR1_SOF_POL (1 << 17)
73 #define CSICR1_SOF_INTEN (1 << 16)
74 #define CSICR1_MCLKDIV(d) (((d) & 0xF) << 12)
75 #define CSICR1_HSYNC_POL (1 << 11)
76 #define CSICR1_CCIR_EN (1 << 10)
77 #define CSICR1_MCLKEN (1 << 9)
78 #define CSICR1_FCC (1 << 8)
79 #define CSICR1_PACK_DIR (1 << 7)
80 #define CSICR1_CLR_STATFIFO (1 << 6)
81 #define CSICR1_CLR_RXFIFO (1 << 5)
82 #define CSICR1_GCLK_MODE (1 << 4)
83 #define CSICR1_INV_DATA (1 << 3)
84 #define CSICR1_INV_PCLK (1 << 2)
85 #define CSICR1_REDGE (1 << 1)
86 #define CSICR1_FMT_MASK (CSICR1_PACK_DIR | CSICR1_SWAP16_EN)
88 #define SHIFT_STATFF_LEVEL 22
89 #define SHIFT_RXFF_LEVEL 19
90 #define SHIFT_MCLKDIV 12
93 #define CSICR3_FRMCNT (0xFFFF << 16)
94 #define CSICR3_FRMCNT_RST (1 << 15)
95 #define CSICR3_DMA_REFLASH_RFF (1 << 14)
96 #define CSICR3_DMA_REFLASH_SFF (1 << 13)
97 #define CSICR3_DMA_REQ_EN_RFF (1 << 12)
98 #define CSICR3_DMA_REQ_EN_SFF (1 << 11)
99 #define CSICR3_RXFF_LEVEL(l) (((l) & 7) << 4)
100 #define CSICR3_CSI_SUP (1 << 3)
101 #define CSICR3_ZERO_PACK_EN (1 << 2)
102 #define CSICR3_ECC_INT_EN (1 << 1)
103 #define CSICR3_ECC_AUTO_EN (1 << 0)
105 #define SHIFT_FRMCNT 16
108 #define CSISR_SFF_OR_INT (1 << 25)
109 #define CSISR_RFF_OR_INT (1 << 24)
110 #define CSISR_STATFF_INT (1 << 21)
111 #define CSISR_DMA_TSF_FB2_INT (1 << 20)
112 #define CSISR_DMA_TSF_FB1_INT (1 << 19)
113 #define CSISR_RXFF_INT (1 << 18)
114 #define CSISR_EOF_INT (1 << 17)
115 #define CSISR_SOF_INT (1 << 16)
116 #define CSISR_F2_INT (1 << 15)
117 #define CSISR_F1_INT (1 << 14)
118 #define CSISR_COF_INT (1 << 13)
119 #define CSISR_ECC_INT (1 << 1)
120 #define CSISR_DRDY (1 << 0)
124 #define CSISR (cpu_is_mx27() ? 0x08 : 0x18)
125 #define CSISTATFIFO 0x0c
126 #define CSIRFIFO 0x10
127 #define CSIRXCNT 0x14
128 #define CSICR3 (cpu_is_mx27() ? 0x1C : 0x08)
129 #define CSIDMASA_STATFIFO 0x20
130 #define CSIDMATA_STATFIFO 0x24
131 #define CSIDMASA_FB1 0x28
132 #define CSIDMASA_FB2 0x2c
133 #define CSIFBUF_PARA 0x30
134 #define CSIIMAG_PARA 0x34
137 #define PRP_CNTL 0x00
138 #define PRP_INTR_CNTL 0x04
139 #define PRP_INTRSTATUS 0x08
140 #define PRP_SOURCE_Y_PTR 0x0c
141 #define PRP_SOURCE_CB_PTR 0x10
142 #define PRP_SOURCE_CR_PTR 0x14
143 #define PRP_DEST_RGB1_PTR 0x18
144 #define PRP_DEST_RGB2_PTR 0x1c
145 #define PRP_DEST_Y_PTR 0x20
146 #define PRP_DEST_CB_PTR 0x24
147 #define PRP_DEST_CR_PTR 0x28
148 #define PRP_SRC_FRAME_SIZE 0x2c
149 #define PRP_DEST_CH1_LINE_STRIDE 0x30
150 #define PRP_SRC_PIXEL_FORMAT_CNTL 0x34
151 #define PRP_CH1_PIXEL_FORMAT_CNTL 0x38
152 #define PRP_CH1_OUT_IMAGE_SIZE 0x3c
153 #define PRP_CH2_OUT_IMAGE_SIZE 0x40
154 #define PRP_SRC_LINE_STRIDE 0x44
155 #define PRP_CSC_COEF_012 0x48
156 #define PRP_CSC_COEF_345 0x4c
157 #define PRP_CSC_COEF_678 0x50
158 #define PRP_CH1_RZ_HORI_COEF1 0x54
159 #define PRP_CH1_RZ_HORI_COEF2 0x58
160 #define PRP_CH1_RZ_HORI_VALID 0x5c
161 #define PRP_CH1_RZ_VERT_COEF1 0x60
162 #define PRP_CH1_RZ_VERT_COEF2 0x64
163 #define PRP_CH1_RZ_VERT_VALID 0x68
164 #define PRP_CH2_RZ_HORI_COEF1 0x6c
165 #define PRP_CH2_RZ_HORI_COEF2 0x70
166 #define PRP_CH2_RZ_HORI_VALID 0x74
167 #define PRP_CH2_RZ_VERT_COEF1 0x78
168 #define PRP_CH2_RZ_VERT_COEF2 0x7c
169 #define PRP_CH2_RZ_VERT_VALID 0x80
171 #define PRP_CNTL_CH1EN (1 << 0)
172 #define PRP_CNTL_CH2EN (1 << 1)
173 #define PRP_CNTL_CSIEN (1 << 2)
174 #define PRP_CNTL_DATA_IN_YUV420 (0 << 3)
175 #define PRP_CNTL_DATA_IN_YUV422 (1 << 3)
176 #define PRP_CNTL_DATA_IN_RGB16 (2 << 3)
177 #define PRP_CNTL_DATA_IN_RGB32 (3 << 3)
178 #define PRP_CNTL_CH1_OUT_RGB8 (0 << 5)
179 #define PRP_CNTL_CH1_OUT_RGB16 (1 << 5)
180 #define PRP_CNTL_CH1_OUT_RGB32 (2 << 5)
181 #define PRP_CNTL_CH1_OUT_YUV422 (3 << 5)
182 #define PRP_CNTL_CH2_OUT_YUV420 (0 << 7)
183 #define PRP_CNTL_CH2_OUT_YUV422 (1 << 7)
184 #define PRP_CNTL_CH2_OUT_YUV444 (2 << 7)
185 #define PRP_CNTL_CH1_LEN (1 << 9)
186 #define PRP_CNTL_CH2_LEN (1 << 10)
187 #define PRP_CNTL_SKIP_FRAME (1 << 11)
188 #define PRP_CNTL_SWRST (1 << 12)
189 #define PRP_CNTL_CLKEN (1 << 13)
190 #define PRP_CNTL_WEN (1 << 14)
191 #define PRP_CNTL_CH1BYP (1 << 15)
192 #define PRP_CNTL_IN_TSKIP(x) ((x) << 16)
193 #define PRP_CNTL_CH1_TSKIP(x) ((x) << 19)
194 #define PRP_CNTL_CH2_TSKIP(x) ((x) << 22)
195 #define PRP_CNTL_INPUT_FIFO_LEVEL(x) ((x) << 25)
196 #define PRP_CNTL_RZ_FIFO_LEVEL(x) ((x) << 27)
197 #define PRP_CNTL_CH2B1EN (1 << 29)
198 #define PRP_CNTL_CH2B2EN (1 << 30)
199 #define PRP_CNTL_CH2FEN (1 << 31)
202 #define PRP_INTR_RDERR (1 << 0)
203 #define PRP_INTR_CH1WERR (1 << 1)
204 #define PRP_INTR_CH2WERR (1 << 2)
205 #define PRP_INTR_CH1FC (1 << 3)
206 #define PRP_INTR_CH2FC (1 << 5)
207 #define PRP_INTR_LBOVF (1 << 7)
208 #define PRP_INTR_CH2OVF (1 << 8)
211 #define PRP_RZ_VALID_TBL_LEN(x) ((x) << 24)
212 #define PRP_RZ_VALID_BILINEAR (1 << 31)
214 #define MAX_VIDEO_MEM 16
216 #define RESIZE_NUM_MIN 1
217 #define RESIZE_NUM_MAX 20
219 #define SZ_COEF (1 << BC_COEF)
221 #define RESIZE_DIR_H 0
222 #define RESIZE_DIR_V 1
224 #define RESIZE_ALGO_BILINEAR 0
225 #define RESIZE_ALGO_AVERAGING 1
311 static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
328 .src_pixel = 0x2ca00565,
329 .ch1_pixel = 0x2ca00565,
342 .src_pixel = 0x22000888,
343 .ch1_pixel = 0x62000888,
356 .src_pixel = 0x22000888,
357 .ch1_pixel = 0x62000888,
370 .src_pixel = 0x22000888,
384 .src_pixel = 0x22000888,
393 static struct mx2_fmt_cfg *mx27_emma_prp_get_format(
399 for (i = 1; i <
ARRAY_SIZE(mx27_emma_prp_table); i++)
400 if ((mx27_emma_prp_table[i].in_fmt == in_fmt) &&
402 return &mx27_emma_prp_table[
i];
405 return &mx27_emma_prp_table[0];
409 unsigned long phys,
int bufnum)
413 if (prp->
cfg.channel == 1) {
420 u32 imgsize = pcdev->
icd->user_height *
421 pcdev->
icd->user_width;
435 clk_disable_unprepare(pcdev->
clk_csi);
445 spin_unlock_irqrestore(&pcdev->
lock, flags);
463 ret = clk_prepare_enable(pcdev->
clk_csi);
495 mx2_camera_deactivate(pcdev);
512 if (*fb_active ==
NULL)
515 vb = &(*fb_active)->vb;
516 dev_dbg(pcdev->
dev,
"%s (vb=0x%p) 0x%p %lu\n", __func__,
523 if (list_empty(&pcdev->
capture)) {
532 writel(vb2_dma_contig_plane_dma_addr(vb, 0),
539 spin_unlock_irqrestore(&pcdev->
lock, flags);
562 static int mx2_videobuf_setup(
struct vb2_queue *vq,
565 unsigned int sizes[],
void *alloc_ctxs[])
571 dev_dbg(icd->
parent,
"count=%d, size=%d\n", *count, sizes[0]);
592 static int mx2_videobuf_prepare(
struct vb2_buffer *vb)
606 0xaa, vb2_get_plane_payload(vb, 0));
609 vb2_set_plane_payload(vb, 0, icd->
sizeimage);
611 vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) {
622 static void mx2_videobuf_queue(
struct vb2_buffer *vb)
626 to_soc_camera_host(icd->
parent);
640 u32 csicr3, dma_inten = 0;
643 writel(vb2_dma_contig_plane_dma_addr(vb, 0),
648 writel(vb2_dma_contig_plane_dma_addr(vb, 0),
666 pcdev->
csicr1 |= dma_inten;
675 spin_unlock_irqrestore(&pcdev->
lock, flags);
678 static void mx2_videobuf_release(
struct vb2_buffer *vb)
690 switch (buf->
state) {
727 spin_unlock_irqrestore(&pcdev->
lock, flags);
734 to_soc_camera_host(icd->
parent);
742 if (prp->
cfg.channel == 1) {
763 unsigned char *
s = pcdev->
resizing[dir].s;
765 unsigned int coeff[2] = {0, 0};
766 unsigned int valid = 0;
779 if (i == 5 || i == 15)
782 valid = (valid << 1) | (s[i] >>
BC_COEF);
790 if (pcdev->
emma_prp->cfg.channel == 1) {
826 static int mx2_start_streaming(
struct vb2_queue *
q,
unsigned int count)
830 to_soc_camera_host(icd->
parent);
851 phys = vb2_dma_contig_plane_dma_addr(vb, 0);
852 mx27_update_emma_buf(pcdev, phys, buf->
internal.bufnum);
861 phys = vb2_dma_contig_plane_dma_addr(vb, 0);
862 mx27_update_emma_buf(pcdev, phys, buf->
internal.bufnum);
867 if (bytesperline < 0) {
868 spin_unlock_irqrestore(&pcdev->
lock, flags);
884 spin_unlock_irqrestore(&pcdev->
lock, flags);
896 mx2_prp_resize_commit(pcdev);
898 mx27_camera_emma_buf_init(icd, bytesperline);
900 if (prp->
cfg.channel == 1) {
920 spin_unlock_irqrestore(&pcdev->
lock, flags);
926 static int mx2_stop_streaming(
struct vb2_queue *q)
930 to_soc_camera_host(icd->
parent);
941 if (prp->
cfg.channel == 1) {
948 INIT_LIST_HEAD(&pcdev->
capture);
950 INIT_LIST_HEAD(&pcdev->
discard);
955 spin_unlock_irqrestore(&pcdev->
lock, flags);
964 static struct vb2_ops mx2_videobuf_ops = {
965 .queue_setup = mx2_videobuf_setup,
966 .buf_prepare = mx2_videobuf_prepare,
967 .buf_queue = mx2_videobuf_queue,
968 .buf_cleanup = mx2_videobuf_release,
969 .start_streaming = mx2_start_streaming,
970 .stop_streaming = mx2_stop_streaming,
973 static int mx2_camera_init_videobuf(
struct vb2_queue *q,
979 q->
ops = &mx2_videobuf_ops;
986 #define MX2_BUS_FLAGS (V4L2_MBUS_MASTER | \
987 V4L2_MBUS_VSYNC_ACTIVE_HIGH | \
988 V4L2_MBUS_VSYNC_ACTIVE_LOW | \
989 V4L2_MBUS_HSYNC_ACTIVE_HIGH | \
990 V4L2_MBUS_HSYNC_ACTIVE_LOW | \
991 V4L2_MBUS_PCLK_SAMPLE_RISING | \
992 V4L2_MBUS_PCLK_SAMPLE_FALLING | \
993 V4L2_MBUS_DATA_ACTIVE_HIGH | \
994 V4L2_MBUS_DATA_ACTIVE_LOW)
996 static int mx27_camera_emma_prp_reset(
struct mx2_camera_dev *pcdev)
1003 while (count++ < 100) {
1027 if (!common_flags) {
1029 "Flags incompatible: camera 0x%x, host 0x%x\n",
1042 common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW;
1044 common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH;
1050 common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_FALLING;
1052 common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_RISING;
1058 dev_dbg(icd->
parent,
"camera s_mbus_config(0x%lx) returned %d\n",
1065 if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
1069 if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
1086 if (bytesperline < 0)
1090 ret = mx27_camera_emma_prp_reset(pcdev);
1110 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1111 struct v4l2_mbus_framefmt mf;
1114 soc_camera_limit_side(&rect->
left, &rect->
width, 0, 2, 4096);
1115 soc_camera_limit_side(&rect->
top, &rect->
height, 0, 2, 4096);
1127 mf.width, mf.height);
1137 struct soc_camera_format_xlate *xlate)
1139 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1152 dev_err(dev,
"Invalid format code #%u: %d\n", idx, code);
1167 dev_dbg(dev,
"Providing host format %s for sensor code %d\n",
1168 xlate->host_fmt->
name, code);
1179 dev_dbg(dev,
"Providing host format %s for sensor code %d\n",
1180 xlate->host_fmt->
name, code);
1188 xlate->host_fmt =
fmt;
1196 struct v4l2_mbus_framefmt *mf_in,
1205 unsigned char *s = tmprsz.
s;
1211 out = pix_out->
width;
1229 if ((num >= 2 * den) && (den == 1) &&
1230 (num < 9) && (!(num & 0x01))) {
1240 for (i = 0; i < (len / 2); i++)
1244 for (i = 0; i < (len / 2); i++) {
1247 for (j = 0; j < (len / 2); j++)
1254 for (i = (len / 2); i <
len; i++)
1255 s[i] = s[len - i - 1];
1262 int in_pos_inc = 2 *
den;
1264 int out_pos_inc = 2 * num;
1265 int init_carry = num -
den;
1266 int carry = init_carry;
1269 v = den + in_pos_inc;
1271 coeff = v - out_pos;
1272 out_pos += out_pos_inc;
1273 carry += out_pos_inc;
1274 for (nxt = 0; v < out_pos; nxt++) {
1276 carry -= in_pos_inc;
1283 (in_pos_inc >> 1)) / in_pos_inc;
1289 s[
len] = (
unsigned char)coeff;
1292 for (i = 1; i < nxt; i++) {
1298 }
while (carry != init_carry);
1302 mf_in->width = pix_out->
width;
1304 mf_in->height = pix_out->
height;
1317 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1318 const struct soc_camera_format_xlate *xlate;
1320 struct v4l2_mbus_framefmt mf;
1323 dev_dbg(icd->
parent,
"%s: requested params: width = %d, height = %d\n",
1333 mf.width = pix->
width;
1335 mf.field = pix->
field;
1337 mf.code = xlate->code;
1346 dev_dbg(icd->
parent,
"%s: sensor params: width = %d, height = %d\n",
1349 pcdev->
emma_prp = mx27_emma_prp_get_format(xlate->code,
1350 xlate->host_fmt->fourcc);
1353 if ((mf.width != pix->
width || mf.height != pix->
height) &&
1355 if (mx2_emmaprp_resize(pcdev, &mf, pix,
true) < 0)
1359 if (mf.code != xlate->code)
1362 pix->
width = mf.width;
1364 pix->
field = mf.field;
1368 dev_dbg(icd->
parent,
"%s: returned params: width = %d, height = %d\n",
1377 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
1378 const struct soc_camera_format_xlate *xlate;
1380 struct v4l2_mbus_framefmt mf;
1385 unsigned int width_limit;
1388 dev_dbg(icd->
parent,
"%s: requested params: width = %d, height = %d\n",
1392 if (pixfmt && !xlate) {
1401 if (xlate->host_fmt->bits_per_sample <= 8)
1402 width_limit = 0xffff * 4;
1404 width_limit = 0xffff * 2;
1406 if (pix->
width > width_limit)
1407 pix->
width = width_limit;
1408 if (pix->
height > 0xffff)
1420 unsigned int new_height =
int_sqrt(div_u64(0x3ffffULL *
1423 pix->
height = new_height;
1433 mf.width = pix->
width;
1435 mf.field = pix->
field;
1437 mf.code = xlate->code;
1443 dev_dbg(icd->
parent,
"%s: sensor params: width = %d, height = %d\n",
1447 emma_prp = mx27_emma_prp_get_format(xlate->code,
1448 xlate->host_fmt->fourcc);
1450 if ((mf.width != pix->
width || mf.height != pix->
height) &&
1452 if (mx2_emmaprp_resize(pcdev, &mf, pix,
false) < 0)
1469 pix->
width = mf.width;
1471 pix->
field = mf.field;
1474 dev_dbg(icd->
parent,
"%s: returned params: width = %d, height = %d\n",
1499 .add = mx2_camera_add_device,
1500 .remove = mx2_camera_remove_device,
1501 .set_fmt = mx2_camera_set_fmt,
1502 .set_crop = mx2_camera_set_crop,
1503 .get_formats = mx2_camera_get_formats,
1504 .try_fmt = mx2_camera_try_fmt,
1505 .init_videobuf2 = mx2_camera_init_videobuf,
1506 .poll = mx2_camera_poll,
1507 .querycap = mx2_camera_querycap,
1508 .set_bus_param = mx2_camera_set_bus_param,
1511 static void mx27_camera_frame_done_emma(
struct mx2_camera_dev *pcdev,
1512 int bufnum,
bool err)
1534 buf = mx2_ibuf_to_buf(ibuf);
1538 phys = vb2_dma_contig_plane_dma_addr(vb, 0);
1539 if (prp->
cfg.channel == 1) {
1541 4 * bufnum) != phys) {
1548 0x14 * bufnum) != phys) {
1555 dev_dbg(pcdev->
dev,
"%s (vb=0x%p) 0x%p %lu\n", __func__, vb,
1557 vb2_get_plane_payload(vb, 0));
1559 list_del_init(&buf->
internal.queue);
1570 if (list_empty(&pcdev->
capture)) {
1571 if (list_empty(&pcdev->
discard)) {
1572 dev_warn(pcdev->
dev,
"%s: trying to access empty discard list\n",
1596 phys = vb2_dma_contig_plane_dma_addr(vb, 0);
1597 mx27_update_emma_buf(pcdev, phys, bufnum);
1600 static irqreturn_t mx27_camera_emma_irq(
int irq_emma,
void *data)
1606 spin_lock(&pcdev->
lock);
1609 dev_warn(pcdev->
dev,
"%s: called while active list is empty\n",
1613 spin_unlock(&pcdev->
lock);
1618 if (status & (1 << 7)) {
1626 mx27_camera_frame_done_emma(pcdev,
1629 status &= ~(1 << 7);
1630 }
else if (((status & (3 << 5)) == (3 << 5)) ||
1631 ((status & (3 << 3)) == (3 << 3))) {
1638 mx27_camera_frame_done_emma(pcdev, ibuf->
bufnum,
false);
1639 status &= ~(1 << (6 - ibuf->
bufnum));
1640 }
else if ((status & (1 << 6)) || (status & (1 << 4))) {
1641 mx27_camera_frame_done_emma(pcdev, 0,
false);
1642 }
else if ((status & (1 << 5)) || (status & (1 << 3))) {
1643 mx27_camera_frame_done_emma(pcdev, 1,
false);
1646 spin_unlock(&pcdev->
lock);
1661 if (!res_emma || !irq_emma) {
1673 err = devm_request_irq(pcdev->
dev, irq_emma, mx27_camera_emma_irq, 0,
1676 dev_err(pcdev->
dev,
"Camera EMMA interrupt register failed \n");
1691 goto exit_clk_emma_ipg;
1696 err = mx27_camera_emma_prp_reset(pcdev);
1698 goto exit_clk_emma_ahb;
1721 if (res_csi ==
NULL || irq_csi < 0) {
1722 dev_err(&pdev->
dev,
"Missing platform resources data\n");
1729 dev_err(&pdev->
dev,
"Could not allocate pcdev\n");
1736 dev_err(&pdev->
dev,
"Could not get csi clock\n");
1737 err = PTR_ERR(pcdev->
clk_csi);
1741 pcdev->
pdata = pdev->
dev.platform_data;
1757 INIT_LIST_HEAD(&pcdev->
capture);
1759 INIT_LIST_HEAD(&pcdev->
discard);
1769 platform_set_drvdata(pdev, pcdev);
1772 err = devm_request_irq(&pdev->
dev, irq_csi, mx25_camera_irq, 0,
1775 dev_err(pcdev->
dev,
"Camera interrupt register failed \n");
1781 err = mx27_camera_emma_init(pdev);
1790 platform_set_drvdata(pdev,
NULL);
1793 pcdev->
soc_host.ops = &mx2_soc_camera_host_ops,
1807 goto exit_free_emma;
1809 dev_info(&pdev->
dev,
"MX2 Camera (CSI) driver probed, clock frequency: %ld\n",
1840 dev_info(&pdev->
dev,
"MX2 Camera driver unloaded\n");
1853 static int __init mx2_camera_init(
void)
1858 static void __exit mx2_camera_exit(
void)