@@ -55,7 +55,7 @@ struct kscan_it8xxx2_config {
5555 int irq ;
5656 /* KSI[7:0] wake-up input source configuration list */
5757 const struct kscan_wuc_map_cfg * wuc_map_list ;
58- /* Keyboard scan alternate configuration */
58+ /* KSI[7:0]/KSO[17:0] keyboard scan alternate configuration */
5959 const struct pinctrl_dev_config * pcfg ;
6060 /* KSO16 GPIO cells */
6161 struct gpio_dt_spec kso16_gpios ;
@@ -425,19 +425,12 @@ static int kscan_it8xxx2_init(const struct device *dev)
425425 const struct kscan_it8xxx2_config * const config = dev -> config ;
426426 struct kscan_it8xxx2_data * data = dev -> data ;
427427 struct kscan_it8xxx2_regs * const inst = config -> base ;
428+ int status ;
428429
429430 /* Disable wakeup and interrupt of KSI pins before configuring */
430431 keyboard_raw_enable_interrupt (dev , 0 );
431432
432- /*
433- * Bit[2] = 1: Enable the internal pull-up of KSO[15:0] pins
434- * Bit[0] = 1: Enable the open-drain mode of KSO[17:0] pins
435- */
436- inst -> KBS_KSOCTRL = (IT8XXX2_KBS_KSOOD | IT8XXX2_KBS_KSOPU );
437-
438433#if (CONFIG_KSCAN_ITE_IT8XXX2_COLUMN_SIZE > 16 )
439- int status ;
440-
441434 /*
442435 * For KSO[16] and KSO[17]:
443436 * 1.GPOTRC:
@@ -451,17 +444,18 @@ static int kscan_it8xxx2_init(const struct device *dev)
451444 */
452445 gpio_pin_configure_dt (& config -> kso16_gpios , GPIO_INPUT );
453446 gpio_pin_configure_dt (& config -> kso17_gpios , GPIO_INPUT );
447+ #endif
448+ /*
449+ * Enable the internal pull-up and kbs mode of the KSI[7:0] pins.
450+ * Enable the internal pull-up and kbs mode of the KSO[15:0] pins.
451+ * Enable the open-drain mode of the KSO[17:0] pins.
452+ */
454453 status = pinctrl_apply_state (config -> pcfg , PINCTRL_STATE_DEFAULT );
455454 if (status < 0 ) {
456- LOG_ERR ("Failed to configure kscan pins" );
455+ LOG_ERR ("Failed to configure KSI[7:0] and KSO[17:0] pins" );
457456 return status ;
458457 }
459458
460- #endif
461-
462- /* Bit[2] = 1: Enable the internal pull-up of KSI[7:0] pins */
463- inst -> KBS_KSICTRL = IT8XXX2_KBS_KSIPU ;
464-
465459 /* KSO[17:0] pins output low */
466460 inst -> KBS_KSOL = 0x00 ;
467461 inst -> KBS_KSOH1 = 0x00 ;
0 commit comments