aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-12-09 06:47:17 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-01 02:33:10 -0500
commitd25f9bfeb62f812e8aa7eded53df8155bff25ee5 (patch)
tree0a07c1a05abef66804a2967f659bb5d42a40634b
parentfe6531075e1dd8a7784bf0450186be1380eafb86 (diff)
v4l: tvp5150: Reset device at probe time, not in get/set format handlers
commit aff808e813fc2d311137754165cf53d4ee6ddcc2 upstream. The tvp5150 doesn't support format setting through the subdev pad API and thus implements the set format handler as a get format operation. The single handler, tvp5150_fill_fmt(), resets the device by calling tvp5150_reset(). This causes malfunction as the device can be reset at will, possibly from userspace when the subdev userspace API is enabled. The reset call was added in commit ec2c4f3f93cb ("[media] media: tvp5150: Add mbus_fmt callbacks"), probably as an attempt to set the device to a known state before detecting the current TV standard. However, the get format handler doesn't access the hardware to get the TV standard since commit 963ddc63e20d ("[media] media: tvp5150: Add cropping support"). There is thus no need to reset the device when getting the format. However, removing the tvp5150_reset() from the get/set format handlers results in the function not being called at all if the bridge driver doesn't use the .reset() operation. The operation is nowadays abused and shouldn't be used, so shouldn't expect bridge drivers to call it. To make sure the device is properly initialize, move the reset call from the format handlers to the probe function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/media/i2c/tvp5150.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 7268e706e216..7fa359ea3031 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -858,8 +858,6 @@ static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
858 858
859 f = &format->format; 859 f = &format->format;
860 860
861 tvp5150_reset(sd, 0);
862
863 f->width = decoder->rect.width; 861 f->width = decoder->rect.width;
864 f->height = decoder->rect.height / 2; 862 f->height = decoder->rect.height / 2;
865 863
@@ -1521,7 +1519,6 @@ static int tvp5150_probe(struct i2c_client *c,
1521 res = core->hdl.error; 1519 res = core->hdl.error;
1522 goto err; 1520 goto err;
1523 } 1521 }
1524 v4l2_ctrl_handler_setup(&core->hdl);
1525 1522
1526 /* Default is no cropping */ 1523 /* Default is no cropping */
1527 core->rect.top = 0; 1524 core->rect.top = 0;
@@ -1532,6 +1529,8 @@ static int tvp5150_probe(struct i2c_client *c,
1532 core->rect.left = 0; 1529 core->rect.left = 0;
1533 core->rect.width = TVP5150_H_MAX; 1530 core->rect.width = TVP5150_H_MAX;
1534 1531
1532 tvp5150_reset(sd, 0); /* Calls v4l2_ctrl_handler_setup() */
1533
1535 res = v4l2_async_register_subdev(sd); 1534 res = v4l2_async_register_subdev(sd);
1536 if (res < 0) 1535 if (res < 0)
1537 goto err; 1536 goto err;