From 0c627e94c86fbd3e0556cc753350488ae3c0649f Mon Sep 17 00:00:00 2001 From: Tim Lin Date: Wed, 25 Jun 2025 18:21:28 +0800 Subject: [PATCH] drivers/pinctrl: ite: Don't clear FUNC3 setting unless alt_func is FUNC3 Previously, FUNC_3 related setting were cleared unconditionally, regardless of the selected alternate function. This could unintentionally disable FUNC_3 settings when configuring other alternate functions. This change ensures that FUNC_3 gcr/ext bits are only cleared when alt_func is IT8XXX2_ALT_FUNC_3. Signed-off-by: Tim Lin --- drivers/pinctrl/pinctrl_ite_it8xxx2.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/pinctrl_ite_it8xxx2.c b/drivers/pinctrl/pinctrl_ite_it8xxx2.c index 1416af04809..33b7075f02f 100644 --- a/drivers/pinctrl/pinctrl_ite_it8xxx2.c +++ b/drivers/pinctrl/pinctrl_ite_it8xxx2.c @@ -176,12 +176,14 @@ static int pinctrl_gpio_it8xxx2_configure_pins(const pinctrl_soc_pin_t *pins) /* * Handle alternate function. */ - if (reg_func3_gcr != NULL) { - *reg_func3_gcr &= ~gpio->func3_en_mask[pin]; - } - /* Ensure that func3-ext setting is in default state. */ - if (reg_func3_ext != NULL) { - *reg_func3_ext &= ~gpio->func3_ext_mask[pin]; + if (pins->alt_func == IT8XXX2_ALT_FUNC_3) { + if (reg_func3_gcr != NULL) { + *reg_func3_gcr &= ~gpio->func3_en_mask[pin]; + } + /* Ensure that func3-ext setting is in default state. */ + if (reg_func3_ext != NULL) { + *reg_func3_ext &= ~gpio->func3_ext_mask[pin]; + } } switch (pins->alt_func) {