From: Hans de Goede <hdegoede@redhat.com>
To: Mark Gross <mgross@linux.intel.com>, Wolfram Sang <wsa@the-dreams.de>
Cc: Hans de Goede <hdegoede@redhat.com>,
Andy Shevchenko <andy@infradead.org>,
platform-driver-x86@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-acpi@vger.kernel.org
Subject: [RFC 1/4] i2c: core: Allow i2c_board_info to specify that the core should not try to find an IRQ
Date: Thu, 5 Nov 2020 09:00:11 +0100 [thread overview]
Message-ID: <20201105080014.45410-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20201105080014.45410-1-hdegoede@redhat.com>
When I2C devices are enumerated/instantiated through ACPI tables then
a single ACPI device may describe multiple separate I2C connected ICs.
This is handled by the drivers/platform/x86/i2c-multi-instantiate.c
code which contains a table which maps the ACPI-device-id to the
information necessary to instantiate the i2c-clients (type and IRQ
routing for each described IC).
In some cases the i2c-driver may need access to the ACPI-fwnode as
that may contain ACPI-methods supplying e.g. orientation-matrix info
for accelerometers.
Currently setting i2c_board_info.fwnode to point to the ACPI-fwnode
will cause the i2c-core to call i2c_acpi_get_irq() for any i2c-clients
for which i2c-multi-instantiate.c has not passed an IRQ in
i2c_board_info.irq, messing up the IRQ routing done by
i2c-multi-instantiate.c.
Make i2c_device_probe() accept a client->init_irq value < 0 to skip
the i2c-core IRQ handling, while still setting client->irq to 0
after checking for this, since most i2c-drivers expect client->irq == 0
for clients without an IRQ.
This allows i2c-multi-instantiate.c to set i2c_board_info.irq = -ENOENT
for clients without an IRQ and pass the ACPI-fwnode without issues.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/i2c/i2c-core-base.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 573b5da145d1..1887e2267031 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -467,11 +467,10 @@ static int i2c_device_probe(struct device *dev)
goto put_sync_adapter;
}
- if (irq < 0)
- irq = 0;
-
client->irq = irq;
}
+ if (client->irq < 0)
+ client->irq = 0;
driver = to_i2c_driver(dev->driver);
--
2.28.0
next prev parent reply other threads:[~2020-11-05 8:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 8:00 [RFC 0/4] platform/x86: i2c-multi-instantiate: Pass ACPI fwnode to instantiated i2c-clients Hans de Goede
2020-11-05 8:00 ` Hans de Goede [this message]
2020-11-05 8:00 ` [RFC 2/4] platform/x86: i2c-multi-instantiate: Set i2c_board_info.irq to -ENOENT when no IRQ is specified Hans de Goede
2020-11-05 8:00 ` [RFC 3/4] platform/x86: i2c-multi-instantiate: Pass ACPI fwnode to instantiated I2C-clients Hans de Goede
2020-11-05 10:31 ` Andy Shevchenko
2020-11-05 8:00 ` [RFC 4/4] platform/x86: i2c-multi-instantiate: Add IRQ_RESOURCE_GPIO_OPTIONAL IRQ type Hans de Goede
2020-11-05 10:36 ` Andy Shevchenko
2020-11-05 10:38 ` [RFC 0/4] platform/x86: i2c-multi-instantiate: Pass ACPI fwnode to instantiated i2c-clients Andy Shevchenko
2020-11-09 11:33 ` Hans de Goede
2020-11-10 10:10 ` Andy Shevchenko
2020-11-10 11:14 ` Hans de Goede
2020-11-10 14:47 ` Andy Shevchenko
2020-11-24 10:35 ` Hans de Goede
2020-11-24 11:35 ` Andy Shevchenko
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=20201105080014.45410-2-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@infradead.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).