summaryrefslogtreecommitdiff
path: root/src/drivers/i2c/hid
diff options
context:
space:
mode:
authorEric Lai <ericr_lai@compal.corp-partner.google.com>2019-04-24 14:21:04 +0800
committerDuncan Laurie <dlaurie@chromium.org>2019-04-24 15:51:22 +0000
commit18060d7d92a924dde1aff73f7792e64c6c0c34cd (patch)
treeaa08b62b6951d556f5695aa56266d364db5aad4c /src/drivers/i2c/hid
parentd228c1ef32daf0affe211cd8e79b31e0a2e5f45c (diff)
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>
Diffstat (limited to 'src/drivers/i2c/hid')
-rw-r--r--src/drivers/i2c/hid/hid.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/drivers/i2c/hid/hid.c b/src/drivers/i2c/hid/hid.c
index d570892c1d..035e5633c6 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 @@ static void i2c_hid_enable(struct device *dev)
{
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) {