summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2023-03-03 10:08:10 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-15 17:35:26 +0000
commitad90151ba343f63b5ce49b7aefb1010a52787cff (patch)
treee2bc9be6fd93707322956f469d2932d6ddd81785
parent3aa70f706008d48967f7d79229d6c778535527cd (diff)
downloadchrome-ec-ad90151ba343f63b5ce49b7aefb1010a52787cff.tar.gz
zephyr: lazor: fix duplicated GPIO
Both the gpio_switchcap_pg_int_l and gpio_da9313_gpio0 entries in the named-gpios pointed to the same GPIO pin. This causes the GPIO initialization to configure this pin twice, but only properties from the second entry are active on the pin. Use multiple node-labels on the same GPIO pin so that there is only a single "gpios" entry created. BUG=b:271576198 BRANCH=none TEST=zmake build -a Change-Id: I63a84319b13007d877b13b76a782ea1a6a51f1e9 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4307835 Reviewed-by: Aaron Massey <aaronmassey@google.com>
-rw-r--r--zephyr/program/trogdor/lazor/gpio.dts14
-rw-r--r--zephyr/program/trogdor/lazor/src/switchcap.c14
2 files changed, 18 insertions, 10 deletions
diff --git a/zephyr/program/trogdor/lazor/gpio.dts b/zephyr/program/trogdor/lazor/gpio.dts
index 92d54a59e3..6cde7e644d 100644
--- a/zephyr/program/trogdor/lazor/gpio.dts
+++ b/zephyr/program/trogdor/lazor/gpio.dts
@@ -100,15 +100,15 @@
gpio_accel_gyro_int_l: accel_gyro_int_l {
gpios = <&gpioa 0 GPIO_INPUT>;
};
- gpio_da9313_gpio0: da9313_gpio0 {
- gpios = <&gpioe 2 GPIO_INPUT>;
- enum-name = "GPIO_DA9313_GPIO0";
- };
/*
- * Active low input
+ * Note, this signal is active low when used as the ln9310
+ * interrupt input, and active high when used as the da9313
+ * power good input. The board code clears the active low
+ * flag when da9313 is detected.
*/
- gpio_switchcap_pg_int_l: switchcap_pg_int_l {
- gpios = <&gpioe 2 (GPIO_ACTIVE_LOW | GPIO_INPUT)>;
+ gpio_switchcap_pg_int_l: gpio_da9313_gpio0: da9313_gpio0 {
+ gpios = <&gpioe 2 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_DA9313_GPIO0";
};
gpio_ec_rst_odl: ec_rst_odl {
gpios = <&gpio0 2 GPIO_INPUT>;
diff --git a/zephyr/program/trogdor/lazor/src/switchcap.c b/zephyr/program/trogdor/lazor/src/switchcap.c
index 77413fb336..45cce0f498 100644
--- a/zephyr/program/trogdor/lazor/src/switchcap.c
+++ b/zephyr/program/trogdor/lazor/src/switchcap.c
@@ -28,14 +28,22 @@ const struct ln9310_config_t ln9310_config = {
static void switchcap_init(void)
{
if (board_has_da9313()) {
+ const struct gpio_dt_spec *da9313_gpio =
+ GPIO_DT_FROM_NODELABEL(gpio_da9313_gpio0);
+ gpio_flags_t flags = da9313_gpio->dt_flags;
+
CPRINTS("Use switchcap: DA9313");
/*
* When the chip in power down mode, it outputs high-Z.
- * Set pull-down to avoid floating.
+ * Set pull-down to avoid floating. Also use the
+ * gpio_pin_configure() routine here so we can clear
+ * the active low flag. gpio_pin_configure_dt() only allows
+ * setting additional flags.
*/
- gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_da9313_gpio0),
- GPIO_INPUT | GPIO_PULL_DOWN);
+ flags &= ~GPIO_ACTIVE_LOW;
+ flags |= GPIO_INPUT | GPIO_PULL_DOWN;
+ gpio_pin_configure(da9313_gpio->port, da9313_gpio->pin, flags);
/*
* Configure DA9313 enable, push-pull output. Don't set the