Furquan Shaikh (furquan@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18238
-gerrit
commit 43d8bc10f408ae89d15a3f9aff6766868e2ebcb4 Author: Furquan Shaikh furquan@chromium.org Date: Wed Jan 25 17:53:01 2017 -0800
i2c/generic: Allow GPIOs to be put in _CRS and PowerResource in ACPI
Linux kernel expects that power management with ACPI should always be handled using PowerResource. However, some kernel drivers (e.g. ELAN touchscreen) check to see if reset gpio is passed in by the BIOS to decide whether the device loses power in suspend. Thus, until the kernel has a better way for drivers to query if device lost power in suspend, we need to allow passing in of GPIOs via _CRS as well as exporting PowerResource to control power to the device.
Update reef to export reset GPIO as well as PowerResource for touchscreen device.
BUG=chrome-os-partner:62311,chrome-os-partner:60194 BRANCH=reef TEST=Verified that touchscreen works on power-on as well as after suspend-resume.
Change-Id: I3409689cf56bfddd321402ad5dda3fc8762e6bc6 Signed-off-by: Furquan Shaikh furquan@chromium.org --- src/drivers/i2c/generic/chip.h | 12 +++++------- src/drivers/i2c/generic/generic.c | 4 ++-- src/mainboard/google/reef/variants/baseboard/devicetree.cb | 14 +++++--------- 3 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h index 19c6596..50a372d 100644 --- a/src/drivers/i2c/generic/chip.h +++ b/src/drivers/i2c/generic/chip.h @@ -19,11 +19,6 @@ #include <arch/acpi_device.h> #include <device/i2c.h>
-enum power_mgmt_type { - POWER_RESOURCE = 1, - GPIO_EXPORT = 2, -}; - struct drivers_i2c_generic_config { const char *hid; /* ACPI _HID (required) */ const char *cid; /* ACPI _CID */ @@ -47,8 +42,11 @@ struct drivers_i2c_generic_config { unsigned device_present_gpio; unsigned device_present_gpio_invert;
- /* Power management type. */ - enum power_mgmt_type pwr_mgmt_type; + /* Do we need to export reset and enable GPIOs in _CRS? */ + bool export_gpio_to_crs; + + /* Does the device have a power resource? */ + bool has_power_resource;
/* GPIO used to take device out of reset or to put it into reset. */ struct acpi_gpio reset_gpio; diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c index 4cf3e9e..35821dd 100644 --- a/src/drivers/i2c/generic/generic.c +++ b/src/drivers/i2c/generic/generic.c @@ -32,7 +32,7 @@ static void i2c_generic_add_power_res(struct drivers_i2c_generic_config *config) unsigned reset_gpio = config->reset_gpio.pins[0]; unsigned enable_gpio = config->enable_gpio.pins[0];
- if (config->pwr_mgmt_type != POWER_RESOURCE) + if (!config->has_power_resource) return;
if (!reset_gpio && !enable_gpio) @@ -72,7 +72,7 @@ static void i2c_generic_add_power_res(struct drivers_i2c_generic_config *config)
static bool i2c_generic_add_gpios_to_crs(struct drivers_i2c_generic_config *cfg) { - if (cfg->pwr_mgmt_type == GPIO_EXPORT) + if (cfg->export_gpio_to_crs) return true;
return false; diff --git a/src/mainboard/google/reef/variants/baseboard/devicetree.cb b/src/mainboard/google/reef/variants/baseboard/devicetree.cb index 7db4f15..c9bbca9 100644 --- a/src/mainboard/google/reef/variants/baseboard/devicetree.cb +++ b/src/mainboard/google/reef/variants/baseboard/devicetree.cb @@ -177,16 +177,12 @@ chip soc/intel/apollolake register "desc" = ""ELAN Touchscreen"" register "irq" = "IRQ_EDGE_LOW(GPIO_21_IRQ)" register "probed" = "1" - register "pwr_mgmt_type" = "GPIO_EXPORT" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_36)" - - chip drivers/generic/gpio_regulator - register "name" = ""vcc33"" - register "gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_152)" - register "enabled_on_boot" = "1" - device generic 0 on end - end - + register "reset_delay_ms" = "20" + register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_152)" + register "enable_delay_ms" = "1" + register "export_gpio_to_crs" = "1" + register "has_power_resource" = "1" device i2c 10 on end end end # - I2C 3