From: Krzysztof Kozlowski <krzk@kernel.org>
To: Lachlan Michael <lachlan.michael@sony.com>
Cc: mchehab@kernel.org, sakari.ailus@linux.intel.com,
hverkuil+cisco@kernel.org, laurent.pinchart@ideasonboard.com,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
kieran.bingham@ideasonboard.com, jai.luthra@ideasonboard.com,
Ryuichi.Tadano@sony.com, Kengo.Hayasaka@sony.com,
Tim.Bird@sony.com, Kazumi.A.Sato@sony.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] media: i2c: Add Sony IMX908 image sensor driver
Date: Thu, 30 Jul 2026 11:09:16 +0200 [thread overview]
Message-ID: <20260730-ruddy-tricky-wildebeest-ec9e46@quoll> (raw)
In-Reply-To: <20260730021525.166811-3-lachlan.michael@sony.com>
On Thu, Jul 30, 2026 at 11:15:25AM +0900, Lachlan Michael wrote:
> + msleep(24); /* Regulator stabilization after standby cancel. */
> +
> + ret = cci_read(imx->cci, IMX908_REG_TYPE_ID, &val, &err);
> + if (ret || err)
> + return ret ? ret : err;
> +
> + chip_id = val;
> + dev_info(imx->dev, "IMX908 chip ID: 0x%04x\n", chip_id);
Drivers should be silent on success. Drop or dev_dbg.
> +
> + if (chip_id != IMX908_CHIP_ID) {
> + dev_err(imx->dev, "Unexpected chip ID 0x%04x (expected 0x%04x)\n",
> + chip_id, IMX908_CHIP_ID);
> + return -ENXIO;
> + }
> +
> + /* Set to standby mode */
> + ret = cci_write(imx->cci, IMX908_REG_STANDBY, IMX908_STANDBY_EN, NULL);
> + if (ret)
> + dev_err(imx->dev, "failed to enter standby state: %d\n", ret);
> +
> + return 0;
> +}
> +
> +static int imx908_probe(struct i2c_client *client)
> +{
> + struct imx908 *imx;
> + int ret;
> +
> + /* Allocate Memory */
Really?
> + imx = devm_kzalloc(&client->dev, sizeof(*imx), GFP_KERNEL);
> + if (!imx)
> + return dev_err_probe(&client->dev, -ENOMEM,
> + "failed to allocate IMX908 device structure\n");
> + imx->dev = &client->dev;
> +
> + /* Initialize V4L2 subdevice */
Obvious.
> + v4l2_i2c_subdev_init(&imx->sd, client, &imx908_subdev_ops);
> + imx->sd.internal_ops = &imx908_internal_ops;
> +
> + /* Register access initialization. Set 2-byte (16-bit) addresses */
> + imx->cci = devm_cci_regmap_init_i2c(client, 16);
> + if (IS_ERR(imx->cci))
> + return dev_err_probe(&client->dev, PTR_ERR(imx->cci),
> + "CCI regmap init failed\n");
> +
> + /* Get mandatory input clock from DT (INCK) */
Obvious.
> + imx->xclk = devm_clk_get(imx->dev, "xclk");
> + if (IS_ERR(imx->xclk))
> + return dev_err_probe(imx->dev, PTR_ERR(imx->xclk), "xclk\n");
> +
> + /* Get clock frequency and check against acceptable HW values */
> + imx->xclk_freq = clk_get_rate(imx->xclk);
> + ret = imx908_get_inck_sel(imx);
> + if (ret)
> + return ret;
> +
> + /* GPIO reset acquisition */
Please drop obvious comments. Can devm_gpiod_get_optional() be anything
else than GPIO reset acquisition? No.
Redundant comments bloat the code and make it more difficult to actually
spot important things.
> + imx->reset_gpio = devm_gpiod_get_optional(imx->dev, "reset",
> + GPIOD_OUT_HIGH);
> +
> + if (IS_ERR(imx->reset_gpio))
> + return dev_err_probe(imx->dev, PTR_ERR(imx->reset_gpio),
> + "reset gpio\n");
> +
> + /* Link to power supplies */
> + ret = imx908_get_regulators(imx);
> + if (ret)
> + return dev_err_probe(&client->dev, ret,
> + "regulator get failed\n");
> +
> + /* Parse Device Tree endpoint */
Obvious
> + ret = imx908_parse_fwnode(imx);
> + if (ret)
> + return dev_err_probe(&client->dev, ret,
> + "device tree parse failed\n");
> +
> + /* Power on IMX908 image sensor */
What if imx908_power_on() does power off of the sensor?
> + ret = imx908_power_on(imx);
> + if (ret)
> + return dev_err_probe(&client->dev, ret, "power-on failed\n");
> +
> + /* Read IMX908 device ID */
Best regards,
Krzysztof
prev parent reply other threads:[~2026-07-30 9:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 2:15 [PATCH 0/2] Add bindings and driver for Sony IMX908 Lachlan Michael
2026-07-30 2:15 ` [PATCH 1/2] media: dt-bindings: imx908: Add Sony IMX908 sensor bindings Lachlan Michael
2026-07-30 2:22 ` sashiko-bot
2026-07-30 3:24 ` Rob Herring (Arm)
2026-07-30 9:06 ` Krzysztof Kozlowski
2026-07-30 2:15 ` [PATCH 2/2] media: i2c: Add Sony IMX908 image sensor driver Lachlan Michael
2026-07-30 2:31 ` sashiko-bot
2026-07-30 9:09 ` Krzysztof Kozlowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260730-ruddy-tricky-wildebeest-ec9e46@quoll \
--to=krzk@kernel.org \
--cc=Kazumi.A.Sato@sony.com \
--cc=Kengo.Hayasaka@sony.com \
--cc=Ryuichi.Tadano@sony.com \
--cc=Tim.Bird@sony.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil+cisco@kernel.org \
--cc=jai.luthra@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzk+dt@kernel.org \
--cc=lachlan.michael@sony.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox