diff options
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/mx2_cam.h | 2 | ||||
| -rw-r--r-- | drivers/media/video/mx2_camera.c | 52 |
2 files changed, 7 insertions, 47 deletions
diff --git a/arch/arm/plat-mxc/include/mach/mx2_cam.h b/arch/arm/plat-mxc/include/mach/mx2_cam.h index 7ded6f1f74bc..3c080a32dbf5 100644 --- a/arch/arm/plat-mxc/include/mach/mx2_cam.h +++ b/arch/arm/plat-mxc/include/mach/mx2_cam.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #ifndef __MACH_MX2_CAM_H_ | 23 | #ifndef __MACH_MX2_CAM_H_ |
| 24 | #define __MACH_MX2_CAM_H_ | 24 | #define __MACH_MX2_CAM_H_ |
| 25 | 25 | ||
| 26 | #define MX2_CAMERA_SWAP16 (1 << 0) | ||
| 26 | #define MX2_CAMERA_EXT_VSYNC (1 << 1) | 27 | #define MX2_CAMERA_EXT_VSYNC (1 << 1) |
| 27 | #define MX2_CAMERA_CCIR (1 << 2) | 28 | #define MX2_CAMERA_CCIR (1 << 2) |
| 28 | #define MX2_CAMERA_CCIR_INTERLACE (1 << 3) | 29 | #define MX2_CAMERA_CCIR_INTERLACE (1 << 3) |
| @@ -30,6 +31,7 @@ | |||
| 30 | #define MX2_CAMERA_GATED_CLOCK (1 << 5) | 31 | #define MX2_CAMERA_GATED_CLOCK (1 << 5) |
| 31 | #define MX2_CAMERA_INV_DATA (1 << 6) | 32 | #define MX2_CAMERA_INV_DATA (1 << 6) |
| 32 | #define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7) | 33 | #define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7) |
| 34 | #define MX2_CAMERA_PACK_DIR_MSB (1 << 8) | ||
| 33 | 35 | ||
| 34 | /** | 36 | /** |
| 35 | * struct mx2_camera_platform_data - optional platform data for mx2_camera | 37 | * struct mx2_camera_platform_data - optional platform data for mx2_camera |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index ded26b7286fa..41f9a254b245 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
| @@ -345,19 +345,6 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
| 345 | PRP_INTR_CH2OVF, | 345 | PRP_INTR_CH2OVF, |
| 346 | } | 346 | } |
| 347 | }, | 347 | }, |
| 348 | { | ||
| 349 | .in_fmt = V4L2_MBUS_FMT_UYVY8_2X8, | ||
| 350 | .out_fmt = V4L2_PIX_FMT_YUV420, | ||
| 351 | .cfg = { | ||
| 352 | .channel = 2, | ||
| 353 | .in_fmt = PRP_CNTL_DATA_IN_YUV422, | ||
| 354 | .out_fmt = PRP_CNTL_CH2_OUT_YUV420, | ||
| 355 | .src_pixel = 0x22000888, /* YUV422 (YUYV) */ | ||
| 356 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | ||
| 357 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | ||
| 358 | PRP_INTR_CH2OVF, | ||
| 359 | } | ||
| 360 | }, | ||
| 361 | }; | 348 | }; |
| 362 | 349 | ||
| 363 | static struct mx2_fmt_cfg *mx27_emma_prp_get_format( | 350 | static struct mx2_fmt_cfg *mx27_emma_prp_get_format( |
| @@ -984,7 +971,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); | 971 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
| 985 | struct mx2_camera_dev *pcdev = ici->priv; | 972 | struct mx2_camera_dev *pcdev = ici->priv; |
| 986 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; | 973 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; |
| 987 | const struct soc_camera_format_xlate *xlate; | ||
| 988 | unsigned long common_flags; | 974 | unsigned long common_flags; |
| 989 | int ret; | 975 | int ret; |
| 990 | int bytesperline; | 976 | int bytesperline; |
| @@ -1029,31 +1015,14 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
| 1029 | return ret; | 1015 | return ret; |
| 1030 | } | 1016 | } |
| 1031 | 1017 | ||
| 1032 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | ||
| 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 | |||
| 1051 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) | 1018 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
| 1052 | csicr1 |= CSICR1_REDGE; | 1019 | csicr1 |= CSICR1_REDGE; |
| 1053 | if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) | 1020 | if (common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) |
| 1054 | csicr1 |= CSICR1_SOF_POL; | 1021 | csicr1 |= CSICR1_SOF_POL; |
| 1055 | if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) | 1022 | if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) |
| 1056 | csicr1 |= CSICR1_HSYNC_POL; | 1023 | csicr1 |= CSICR1_HSYNC_POL; |
| 1024 | if (pcdev->platform_flags & MX2_CAMERA_SWAP16) | ||
| 1025 | csicr1 |= CSICR1_SWAP16_EN; | ||
| 1057 | if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) | 1026 | if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) |
| 1058 | csicr1 |= CSICR1_EXT_VSYNC; | 1027 | csicr1 |= CSICR1_EXT_VSYNC; |
| 1059 | if (pcdev->platform_flags & MX2_CAMERA_CCIR) | 1028 | if (pcdev->platform_flags & MX2_CAMERA_CCIR) |
| @@ -1064,6 +1033,8 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
| 1064 | csicr1 |= CSICR1_GCLK_MODE; | 1033 | csicr1 |= CSICR1_GCLK_MODE; |
| 1065 | if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) | 1034 | if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) |
| 1066 | csicr1 |= CSICR1_INV_DATA; | 1035 | csicr1 |= CSICR1_INV_DATA; |
| 1036 | if (pcdev->platform_flags & MX2_CAMERA_PACK_DIR_MSB) | ||
| 1037 | csicr1 |= CSICR1_PACK_DIR; | ||
| 1067 | 1038 | ||
| 1068 | pcdev->csicr1 = csicr1; | 1039 | pcdev->csicr1 = csicr1; |
| 1069 | 1040 | ||
| @@ -1138,8 +1109,7 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd, | |||
| 1138 | return 0; | 1109 | return 0; |
| 1139 | } | 1110 | } |
| 1140 | 1111 | ||
| 1141 | if (code == V4L2_MBUS_FMT_YUYV8_2X8 || | 1112 | if (code == V4L2_MBUS_FMT_YUYV8_2X8) { |
| 1142 | code == V4L2_MBUS_FMT_UYVY8_2X8) { | ||
| 1143 | formats++; | 1113 | formats++; |
| 1144 | if (xlate) { | 1114 | if (xlate) { |
| 1145 | /* | 1115 | /* |
| @@ -1155,18 +1125,6 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd, | |||
| 1155 | } | 1125 | } |
| 1156 | } | 1126 | } |
| 1157 | 1127 | ||
| 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 */ | 1128 | /* Generic pass-trough */ |
| 1171 | formats++; | 1129 | formats++; |
| 1172 | if (xlate) { | 1130 | if (xlate) { |
