Linux IIO development
 help / color / mirror / Atom feed
From: Patrick Williams <patrick@stwcx.xyz>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Potin Lai <potin.lai.pt@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Potin Lai <potin.lai@quantatw.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 2/2] iio: humidity: hdc100x: add manufacturer and device ID check
Date: Mon, 1 Aug 2022 11:12:00 -0500	[thread overview]
Message-ID: <Yuf7UAVrIJCnO40X@heinlein.stwcx.org.github.beta.tailscale.net> (raw)
In-Reply-To: <CAHp75VcZqTpmvVV=u4t=fdx=ffzksoWVDFZmq6Lfr6DrFrB2aA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]

On Mon, Aug 01, 2022 at 10:22:16AM +0200, Andy Shevchenko wrote:
> On Mon, Aug 1, 2022 at 3:52 AM Potin Lai <potin.lai.pt@gmail.com> wrote:
> > On 7/31/22 20:09, Jonathan Cameron wrote:
> > In our hardware board, we have "ti,hdc1080" as main source, and "silabs,si7020"
> > for 2nd source. This two chip are locate at same bus and same slave address,
> > and we want to use multiple compatibles to support both chips with single device
> > node in device tree.
> >
> > Ex:
> > compatible = "ti,hdc1099", "silabs,si7020";
> 
> This is simply broken DT, you must not put incompatible hardware on
> the same compatible string. DT is by definition the description of a
> certain platform. What you showed is a combination of incompatible
> chips in a single DT.

We were mistaken that this is the appropriate way to specify this
behavior, partially because it works as long as the probe functions
return an error the next matching driver from the compatible will probe.
It does seem that specifying two different compatibles like this would
violate the intention of the DT spec:

    The property value consists of a concatenated list of null terminated
    strings, from most specific to most general. They allow a device to
    express its compatibility with a family of similar devices, potentially
    allowing a single device driver to match against several devices.

> 
> > In order to support this, I need to add ID checking mechanism into the current
> > hdc100x driver, so the si7020 chip will fail to probe with hdc100x driver
> > (because the ID checking is not failed), then success probe with si7020.
> >
> > Base on you explanation, it looks multiple compatibles is not suitable in this
> > case? Would you mind advise us what would be the better approach for our case?
> 
> If I may advise... fix your DT by dropping the wrong compatible item.

This doesn't really give any helpful advice.

The reality is that these two chips are pin compatible and function
compatible but not driver compatible.  Boards have been manufactured
which are identical except for this chip replaced, due various to chip
shortages.

Making probe fail so that the next 'compatible' is chosen sounds like it
isn't desired.  I'm pretty sure you can't have two DT entries for the
same i2c address, but with different 'compatible" properties, and even
if we did you'd still need probe to fail on one of them.

Are there any other suggestions for being able to inform the kernel that
one of two chips might be present?

-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-08-01 16:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 12:54 [PATCH v5 0/2] iio: humidity: hdc100x: add manufacturer and device ID check Potin Lai
2022-07-28 12:54 ` [PATCH v5 1/2] iio: humidity: hdc100x: switch to probe_new callback Potin Lai
2022-07-28 20:41   ` Andy Shevchenko
2022-07-29  0:43     ` Potin Lai
2022-07-29 18:00       ` Andy Shevchenko
2022-07-28 12:54 ` [PATCH v5 2/2] iio: humidity: hdc100x: add manufacturer and device ID check Potin Lai
2022-07-28 20:42   ` Andy Shevchenko
2022-07-31 12:09   ` Jonathan Cameron
2022-08-01  1:50     ` Potin Lai
2022-08-01  8:22       ` Andy Shevchenko
2022-08-01 16:12         ` Patrick Williams [this message]
2022-08-01 16:26           ` Andy Shevchenko
2022-08-01 16:30             ` Andy Shevchenko
2022-08-06 17:12               ` Jonathan Cameron
2022-08-08  9:40                 ` Krzysztof Kozlowski
2022-08-08  9:49                   ` Andy Shevchenko

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=Yuf7UAVrIJCnO40X@heinlein.stwcx.org.github.beta.tailscale.net \
    --to=patrick@stwcx.xyz \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=potin.lai.pt@gmail.com \
    --cc=potin.lai@quantatw.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