diff options
Diffstat (limited to 'drivers/media/video/mx2_camera.c')
-rw-r--r-- | drivers/media/video/mx2_camera.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index ded26b7286fa..637bde8aca28 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #define CSICR1_INV_DATA (1 << 3) | 83 | #define CSICR1_INV_DATA (1 << 3) |
84 | #define CSICR1_INV_PCLK (1 << 2) | 84 | #define CSICR1_INV_PCLK (1 << 2) |
85 | #define CSICR1_REDGE (1 << 1) | 85 | #define CSICR1_REDGE (1 << 1) |
86 | #define CSICR1_FMT_MASK (CSICR1_PACK_DIR | CSICR1_SWAP16_EN) | ||
86 | 87 | ||
87 | #define SHIFT_STATFF_LEVEL 22 | 88 | #define SHIFT_STATFF_LEVEL 22 |
88 | #define SHIFT_RXFF_LEVEL 19 | 89 | #define SHIFT_RXFF_LEVEL 19 |
@@ -230,6 +231,7 @@ struct mx2_prp_cfg { | |||
230 | u32 src_pixel; | 231 | u32 src_pixel; |
231 | u32 ch1_pixel; | 232 | u32 ch1_pixel; |
232 | u32 irq_flags; | 233 | u32 irq_flags; |
234 | u32 csicr1; | ||
233 | }; | 235 | }; |
234 | 236 | ||
235 | /* prp resizing parameters */ | 237 | /* prp resizing parameters */ |
@@ -330,6 +332,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
330 | .ch1_pixel = 0x2ca00565, /* RGB565 */ | 332 | .ch1_pixel = 0x2ca00565, /* RGB565 */ |
331 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | | 333 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | |
332 | PRP_INTR_CH1FC | PRP_INTR_LBOVF, | 334 | PRP_INTR_CH1FC | PRP_INTR_LBOVF, |
335 | .csicr1 = 0, | ||
333 | } | 336 | } |
334 | }, | 337 | }, |
335 | { | 338 | { |
@@ -343,6 +346,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
343 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | 346 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | |
344 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | 347 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | |
345 | PRP_INTR_CH2OVF, | 348 | PRP_INTR_CH2OVF, |
349 | .csicr1 = CSICR1_PACK_DIR, | ||
346 | } | 350 | } |
347 | }, | 351 | }, |
348 | { | 352 | { |
@@ -356,6 +360,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
356 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | 360 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | |
357 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | 361 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | |
358 | PRP_INTR_CH2OVF, | 362 | PRP_INTR_CH2OVF, |
363 | .csicr1 = CSICR1_SWAP16_EN, | ||
359 | } | 364 | } |
360 | }, | 365 | }, |
361 | }; | 366 | }; |
@@ -984,7 +989,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
984 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 989 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
985 | struct mx2_camera_dev *pcdev = ici->priv; | 990 | struct mx2_camera_dev *pcdev = ici->priv; |
986 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; | 991 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; |
987 | const struct soc_camera_format_xlate *xlate; | ||
988 | unsigned long common_flags; | 992 | unsigned long common_flags; |
989 | int ret; | 993 | int ret; |
990 | int bytesperline; | 994 | int bytesperline; |
@@ -1029,24 +1033,7 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
1029 | return ret; | 1033 | return ret; |
1030 | } | 1034 | } |
1031 | 1035 | ||
1032 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 1036 | csicr1 = (csicr1 & ~CSICR1_FMT_MASK) | pcdev->emma_prp->cfg.csicr1; |
1033 | if (!xlate) { | ||
1034 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); | ||
1035 | return -EINVAL; | ||
1036 | } | ||
1037 | |||
1038 | if (xlate->code == V4L2_MBUS_FMT_YUYV8_2X8) { | ||
1039 | csicr1 |= CSICR1_PACK_DIR; | ||
1040 | csicr1 &= ~CSICR1_SWAP16_EN; | ||
1041 | dev_dbg(icd->parent, "already yuyv format, don't convert\n"); | ||
1042 | } else if (xlate->code == V4L2_MBUS_FMT_UYVY8_2X8) { | ||
1043 | csicr1 &= ~CSICR1_PACK_DIR; | ||
1044 | csicr1 |= CSICR1_SWAP16_EN; | ||
1045 | dev_dbg(icd->parent, "convert uyvy mbus format into yuyv\n"); | ||
1046 | } else { | ||
1047 | dev_warn(icd->parent, "mbus format not supported\n"); | ||
1048 | return -EINVAL; | ||
1049 | } | ||
1050 | 1037 | ||
1051 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) | 1038 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
1052 | csicr1 |= CSICR1_REDGE; | 1039 | csicr1 |= CSICR1_REDGE; |
@@ -1155,18 +1142,6 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd, | |||
1155 | } | 1142 | } |
1156 | } | 1143 | } |
1157 | 1144 | ||
1158 | if (code == V4L2_MBUS_FMT_UYVY8_2X8) { | ||
1159 | formats++; | ||
1160 | if (xlate) { | ||
1161 | xlate->host_fmt = | ||
1162 | soc_mbus_get_fmtdesc(V4L2_MBUS_FMT_YUYV8_2X8); | ||
1163 | xlate->code = code; | ||
1164 | dev_dbg(dev, "Providing host format %s for sensor code %d\n", | ||
1165 | xlate->host_fmt->name, code); | ||
1166 | xlate++; | ||
1167 | } | ||
1168 | } | ||
1169 | |||
1170 | /* Generic pass-trough */ | 1145 | /* Generic pass-trough */ |
1171 | formats++; | 1146 | formats++; |
1172 | if (xlate) { | 1147 | if (xlate) { |