Skip to content

Commit 0c627e9

Browse files
GTLin08danieldegrasse
authored andcommitted
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 <tim2.lin@ite.corp-partner.google.com>
1 parent 2c767cb commit 0c627e9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/pinctrl/pinctrl_ite_it8xxx2.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,14 @@ static int pinctrl_gpio_it8xxx2_configure_pins(const pinctrl_soc_pin_t *pins)
176176
/*
177177
* Handle alternate function.
178178
*/
179-
if (reg_func3_gcr != NULL) {
180-
*reg_func3_gcr &= ~gpio->func3_en_mask[pin];
181-
}
182-
/* Ensure that func3-ext setting is in default state. */
183-
if (reg_func3_ext != NULL) {
184-
*reg_func3_ext &= ~gpio->func3_ext_mask[pin];
179+
if (pins->alt_func == IT8XXX2_ALT_FUNC_3) {
180+
if (reg_func3_gcr != NULL) {
181+
*reg_func3_gcr &= ~gpio->func3_en_mask[pin];
182+
}
183+
/* Ensure that func3-ext setting is in default state. */
184+
if (reg_func3_ext != NULL) {
185+
*reg_func3_ext &= ~gpio->func3_ext_mask[pin];
186+
}
185187
}
186188

187189
switch (pins->alt_func) {

0 commit comments

Comments
 (0)