linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH RFC] modpost: Support I2C Aliases from OF tables
Date: Tue, 6 Aug 2019 19:39:48 +0200	[thread overview]
Message-ID: <8df8133c-60c6-d9b5-2594-d7a5715e907a@redhat.com> (raw)
In-Reply-To: <CAMuHMdX3QqXGt4=31ECZ7vryjsSA7NufuvA_XVLjS91_1q=uqw@mail.gmail.com>

Hello Geert,

On 8/6/19 9:30 AM, Geert Uytterhoeven wrote:
> On Tue, Aug 6, 2019 at 12:48 AM Javier Martinez Canillas
> <javierm@redhat.com> wrote:
>> On 8/1/19 4:17 AM, Masahiro Yamada wrote:
>> So I think that we should either:
>>
>> a) take Kieran's patch or b) remove the i2c_of_match_device_sysfs() fallback
>> for OF and require an I2C device table for sysfs instantiation and matching.
>>
>>> If a driver supports DT and devices are instantiated via DT,
>>> in which situation is this useful?
>>
>> Is useful if you don't have all the I2C devices described in the DT. For example
>> a daughterboard with an I2C device is connected to a board through an expansion
>> slot or an I2C device connected directly to I2C pins exposed in a machine.
>>
>> In these cases your I2C devices won't be static so users might want to use the
>> sysfs user-space interface to instantiate the I2C devices, i.e:
>>
>>  # echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-3/new_device
>>
>> as explained in https://github.com/torvalds/linux/blob/master/Documentation/i2c/instantiating-devices#L207
> 
> Does this actually work with DT names, too? E.g.
> 
> # echo atmel,24c02 > /sys/bus/i2c/devices/i2c-3/new_device
>

My understanding is that it does. If I'm reading the code correctly the
i2c_of_match_device_sysfs() function first attempts to match using both
the vendor and device part of the compatible string and if that fails,
it strips the vendor part and try to match only using the device part.

So you could use any of the following:

# echo 24c02 0x50 > /sys/bus/i2c/devices/i2c-3/new_device

# echo atmel,24c02 0x50 > /sys/bus/i2c/devices/i2c-3/new_device

Best regards, 
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat

  reply	other threads:[~2019-08-06 17:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 19:39 [PATCH RFC] modpost: Support I2C Aliases from OF tables Kieran Bingham
2019-07-22 13:03 ` Javier Martinez Canillas
2019-07-31 19:44   ` Wolfram Sang
2019-08-01  2:17     ` Masahiro Yamada
2019-08-05 22:48       ` Javier Martinez Canillas
2019-08-06  7:30         ` Geert Uytterhoeven
2019-08-06 17:39           ` Javier Martinez Canillas [this message]
2019-08-05 22:25     ` Javier Martinez Canillas
2019-08-06  7:22       ` Geert Uytterhoeven
2019-08-06 17:12         ` Javier Martinez Canillas
2019-08-08 13:12           ` Enrico Weigelt, metux IT consult
2019-08-08 13:24             ` Andy Shevchenko
2019-08-08 14:00               ` Enrico Weigelt, metux IT consult

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=8df8133c-60c6-d9b5-2594-d7a5715e907a@redhat.com \
    --to=javierm@redhat.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=wsa@the-dreams.de \
    --cc=yamada.masahiro@socionext.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;
as well as URLs for NNTP newsgroup(s).