Re: [RFC PATCH v3 2/2] media: i2c: Add onsemi AR0234 image sensor driver

Quentin Freimanis
2026-05-05T04:21:44Z

Hi Alexander,

On 2026-03-06 2:36 a.m., Alexander Shiyan wrote:
> +static int ar0234_identify_module(struct ar0234 *ar0234)
> +{
> + u64 id, rev;
> + int ret;
> +
> + ret = cci_read(ar0234->regmap, AR0234_REG_CHIP_VERSION, &id, NULL);
> + ret = cci_read(ar0234->regmap, AR0234_REG_REVISION_NUMBER, &rev, &ret);
> + if (ret)
> + return dev_err_probe(ar0234->dev, ret,
> + "Failed to read chip id\n");
> +
> + if (id == AR0234_CHIP_ID_MONO)
> + ar0234->variant = AR0234_VARIANT_MONO;
> + else if (id == AR0234_CHIP_ID)
> + ar0234->variant = AR0234_VARIANT_COLOUR;
> + else
> + return dev_err_probe(ar0234->dev, -ENODEV,
> + "Invalid chip id: 0x%04x\n", (u16)id);
> +
> + dev_info(ar0234->dev, "Success reading chip id: 0x%04x, Rev.%lld\n",
> + (u16)id, (rev >> 12) & 0xf);
> +
> + return ret;
> +}
> +
> +static int ar0234_power_on(struct device *dev)
> +{
> + struct v4l2_subdev *sd = dev_get_drvdata(dev);
> + struct ar0234 *ar0234 = to_ar0234(sd);
> + int ret;
> +
> + ret = regulator_bulk_enable(ARRAY_SIZE(ar0234->supplies),
> + ar0234->supplies);
> + if (ret) {
> + dev_err(ar0234->dev, "Failed to enable regulators\n");
> + return ret;
> + }
> +
> + ret = clk_prepare_enable(ar0234->clk);
> + if (ret) {
> + dev_err(ar0234->dev, "Failed to enable clock\n");
> + regulator_bulk_disable(ARRAY_SIZE(ar0234->supplies),
> + ar0234->supplies);
> + return ret;
> + }
> +
> + gpiod_set_value_cansleep(ar0234->reset, 1);

should be 0 to de-assert the reset pin to power on

> + /* ~160000 EXTCLKs */
> + usleep_range(27000, 28000);
> +
> + return 0;
> +}
> +
> +static int ar0234_power_off(struct device *dev)
> +{
> + struct v4l2_subdev *sd = dev_get_drvdata(dev);
> + struct ar0234 *ar0234 = to_ar0234(sd);
> +
> + gpiod_set_value_cansleep(ar0234->reset, 0);

1 to assert reset to power off

> + regulator_bulk_disable(ARRAY_SIZE(ar0234->supplies), ar0234->supplies);
> + clk_disable_unprepare(ar0234->clk);
> + /* 100ms PwrDown until next PwrUp */
> + usleep_range(100000, 110000);
> +
> + return 0;
> +}
> +
after fixing the reset polarity locally I got the driver working with a
rgb ar0234cs in 4-lane 10bit mode using a 24mhz extclk and a 448MHz link
frequency.

Tested-by: Quentin Freimanis <quentin@q-lab.dev>
(after the reset fix)

- Quentin