From: Wolfram Sang <wsa@the-dreams.de>
To: Dustin Byford <dustin@cumulusnetworks.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
rjw@rjwysocki.net, linux-acpi@vger.kernel.org
Subject: Re: [RFC v2 1/1] i2c: acpi: scan ACPI enumerated I2C mux channels
Date: Fri, 9 Oct 2015 22:42:44 +0100 [thread overview]
Message-ID: <20151009214241.GC1481@katana> (raw)
In-Reply-To: <1439580693-5538-2-git-send-email-dustin@cumulusnetworks.com>
[-- Attachment #1: Type: text/plain, Size: 2097 bytes --]
On Fri, Aug 14, 2015 at 12:31:33PM -0700, Dustin Byford wrote:
>
> Set an ACPI companion for I2C mux channels enumerated through ACPI and
> ensure they are scanned for devices.
>
> Signed-off-by: Dustin Byford <dustin@cumulusnetworks.com>
Mika, is this one okay with you?
> ---
> drivers/i2c/i2c-core.c | 10 ++++++++++
> drivers/i2c/i2c-mux.c | 8 ++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index c83e4d1..23cc8e9 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -171,8 +171,18 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap)
> if (!adap->dev.parent)
> return;
>
> + /*
> + * Determine where to start walking the ACPI namespace. The common
> + * case is to start at the adapter's parent device. However, in
> + * the case of a "virtual" I2C adapter created to represent a mux
> + * channel the parent dev (pointing to the mux device) does not
> + * have an ACPI handle. Walk starting at the adapter instead.
> + */
> handle = ACPI_HANDLE(adap->dev.parent);
> if (!handle)
> + handle = ACPI_HANDLE(&adap->dev);
> +
> + if (!handle)
> return;
>
> status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 2ba7c0f..2731b99 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -25,6 +25,7 @@
> #include <linux/i2c.h>
> #include <linux/i2c-mux.h>
> #include <linux/of.h>
> +#include <linux/acpi.h>
>
> /* multiplexer per channel data */
> struct i2c_mux_priv {
> @@ -173,6 +174,13 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
> }
> }
>
> + /*
> + * Now try to populate the mux adapter's ACPI node.
> + */
> + if (has_acpi_companion(mux_dev))
> + acpi_preset_companion(&priv->adap.dev, ACPI_COMPANION(mux_dev),
> + chan_id);
> +
> if (force_nr) {
> priv->adap.nr = force_nr;
> ret = i2c_add_numbered_adapter(&priv->adap);
> --
> 2.1.4
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-10-09 21:43 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 23:59 [RFC PATCH 0/1] i2c: scan ACPI enumerated I2C mux channels Dustin Byford
2015-08-13 23:59 ` [RFC PATCH 1/1] i2c: acpi: " Dustin Byford
2015-08-14 19:31 ` [RFC v2 0/1] " Dustin Byford
2015-08-14 19:31 ` [RFC v2 1/1] " Dustin Byford
2015-10-09 21:42 ` Wolfram Sang [this message]
2015-10-09 21:50 ` Dustin Byford
2015-10-09 21:51 ` Wolfram Sang
2015-08-15 20:22 ` [RFC v2 0/1] " Wolfram Sang
2015-08-17 12:03 ` Mika Westerberg
2015-08-17 19:00 ` Dustin Byford
2015-10-10 0:41 ` [PATCH 0/2] " Dustin Byford
2015-10-10 0:41 ` [PATCH 1/2] i2c: scan entire ACPI namespace for I2C connections Dustin Byford
2015-10-12 10:46 ` Mika Westerberg
2015-10-12 11:20 ` Andy Shevchenko
2015-10-12 17:00 ` Dustin Byford
2015-10-12 19:01 ` Rafael J. Wysocki
2015-10-12 18:57 ` Dustin Byford
2015-10-10 0:41 ` [PATCH 2/2] i2c: add ACPI support for I2C mux ports Dustin Byford
2015-10-10 1:03 ` kbuild test robot
2015-10-12 10:50 ` Mika Westerberg
2015-10-12 18:32 ` Dustin Byford
2015-10-13 11:32 ` Mika Westerberg
2015-10-19 9:01 ` [PATCH v2 0/1] i2c: acpi: scan ACPI enumerated I2C mux channels Dustin Byford
2015-10-19 22:28 ` [PATCH v3 " Dustin Byford
2015-10-19 22:29 ` [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford
2015-10-20 9:16 ` Andy Shevchenko
2015-10-20 12:51 ` Mika Westerberg
2015-10-20 17:49 ` Dustin Byford
2015-10-20 23:13 ` Rafael J. Wysocki
2015-10-21 8:12 ` Mika Westerberg
2015-10-21 8:21 ` Dustin Byford
2015-10-21 8:34 ` Mika Westerberg
2015-10-21 8:52 ` Dustin Byford
2015-10-21 9:08 ` Mika Westerberg
2015-10-21 9:25 ` Dustin Byford
2015-10-21 22:39 ` Rafael J. Wysocki
2015-10-22 9:27 ` Dustin Byford
2015-10-20 23:12 ` Rafael J. Wysocki
2015-10-21 8:02 ` Mika Westerberg
2015-10-22 9:17 ` [PATCH v4 0/2] i2c: acpi: scan ACPI enumerated I2C mux channels Dustin Byford
2015-10-22 9:17 ` [PATCH v4 1/2] acpi: add acpi_preset_companion() stub Dustin Byford
2015-10-23 8:33 ` Mika Westerberg
2015-10-25 13:40 ` Rafael J. Wysocki
2015-10-25 15:01 ` Rafael J. Wysocki
2015-10-22 9:17 ` [PATCH v4 2/2] i2c: add ACPI support for I2C mux ports Dustin Byford
2015-10-23 8:40 ` Mika Westerberg
2015-10-23 10:16 ` Wolfram Sang
2015-10-23 13:13 ` Mika Westerberg
2015-10-23 13:40 ` Mika Westerberg
2015-10-23 13:55 ` Jarkko Nikula
2015-10-23 19:27 ` [PATCH v5 0/2] i2c: acpi: scan ACPI enumerated I2C mux channels Dustin Byford
2015-10-23 19:27 ` [PATCH v5 1/2] acpi: add acpi_preset_companion() stub Dustin Byford
2015-10-24 16:41 ` Wolfram Sang
2015-10-25 15:00 ` Rafael J. Wysocki
2015-10-23 19:27 ` [PATCH v5 2/2] i2c: add ACPI support for I2C mux ports Dustin Byford
2015-10-25 14:53 ` [PATCH v5 0/2] i2c: acpi: scan ACPI enumerated I2C mux channels Wolfram Sang
2015-10-25 15:15 ` Dustin Byford
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=20151009214241.GC1481@katana \
--to=wsa@the-dreams.de \
--cc=dustin@cumulusnetworks.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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).