Hi Benjamin, On Wed, Aug 28, 2024 at 08:13:07PM +0200, Benjamin Bara wrote: > Currently, the V4L2 subdevice is also created when the device is not > available/connected. In this case, dmesg shows the following: > > [ 10.419510] imx290 7-001a: Error writing reg 0x301c: -6 > [ 10.428981] imx290 7-001a: Error writing reg 0x3020: -6 > [ 10.442712] imx290 7-001a: Error writing reg 0x3018: -6 > [ 10.454018] imx290 7-001a: Error writing reg 0x3020: -6 > > which seems to come from imx290_ctrl_update() after the subdev init is > finished. However, as the errors are ignored, the subdev is initialized > but simply does not work. From userspace perspective, there is no > visible difference between a working and not-working subdevice (except > when trying it out or watching for the error message). > > This commit adds a simple availability check before starting with the > subdev initialization to error out instead. > > Signed-off-by: Benjamin Bara <benjamin.bara@xxxxxxxxxxx> > --- > Changes since v1: > - define operating/standby mode and use it > - read out the standby mode during probe and ensure it is standby > --- > drivers/media/i2c/imx290.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c > index 4150e6e4b9a6..2a869576600c 100644 > --- a/drivers/media/i2c/imx290.c > +++ b/drivers/media/i2c/imx290.c > @@ -29,6 +29,8 @@ > #include <media/v4l2-subdev.h> > > #define IMX290_STANDBY CCI_REG8(0x3000) > +#define IMX290_STANDBY_OPERATING (0 << 0) > +#define IMX290_STANDBY_STANDBY (1 << 0) This should use BIT() instead (or at least unsigned values). I'll fix that while at it, too... -- Kind regards, Sakari Ailus