summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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