drivers: input: it8xxx2: resolve runtime assertion failure

When the kso[17:16] lines are enabled and `CONFIG_ASSERT` is
configured, the following error occurs: "Input cannot be
enabled for 'Open Drain', 'Open Source' modes without Output."
To address this, this commit configures kso16 and kso17 as
gpio output before applying the pinctrl settings.

Tested with: no abnormal keyscan occurs during
initialization

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
This commit is contained in:
Ruibin Chang
2025-08-04 13:16:41 +08:00
committed by Johan Hedberg
parent 3a4cc129a7
commit 3fc27e71d2

View File

@@ -171,15 +171,15 @@ static int it8xxx2_kbd_init(const struct device *dev)
* Bit[7:6] = 00b: Select alternate KSO function
* Bit[2] = 1b: Enable the internal pull-up of KSO pin
*
* NOTE: Set input temporarily for gpio_pin_configure(), after
* that pinctrl_apply_state() set to alternate function
* immediately.
* NOTE: Set (output | dt_flag) temporarily for kso16 and
* kso17 pins, after that pinctrl_apply_state() set to
* alternate function immediately.
*/
if (!(config->kso_ignore_mask & BIT(16))) {
gpio_pin_configure_dt(&config->kso16_gpios, GPIO_INPUT);
gpio_pin_configure_dt(&config->kso16_gpios, GPIO_OUTPUT);
}
if (common->col_size > 17 && !(config->kso_ignore_mask & BIT(17))) {
gpio_pin_configure_dt(&config->kso17_gpios, GPIO_INPUT);
gpio_pin_configure_dt(&config->kso17_gpios, GPIO_OUTPUT);
}
}
/*