aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-05-13 12:11:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 11:04:32 -0400
commite9ceeced6feb6f072d59b87fe5a47c37e2b50d51 (patch)
treeed4f969ad09adf1b02940720dd6c3a8167c12709 /drivers/media/video
parent93f116d595e9aa7dca5f6507376d6995f217d420 (diff)
[media] V4L: omap1-camera: fix huge lookup array
Since V4L2_MBUS_FMT_* codes have become large and sparse, they cannot be used as array indices anymore. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/omap1_camera.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c
index 5954b9306630..fe577a9632b4 100644
--- a/drivers/media/video/omap1_camera.c
+++ b/drivers/media/video/omap1_camera.c
@@ -990,63 +990,80 @@ static void omap1_cam_remove_device(struct soc_camera_device *icd)
990} 990}
991 991
992/* Duplicate standard formats based on host capability of byte swapping */ 992/* Duplicate standard formats based on host capability of byte swapping */
993static const struct soc_mbus_pixelfmt omap1_cam_formats[] = { 993static const struct soc_mbus_lookup omap1_cam_formats[] = {
994 [V4L2_MBUS_FMT_UYVY8_2X8] = { 994{
995 .code = V4L2_MBUS_FMT_UYVY8_2X8,
996 .fmt = {
995 .fourcc = V4L2_PIX_FMT_YUYV, 997 .fourcc = V4L2_PIX_FMT_YUYV,
996 .name = "YUYV", 998 .name = "YUYV",
997 .bits_per_sample = 8, 999 .bits_per_sample = 8,
998 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1000 .packing = SOC_MBUS_PACKING_2X8_PADHI,
999 .order = SOC_MBUS_ORDER_BE, 1001 .order = SOC_MBUS_ORDER_BE,
1000 }, 1002 },
1001 [V4L2_MBUS_FMT_VYUY8_2X8] = { 1003}, {
1004 .code = V4L2_MBUS_FMT_VYUY8_2X8,
1005 .fmt = {
1002 .fourcc = V4L2_PIX_FMT_YVYU, 1006 .fourcc = V4L2_PIX_FMT_YVYU,
1003 .name = "YVYU", 1007 .name = "YVYU",
1004 .bits_per_sample = 8, 1008 .bits_per_sample = 8,
1005 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1009 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1006 .order = SOC_MBUS_ORDER_BE, 1010 .order = SOC_MBUS_ORDER_BE,
1007 }, 1011 },
1008 [V4L2_MBUS_FMT_YUYV8_2X8] = { 1012}, {
1013 .code = V4L2_MBUS_FMT_YUYV8_2X8,
1014 .fmt = {
1009 .fourcc = V4L2_PIX_FMT_UYVY, 1015 .fourcc = V4L2_PIX_FMT_UYVY,
1010 .name = "UYVY", 1016 .name = "UYVY",
1011 .bits_per_sample = 8, 1017 .bits_per_sample = 8,
1012 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1018 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1013 .order = SOC_MBUS_ORDER_BE, 1019 .order = SOC_MBUS_ORDER_BE,
1014 }, 1020 },
1015 [V4L2_MBUS_FMT_YVYU8_2X8] = { 1021}, {
1022 .code = V4L2_MBUS_FMT_YVYU8_2X8,
1023 .fmt = {
1016 .fourcc = V4L2_PIX_FMT_VYUY, 1024 .fourcc = V4L2_PIX_FMT_VYUY,
1017 .name = "VYUY", 1025 .name = "VYUY",
1018 .bits_per_sample = 8, 1026 .bits_per_sample = 8,
1019 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1027 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1020 .order = SOC_MBUS_ORDER_BE, 1028 .order = SOC_MBUS_ORDER_BE,
1021 }, 1029 },
1022 [V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE] = { 1030}, {
1031 .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
1032 .fmt = {
1023 .fourcc = V4L2_PIX_FMT_RGB555, 1033 .fourcc = V4L2_PIX_FMT_RGB555,
1024 .name = "RGB555", 1034 .name = "RGB555",
1025 .bits_per_sample = 8, 1035 .bits_per_sample = 8,
1026 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1036 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1027 .order = SOC_MBUS_ORDER_BE, 1037 .order = SOC_MBUS_ORDER_BE,
1028 }, 1038 },
1029 [V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE] = { 1039}, {
1040 .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
1041 .fmt = {
1030 .fourcc = V4L2_PIX_FMT_RGB555X, 1042 .fourcc = V4L2_PIX_FMT_RGB555X,
1031 .name = "RGB555X", 1043 .name = "RGB555X",
1032 .bits_per_sample = 8, 1044 .bits_per_sample = 8,
1033 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1045 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1034 .order = SOC_MBUS_ORDER_BE, 1046 .order = SOC_MBUS_ORDER_BE,
1035 }, 1047 },
1036 [V4L2_MBUS_FMT_RGB565_2X8_BE] = { 1048}, {
1049 .code = V4L2_MBUS_FMT_RGB565_2X8_BE,
1050 .fmt = {
1037 .fourcc = V4L2_PIX_FMT_RGB565, 1051 .fourcc = V4L2_PIX_FMT_RGB565,
1038 .name = "RGB565", 1052 .name = "RGB565",
1039 .bits_per_sample = 8, 1053 .bits_per_sample = 8,
1040 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1054 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1041 .order = SOC_MBUS_ORDER_BE, 1055 .order = SOC_MBUS_ORDER_BE,
1042 }, 1056 },
1043 [V4L2_MBUS_FMT_RGB565_2X8_LE] = { 1057}, {
1058 .code = V4L2_MBUS_FMT_RGB565_2X8_LE,
1059 .fmt = {
1044 .fourcc = V4L2_PIX_FMT_RGB565X, 1060 .fourcc = V4L2_PIX_FMT_RGB565X,
1045 .name = "RGB565X", 1061 .name = "RGB565X",
1046 .bits_per_sample = 8, 1062 .bits_per_sample = 8,
1047 .packing = SOC_MBUS_PACKING_2X8_PADHI, 1063 .packing = SOC_MBUS_PACKING_2X8_PADHI,
1048 .order = SOC_MBUS_ORDER_BE, 1064 .order = SOC_MBUS_ORDER_BE,
1049 }, 1065 },
1066},
1050}; 1067};
1051 1068
1052static int omap1_cam_get_formats(struct soc_camera_device *icd, 1069static int omap1_cam_get_formats(struct soc_camera_device *icd,
@@ -1085,12 +1102,14 @@ static int omap1_cam_get_formats(struct soc_camera_device *icd,
1085 case V4L2_MBUS_FMT_RGB565_2X8_LE: 1102 case V4L2_MBUS_FMT_RGB565_2X8_LE:
1086 formats++; 1103 formats++;
1087 if (xlate) { 1104 if (xlate) {
1088 xlate->host_fmt = &omap1_cam_formats[code]; 1105 xlate->host_fmt = soc_mbus_find_fmtdesc(code,
1106 omap1_cam_formats,
1107 ARRAY_SIZE(omap1_cam_formats));
1089 xlate->code = code; 1108 xlate->code = code;
1090 xlate++; 1109 xlate++;
1091 dev_dbg(dev, 1110 dev_dbg(dev,
1092 "%s: providing format %s as byte swapped code #%d\n", 1111 "%s: providing format %s as byte swapped code #%d\n",
1093 __func__, omap1_cam_formats[code].name, code); 1112 __func__, xlate->host_fmt->name, code);
1094 } 1113 }
1095 default: 1114 default:
1096 if (xlate) 1115 if (xlate)