Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: i2c: imx290: Avoid communication during probe()

As we don't know the mode during probe(), it doesn't make sense to
update the sensors' registers with assumptions. As imx290_set_ctrl(),
which is responsible for the happening communication, already ensures that
there is no communication with a suspended sensor, put the sensor to
suspend before calling it.

To clarify the dependency of the PM runtime to the link of the subdev
and the imx290 instance, put the block together.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Benjamin Bara and committed by
Mauro Carvalho Chehab
a92651b8 856e89ff

+11 -8
+11 -8
drivers/media/i2c/imx290.c
··· 1249 1249 1250 1250 imx290->current_mode = &imx290_modes_ptr(imx290)[0]; 1251 1251 1252 + /* 1253 + * After linking the subdev with the imx290 instance, we are allowed to 1254 + * use the pm_runtime functions. Decrease the PM usage count. The device 1255 + * will get suspended after the autosuspend delay, turning the power 1256 + * off. However, the communication happening in imx290_ctrl_update() 1257 + * will already be prevented even before the delay. 1258 + */ 1252 1259 v4l2_i2c_subdev_init(&imx290->sd, client, &imx290_subdev_ops); 1260 + imx290->sd.dev = imx290->dev; 1261 + pm_runtime_mark_last_busy(imx290->dev); 1262 + pm_runtime_put_autosuspend(imx290->dev); 1263 + 1253 1264 imx290->sd.internal_ops = &imx290_internal_ops; 1254 1265 imx290->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | 1255 1266 V4L2_SUBDEV_FL_HAS_EVENTS; 1256 - imx290->sd.dev = imx290->dev; 1257 1267 imx290->sd.entity.ops = &imx290_subdev_entity_ops; 1258 1268 imx290->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; 1259 1269 ··· 1607 1597 dev_err(dev, "Could not register v4l2 device\n"); 1608 1598 goto err_subdev; 1609 1599 } 1610 - 1611 - /* 1612 - * Decrease the PM usage count. The device will get suspended after the 1613 - * autosuspend delay, turning the power off. 1614 - */ 1615 - pm_runtime_mark_last_busy(dev); 1616 - pm_runtime_put_autosuspend(dev); 1617 1600 1618 1601 return 0; 1619 1602