All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooks <andrew.cooks@opengear.com>
To: jdelvare@suse.com, linux-i2c@vger.kernel.org
Cc: platypus-sw@opengear.com,
	Andrew Cooks <andrew.cooks@opengear.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v2 3/3] i2c: add ACPI support for i2c-piix4
Date: Thu, 14 Dec 2017 13:11:46 +1000	[thread overview]
Message-ID: <fbd6aa2d081baec604b08841be6efa8432f7afd3.1513215039.git.andrew.cooks@opengear.com> (raw)
In-Reply-To: <cover.1513215039.git.andrew.cooks@opengear.com>

This enables the i2c-piix4 SMBus controller driver to enumerate I2C
slave devices using ACPI. It builds on the related I2C mux device work
in commit 8eb5c87a92c0 ("i2c: add ACPI support for I2C mux ports")

In the i2c-piix4 driver the adapters are enumerated as:
 Main SMBus adapter Port 0, Port 2, ..., aux port (i.e., ASF adapter)

However, in the AMD BKDG documentation[1], the implied order of ports is:
 Main SMBus adapter Port 0, ASF adapter, Port 2, Port 3, ...

This ordering difference is unfortunate, and we assume that ACPI
developers will use the Linux ordering.

[1] 52740 BIOS and Kernel Developer's Guide (BKDG) for AMD Family 16h
Models 30h-3Fh Processors

Signed-off-by: Andrew Cooks <andrew.cooks@opengear.com>
---
 drivers/i2c/busses/i2c-piix4.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index cc38dc3..65e6390 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -845,6 +845,12 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
 	/* set up the sysfs linkage to our parent device */
 	adap->dev.parent = &dev->dev;
 
+	if (has_acpi_companion(&dev->dev)) {
+		acpi_preset_companion(&adap->dev,
+				      ACPI_COMPANION(&dev->dev),
+				      piix4_adapter_count++);
+	}
+
 	snprintf(adap->name, sizeof(adap->name),
 		"SMBus PIIX4 adapter%s at %04x", name, smba);
 
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Cooks <andrew.cooks@opengear.com>
To: jdelvare@suse.com, linux-i2c@vger.kernel.org
Cc: platypus-sw@opengear.com,
	Andrew Cooks <andrew.cooks@opengear.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	open list <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 3/3] i2c: add ACPI support for i2c-piix4
Date: Thu, 14 Dec 2017 13:11:46 +1000	[thread overview]
Message-ID: <fbd6aa2d081baec604b08841be6efa8432f7afd3.1513215039.git.andrew.cooks@opengear.com> (raw)
In-Reply-To: <cover.1513215039.git.andrew.cooks@opengear.com>

This enables the i2c-piix4 SMBus controller driver to enumerate I2C
slave devices using ACPI. It builds on the related I2C mux device work
in commit 8eb5c87a92c0 ("i2c: add ACPI support for I2C mux ports")

In the i2c-piix4 driver the adapters are enumerated as:
 Main SMBus adapter Port 0, Port 2, ..., aux port (i.e., ASF adapter)

However, in the AMD BKDG documentation[1], the implied order of ports is:
 Main SMBus adapter Port 0, ASF adapter, Port 2, Port 3, ...

This ordering difference is unfortunate, and we assume that ACPI
developers will use the Linux ordering.

[1] 52740 BIOS and Kernel Developer's Guide (BKDG) for AMD Family 16h
Models 30h-3Fh Processors

Signed-off-by: Andrew Cooks <andrew.cooks@opengear.com>
---
 drivers/i2c/busses/i2c-piix4.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index cc38dc3..65e6390 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -845,6 +845,12 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
 	/* set up the sysfs linkage to our parent device */
 	adap->dev.parent = &dev->dev;
 
+	if (has_acpi_companion(&dev->dev)) {
+		acpi_preset_companion(&adap->dev,
+				      ACPI_COMPANION(&dev->dev),
+				      piix4_adapter_count++);
+	}
+
 	snprintf(adap->name, sizeof(adap->name),
 		"SMBus PIIX4 adapter%s at %04x", name, smba);
 
-- 
2.7.4

  parent reply	other threads:[~2017-12-14  3:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14  3:11 [PATCH v2 0/3] Enable ACPI-defined peripherals on i2c-piix4 SMBus Andrew Cooks
2018-01-29  3:54 ` [PATCH v3 " Andrew Cooks
2017-12-14  3:11 ` [PATCH v2 1/3] i2c: piix4: Fix SMBus port selection for AMD Family 16h chips Andrew Cooks
2017-12-14  3:11   ` Andrew Cooks
2017-12-14 23:58   ` Andrew Cooks
2017-12-14  3:11 ` [PATCH v2 2/3] i2c: piix4: fix number of SMBus ports on HUDSON2 Andrew Cooks
2017-12-14  3:11   ` Andrew Cooks
2017-12-14  3:11 ` Andrew Cooks [this message]
2017-12-14  3:11   ` [PATCH v2 3/3] i2c: add ACPI support for i2c-piix4 Andrew Cooks

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=fbd6aa2d081baec604b08841be6efa8432f7afd3.1513215039.git.andrew.cooks@opengear.com \
    --to=andrew.cooks@opengear.com \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platypus-sw@opengear.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.