All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/3] Add imx577 compatible to imx412
@ 2022-10-14 18:04 Bryan O'Donoghue
  2022-10-14 18:04 ` [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings Bryan O'Donoghue
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-10-14 18:04 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, paul.j.murphy,
	daniele.alessandrelli, mchehab, linux-media
  Cc: bryan.odonoghue

v6:
- Drops -items encapsulating compatible - Krzysztof

v5:
- Drops imx477 from compat strings
  After Dave's comments I went and got the official imx477 sensor for the
  RPI and fired up the upstream imx412 usptream.

  Aside from the chip-id, the # of mipi-data lanes doesn't match and as
  Dave subsequently pointed out, neither do the PLL settings.

  I think it is possible to import a lot of the imx477.c code in the RPI
  tree into imx412/imx577 and potentially unify the code base. Even if its
  not possible to unify the code in the RPI imx477 can probably be adapted
  to imx412 for some combination of test patterns, data-lanes or PLLs.

  Anyway dropping imx477 is the right thing here since there's more work
  than a simple compat string to unify with imx412.c

Resend:
- Cc Rob and Krzysztof

v4:
- Squashes dt-bindings addition - Sakari
- Squashes compat string addition to driver - Sakari
- Drops checking fwnode(&client->dev), checks for !name - Sakari
- Retains imx477 compat
  I think we have established that imx477 and imx577 do have additional
  settings and modes over the imx412 which, we can and hopefully will add
  in as time goes by. What we have upstream will work for all three parts.

v3:
To really get to the bottom of what was going on with the imx412, imx477
and imx577 I got a Nvida Nano with both sensors from Leopard imaging.

Interestingly the shipped driver from Leopard is called "imx477" and is
keyed to work with imx412, imx477 and imx577 with predictably the same
register init sequence.

For me aside from the physical size difference in the modules the only
discerable difference is the imx577 has a "green tinge" which is exactly
the same experience I have with the imx577 on the Qualcomm RB5 - with both
the downstream driver stack and the usptream driver.

With the modules shipped from Leopard both the imx412 and imx577 report the
same chip id of 0x0577.

I dumped the first 32 registers on both modules using the Nvidia/Leopard
stack and as expected - all of the register values match.

So I've confirmed as far as my investigation has gone, there's no
clear register we can interrogate to differentiate the parts.

- Drops renaming of the driver to imx577.c
  I continue to think this is the right thing to do but, I'm happy to
  leave that on the back burner for another time.
- Add in compatible strings for imx477 and imx577 into the dt-bindings
- Extend the imx412 per Sakari's comment re: media device naming
  https://patchwork.kernel.org/project/linux-media/patch/20220607134057.2427663-3-bryan.odonoghue@linaro.org/#24894500
- Add imx477 and imx577 with supporting code to drive media device name

Depending then if the compat string is imx412, imx477 or imx577 the media
name of the device will be imx412, imx477 or imx577 e.g. I use the
following media-ctl command depending on the specified compatible.

media-ctl -v -d /dev/media0 -V '"imx577 '22-001a'"...
media-ctl -v -d /dev/media0 -V '"imx412 '22-001a'"...

v2:
Sakari wasn't especially satisfied with the answer imx412 and imx577 have
the same init sequence but, suggested setting the string for imx577 as is
done in the ccs driver.

https://lore.kernel.org/all/20220607134057.2427663-3-bryan.odonoghue@xxxxxxxxxx/t/

I went to look at that and asked myself "how would I tell the difference
between the two silicon parts". The obvious answer is a chip identifier.

Luckily this class of IMX sensor has a chip identifier at offset 0x0016.

That looks like this for imx258, imx319 and imx355

drivers/media/i2c/imx258.c:#define IMX258_REG_CHIP_ID    0x0016
drivers/media/i2c/imx258.c:#define IMX258_CHIP_ID        0x0258

drivers/media/i2c/imx319.c:#define IMX319_REG_CHIP_ID    0x0016
drivers/media/i2c/imx319.c:#define IMX319_CHIP_ID        0x0319

drivers/media/i2c/imx355.c:#define IMX355_REG_CHIP_ID    0x0016
drivers/media/i2c/imx355.c:#define IMX355_CHIP_ID        0x0355

but then looks like this for imx412.

drivers/media/i2c/imx412.c:#define IMX412_REG_ID         0x0016
drivers/media/i2c/imx412.c:#define IMX412_ID             0x577

This made no sense at all to me, why is the imx412 driver not named imx577 ?

I went and dug into the Qualcomm camx/chi-cdk sources to find that a file
called cmk_imx577_sensor.xml has a property called sensorId which is
constrained to 0x0577.

In the Qualcomm stack this pairing of filename and identifier is
maintained for imx258, imx376, imx476, imx576, imx519, imx362, imx481,
imx318 imx334 and imx386.

Every single example I can find of a Sony IMX sensor which returns a chip
identifier at offset 0x0016 matches the driver name to the returned sensor
id both here upstream in Linux and in Qualcomm's camx stack.

The conclusion I draw from this is that imx412.c is inappropriately named.

I think the right thing to do is to rename imx412 to imx577. It is
confusing and I think wrong to pair imx412.c with a chip which identifies
as 0x0577.

v1:
Right now the imx412 and imx577 are code and pin compatible however, they
are distinct pieces of silicon.

Document imx577 as a compatible enum and add the compat string to imx412.c.
This allows us to differentiate these chips in DTS and potentially to apply
any future imx412 or imx577 specific changes appropriately.

Bryan O'Donoghue (3):
  media: dt-bindings: imx412: Extend compatible strings
  media: i2c: imx412: Assign v4l2 device subname based on compat string
  media: i2c: imx412: Add new compatible strings

 .../devicetree/bindings/media/i2c/sony,imx412.yaml       | 4 +++-
 drivers/media/i2c/imx412.c                               | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings
  2022-10-14 18:04 [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
@ 2022-10-14 18:04 ` Bryan O'Donoghue
  2022-10-14 21:09   ` Rob Herring
  2022-10-14 18:04 ` [PATCH v6 2/3] media: i2c: imx412: Assign v4l2 device subname based on compat string Bryan O'Donoghue
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-10-14 18:04 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, paul.j.murphy,
	daniele.alessandrelli, mchehab, linux-media
  Cc: bryan.odonoghue, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

Add compatible bindings for imx577 which uses the same silicon enabling
reference code from Sony in the available examples provided.

Cc: sakari.ailus@iki.fi
Cc: dave.stevenson@raspberrypi.com
Cc: jacopo@jmondi.org
Cc: "Paul J. Murphy" <paul.j.murphy@intel.com>
Cc: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-media@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml b/Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml
index 26d1807d0bb6..60dc25ff2b9e 100644
--- a/Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml
@@ -19,7 +19,9 @@ description:
 
 properties:
   compatible:
-    const: sony,imx412
+    enum:
+      - sony,imx412
+      - sony,imx577
   reg:
     description: I2C address
     maxItems: 1
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 2/3] media: i2c: imx412: Assign v4l2 device subname based on compat string
  2022-10-14 18:04 [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
  2022-10-14 18:04 ` [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings Bryan O'Donoghue
@ 2022-10-14 18:04 ` Bryan O'Donoghue
  2022-10-14 18:04 ` [PATCH v6 3/3] media: i2c: imx412: Add new compatible strings Bryan O'Donoghue
  2022-11-07 23:29 ` [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
  3 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-10-14 18:04 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, paul.j.murphy,
	daniele.alessandrelli, mchehab, linux-media
  Cc: bryan.odonoghue, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

imx412 and imx577 return the same chip-id when interrogated via i2c.
I've confirmed this myself by

Sakari suggested we should add a new compat which should be reflected in
the name of the media entity

https://patchwork.kernel.org/project/linux-media/patch/20220607134057.2427663-3-bryan.odonoghue@linaro.org/#24894500

Set up the .data parameter of of_device_id to pass a string which
we use to set the media entity name. Once done we can add in imx577 as a
compatible chips with the media names reflecting the directed compat string.

Cc: sakari.ailus@iki.fi
Cc: dave.stevenson@raspberrypi.com
Cc: jacopo@jmondi.org
Cc: "Paul J. Murphy" <paul.j.murphy@intel.com>
Cc: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-media@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/i2c/imx412.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/imx412.c b/drivers/media/i2c/imx412.c
index 7f6d29e0e7c4..353304312e1c 100644
--- a/drivers/media/i2c/imx412.c
+++ b/drivers/media/i2c/imx412.c
@@ -1172,6 +1172,7 @@ static int imx412_init_controls(struct imx412 *imx412)
 static int imx412_probe(struct i2c_client *client)
 {
 	struct imx412 *imx412;
+	const char *name;
 	int ret;
 
 	imx412 = devm_kzalloc(&client->dev, sizeof(*imx412), GFP_KERNEL);
@@ -1179,6 +1180,9 @@ static int imx412_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	imx412->dev = &client->dev;
+	name = device_get_match_data(&client->dev);
+	if (!name)
+		return -ENODEV;
 
 	/* Initialize subdev */
 	v4l2_i2c_subdev_init(&imx412->sd, client, &imx412_subdev_ops);
@@ -1218,6 +1222,8 @@ static int imx412_probe(struct i2c_client *client)
 	imx412->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	imx412->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
+	v4l2_i2c_subdev_set_name(&imx412->sd, client, name, NULL);
+
 	/* Initialize source pad */
 	imx412->pad.flags = MEDIA_PAD_FL_SOURCE;
 	ret = media_entity_pads_init(&imx412->sd.entity, 1, &imx412->pad);
@@ -1279,7 +1285,7 @@ static const struct dev_pm_ops imx412_pm_ops = {
 };
 
 static const struct of_device_id imx412_of_match[] = {
-	{ .compatible = "sony,imx412" },
+	{ .compatible = "sony,imx412", .data = "imx412" },
 	{ }
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v6 3/3] media: i2c: imx412: Add new compatible strings
  2022-10-14 18:04 [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
  2022-10-14 18:04 ` [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings Bryan O'Donoghue
  2022-10-14 18:04 ` [PATCH v6 2/3] media: i2c: imx412: Assign v4l2 device subname based on compat string Bryan O'Donoghue
@ 2022-10-14 18:04 ` Bryan O'Donoghue
  2022-11-07 23:29 ` [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
  3 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-10-14 18:04 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, paul.j.murphy,
	daniele.alessandrelli, mchehab, linux-media
  Cc: bryan.odonoghue, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

The Sony imx577 uses the same silicon enabling reference code in the
available examples provided as the imx412.

Add in compatible strings to enable and differentiate the parts.

Cc: sakari.ailus@iki.fi
Cc: dave.stevenson@raspberrypi.com
Cc: jacopo@jmondi.org
Cc: "Paul J. Murphy" <paul.j.murphy@intel.com>
Cc: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-media@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/i2c/imx412.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/imx412.c b/drivers/media/i2c/imx412.c
index 353304312e1c..e1e986dc8856 100644
--- a/drivers/media/i2c/imx412.c
+++ b/drivers/media/i2c/imx412.c
@@ -1286,6 +1286,7 @@ static const struct dev_pm_ops imx412_pm_ops = {
 
 static const struct of_device_id imx412_of_match[] = {
 	{ .compatible = "sony,imx412", .data = "imx412" },
+	{ .compatible = "sony,imx577", .data = "imx577" },
 	{ }
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings
  2022-10-14 18:04 ` [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings Bryan O'Donoghue
@ 2022-10-14 21:09   ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2022-10-14 21:09 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: devicetree, paul.j.murphy, mchehab, daniele.alessandrelli,
	Krzysztof Kozlowski, Rob Herring, linux-kernel, dave.stevenson,
	jacopo, sakari.ailus, linux-media

On Fri, 14 Oct 2022 19:04:15 +0100, Bryan O'Donoghue wrote:
> Add compatible bindings for imx577 which uses the same silicon enabling
> reference code from Sony in the available examples provided.
> 
> Cc: sakari.ailus@iki.fi
> Cc: dave.stevenson@raspberrypi.com
> Cc: jacopo@jmondi.org
> Cc: "Paul J. Murphy" <paul.j.murphy@intel.com>
> Cc: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: linux-media@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v6 0/3] Add imx577 compatible to imx412
  2022-10-14 18:04 [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
                   ` (2 preceding siblings ...)
  2022-10-14 18:04 ` [PATCH v6 3/3] media: i2c: imx412: Add new compatible strings Bryan O'Donoghue
@ 2022-11-07 23:29 ` Bryan O'Donoghue
  2022-11-08 13:17   ` Sakari Ailus
  3 siblings, 1 reply; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-11-07 23:29 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, paul.j.murphy,
	daniele.alessandrelli, mchehab, linux-media
  Cc: Hans Verkuil, laurent.pinchart

On 14/10/2022 19:04, Bryan O'Donoghue wrote:
> v6:
> - Drops -items encapsulating compatible - Krzysztof

Ping.

Any chance of the good folks @ 
https://patchwork.linuxtv.org/project/linux-media picking this up ?

It unblocks enabling CAMSS on the qcom RB5 where the feedback I've had 
is we should get compat imx577 merged to accurately map the hardware 
config we have.

https://patchwork.kernel.org/project/linux-media/list/?series=644675

https://patches.linaro.org/project/linux-arm-msm/patch/20220518133004.342775-2-bryan.odonoghue@linaro.org/

---
bod

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v6 0/3] Add imx577 compatible to imx412
  2022-11-07 23:29 ` [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
@ 2022-11-08 13:17   ` Sakari Ailus
  0 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2022-11-08 13:17 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: dave.stevenson, jacopo, paul.j.murphy, daniele.alessandrelli,
	mchehab, linux-media, Hans Verkuil, laurent.pinchart

Hi Bryan,

On Mon, Nov 07, 2022 at 11:29:47PM +0000, Bryan O'Donoghue wrote:
> On 14/10/2022 19:04, Bryan O'Donoghue wrote:
> > v6:
> > - Drops -items encapsulating compatible - Krzysztof
> 
> Ping.
> 
> Any chance of the good folks @
> https://patchwork.linuxtv.org/project/linux-media picking this up ?

This is waiting like other media patches to be merged to my tree. I think
I'll prepare a second branch to get more patches merged.

> 
> It unblocks enabling CAMSS on the qcom RB5 where the feedback I've had is we
> should get compat imx577 merged to accurately map the hardware config we
> have.
> 
> https://patchwork.kernel.org/project/linux-media/list/?series=644675
> 
> https://patches.linaro.org/project/linux-arm-msm/patch/20220518133004.342775-2-bryan.odonoghue@linaro.org/

-- 
Regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v6 0/3] Add imx577 compatible to imx412
@ 2022-10-14 15:30 Bryan O'Donoghue
  0 siblings, 0 replies; 8+ messages in thread
From: Bryan O'Donoghue @ 2022-10-14 15:30 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, paul.j.murphy,
	daniele.alessandrelli, mchehab, linux-media
  Cc: bryan.odonoghue

v6:
- Drops -items encapsulating compatible - Krzysztof

v5:
- Drops imx477 from compat strings
  After Dave's comments I went and got the official imx477 sensor for the
  RPI and fired up the upstream imx412 usptream.

  Aside from the chip-id, the # of mipi-data lanes doesn't match and as
  Dave subsequently pointed out, neither do the PLL settings.

  I think it is possible to import a lot of the imx477.c code in the RPI
  tree into imx412/imx577 and potentially unify the code base. Even if its
  not possible to unify the code in the RPI imx477 can probably be adapted
  to imx412 for some combination of test patterns, data-lanes or PLLs.

  Anyway dropping imx477 is the right thing here since there's more work
  than a simple compat string to unify with imx412.c

Resend:
- Cc Rob and Krzysztof

v4:
- Squashes dt-bindings addition - Sakari
- Squashes compat string addition to driver - Sakari
- Drops checking fwnode(&client->dev), checks for !name - Sakari
- Retains imx477 compat
  I think we have established that imx477 and imx577 do have additional
  settings and modes over the imx412 which, we can and hopefully will add
  in as time goes by. What we have upstream will work for all three parts.

v3:
To really get to the bottom of what was going on with the imx412, imx477
and imx577 I got a Nvida Nano with both sensors from Leopard imaging.

Interestingly the shipped driver from Leopard is called "imx477" and is
keyed to work with imx412, imx477 and imx577 with predictably the same
register init sequence.

For me aside from the physical size difference in the modules the only
discerable difference is the imx577 has a "green tinge" which is exactly
the same experience I have with the imx577 on the Qualcomm RB5 - with both
the downstream driver stack and the usptream driver.

With the modules shipped from Leopard both the imx412 and imx577 report the
same chip id of 0x0577.

I dumped the first 32 registers on both modules using the Nvidia/Leopard
stack and as expected - all of the register values match.

So I've confirmed as far as my investigation has gone, there's no
clear register we can interrogate to differentiate the parts.

- Drops renaming of the driver to imx577.c
  I continue to think this is the right thing to do but, I'm happy to
  leave that on the back burner for another time.
- Add in compatible strings for imx477 and imx577 into the dt-bindings
- Extend the imx412 per Sakari's comment re: media device naming
  https://patchwork.kernel.org/project/linux-media/patch/20220607134057.2427663-3-bryan.odonoghue@linaro.org/#24894500
- Add imx477 and imx577 with supporting code to drive media device name

Depending then if the compat string is imx412, imx477 or imx577 the media
name of the device will be imx412, imx477 or imx577 e.g. I use the
following media-ctl command depending on the specified compatible.

media-ctl -v -d /dev/media0 -V '"imx577 '22-001a'"...
media-ctl -v -d /dev/media0 -V '"imx412 '22-001a'"...

v2:
Sakari wasn't especially satisfied with the answer imx412 and imx577 have
the same init sequence but, suggested setting the string for imx577 as is
done in the ccs driver.

https://lore.kernel.org/all/20220607134057.2427663-3-bryan.odonoghue@xxxxxxxxxx/t/

I went to look at that and asked myself "how would I tell the difference
between the two silicon parts". The obvious answer is a chip identifier.

Luckily this class of IMX sensor has a chip identifier at offset 0x0016.

That looks like this for imx258, imx319 and imx355

drivers/media/i2c/imx258.c:#define IMX258_REG_CHIP_ID    0x0016
drivers/media/i2c/imx258.c:#define IMX258_CHIP_ID        0x0258

drivers/media/i2c/imx319.c:#define IMX319_REG_CHIP_ID    0x0016
drivers/media/i2c/imx319.c:#define IMX319_CHIP_ID        0x0319

drivers/media/i2c/imx355.c:#define IMX355_REG_CHIP_ID    0x0016
drivers/media/i2c/imx355.c:#define IMX355_CHIP_ID        0x0355

but then looks like this for imx412.

drivers/media/i2c/imx412.c:#define IMX412_REG_ID         0x0016
drivers/media/i2c/imx412.c:#define IMX412_ID             0x577

This made no sense at all to me, why is the imx412 driver not named imx577 ?

I went and dug into the Qualcomm camx/chi-cdk sources to find that a file
called cmk_imx577_sensor.xml has a property called sensorId which is
constrained to 0x0577.

In the Qualcomm stack this pairing of filename and identifier is
maintained for imx258, imx376, imx476, imx576, imx519, imx362, imx481,
imx318 imx334 and imx386.

Every single example I can find of a Sony IMX sensor which returns a chip
identifier at offset 0x0016 matches the driver name to the returned sensor
id both here upstream in Linux and in Qualcomm's camx stack.

The conclusion I draw from this is that imx412.c is inappropriately named.

I think the right thing to do is to rename imx412 to imx577. It is
confusing and I think wrong to pair imx412.c with a chip which identifies
as 0x0577.

v1:
Right now the imx412 and imx577 are code and pin compatible however, they
are distinct pieces of silicon.

Document imx577 as a compatible enum and add the compat string to imx412.c.
This allows us to differentiate these chips in DTS and potentially to apply
any future imx412 or imx577 specific changes appropriately.

Bryan O'Donoghue (3):
  media: dt-bindings: imx412: Extend compatible strings
  media: i2c: imx412: Assign v4l2 device subname based on compat string
  media: i2c: imx412: Add new compatible strings

 .../devicetree/bindings/media/i2c/sony,imx412.yaml       | 4 +++-
 drivers/media/i2c/imx412.c                               | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-08 13:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 18:04 [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
2022-10-14 18:04 ` [PATCH v6 1/3] media: dt-bindings: imx412: Extend compatible strings Bryan O'Donoghue
2022-10-14 21:09   ` Rob Herring
2022-10-14 18:04 ` [PATCH v6 2/3] media: i2c: imx412: Assign v4l2 device subname based on compat string Bryan O'Donoghue
2022-10-14 18:04 ` [PATCH v6 3/3] media: i2c: imx412: Add new compatible strings Bryan O'Donoghue
2022-11-07 23:29 ` [PATCH v6 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
2022-11-08 13:17   ` Sakari Ailus
  -- strict thread matches above, loose matches on Subject: below --
2022-10-14 15:30 Bryan O'Donoghue

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.