From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
mark.rutland@arm.com
Subject: Re: [PATCH] i2c: Add generic support passing secondary devices addresses
Date: Wed, 15 Oct 2014 11:54:37 -0700 [thread overview]
Message-ID: <1413399277.1902.51.camel@spandruv-desktop.jf.intel.com> (raw)
In-Reply-To: <20141003104637.GC1349@katana>
Hi Lars and Jean,
Are you taking this patch further to take care about ACPI related stuff
submitted by Mika?
Thanks,
Srinivas
On Fri, 2014-10-03 at 12:46 +0200, Wolfram Sang wrote:
> > > Ok, looks like there are two main differences in the two implementations.
> > >
> > > 1) The ACPI one uses a integer index and the DT one uses a string index to
> > > lookup the device.
> > >
> > > The problem with the index lookup is that the order is binding specific. So
> > > it might be different between e.g. the devicetree binding and the ACPI
> > > binding. This makes it quite hard to use the API in a generic way and you'd
> > > end up with hacks like:
> > >
> > > if (client->dev.of_node)
> > > index = 3;
> > > else if (ACPI_COMPANION(client->dev))
> > > index = 1;
> > > else
> > > index = 5;
> > >
> >
> > Indeed.
> >
> > > So we might need a extra translation table which maps a name to a ACPI index
> > > and then we could use the name as the generic index in the driver.
> >
> > Good thing is that ACPI 5.1 _DSD finally allows us to use similar naming
> > as the DT has been doing. Problem is that we need to support both the
> > new way *and* the older index lookup somehow :-/
> >
> > > 2) The ACPI implementation returns the i2c_board_info and the adapter, while
> > > the DT implementation returns the instantiated I2C client device.
> > >
> > > It might make sense to have both. I image that most drivers are just
> > > interested in creating a new client device and will simply pass the board
> > > info and adapter they got to i2c_new_device(). In this case it makes sense
> > > to have a helper function which already does this internally to avoid
> > > boilerplate code duplication.
> >
> > I agree. How about making that helper a wrapper around the function that
> > returns both i2c_board_info and an adapter?
> >
> > > There will probably some special cases though in which case the driver wants
> > > to get the adapter and the board info and then manually call
> > > i2c_new_device() after having done some additional steps.
> >
> > Yes, if the alternative address happens to be on another bus. That
> > should at least be possible with this API.
>
> Thanks for the discussion so far! I'll wait and see if some patches come
> out of it and mark this one as deferred for now.
>
prev parent reply other threads:[~2014-10-15 18:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 14:02 Jean-Michel Hautbois
2014-09-20 16:49 ` Wolfram Sang
2014-09-20 19:50 ` Lars-Peter Clausen
2014-09-21 17:49 ` Wolfram Sang
2014-09-21 19:23 ` Lars-Peter Clausen
2014-09-22 10:45 ` Mika Westerberg
2014-09-22 13:27 ` Lars-Peter Clausen
2014-09-22 13:45 ` Mika Westerberg
2014-09-22 14:11 ` Lars-Peter Clausen
2014-09-22 14:41 ` Mika Westerberg
2014-10-03 10:46 ` Wolfram Sang
2014-10-15 18:54 ` Srinivas Pandruvada [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=1413399277.1902.51.camel@spandruv-desktop.jf.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=jean-michel.hautbois@vodalys.com \
--cc=lars@metafoo.de \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mika.westerberg@linux.intel.com \
--cc=wsa@the-dreams.de \
/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
all inboxes | Powered by JetHome®