summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/i2c/generic/chip.h12
-rw-r--r--src/drivers/i2c/generic/generic.c17
-rw-r--r--src/mainboard/google/reef/variants/baseboard/devicetree.cb13
-rw-r--r--src/mainboard/google/reef/variants/snappy/devicetree.cb14
-rw-r--r--src/mainboard/intel/leafhill/devicetree.cb13
5 files changed, 29 insertions, 40 deletions
diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h
index 19c6596db4..a4f85df2ee 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;
+ /* Disable reset and enable GPIO export in _CRS */
+ bool disable_gpio_export_in_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 4cf3e9e419..a90947f1b4 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,10 +72,17 @@ 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)
- return true;
-
- return false;
+ /*
+ * Return false if:
+ * 1. Request to explicitly disable export of GPIOs in CRS, or
+ * 2. Both reset and enable GPIOs are not provided.
+ */
+ if (cfg->disable_gpio_export_in_crs ||
+ ((cfg->reset_gpio.pin_count == 0) &&
+ (cfg->enable_gpio.pin_count == 0)))
+ return false;
+
+ return true;
}
static int i2c_generic_write_gpio(struct acpi_gpio *gpio, int *curr_index)
diff --git a/src/mainboard/google/reef/variants/baseboard/devicetree.cb b/src/mainboard/google/reef/variants/baseboard/devicetree.cb
index 7db4f156b8..2ccf277299 100644
--- a/src/mainboard/google/reef/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/reef/variants/baseboard/devicetree.cb
@@ -177,16 +177,11 @@ 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 "has_power_resource" = "1"
device i2c 10 on end
end
end # - I2C 3
diff --git a/src/mainboard/google/reef/variants/snappy/devicetree.cb b/src/mainboard/google/reef/variants/snappy/devicetree.cb
index e498533db3..febc03fa80 100644
--- a/src/mainboard/google/reef/variants/snappy/devicetree.cb
+++ b/src/mainboard/google/reef/variants/snappy/devicetree.cb
@@ -175,16 +175,11 @@ 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 "has_power_resource" = "1"
device i2c 10 on end
end
chip drivers/i2c/hid
@@ -192,7 +187,6 @@ chip soc/intel/apollolake
register "generic.desc" = ""WDT Touchscreen""
register "generic.irq" = "IRQ_EDGE_LOW(GPIO_21_IRQ)"
register "generic.probed" = "1"
- register "generic.pwr_mgmt_type" = "GPIO_EXPORT"
register "generic.reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPIO_36)"
register "hid_desc_reg_offset" = "0x20"
device i2c 2c on end
diff --git a/src/mainboard/intel/leafhill/devicetree.cb b/src/mainboard/intel/leafhill/devicetree.cb
index 7db4f156b8..2ccf277299 100644
--- a/src/mainboard/intel/leafhill/devicetree.cb
+++ b/src/mainboard/intel/leafhill/devicetree.cb
@@ -177,16 +177,11 @@ 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 "has_power_resource" = "1"
device i2c 10 on end
end
end # - I2C 3