diff options
Diffstat (limited to 'drivers/media/video/mt9v022.c')
-rw-r--r-- | drivers/media/video/mt9v022.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index 468333946d57..d677344d233d 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -59,18 +59,25 @@ MODULE_PARM_DESC(sensor_type, "Sensor type: \"colour\" or \"monochrome\"\n"); | |||
59 | /* Progressive scan, master, defaults */ | 59 | /* Progressive scan, master, defaults */ |
60 | #define MT9V022_CHIP_CONTROL_DEFAULT 0x188 | 60 | #define MT9V022_CHIP_CONTROL_DEFAULT 0x188 |
61 | 61 | ||
62 | static const struct soc_camera_data_format mt9v022_formats[] = { | 62 | static const struct soc_camera_data_format mt9v022_colour_formats[] = { |
63 | /* Order important: first natively supported, | ||
64 | * second supported with a GPIO extender */ | ||
63 | { | 65 | { |
64 | .name = "RGB Bayer (sRGB)", | 66 | .name = "Bayer (sRGB) 10 bit", |
65 | .depth = 8, | ||
66 | .fourcc = V4L2_PIX_FMT_SBGGR8, | ||
67 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
68 | }, { | ||
69 | .name = "RGB Bayer (sRGB)", | ||
70 | .depth = 10, | 67 | .depth = 10, |
71 | .fourcc = V4L2_PIX_FMT_SBGGR16, | 68 | .fourcc = V4L2_PIX_FMT_SBGGR16, |
72 | .colorspace = V4L2_COLORSPACE_SRGB, | 69 | .colorspace = V4L2_COLORSPACE_SRGB, |
73 | }, { | 70 | }, { |
71 | .name = "Bayer (sRGB) 8 bit", | ||
72 | .depth = 8, | ||
73 | .fourcc = V4L2_PIX_FMT_SBGGR8, | ||
74 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | static const struct soc_camera_data_format mt9v022_monochrome_formats[] = { | ||
79 | /* Order important - see above */ | ||
80 | { | ||
74 | .name = "Monochrome 10 bit", | 81 | .name = "Monochrome 10 bit", |
75 | .depth = 10, | 82 | .depth = 10, |
76 | .fourcc = V4L2_PIX_FMT_Y16, | 83 | .fourcc = V4L2_PIX_FMT_Y16, |
@@ -486,8 +493,8 @@ static struct soc_camera_ops mt9v022_ops = { | |||
486 | .stop_capture = mt9v022_stop_capture, | 493 | .stop_capture = mt9v022_stop_capture, |
487 | .set_capture_format = mt9v022_set_capture_format, | 494 | .set_capture_format = mt9v022_set_capture_format, |
488 | .try_fmt_cap = mt9v022_try_fmt_cap, | 495 | .try_fmt_cap = mt9v022_try_fmt_cap, |
489 | .formats = mt9v022_formats, | 496 | .formats = NULL, /* Filled in later depending on the */ |
490 | .num_formats = ARRAY_SIZE(mt9v022_formats), | 497 | .num_formats = 0, /* sensor type and data widths */ |
491 | .get_datawidth = mt9v022_get_datawidth, | 498 | .get_datawidth = mt9v022_get_datawidth, |
492 | .controls = mt9v022_controls, | 499 | .controls = mt9v022_controls, |
493 | .num_controls = ARRAY_SIZE(mt9v022_controls), | 500 | .num_controls = ARRAY_SIZE(mt9v022_controls), |
@@ -671,9 +678,19 @@ static int mt9v022_video_probe(struct soc_camera_device *icd) | |||
671 | !strcmp("color", sensor_type))) { | 678 | !strcmp("color", sensor_type))) { |
672 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11); | 679 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11); |
673 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATC; | 680 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATC; |
681 | mt9v022_ops.formats = mt9v022_colour_formats; | ||
682 | if (mt9v022->client->dev.platform_data) | ||
683 | mt9v022_ops.num_formats = ARRAY_SIZE(mt9v022_colour_formats); | ||
684 | else | ||
685 | mt9v022_ops.num_formats = 1; | ||
674 | } else { | 686 | } else { |
675 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11); | 687 | ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11); |
676 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATM; | 688 | mt9v022->model = V4L2_IDENT_MT9V022IX7ATM; |
689 | mt9v022_ops.formats = mt9v022_monochrome_formats; | ||
690 | if (mt9v022->client->dev.platform_data) | ||
691 | mt9v022_ops.num_formats = ARRAY_SIZE(mt9v022_monochrome_formats); | ||
692 | else | ||
693 | mt9v022_ops.num_formats = 1; | ||
677 | } | 694 | } |
678 | 695 | ||
679 | if (ret >= 0) | 696 | if (ret >= 0) |