[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240903-imx290-avail-v4-3-e4a6c0837f0b@skidata.com>
Date: Tue, 03 Sep 2024 16:54:34 +0200
From: Benjamin Bara <bbara93@...il.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Hans de Goede <hdegoede@...hat.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Alexander Stein <alexander.stein@...tq-group.com>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Benjamin Bara <benjamin.bara@...data.com>
Subject: [PATCH v4 3/3] media: i2c: imx290: Check for availability in
probe()
From: Benjamin Bara <benjamin.bara@...data.com>
Currently, the V4L2 subdevice is also created when the device is not
available/connected. From userspace perspective, there is no visible
difference between a working and not-working subdevice (except when
trying it out).
This commit adds a simple preparation step, which includes an
availability check, before the subdev is initialized.
Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
---
Changes since v3:
- thanks to the feedback of Dave, I decided to switch to a write instead
of a read for the availability check.
- instead of only writing the STANDBY register, re-use stop_streaming() to
ensure a proper state.
- reword commit message.
---
drivers/media/i2c/imx290.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c
index 47cfb6a9e9b5..49a5bf9c17da 100644
--- a/drivers/media/i2c/imx290.c
+++ b/drivers/media/i2c/imx290.c
@@ -1589,6 +1589,16 @@ static int imx290_probe(struct i2c_client *client)
pm_runtime_set_autosuspend_delay(dev, 1000);
pm_runtime_use_autosuspend(dev);
+ /*
+ * Make sure the sensor is available, in STANDBY and not streaming
+ * before the V4L2 subdev is initialized.
+ */
+ ret = imx290_stop_streaming(imx290);
+ if (ret) {
+ ret = dev_err_probe(dev, ret, "Could not initialize device\n");
+ goto err_pm;
+ }
+
/* Initialize the V4L2 subdev. */
ret = imx290_subdev_init(imx290);
if (ret)
--
2.46.0
Powered by blists - more mailing lists