Commit 297a7ef7 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

V4L/DVB (10066): mt9m001 mt9v022: fix bus-width switch GPIO availability test

Testing for non-NULL platform-data is not enough, we have to check if the GPIO
in the platform data is valid or not. Also see my earlier patch:

	[ARM] pxa/pcm990: use negative number for an invalid GPIO in camera data
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 88f4b899
...@@ -578,6 +578,7 @@ static int mt9m001_set_control(struct soc_camera_device *icd, struct v4l2_contro ...@@ -578,6 +578,7 @@ static int mt9m001_set_control(struct soc_camera_device *icd, struct v4l2_contro
static int mt9m001_video_probe(struct soc_camera_device *icd) static int mt9m001_video_probe(struct soc_camera_device *icd)
{ {
struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
struct soc_camera_link *icl = mt9m001->client->dev.platform_data;
s32 data; s32 data;
int ret; int ret;
...@@ -600,7 +601,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd) ...@@ -600,7 +601,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd)
case 0x8421: case 0x8421:
mt9m001->model = V4L2_IDENT_MT9M001C12ST; mt9m001->model = V4L2_IDENT_MT9M001C12ST;
icd->formats = mt9m001_colour_formats; icd->formats = mt9m001_colour_formats;
if (mt9m001->client->dev.platform_data) if (gpio_is_valid(icl->gpio))
icd->num_formats = ARRAY_SIZE(mt9m001_colour_formats); icd->num_formats = ARRAY_SIZE(mt9m001_colour_formats);
else else
icd->num_formats = 1; icd->num_formats = 1;
...@@ -608,7 +609,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd) ...@@ -608,7 +609,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd)
case 0x8431: case 0x8431:
mt9m001->model = V4L2_IDENT_MT9M001C12STM; mt9m001->model = V4L2_IDENT_MT9M001C12STM;
icd->formats = mt9m001_monochrome_formats; icd->formats = mt9m001_monochrome_formats;
if (mt9m001->client->dev.platform_data) if (gpio_is_valid(icl->gpio))
icd->num_formats = ARRAY_SIZE(mt9m001_monochrome_formats); icd->num_formats = ARRAY_SIZE(mt9m001_monochrome_formats);
else else
icd->num_formats = 1; icd->num_formats = 1;
......
...@@ -690,6 +690,7 @@ static int mt9v022_set_control(struct soc_camera_device *icd, ...@@ -690,6 +690,7 @@ static int mt9v022_set_control(struct soc_camera_device *icd,
static int mt9v022_video_probe(struct soc_camera_device *icd) static int mt9v022_video_probe(struct soc_camera_device *icd)
{ {
struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
struct soc_camera_link *icl = mt9v022->client->dev.platform_data;
s32 data; s32 data;
int ret; int ret;
...@@ -725,7 +726,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd) ...@@ -725,7 +726,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd)
ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11); ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 4 | 0x11);
mt9v022->model = V4L2_IDENT_MT9V022IX7ATC; mt9v022->model = V4L2_IDENT_MT9V022IX7ATC;
icd->formats = mt9v022_colour_formats; icd->formats = mt9v022_colour_formats;
if (mt9v022->client->dev.platform_data) if (gpio_is_valid(icl->gpio))
icd->num_formats = ARRAY_SIZE(mt9v022_colour_formats); icd->num_formats = ARRAY_SIZE(mt9v022_colour_formats);
else else
icd->num_formats = 1; icd->num_formats = 1;
...@@ -733,7 +734,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd) ...@@ -733,7 +734,7 @@ static int mt9v022_video_probe(struct soc_camera_device *icd)
ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11); ret = reg_write(icd, MT9V022_PIXEL_OPERATION_MODE, 0x11);
mt9v022->model = V4L2_IDENT_MT9V022IX7ATM; mt9v022->model = V4L2_IDENT_MT9V022IX7ATM;
icd->formats = mt9v022_monochrome_formats; icd->formats = mt9v022_monochrome_formats;
if (mt9v022->client->dev.platform_data) if (gpio_is_valid(icl->gpio))
icd->num_formats = ARRAY_SIZE(mt9v022_monochrome_formats); icd->num_formats = ARRAY_SIZE(mt9v022_monochrome_formats);
else else
icd->num_formats = 1; icd->num_formats = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment