summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2023-03-03 10:57:17 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-15 17:35:28 +0000
commit2ac9ae273e5589a35e1fc9a92c3d678df697c9c7 (patch)
tree08b9898ac7a8b9eaf3c2312b2c5c7bbcfa2935d3 /zephyr
parentad90151ba343f63b5ce49b7aefb1010a52787cff (diff)
downloadchrome-ec-2ac9ae273e5589a35e1fc9a92c3d678df697c9c7.tar.gz
zephyr: brya: correct duplicate GPIOs
Correct duplicate GPIOs on the brya project. Duplicate entries are error prone if future changes are made to the GPIO configuration. BUG=b:271588407 BRANCH=none TEST=zmake build -a Change-Id: Ida8efe2099612af598cfb0334afa230cb81f93bc Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4307836 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/program/brya/gpio.dts22
-rw-r--r--zephyr/program/brya/kblight_hooks.c14
2 files changed, 19 insertions, 17 deletions
diff --git a/zephyr/program/brya/gpio.dts b/zephyr/program/brya/gpio.dts
index 6c6a2ac054..ff9f895ec1 100644
--- a/zephyr/program/brya/gpio.dts
+++ b/zephyr/program/brya/gpio.dts
@@ -26,17 +26,15 @@
charger_vap_otg_en {
gpios = <&gpio7 3 GPIO_OUTPUT_LOW>;
};
- gpio_ec_batt_pres_odl: ec_batt_pres_odl {
- gpios = <&gpioa 3 GPIO_INPUT>;
- enum-name = "GPIO_BATT_PRES_ODL";
- };
+
/*
- * Same GPIO as gpio_ec_batt_pres_odl,
- * but only enabled for board id 1.
+ * Board ID 1 repurposes the gpio_ec_batt_pres_odl pin as
+ * an output signal. The board code switches the pin
+ * pin configuration to an output when board ID 1 is detected.
*/
- gpio_id_1_ec_kb_bl_en: id_1_ec_kb_bl_en {
- gpios = <&gpioa 3 GPIO_OUTPUT_LOW>;
- no-auto-init;
+ gpio_id_1_ec_kb_bl_en: gpio_ec_batt_pres_odl: ec_batt_pres_odl {
+ gpios = <&gpioa 3 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
};
gpio_id_1_ec_batt_pres_odl: id_1_ec_batt_pres_odl {
gpios = <&gpioe 1 GPIO_INPUT>;
@@ -260,12 +258,6 @@
id_1_usb_c0_c2_tcpc_rst_odl {
gpios = <&gpio3 4 GPIO_ODR_LOW>;
};
- usb_c0_int_odl {
- gpios = <&gpiob 1 GPIO_INPUT>;
- };
- usb_c2_int_odl {
- gpios = <&gpio4 1 GPIO_INPUT>;
- };
usb_c0_rt_int_odl: usb_c0_rt_int_odl {
gpios = <&gpiob 1 GPIO_INPUT>;
};
diff --git a/zephyr/program/brya/kblight_hooks.c b/zephyr/program/brya/kblight_hooks.c
index 8716537f5d..a9b1b64a5c 100644
--- a/zephyr/program/brya/kblight_hooks.c
+++ b/zephyr/program/brya/kblight_hooks.c
@@ -52,6 +52,9 @@ static void board_backlight_handler(struct ap_power_ev_callback *cb,
static void set_board_id_1_gpios(void)
{
static struct ap_power_ev_callback cb;
+ const struct gpio_dt_spec *ec_kb_bl_en =
+ GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en);
+ gpio_flags_t flags = ec_kb_bl_en->dt_flags;
/*
* Add a callback for suspend/resume to
@@ -63,7 +66,14 @@ static void set_board_id_1_gpios(void)
if (get_board_id() != 1)
return;
- gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en),
- GPIO_OUTPUT_LOW);
+
+ /*
+ * Note, use gpio_pin_configure() instead of gpio_pin_configure_dt()
+ * because gpio_pin_configure_dt() only sets additional flags, and
+ * cannot clear flags.
+ */
+ flags &= ~GPIO_INPUT;
+ flags |= GPIO_OUTPUT_LOW;
+ gpio_pin_configure(ec_kb_bl_en->port, ec_kb_bl_en->pin, flags);
}
DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST);