[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z1g2tLicdrb6lfoK@kekkonen.localdomain>
Date: Tue, 10 Dec 2024 12:40:20 +0000
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: git@...tzsch.eu
Cc: Ricardo Ribalda <ribalda@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
Vincent Knecht <vincent.knecht@...loo.org>,
Ricardo Ribalda <ribalda@...omium.org>
Subject: Re: [PATCH v3 10/12] media: i2c: imx214: Verify chip ID
Hi André,
Thanks for the update.
On Sat, Dec 07, 2024 at 09:47:59PM +0100, André Apitzsch via B4 Relay wrote:
> From: André Apitzsch <git@...tzsch.eu>
>
> Check the chip ID and stop probing if it is no imx214 sensor.
>
> Acked-by: Ricardo Ribalda <ribalda@...omium.org>
> Signed-off-by: André Apitzsch <git@...tzsch.eu>
> ---
> drivers/media/i2c/imx214.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index a35e4e60e55c2b9d9e3090c98e695f78d099cf44..3cd64bb91795d8490acad5926940c111fb95fae5 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -20,6 +20,10 @@
> #include <media/v4l2-fwnode.h>
> #include <media/v4l2-subdev.h>
>
> +/* Chip ID */
> +#define IMX214_REG_CHIP_ID CCI_REG16(0x0016)
> +#define IMX214_CHIP_ID 0x0214
> +
> #define IMX214_REG_MODE_SELECT CCI_REG8(0x0100)
> #define IMX214_MODE_STANDBY 0x00
> #define IMX214_MODE_STREAMING 0x01
> @@ -1092,6 +1096,27 @@ static int imx214_get_regulators(struct device *dev, struct imx214 *imx214)
> imx214->supplies);
> }
>
> +/* Verify chip ID */
> +static int imx214_identify_module(struct imx214 *imx214)
> +{
> + struct i2c_client *client = v4l2_get_subdevdata(&imx214->sd);
> + int ret;
> + u64 val;
> +
> + ret = cci_read(imx214->regmap, IMX214_REG_CHIP_ID, &val, NULL);
> + if (ret)
> + return dev_err_probe(&client->dev, ret,
> + "failed to read chip id %x\n",
> + IMX214_CHIP_ID);
> +
> + if (val != IMX214_CHIP_ID)
> + return dev_err_probe(&client->dev, -EIO,
> + "chip id mismatch: %x!=%llx\n",
> + IMX214_CHIP_ID, val);
> +
> + return 0;
> +}
> +
> static int imx214_parse_fwnode(struct device *dev)
> {
> struct fwnode_handle *endpoint;
> @@ -1184,6 +1209,10 @@ static int imx214_probe(struct i2c_client *client)
> */
> imx214_power_on(imx214->dev);
>
> + ret = imx214_identify_module(imx214);
> + if (ret)
> + goto error_power_off;
The error handling was wrong in the driver, the code under the
error_power_off label only disables the regulator (and runtime PM, which
hasn't been enabled) but it does not disable or unprepare the clock. Could
you fix these in a new patch, please?
> +
> pm_runtime_set_active(imx214->dev);
> pm_runtime_enable(imx214->dev);
> pm_runtime_idle(imx214->dev);
>
--
Kind regards,
Sakari Ailus
Powered by blists - more mailing lists