diff options
author | Aseda Aboagye <aaboagye@google.com> | 2015-04-08 16:42:55 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-04-10 22:08:25 +0000 |
commit | e9883124ff1600db5788e44c332a403499fb5da6 (patch) | |
tree | 5e5b64b72e89037845cc549e1c4262bf9d224a04 /board/npcx_evb | |
parent | 0b043fed030129ea99272f1ba729307fafaa93e2 (diff) | |
download | chrome-ec-e9883124ff1600db5788e44c332a403499fb5da6.tar.gz |
gpio: Refactor IRQ handler pointer out of gpio_list
In the gpio_info struct, we had a irq_handler pointer defined even
though a majority of the GPIOs did not have irq handlers associated. By
removing the irq_handler pointer out of the struct, we can save some
space with some targets saving more than others. (For example, ~260
bytes for samus_pd).
This change also brings about a new define:
GPIO_INT(name, port, pin, flags, signal)
And the existing GPIO macro has had the signal parameter removed since
they were just NULL.
GPIO(name, port, pin, flags)
In each of the gpio.inc files, all the GPIOs with irq handlers must be
defined at the top of the file. This is because their enum values from
gpio_signal are used as the index to the gpio_irq_handlers table.
BUG=chromium:471331
BRANCH=none
TEST=Flashed ec to samus and samus_pd, verified lightbar tap, lid, power
button, keyboard, charging, all still working.
TEST=Moved a GPIO_INT declaration after a GPIO declaration and watched the build
fail.
TEST=make -j BOARD=peppy tests
TEST=make -j BOARD=auron tests
TEST=make -j BOARD=link tests
Change-Id: Id6e261b0a3cd63223ca92f2e96a80c95e85cdefb
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/263973
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/npcx_evb')
-rw-r--r-- | board/npcx_evb/gpio.inc | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/board/npcx_evb/gpio.inc b/board/npcx_evb/gpio.inc index 8457aff4ae..77dbd801c5 100644 --- a/board/npcx_evb/gpio.inc +++ b/board/npcx_evb/gpio.inc @@ -6,33 +6,34 @@ */ /* TODO: Redefine debug 2 inputs */ -GPIO(RECOVERY_L, 0, 0, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ -GPIO(WP_L, 9, 3, GPIO_PULL_DOWN | GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(RECOVERY_L, 0, 0, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ +GPIO_INT(WP_L, 9, 3, GPIO_PULL_DOWN | GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ /* For testing 8042 commands, we need the following GPIOs */ /* TODO: Redefine 4 inputs */ -GPIO(POWER_BUTTON_L, 0, 2, GPIO_PULL_UP | GPIO_INT_BOTH, power_button_interrupt) /* Power button */ -GPIO(LID_OPEN, 3, 3, GPIO_PULL_DOWN | GPIO_INT_BOTH, lid_interrupt) /* Lid switch */ -GPIO(ENTERING_RW, 3, 6, GPIO_OUT_LOW, NULL) /* Indicate when EC is entering RW code */ -GPIO(PCH_WAKE_L, 5, 0, GPIO_OUT_HIGH, NULL) /* Wake signal output to PCH */ +GPIO_INT(POWER_BUTTON_L, 0, 2, GPIO_PULL_UP | GPIO_INT_BOTH, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, 3, 3, GPIO_PULL_DOWN | GPIO_INT_BOTH, lid_interrupt) /* Lid switch */ + +GPIO(ENTERING_RW, 3, 6, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_WAKE_L, 5, 0, GPIO_OUT_HIGH) /* Wake signal output to PCH */ /* Used for module testing */ -GPIO(PGOOD_FAN, C, 7, GPIO_PULL_UP | GPIO_INPUT, NULL) /* Power Good for FAN test */ -GPIO(SPI_CS_L, A, 5, GPIO_OUT_HIGH, NULL) /* SPI_CS Ready, Low Active. */ +GPIO(PGOOD_FAN, C, 7, GPIO_PULL_UP | GPIO_INPUT) /* Power Good for FAN test */ +GPIO(SPI_CS_L, A, 5, GPIO_OUT_HIGH) /* SPI_CS Ready, Low Active. */ /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, B, 5, GPIO_INPUT, NULL) -GPIO(MASTER_I2C_SDA, B, 4, GPIO_INPUT, NULL) +GPIO(MASTER_I2C_SCL, B, 5, GPIO_INPUT) +GPIO(MASTER_I2C_SDA, B, 4, GPIO_INPUT) /* Used for board version command */ -GPIO(BOARD_VERSION1, 6, 4, GPIO_INPUT, NULL) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, 6, 5, GPIO_INPUT, NULL) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, 6, 6, GPIO_INPUT, NULL) /* Board version stuffing resistor 3 */ +GPIO(BOARD_VERSION1, 6, 4, GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, 6, 5, GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, 6, 6, GPIO_INPUT) /* Board version stuffing resistor 3 */ #ifdef CONFIG_KEYBOARD_COL2_INVERTED -GPIO(KBD_KSO2, 1, 7, GPIO_OUT_LOW, NULL) /* Negative edge triggered keyboard irq. */ +GPIO(KBD_KSO2, 1, 7, GPIO_OUT_LOW) /* Negative edge triggered keyboard irq. */ #endif /* Alternate pins for UART/I2C/ADC/SPI/PWM/MFT */ ALTERNATE(1, 0x03, 1, MODULE_UART, 0) /* CR_SIN/SOUT GPIO10/11 */ |