]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[media] v4l: tvp5150: Reset device at probe time, not in get/set format handlers
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 9 Dec 2016 11:47:17 +0000 (09:47 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 21 Dec 2016 09:28:20 +0000 (07:28 -0200)
commitaff808e813fc2d311137754165cf53d4ee6ddcc2
tree4918cac1f2669a3bf0560fe3f19a7ce33c410af5
parent48775cb73c2e26b7ca9d679875a6e570c8b8e124
[media] v4l: tvp5150: Reset device at probe time, not in get/set format handlers

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.

Cc: stable@vger.kernel.org # For Kernel 4.5 and upper
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/tvp5150.c