Duncan Laurie (dlaurie@chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16742
-gerrit
commit 01a142857b11c4aadb837096f0b213b3764765f7 Author: Duncan Laurie dlaurie@chromium.org Date: Mon Sep 26 10:31:22 2016 -0700
drivers/i2c/generic: Add config for marking device as probed
Add a config option to the generic I2C device driver to indicate to the OS that this device should be probed before being added.
This can be used to provide ACPI device instantiations to devices that may not actually exist on the board. For example, if multiple trackpad vendors are supported on the same board they can both be described in ACPI and the OS will probe the address and load the driver only if the device responds to the probe at that address.
BUG=chrome-os-partner:57686
Change-Id: I22cffb4b15f25d97dfd37dc58bca315f57bafc59 Signed-off-by: Duncan Laurie dlaurie@chromium.org --- src/drivers/i2c/generic/chip.h | 9 +++++++++ src/drivers/i2c/generic/generic.c | 7 +++++++ 2 files changed, 16 insertions(+)
diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h index 84657d5..d84097f 100644 --- a/src/drivers/i2c/generic/chip.h +++ b/src/drivers/i2c/generic/chip.h @@ -10,6 +10,15 @@ struct drivers_i2c_generic_config { unsigned wake; /* Wake GPE */ struct acpi_irq irq; /* Interrupt */
+ /* + * This flag will add a device propery which will indicate + * to the OS that it should probe this device before adding it. + * + * This can be used to declare a device that may not exist on + * the board, for example to support multiple trackpad vendors. + */ + int probed; + /* GPIO used to indicate if this device is present */ unsigned device_present_gpio; unsigned device_present_gpio_invert; diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c index 62e2e9a..30a280b 100644 --- a/src/drivers/i2c/generic/generic.c +++ b/src/drivers/i2c/generic/generic.c @@ -35,6 +35,7 @@ static void i2c_generic_fill_ssdt(struct device *dev) .speed = config->speed ? : I2C_SPEED_FAST, .resource = scope, }; + struct acpi_dp *dsd = NULL;
if (!dev->enabled || !scope) return; @@ -65,6 +66,12 @@ static void i2c_generic_fill_ssdt(struct device *dev) acpigen_write_PRW(config->wake, 3); }
+ if (config->probed) { + dsd = acpi_dp_new_table("_DSD"); + acpi_dp_add_integer(dsd, "linux,probed", 1); + acpi_dp_write(dsd); + } + acpigen_pop_len(); /* Device */ acpigen_pop_len(); /* Scope */