From 460cc37c5be4cc2d986a89fd7237fc31fc30bf7a Mon Sep 17 00:00:00 2001 From: Alexandru M Stan Date: Tue, 9 Jul 2019 15:26:59 -0700 Subject: keyscan: decouple keyboard_raw functionality from the presence of TASK_KEYSCAN With the addition of external i2c keyboard controllers, chips that don't necessarly have gpios going to a keyboard can now still have a TASK_KEYSCAN. Therefore it's wrong to assume we want the chip/*/keyboard_raw code included. There was no easy way to make an ways on option (eg: CONFIG_KEYBOARD_RAW) that could get #undefd in strategic places. The place that would always define it would be in include/config.h but I don't believe that executes before the build.mk rules. BUG=b:135895590 TEST=Other boards with keyboards still happy. TEST=No compile errors (regarding missing keyboard GPIOS) when declaring TASK_KEYSCAN on a fresh stm32 board. BRANCH=master Change-Id: I061812a6941a11784950280648912edd5844bd79 Signed-off-by: Alexandru M Stan Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1693862 Reviewed-by: Jack Rosenthal --- chip/host/build.mk | 2 ++ chip/it83xx/build.mk | 2 ++ chip/lm4/build.mk | 2 ++ chip/mchp/build.mk | 2 ++ chip/mec1322/build.mk | 2 ++ chip/npcx/build.mk | 2 ++ chip/nrf51/build.mk | 2 ++ chip/stm32/build.mk | 2 ++ include/config.h | 8 ++++++++ 9 files changed, 24 insertions(+) diff --git a/chip/host/build.mk b/chip/host/build.mk index 2e62f8f3d0..12b10dba16 100644 --- a/chip/host/build.mk +++ b/chip/host/build.mk @@ -10,7 +10,9 @@ CORE:=host chip-y=system.o gpio.o uart.o persistence.o flash.o lpc.o reboot.o i2c.o \ clock.o spi_master.o trng.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif chip-$(CONFIG_USB_PD_TCPC)+=usb_pd_phy.o ifeq ($(CONFIG_DCRYPTO),y) diff --git a/chip/it83xx/build.mk b/chip/it83xx/build.mk index 027bf2e1b3..657dedf97b 100644 --- a/chip/it83xx/build.mk +++ b/chip/it83xx/build.mk @@ -31,6 +31,8 @@ chip-$(CONFIG_HOSTCMD_X86)+=lpc.o ec2i.o chip-$(CONFIG_HOSTCMD_ESPI)+=espi.o chip-$(CONFIG_SPI_MASTER)+=spi_master.o chip-$(CONFIG_PECI)+=peci.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif chip-$(CONFIG_I2C_MASTER)+=i2c.o chip-$(CONFIG_I2C_SLAVE)+=i2c_slave.o diff --git a/chip/lm4/build.mk b/chip/lm4/build.mk index 83ff3f15d5..26419d3a04 100644 --- a/chip/lm4/build.mk +++ b/chip/lm4/build.mk @@ -26,4 +26,6 @@ chip-$(CONFIG_PECI)+=peci.o chip-$(CONFIG_PWM)+=pwm.o fan.o chip-$(CONFIG_SPI)+=spi.o chip-$(CONFIG_WATCHDOG)+=watchdog.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif diff --git a/chip/mchp/build.mk b/chip/mchp/build.mk index 0197e364d0..cea514ec43 100644 --- a/chip/mchp/build.mk +++ b/chip/mchp/build.mk @@ -43,7 +43,9 @@ chip-$(CONFIG_PWM)+=pwm.o chip-$(CONFIG_SPI)+=spi.o qmspi.o chip-$(CONFIG_TFDP)+=tfdp.o chip-$(CONFIG_WATCHDOG)+=watchdog.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif # location of the scripts and keys used to pack the SPI flash image SCRIPTDIR:=./chip/${CHIP}/util diff --git a/chip/mec1322/build.mk b/chip/mec1322/build.mk index ced56303a5..2b0c9cc229 100644 --- a/chip/mec1322/build.mk +++ b/chip/mec1322/build.mk @@ -25,7 +25,9 @@ chip-$(CONFIG_I2C)+=i2c.o chip-$(CONFIG_HOSTCMD_LPC)+=lpc.o chip-$(CONFIG_PWM)+=pwm.o chip-$(CONFIG_WATCHDOG)+=watchdog.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif chip-$(CONFIG_DMA)+=dma.o chip-$(CONFIG_SPI)+=spi.o diff --git a/chip/npcx/build.mk b/chip/npcx/build.mk index 31e3cce6d6..2785f92ea4 100644 --- a/chip/npcx/build.mk +++ b/chip/npcx/build.mk @@ -35,7 +35,9 @@ chip-$(CONFIG_CEC)+=cec.o chip-$(CONFIG_PWM)+=pwm.o chip-$(CONFIG_SPI)+=spi.o chip-$(CONFIG_WATCHDOG)+=watchdog.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif chip-$(CONFIG_WAKE_ON_VOICE)+=apm.o chip-$(CONFIG_WAKE_ON_VOICE)+=wov.o diff --git a/chip/nrf51/build.mk b/chip/nrf51/build.mk index 888648c9de..7a7a33d402 100644 --- a/chip/nrf51/build.mk +++ b/chip/nrf51/build.mk @@ -21,4 +21,6 @@ chip-$(CONFIG_BLUETOOTH_LE)+=radio.o bluetooth_le.o chip-$(CONFIG_BLUETOOTH_LE_RADIO_TEST)+=radio_test.o chip-$(CONFIG_COMMON_TIMER)+=hwtimer.o clock.o chip-$(CONFIG_I2C)+=i2c.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif diff --git a/chip/stm32/build.mk b/chip/stm32/build.mk index c2a678569b..807cfd7ebd 100644 --- a/chip/stm32/build.mk +++ b/chip/stm32/build.mk @@ -55,7 +55,9 @@ chip-$(CONFIG_STREAM_USART)+=usart_rx_dma.o usart_tx_dma.o chip-$(CONFIG_CMD_USART_INFO)+=usart_info_command.o chip-$(CONFIG_WATCHDOG)+=watchdog.o chip-$(HAS_TASK_CONSOLE)+=uart.o +ifndef CONFIG_KEYBOARD_NOT_RAW chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o +endif chip-$(HAS_TASK_POWERLED)+=power_led.o chip-$(CONFIG_FLASH_PHYSICAL)+=flash-$(CHIP_FAMILY).o ifdef CONFIG_FLASH_PHYSICAL diff --git a/include/config.h b/include/config.h index aef854ff62..ebf3f09c49 100644 --- a/include/config.h +++ b/include/config.h @@ -2416,6 +2416,13 @@ /* Enable extra debugging output from keyboard modules */ #undef CONFIG_KEYBOARD_DEBUG +/* + * Disables the directly connected keyboard pins and drivers on a particular + * chip. You might want this enabled if the keyboard is indirectly connected + * to the EC, perhaps through an I2C controller. + */ +#undef CONFIG_KEYBOARD_NOT_RAW + /* The board uses a negative edge-triggered GPIO for keyboard interrupts. */ #undef CONFIG_KEYBOARD_IRQ_GPIO @@ -2507,6 +2514,7 @@ * Enable keypad (a palm-sized keyboard section usually placed on the far right) */ #undef CONFIG_KEYBOARD_KEYPAD + /*****************************************************************************/ /* Support common LED interface */ -- cgit v1.2.1