From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: ad7476: Support ROHM BU79100G
Date: Thu, 15 May 2025 18:06:16 +0100 [thread overview]
Message-ID: <20250515180616.23ca96fd@jic23-huawei> (raw)
In-Reply-To: <5ed56b89-8a9b-464f-9b87-f6553395a941@gmail.com>
On Wed, 14 May 2025 12:21:30 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> On 14/05/2025 10:38, Matti Vaittinen wrote:
> > On 13/05/2025 11:26, Matti Vaittinen wrote:
> >> ROHM BU79100G is a 12-bit, single channel ADC. Support reading ADC
> >> measurements using the ad7476.c
> >>
> >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> >> ---
> >> drivers/iio/adc/ad7476.c | 8 ++++++++
> >> 1 file changed, 8 insertions(+)
> >
> > For anyone who might hit this mail thread later:
> >
> > Conor made me realize that, for now, the BU79100G looks identical to the
> > ads7866. Thus, these code-changes aren't needed at the moment, and this
> > patch can be dropped. For those who wish to use BU79100G, please
> > introduce it as
> >
> > compatible = "rohm,bu79100g", "ti,ads7866";
> >
>
> I was too hasty.
>
> It seems to me that the fallback won't work with the current driver
> because the driver is not populating the of_match_table, but is relying
> solely on the spi_device_id table.
>
> Judging a quick code reading, the spi_driver_id table entries are
> matched to the modalias:
> https://elixir.bootlin.com/linux/v6.15-rc6/source/drivers/spi/spi.c#L393
>
> Which is (as far as I understand), generated from the first compatible:
> https://elixir.bootlin.com/linux/v6.15-rc6/source/drivers/of/base.c#L1170
>
> and not from the fallback one.
>
> I suppose this means that we would need to add the of_match_table entry
> for the ti,ads7866 to make the fallback entry to match the driver.
>
> But...
>
> The __spi_register_driver() has following comment:
> /*
> * For Really Good Reasons we use spi: modaliases not of:
> * modaliases for DT so module autoloading won't work if we
> * don't have a spi_device_id as well as a compatible string.
> */
> https://elixir.bootlin.com/linux/v6.15-rc6/source/drivers/spi/spi.c#L487
>
> So, having the of_match_table for would not be sufficient for the
> autoloading, which would still require the bu79100g to be in the
> spi_device_id table.
>
> Am I missing something? I don't see how the Linux SPI drivers benefit
> from the fallback entries in the dt? (Not saying fallbacks wouldn't be
> The Right Thing To Do. Ideally DTs aren't for Linux only, maybe some
> other systems can utilize them). To me it seems I still need to add the
> spi_device_id entry for the BU79100G, and of_match_table has no
> additional benefit? If this is right, then this patch is still relevant,
> even though the binding should be done as in v2.
+CC Mark Brown and linux-spi.
>
> Yours,
> -- Matti
>
>
>
next prev parent reply other threads:[~2025-05-15 17:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 8:26 [PATCH 0/2] Support ROHM BU79100G ADC Matti Vaittinen
2025-05-13 8:26 ` [PATCH 1/2] dt-bindings: iio: adc: Add ROHM BD79100G Matti Vaittinen
2025-05-13 14:39 ` Conor Dooley
2025-05-13 14:39 ` Conor Dooley
2025-05-14 5:36 ` Matti Vaittinen
2025-05-14 6:00 ` Matti Vaittinen
2025-05-13 8:26 ` [PATCH 2/2] iio: adc: ad7476: Support ROHM BU79100G Matti Vaittinen
2025-05-14 7:38 ` Matti Vaittinen
2025-05-14 9:21 ` Matti Vaittinen
2025-05-15 17:06 ` Jonathan Cameron [this message]
2025-05-26 6:17 ` Matti Vaittinen
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=20250515180616.23ca96fd@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=robh@kernel.org \
/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