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 /include/gpio.wrap | |
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 'include/gpio.wrap')
-rw-r--r-- | include/gpio.wrap | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/include/gpio.wrap b/include/gpio.wrap index cf4fbb319a..1eb9f3643e 100644 --- a/include/gpio.wrap +++ b/include/gpio.wrap @@ -8,15 +8,26 @@ /* * The GPIO macro is used to define a new GPIO pin name and function. * - * The name is used to populate the gpio_signal enum by first prepending GPIO_ - * to the name. It is also used to construct the string name that is presented - * in the shell interface. Similarly, the port parameter has GPIO_ prepended to - * it before it is used to initialize the port base address of a gpio_info - * struct. The pin number is used to create a bitmask. The flags and signal - * parameters are passed on to the gpio_info directly. + * The name is used to populate the gpio_signal enum by first + * prepending GPIO_ to the name. It is also used to construct the + * string name that is presented in the shell interface. Similarly, + * the port parameter has GPIO_ prepended to it before it is used to + * initialize the port base address of a gpio_info struct. The pin + * number is used to create a bitmask. The flags parameter is passed + * on to the gpio_info directly. */ #ifndef GPIO -#define GPIO(name, port, pin, flags, signal) +#define GPIO(name, port, pin, flags) +#endif + +/* + * The GPIO_INT macro is used to define a GPIOs that have an IRQ handler. + * + * The IRQ handler pointers are stored as elements in the gpio_irq_handlers + * array. + */ +#ifndef GPIO_INT +#define GPIO_INT(name, port, pin, flags, signal) #endif /* @@ -61,5 +72,6 @@ * Once the gpio.inc file has been included these macros are no longer needed. */ #undef GPIO +#undef GPIO_INT #undef ALTERNATE #undef UNIMPLEMENTED |