summaryrefslogtreecommitdiff
path: root/src/drivers/i2c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2016-09-26 10:31:22 -0700
committerMartin Roth <martinroth@google.com>2016-09-28 22:17:43 +0200
commitfbf2c79b489a526e5ab7359ce56be0b4b66c854b (patch)
tree2dbf89a7861ea851648eea01c38224d0c74d44da /src/drivers/i2c
parenteeabb75e8c5a72fb01c1966fd91ea398818f15b3 (diff)
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> Reviewed-on: https://review.coreboot.org/16742 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/i2c')
-rw-r--r--src/drivers/i2c/generic/chip.h9
-rw-r--r--src/drivers/i2c/generic/generic.c7
2 files changed, 16 insertions, 0 deletions
diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h
index 84657d5241..d84097f6c6 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 62e2e9a813..30a280bcff 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 */