diff options
author | Julien Massot <julien.massot@collabora.com> | 2024-04-30 15:19:31 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2024-06-04 08:31:26 +0200 |
commit | 64a9e1fb1d6ff67d52d546732e11aea1e43b01e8 (patch) | |
tree | 264a676ab68c656b65dfd80ae0d68f51631830c1 /drivers/media/i2c/max96717.c | |
parent | media: i2c: add MAX96714 driver (diff) | |
download | linux-64a9e1fb1d6ff67d52d546732e11aea1e43b01e8.tar.xz linux-64a9e1fb1d6ff67d52d546732e11aea1e43b01e8.zip |
drivers: media: max96717: stop the csi receiver before the source
Stopping the CSI source before stopping the serializer
CSI port may make the serializer not respond.
Then all the next writes to the device will fail.
max96717 1-0040: Error writing reg 0x0308: -121
max96717 1-0040: Error writing reg 0x0006: -121
Fix that by stopping the CSI receiver first and then CSI source.
Seen on max96717f revision 4.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c/max96717.c')
-rw-r--r-- | drivers/media/i2c/max96717.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/media/i2c/max96717.c b/drivers/media/i2c/max96717.c index 62df822a193f..949306485873 100644 --- a/drivers/media/i2c/max96717.c +++ b/drivers/media/i2c/max96717.c @@ -384,24 +384,23 @@ static int max96717_disable_streams(struct v4l2_subdev *sd, { struct max96717_priv *priv = sd_to_max96717(sd); u64 sink_streams; - int ret; + + /* + * Stop the CSI receiver first then the source, + * otherwise the device may become unresponsive + * while holding the I2C bus low. + */ + priv->enabled_source_streams &= ~streams_mask; + if (!priv->enabled_source_streams) + max96717_start_csi(priv, false); sink_streams = v4l2_subdev_state_xlate_streams(state, MAX96717_PAD_SOURCE, MAX96717_PAD_SINK, &streams_mask); - ret = v4l2_subdev_disable_streams(priv->source_sd, priv->source_sd_pad, - sink_streams); - if (ret) - return ret; - - priv->enabled_source_streams &= ~streams_mask; - - if (!priv->enabled_source_streams) - max96717_start_csi(priv, false); - - return 0; + return v4l2_subdev_disable_streams(priv->source_sd, priv->source_sd_pad, + sink_streams); } static const struct v4l2_subdev_pad_ops max96717_pad_ops = { |