Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17080
-gerrit
commit bc0682240eb567cda96e6dd76a8c49ee095c0a1d
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Thu Oct 20 07:12:49 2016 -0700
arch/x86/acpigen: Add support for interacting with GPIOs
Since reading/toggling of GPIOs is platform-dependent task, provide an
interface with common functions to generate ACPI AML code for
manipulating GPIOs:
1. acpigen_soc_read_rx_gpio
2. acpigen_soc_get_tx_gpio
3. acpigen_soc_set_tx_gpio
4. acpigen_soc_clear_tx_gpio
Provide weak implementations of above functions. These functions are
expected to be implemented by every SoC that uses ACPI. This allows
drivers to easily generate ACPI AML code to interact GPIOs.
BUG=chrome-os-partner:55988
Change-Id: I3564f15a1cb50e6ca6132638447529648589aa0e
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/arch/x86/acpigen.c | 29 +++++++++++++++++++++++++++++
src/arch/x86/include/arch/acpigen.h | 22 ++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 43de1d5..44c77cc 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -976,3 +976,32 @@ void acpigen_write_else(void)
acpigen_emit_byte(ELSE_OP);
acpigen_write_len_f();
}
+
+/* Soc-implemented functions -- weak definitions. */
+int __attribute__((weak)) acpigen_soc_read_rx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("read_rx_gpio not available");
+ return -1;
+}
+
+int __attribute__((weak)) acpigen_soc_get_tx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("get_tx_gpio not available");
+ return -1;
+}
+
+int __attribute__((weak)) acpigen_soc_set_tx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("set_tx_gpio not available");
+ return -1;
+}
+
+int __attribute__((weak)) acpigen_soc_clear_tx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("clear_tx_gpio not available");
+ return -1;
+}
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index c2936e2..8ac8f48 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -160,4 +160,26 @@ void acpigen_write_else(void);
int get_cst_entries(acpi_cstate_t **);
+/*
+ * Soc-implemented functions for generating ACPI AML code for GPIO handling. All
+ * these functions are expected to use only Local5, Local6 and Local7
+ * variables. If the functions call into another ACPI method, then there is no
+ * restriction on the use of Local variables. In case of get/read functions,
+ * return value is expected to be stored in Local0 variable.
+ *
+ * All functions return 0 on success and -1 on error.
+ */
+
+/* Generate ACPI AML code to return Rx value of GPIO in Local0. */
+int acpigen_soc_read_rx_gpio(unsigned gpio_num);
+
+/* Generate ACPI AML code to return Tx value of GPIO in Local0. */
+int acpigen_soc_get_tx_gpio(unsigned gpio_num);
+
+/* Generate ACPI AML code to set Tx value of GPIO to 1. */
+int acpigen_soc_set_tx_gpio(unsigned gpio_num);
+
+/* Generate ACPI AML code to set Tx value of GPIO to 0. */
+int acpigen_soc_clear_tx_gpio(unsigned gpio_num);
+
#endif
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17083
-gerrit
commit cd12358c06340cd31099279df699bf54bfab8ed7
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Thu Oct 20 22:48:45 2016 -0700
mainboard/google/reef: Add PowerResource for ELAN touchscreen
Define reset_gpio and enable_gpio for touchscreen device so that when
kernel puts this device into D3, we put the device into
reset. PowerResource _ON and _OFF routines are used to put the device
into D0 and D3 states.
BUG=chrome-os-partner:55988
Change-Id: Ia905f9eb630cd96767b639aec74131dbd7952d0e
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/mainboard/google/reef/variants/baseboard/devicetree.cb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/mainboard/google/reef/variants/baseboard/devicetree.cb b/src/mainboard/google/reef/variants/baseboard/devicetree.cb
index 00df9bd..30d61f6 100644
--- a/src/mainboard/google/reef/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/reef/variants/baseboard/devicetree.cb
@@ -142,6 +142,10 @@ chip soc/intel/apollolake
register "desc" = ""ELAN Touchscreen""
register "irq" = "IRQ_EDGE_LOW(GPIO_21_IRQ)"
register "probed" = "1"
+ register "reset_gpio" = "GPIO_36"
+ register "reset_delay_ms" = "20"
+ register "enable_gpio" = "GPIO_152"
+ register "enable_delay_ms" = "1"
device i2c 10 on end
end
end # - I2C 3
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17083
-gerrit
commit 9b6ac02df2f78247abe6d61a1a40fdef90b747e5
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Thu Oct 20 22:48:45 2016 -0700
mainboard/google/reef: Add PowerResource for ELAN touchscreen
Define reset_gpio and enable_gpio for touchscreen device so that when
kernel puts this device into D3, we put the device into
reset. PowerResource _ON and _OFF routines are used to put the device
into D0 and D3 states.
BUG=chrome-os-partner:55988
Change-Id: Ia905f9eb630cd96767b639aec74131dbd7952d0e
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/mainboard/google/reef/variants/baseboard/devicetree.cb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/mainboard/google/reef/variants/baseboard/devicetree.cb b/src/mainboard/google/reef/variants/baseboard/devicetree.cb
index 00df9bd..30d61f6 100644
--- a/src/mainboard/google/reef/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/reef/variants/baseboard/devicetree.cb
@@ -142,6 +142,10 @@ chip soc/intel/apollolake
register "desc" = ""ELAN Touchscreen""
register "irq" = "IRQ_EDGE_LOW(GPIO_21_IRQ)"
register "probed" = "1"
+ register "reset_gpio" = "GPIO_36"
+ register "reset_delay_ms" = "20"
+ register "enable_gpio" = "GPIO_152"
+ register "enable_delay_ms" = "1"
device i2c 10 on end
end
end # - I2C 3
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17080
-gerrit
commit 4afa11b82e5dc98d47e5dc7d030b0a8a27006171
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Thu Oct 20 07:12:49 2016 -0700
x86/acpigen: Add support for interacting with GPIOs
Since reading/toggling of GPIOs is platform-dependent task, provide an
interface with common functions to generate ACPI AML code for
manipulating GPIOs:
1. acpigen_soc_read_rx_gpio
2. acpigen_soc_get_tx_gpio
3. acpigen_soc_set_tx_gpio
4. acpigen_soc_clear_tx_gpio
Provide weak implementations of above functions. These functions are
expected to be implemented by every SoC that uses ACPI. This allows
drivers to easily generate ACPI AML code to interact GPIOs.
BUG=chrome-os-partner:55988
Change-Id: I3564f15a1cb50e6ca6132638447529648589aa0e
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/arch/x86/acpigen.c | 29 +++++++++++++++++++++++++++++
src/arch/x86/include/arch/acpigen.h | 22 ++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 43de1d5..44c77cc 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -976,3 +976,32 @@ void acpigen_write_else(void)
acpigen_emit_byte(ELSE_OP);
acpigen_write_len_f();
}
+
+/* Soc-implemented functions -- weak definitions. */
+int __attribute__((weak)) acpigen_soc_read_rx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("read_rx_gpio not available");
+ return -1;
+}
+
+int __attribute__((weak)) acpigen_soc_get_tx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("get_tx_gpio not available");
+ return -1;
+}
+
+int __attribute__((weak)) acpigen_soc_set_tx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("set_tx_gpio not available");
+ return -1;
+}
+
+int __attribute__((weak)) acpigen_soc_clear_tx_gpio(unsigned gpio_num)
+{
+ printk(BIOS_ERR, "ERROR: %s not implemented\n", __func__);
+ acpigen_write_debug_string("clear_tx_gpio not available");
+ return -1;
+}
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index c2936e2..8ac8f48 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -160,4 +160,26 @@ void acpigen_write_else(void);
int get_cst_entries(acpi_cstate_t **);
+/*
+ * Soc-implemented functions for generating ACPI AML code for GPIO handling. All
+ * these functions are expected to use only Local5, Local6 and Local7
+ * variables. If the functions call into another ACPI method, then there is no
+ * restriction on the use of Local variables. In case of get/read functions,
+ * return value is expected to be stored in Local0 variable.
+ *
+ * All functions return 0 on success and -1 on error.
+ */
+
+/* Generate ACPI AML code to return Rx value of GPIO in Local0. */
+int acpigen_soc_read_rx_gpio(unsigned gpio_num);
+
+/* Generate ACPI AML code to return Tx value of GPIO in Local0. */
+int acpigen_soc_get_tx_gpio(unsigned gpio_num);
+
+/* Generate ACPI AML code to set Tx value of GPIO to 1. */
+int acpigen_soc_set_tx_gpio(unsigned gpio_num);
+
+/* Generate ACPI AML code to set Tx value of GPIO to 0. */
+int acpigen_soc_clear_tx_gpio(unsigned gpio_num);
+
#endif