EricR Lai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32438
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarein: Disable touch by strap pin GPP_B4
We want to disable touch for none touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not. If GPP_B4 is low level that means touch sku. If GPP_B4 is high level that means none-touch sku.
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/32438/1
diff --git a/src/drivers/i2c/hid/hid.c b/src/drivers/i2c/hid/hid.c index d570892..6d93e2a 100644 --- a/src/drivers/i2c/hid/hid.c +++ b/src/drivers/i2c/hid/hid.c @@ -60,6 +60,23 @@ { struct drivers_i2c_hid_config *config = dev->chip_info;
+ if (!config) + return; + + /* Check if device is present by reading GPIO */ + if (config->generic.device_present_gpio) { + int present = gpio_get(config->generic.device_present_gpio); + present ^= config->generic.device_present_gpio_invert; + + printk(BIOS_INFO, "%s is %spresent\n", + dev->chip_ops->name, present ? "" : "not "); + + if (!present) { + dev->enabled = 0; + return; + } + } + dev->ops = &i2c_hid_ops;
if (config && config->generic.desc) { diff --git a/src/mainboard/google/sarien/variants/sarien/devicetree.cb b/src/mainboard/google/sarien/variants/sarien/devicetree.cb index 1b72058..dab92f3 100644 --- a/src/mainboard/google/sarien/variants/sarien/devicetree.cb +++ b/src/mainboard/google/sarien/variants/sarien/devicetree.cb @@ -316,6 +316,8 @@ register "generic.enable_off_delay_ms" = "100" register "generic.has_power_resource" = "1" register "hid_desc_reg_offset" = "0x01" + register "generic.device_present_gpio" = "GPP_B4" + register "generic.device_present_gpio_invert" = "1" device i2c 10 on end end chip drivers/i2c/generic @@ -326,6 +328,8 @@ register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E7)" register "enable_delay_ms" = "5" register "has_power_resource" = "1" + register "generic.device_present_gpio" = "GPP_B4" + register "generic.device_present_gpio_invert" = "1" device i2c 34 on end end end # I2C #0
EricR Lai has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32438 )
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
Patch Set 1:
Please help review this.
Hello Duncan Laurie, build bot (Jenkins), Furquan Shaikh, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32438
to look at the new patch set (#2).
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarein: Disable touch by strap pin GPP_B4
We want to disable touch for none touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not. If GPP_B4 is low that means touch sku. If GPP_B4 is high that means none-touch sku.
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/32438/2
Hello Duncan Laurie, build bot (Jenkins), Furquan Shaikh, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32438
to look at the new patch set (#3).
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarein: Disable touch by strap pin GPP_B4
We want to disable touch for none touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not. If GPP_B4 is low level that means touch sku. If GPP_B4 is high level that means none-touch sku.
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/32438/3
Hello Duncan Laurie, build bot (Jenkins), Furquan Shaikh, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32438
to look at the new patch set (#4).
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarein: Disable touch by strap pin GPP_B4
We want to disable touch for none touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not. If GPP_B4 is low level that means touch sku. If GPP_B4 is high level that means none-touch sku.
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/32438/4
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32438 )
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
Patch Set 4: Code-Review+1
(2 comments)
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@9 PS4, Line 9: We want to disable touch for none touch sku. We can use : strap pin GPP_B4 to identify it is connected with touch : or not. Please add a blank line below (between paragraphs).
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@12 PS4, Line 12: If GPP_B4 is low level that means touch sku. : If GPP_B4 is high level that means none-touch sku. Please format that as a list.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32438 )
Change subject: mb/google/sarein: Disable touch by strap pin GPP_B4 ......................................................................
Patch Set 4: Code-Review+1
(2 comments)
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@7 PS4, Line 7: sarein sarien
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@9 PS4, Line 9: none touch I'd rather use "non-touch"
Hello Angel Pons, Paul Menzel, Duncan Laurie, build bot (Jenkins), Furquan Shaikh, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32438
to look at the new patch set (#5).
Change subject: mb/google/sarien: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarien: Disable touch by strap pin GPP_B4
We want to disable touch for non-touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not.
If GPP_B4 is low level that means touch sku. If GPP_B4 is high level that means non-touch sku.
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/32438/5
EricR Lai has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32438 )
Change subject: mb/google/sarien: Disable touch by strap pin GPP_B4 ......................................................................
Patch Set 5:
(4 comments)
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@7 PS4, Line 7: sarein
sarien
Ack
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@9 PS4, Line 9: none touch
I'd rather use "non-touch"
Done
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@9 PS4, Line 9: We want to disable touch for none touch sku. We can use : strap pin GPP_B4 to identify it is connected with touch : or not.
Please add a blank line below (between paragraphs).
Done
https://review.coreboot.org/#/c/32438/4//COMMIT_MSG@12 PS4, Line 12: If GPP_B4 is low level that means touch sku. : If GPP_B4 is high level that means none-touch sku.
Please format that as a list.
I can't get this. Any sample to me?
Hello Angel Pons, Paul Menzel, Duncan Laurie, build bot (Jenkins), Furquan Shaikh, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/32438
to look at the new patch set (#6).
Change subject: mb/google/sarien: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarien: Disable touch by strap pin GPP_B4
We want to disable touch for non-touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not.
touch sku: GPP_B4 is low non-touch sku: GPP_B4 is high
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 23 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/32438/6
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32438 )
Change subject: mb/google/sarien: Disable touch by strap pin GPP_B4 ......................................................................
Patch Set 6: Code-Review+2
This would be better split into two commits, but we are under some time pressure so I'm going to go ahead and go with this iteration.
Duncan Laurie has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32438 )
Change subject: mb/google/sarien: Disable touch by strap pin GPP_B4 ......................................................................
mb/google/sarien: Disable touch by strap pin GPP_B4
We want to disable touch for non-touch sku. We can use strap pin GPP_B4 to identify it is connected with touch or not.
touch sku: GPP_B4 is low non-touch sku: GPP_B4 is high
BUG=b:131132419 TEST=boot up and check no touch device exist
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: If6681262c25e4b01e061a8520e38905d40345509 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32438 Reviewed-by: Duncan Laurie dlaurie@chromium.org Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/drivers/i2c/hid/hid.c M src/mainboard/google/sarien/variants/sarien/devicetree.cb 2 files changed, 23 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve Angel Pons: Looks good to me, but someone else must approve
diff --git a/src/drivers/i2c/hid/hid.c b/src/drivers/i2c/hid/hid.c index d570892..035e563 100644 --- a/src/drivers/i2c/hid/hid.c +++ b/src/drivers/i2c/hid/hid.c @@ -18,6 +18,8 @@ #include <stdint.h> #include <string.h> #include "chip.h" +#include <gpio.h> +#include <console/console.h>
#if CONFIG(HAVE_ACPI_TABLES) static void i2c_hid_fill_dsm(struct device *dev) @@ -60,6 +62,23 @@ { struct drivers_i2c_hid_config *config = dev->chip_info;
+ if (!config) + return; + + /* Check if device is present by reading GPIO */ + if (config->generic.device_present_gpio) { + int present = gpio_get(config->generic.device_present_gpio); + present ^= config->generic.device_present_gpio_invert; + + printk(BIOS_INFO, "%s is %spresent\n", + dev->chip_ops->name, present ? "" : "not "); + + if (!present) { + dev->enabled = 0; + return; + } + } + dev->ops = &i2c_hid_ops;
if (config && config->generic.desc) { diff --git a/src/mainboard/google/sarien/variants/sarien/devicetree.cb b/src/mainboard/google/sarien/variants/sarien/devicetree.cb index 625655b..12e5dea 100644 --- a/src/mainboard/google/sarien/variants/sarien/devicetree.cb +++ b/src/mainboard/google/sarien/variants/sarien/devicetree.cb @@ -329,6 +329,8 @@ register "generic.enable_off_delay_ms" = "100" register "generic.has_power_resource" = "1" register "hid_desc_reg_offset" = "0x01" + register "generic.device_present_gpio" = "GPP_B4" + register "generic.device_present_gpio_invert" = "1" device i2c 10 on end end chip drivers/i2c/generic @@ -339,6 +341,8 @@ register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_HIGH(GPP_E7)" register "enable_delay_ms" = "5" register "has_power_resource" = "1" + register "device_present_gpio" = "GPP_B4" + register "device_present_gpio_invert" = "1" device i2c 34 on end end end # I2C #0