From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Mirela Rabulea <mirela.rabulea@nxp.com>,
mchehab@kernel.org, sakari.ailus@linux.intel.com,
hverkuil-cisco@xs4all.nl, robh@kernel.org, krzk+dt@kernel.org,
bryan.odonoghue@linaro.org, laurentiu.palcu@nxp.com,
robert.chiras@nxp.com, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, LnxRevLi@nxp.com,
kieran.bingham@ideasonboard.com, hdegoede@redhat.com,
dave.stevenson@raspberrypi.com, mike.rudenko@gmail.com,
alain.volmat@foss.st.com, devicetree@vger.kernel.org,
conor+dt@kernel.org, alexander.stein@ew.tq-group.com,
umang.jain@ideasonboard.com, zhi.mao@mediatek.com,
festevam@denx.de, julien.vuillaumier@nxp.com, alice.yuan@nxp.com
Subject: Re: [PATCH v3 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver
Date: Mon, 3 Feb 2025 15:32:24 +0200 [thread overview]
Message-ID: <20250203133224.GA22963@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250124-benevolent-rat-of-tolerance-3a7eea@krzk-bin>
On Fri, Jan 24, 2025 at 09:07:01AM +0100, Krzysztof Kozlowski wrote:
> On Fri, Jan 24, 2025 at 02:12:41AM +0200, Mirela Rabulea wrote:
> > +
> > +static int ox05b1s_read_chip_id(struct ox05b1s *sensor)
> > +{
> > + struct device *dev = &sensor->i2c_client->dev;
> > + u64 chip_id = 0;
> > + char *camera_name;
> > + int ret = 0;
> > +
> > + ret = cci_read(sensor->regmap, OX05B1S_REG_CHIP_ID, &chip_id, NULL);
>
> This suggests these are compatible devices. But in the binding you said
> they are not... so your binding is not correct. Express compatibility
> with proper fallback.
Unfortunately we can't do that for camera sensors. It's important for
drivers to be able to identify the camera sensor model without having to
power up the device at probe time, depending on what device the sensor
is integrated in. For instance, with camera sensors found in laptops,
the privacy LED is often connected to the sensor power supply, and a
flashing privacy light when booting scares users.
Reading the ID register at probe time is fine when running on a platform
where the sensor can be powered up when probing, so the driver isn't
wrong doing so. It's also fine for drivers to not implement the no-power
probe right away. DT bindings however need to be ready for this, so a
fallback string can't be used.
> > + if (ret) {
> > + dev_err(dev, "Camera chip_id read error\n");
> > + return -ENODEV;
> > + }
> > +
> > + switch (chip_id) {
> > + case 0x580542:
> > + camera_name = "ox05b1s";
> > + break;
> > + default:
> > + camera_name = "unknown";
> > + break;
> > + }
> > +
> > + if (chip_id == sensor->model->chip_id) {
> > + dev_dbg(dev, "Camera %s detected, chip_id=%llx\n", camera_name, chip_id);
> > + } else {
> > + dev_err(dev, "Detected %s camera (chip_id=%llx), but expected %s (chip_id=%x)\n",
> > + camera_name, chip_id, sensor->model->name, sensor->model->chip_id);
> > + ret = -ENODEV;
> > + }
> > +
> > + return ret;
> > +}
>
> ...
>
> > +
> > +static const struct of_device_id ox05b1s_of_match[] = {
> > + {
> > + .compatible = "ovti,ox05b1s",
>
> And this is incomplete, according to current binding, so it seems you
> wanted to make them compatible just did not write the binding like that?
>
> Confusing.
>
> > + .data = &ox05b1s_data,
> > + },
> > + { /* sentinel */ }
> > +};
> > +MODULE_DEVICE_TABLE(of, ox05b1s_of_match);
> > +
> > +static struct i2c_driver ox05b1s_i2c_driver = {
> > + .driver = {
> > + .name = "ox05b1s",
> > + .pm = pm_ptr(&ox05b1s_pm_ops),
> > + .of_match_table = ox05b1s_of_match,
> > + },
> > + .probe = ox05b1s_probe,
> > + .remove = ox05b1s_remove,
> > +};
> > +
> > +module_i2c_driver(ox05b1s_i2c_driver);
> > +MODULE_DESCRIPTION("Omnivision OX05B1S MIPI Camera Subdev Driver");
> > +MODULE_AUTHOR("Mirela Rabulea <mirela.rabulea@nxp.com>");
> > +MODULE_LICENSE("GPL");
> > diff --git a/drivers/media/i2c/ox05b1s/ox05b1s_modes.c b/drivers/media/i2c/ox05b1s/ox05b1s_modes.c
> > new file mode 100644
> > index 000000000000..1f3b822d4482
> > --- /dev/null
> > +++ b/drivers/media/i2c/ox05b1s/ox05b1s_modes.c
> > @@ -0,0 +1,63 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Register configurations for all sensor supported modes
> > + * Copyright (C) 2024, NXP
> > + * Copyright (C) 2024, Omnivision
> > + * Copyright (C) 2024, Verisilicon
> > + *
> > + */
> > +
> > +#include "ox05b1s.h"
> > +
> > +/*
> > + * Register configuration for Omnivision OX05B1S raw camera
> > + * 2592X1944_30FPS_FULL_RGBIr 2592 1944
> > + */
> > +struct ox05b1s_reg ovx5b_init_setting_2592x1944[] = {
>
> Why this is not const? I commented last time with the same.
>
> > + { 0x0107, 0x01 },
> > + { 0x0307, 0x02 },
> > + { 0x034a, 0x05 },
> > + { 0x040b, 0x5c },
> > + { 0x040c, 0xcd },
> > + { 0x3009, 0x2e },
> > + { 0x3219, 0x08 },
> > + { 0x3684, 0x6d },
> > + { 0x3685, 0x6d },
> > + { 0x3686, 0x6d },
> > + { 0x3687, 0x6d },
> > + { 0x368c, 0x07 },
> > + { 0x368d, 0x07 },
> > + { 0x368e, 0x07 },
> > + { 0x368f, 0x00 },
> > + { 0x3690, 0x04 },
> > + { 0x3691, 0x04 },
> > + { 0x3692, 0x04 },
> > + { 0x3693, 0x04 },
> > + { 0x3698, 0x00 },
> > + { 0x36a0, 0x05 },
> > + { 0x36a2, 0x16 },
> > + { 0x36a3, 0x03 },
> > + { 0x36a4, 0x07 },
> > + { 0x36a5, 0x24 },
> > + { 0x36e3, 0x09 },
> > + { 0x3702, 0x0a },
> > + { 0x3821, 0x04 }, /* mirror */
> > + { 0x3822, 0x10 },
> > + { 0x382b, 0x03 },
> > + { 0x3866, 0x10 },
> > + { 0x386c, 0x46 },
> > + { 0x386d, 0x08 },
> > + { 0x386e, 0x7b },
> > + { 0x4802, 0x00 },
> > + { 0x481b, 0x3c },
> > + { 0x4837, 0x19 },
> > + { /* sentinel*/ },
> > +};
> > +
> > +struct ox05b1s_reglist ox05b1s_reglist_2592x1944[] = {
>
> Why not const?
>
> Best regards,
> Krzysztof
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2025-02-03 13:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 0:12 [PATCH v3 0/4] media: i2c: Add OX05B1S camera sensor driver Mirela Rabulea
2025-01-24 0:12 ` [PATCH v3 1/4] dt-bindings: media: i2c: Add OX05B1S sensor Mirela Rabulea
2025-01-24 8:02 ` Krzysztof Kozlowski
2025-01-24 0:12 ` [PATCH v3 2/4] media: ox05b1s: Add omnivision OX05B1S raw sensor driver Mirela Rabulea
2025-01-24 6:56 ` Christophe JAILLET
2025-01-24 8:07 ` Krzysztof Kozlowski
2025-02-03 13:32 ` Laurent Pinchart [this message]
2025-02-03 13:45 ` Markus Elfring
2025-01-24 0:12 ` [PATCH v3 3/4] MAINTAINERS: Add entry for OX05B1S " Mirela Rabulea
2025-01-24 0:12 ` [PATCH v3 4/4] media: ox05b1s: Add support for Omnivision OS08A20 raw sensor Mirela Rabulea
2025-01-24 7:03 ` Christophe JAILLET
2025-01-24 8:09 ` Krzysztof Kozlowski
2025-02-03 8:43 ` Mirela Rabulea
2025-02-03 11:36 ` Krzysztof Kozlowski
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=20250203133224.GA22963@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=LnxRevLi@nxp.com \
--cc=alain.volmat@foss.st.com \
--cc=alexander.stein@ew.tq-group.com \
--cc=alice.yuan@nxp.com \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=dave.stevenson@raspberrypi.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@denx.de \
--cc=hdegoede@redhat.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=julien.vuillaumier@nxp.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=laurentiu.palcu@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mike.rudenko@gmail.com \
--cc=mirela.rabulea@nxp.com \
--cc=robert.chiras@nxp.com \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=umang.jain@ideasonboard.com \
--cc=zhi.mao@mediatek.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