From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: "sakari.ailus@iki.fi" <sakari.ailus@iki.fi>
Cc: "Alessandrelli, Daniele" <daniele.alessandrelli@intel.com>,
"Murphy, Paul J" <paul.j.murphy@intel.com>,
"jacopo@jmondi.org" <jacopo@jmondi.org>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"konrad.dybcio@somainline.org" <konrad.dybcio@somainline.org>,
"dmitry.baryshkov@linaro.org" <dmitry.baryshkov@linaro.org>,
"andrey.konovalov@linaro.org" <andrey.konovalov@linaro.org>
Subject: Re: [PATCH v2 0/3] Add imx577 compatible to imx412
Date: Thu, 28 Jul 2022 13:05:18 +0100 [thread overview]
Message-ID: <deb2e8de-683e-2b5c-5365-e9d306d29f69@linaro.org> (raw)
In-Reply-To: <YuJ2Aa9b6JL1GEQn@valkosipuli.retiisi.eu>
On 28/07/2022 12:41, sakari.ailus@iki.fi wrote:
> Hi Bryan,
>
> On Thu, Jul 28, 2022 at 03:01:38AM +0100, Bryan O'Donoghue wrote:
>> On 27/07/2022 21:12, Alessandrelli, Daniele wrote:
>>> On Thu, 2022-07-21 at 16:15 +0100, Daniele Alessandrelli wrote:
>>>> Hi Bryan,
>>>>
>>>> On Mon, 2022-07-18 at 02:42 +0100, Bryan O'Donoghue wrote:
>>>>> 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@linaro.org/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 tried to reached out to the colleagues who wrote the driver but it
>>>> seems they are not in the company anymore.
>>>>
>>>> However, I managed to get the imx412 register map documentation they
>>>> used while developing the driver and the value at offset 0x0016 is
>>>> reported to be 0x0577.
>>>>
>>>> I agree this is strange, so, next week, I'll try to see if I can get my
>>>> hands on an imx412 sensor to verify the value reported by the HW.
>>>
>>> I managed to get one of the imx412 sensors that were used for the
>>> development of this driver and I can confirm that the CHIP ID reported
>>> by the HW is 0x577 (as specified in the datasheet I was given)
>>
>> Did you happen to check the other offset we discussed, the one you mentioned
>> @ 0x0000 ?
>>
>> [ 10.422064] imx577 20-001a: Register @ 0x0000 0x0000 register @ 0x0016
>> 0x0577
>>
>>> However, somebody [1] on the internet is reporting that their imx412
>>> shows a different ID, so it's possible that different batches of imx412
>>> have different IDs (perhaps Sony fixed the ID inconsistency at some
>>> point). But I'd like to see more evidence of this.
>>>
>>> [1] https://discuss.96boards.org/t/imx412-driver-troubleshooting/11350
>>>
>>> Anyway, regardless of the ID, I think this driver shouldn't be renamed
>>> because it was written for imx412, using an imx412.
>>
>> Can't say I agree there.
>>
>> Currently imx412.c
>>
>> - Uses the imx577 init sequence
>> - Uses the imx577 register id
>>
>> if any thing imx412 should be considered a special case of imx577 not the
>> reverse.
>>
>> ./oem/qcom/sensor/imx577/imx577_sensor.xml<registerAddr>0x0136</registerAddr>
>> <registerData>0x18</registerData>
>> <registerAddr>0x0137</registerAddr>
>> <registerData>0x00</registerData><registerAddr>0x3C7E</registerAddr>
>> <registerData>0x01</registerData>
>> <registerAddr>0x3C7F</registerAddr>
>> <registerData>0x02</registerData>
>> <registerAddr>0x38A8</registerAddr>
>> <registerData>0x1F</registerData>
>> <registerAddr>0x38A9</registerAddr>
>> <registerData>0xFF</registerData>
>> <registerAddr>0x38AA</registerAddr>
>> <registerData>0x1F</registerData>
>> <registerAddr>0x38AB</registerAddr>
>> <registerData>0xFF</registerData>
>> <registerAddr>0x55D4</registerAddr>
>> <registerData>0x00</registerData>
>> <registerAddr>0x55D5</registerAddr>
>> <registerData>0x00</registerData>
>> ...
>>
>> drivers/media/i2c/imx412.c
>> static const struct imx412_reg mode_4056x3040_regs[] = {
>> {0x0136, 0x18},
>> {0x0137, 0x00},
>> {0x3c7e, 0x08},
>> {0x3c7f, 0x02},
>> {0x38a8, 0x1f},
>> {0x38a9, 0xff},
>> {0x38aa, 0x1f},
>> {0x38ab, 0xff},
>> {0x55d4, 0x00},
>> {0x55d5, 0x00},
>> ...
>>
>> drivers/media/i2c/imx258.c:#define IMX258_CHIP_ID 0x0258
>> drivers/media/i2c/imx319.c:#define IMX319_CHIP_ID 0x0319
>> drivers/media/i2c/imx355.c:#define IMX355_CHIP_ID 0x0355
>>
>> and then make this departure
>>
>> drivers/media/i2c/imx412.c:#define IMX577_ID 0x577
>>
>> I honestly think we should rename to imx577 here, it seems very illogical to
>> have the imx577 init sequence, the imx577 register identifier but break with
>> the established naming convention and call the driver imx412.
>
> The device is called IMX412 according to Sony, so similarly the driver is
> called imx412.
The device I have is called an imx577 by Sony and reports 0x577 in the
chip identifier field.
What's in the model ID register is another matter. On IMX577
> support, please simply add a new compatible string for it and mention in
> driver's Kconfig help text it supports both.
I'm happy to add a compat string, np.
It seems to me, given our established naming convention for these chips
=>
drivers/media/i2c/imx258.c:#define IMX258_CHIP_ID 0x0258
drivers/media/i2c/imx319.c:#define IMX319_CHIP_ID 0x0319
drivers/media/i2c/imx355.c:#define IMX355_CHIP_ID 0x0355
there _ought_ to be two compat strings "imx412" and "imx577" living
inside of a driver called imx577.c not imx412.c
---
bod
prev parent reply other threads:[~2022-07-28 12:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 1:42 [PATCH v2 0/3] Add imx577 compatible to imx412 Bryan O'Donoghue
2022-07-18 1:42 ` [PATCH v2 1/3] media: dt-bindings: media: Rename imx412 to imx577 Bryan O'Donoghue
2022-07-20 22:31 ` Rob Herring
2022-07-22 16:03 ` Sakari Ailus
2022-07-22 16:47 ` Bryan O'Donoghue
2022-07-18 1:42 ` [PATCH v2 2/3] media: i2c: imx577: Rename imx412.c to imx577.c Bryan O'Donoghue
2022-07-18 1:42 ` [PATCH v2 3/3] media: i2c: imx577: Fix chip identifier define name Bryan O'Donoghue
2022-07-21 15:15 ` [PATCH v2 0/3] Add imx577 compatible to imx412 Alessandrelli, Daniele
2022-07-21 15:24 ` Bryan O'Donoghue
2022-07-27 20:12 ` Alessandrelli, Daniele
2022-07-28 2:01 ` Bryan O'Donoghue
2022-07-28 11:41 ` sakari.ailus
2022-07-28 12:05 ` Bryan O'Donoghue [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=deb2e8de-683e-2b5c-5365-e9d306d29f69@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=andrey.konovalov@linaro.org \
--cc=daniele.alessandrelli@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=jacopo@jmondi.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=paul.j.murphy@intel.com \
--cc=sakari.ailus@iki.fi \
/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;
as well as URLs for NNTP newsgroup(s).