Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1251652

Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports

From Mika Westerberg <mika.westerberg@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports
Date 2015-10-20 15:00 +0200
Message-ID <qlEGe-4bA-21@gated-at.bofh.it> (permalink)
References <pXazE-1La-5@gated-at.bofh.it> <qlr6i-1dr-5@gated-at.bofh.it> <qlr6i-1dr-21@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


On Mon, Oct 19, 2015 at 03:29:00PM -0700, Dustin Byford wrote:
> Although I2C mux devices are easily enumerated using ACPI (_HID/_CID or
> device property compatible string match) enumerating I2C client devices
> connected through a I2C mux device requires a little extra work.
> 
> This change implements a method for describing an I2C device hierarchy that
> includes mux devices by using an ACPI Device() for each mux channel along
> with an _ADR to set the channel number for the device.  See
> Documentation/acpi/i2c-muxes.txt for a simple example.
> 
> Signed-off-by: Dustin Byford <dustin@cumulusnetworks.com>

In general this looks good to me.

> ---
>  Documentation/acpi/i2c-muxes.txt | 58 ++++++++++++++++++++++++++++++++++++++++
>  drivers/i2c/i2c-core.c           | 15 +++++++++--
>  drivers/i2c/i2c-mux.c            |  8 ++++++
>  include/linux/acpi.h             |  6 +++++
>  4 files changed, 85 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/acpi/i2c-muxes.txt
> 

[...]

> +	/*
> +	 * By default, associate I2C adapters with their parent device's ACPI
> +	 * node.
> +	 */
> +	if (!has_acpi_companion(dev)) {
> +		struct acpi_device *adev = ACPI_COMPANION(dev->parent);
> +
> +		if (adev)
> +			ACPI_COMPANION_SET(dev, adev);

Instead of always doing this in the I2C core, maybe we can make it
dependent on the host controller driver. For example the I2C designware
driver already did this for both DT and ACPI:

	adap->dev.parent = &pdev->dev;
	adap->dev.of_node = pdev->dev.of_node;
	ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));

Also I would like to ask what Rafael thinks about this since he authored
b34bb1ee71158d5b ("ACPI / I2C: Use parent's ACPI_HANDLE() in
acpi_i2c_register_devices()").

I don't see a problem multiple Linux devices sharing a single ACPI
companion device like in this patch but I may be forgetting something ;-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/1] i2c: acpi: scan ACPI enumerated I2C mux channels Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-20 00:30 +0200
  [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-20 00:30 +0200
    Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-10-20 11:20 +0200
    Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-10-20 15:00 +0200
      Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-20 20:00 +0200
        Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-21 00:50 +0200
        Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-10-21 10:20 +0200
          Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-21 10:30 +0200
            Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-10-21 10:40 +0200
              Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-21 11:00 +0200
                Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-10-21 11:20 +0200
                Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-21 11:30 +0200
                Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports "Rafael J. Wysocki" <rafael@kernel.org> - 2015-10-22 00:40 +0200
                Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Dustin Byford <dustin@cumulusnetworks.com> - 2015-10-22 11:30 +0200
      Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-21 00:50 +0200
        Re: [PATCH v3 1/1] i2c: add ACPI support for I2C mux ports Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-10-21 10:10 +0200

csiph-web