diff options
author | Simon Glass <sjg@chromium.org> | 2012-06-24 12:00:07 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-02 22:35:52 -0700 |
commit | aa64550a3f01704c1a23aeab057bfb58e96100b7 (patch) | |
tree | 0e0b23d288feff36eb6fb59a850c306439f7846a /include | |
parent | 9a4eff992fa0efdbbe909ed0e635b7139f178948 (diff) | |
download | chrome-ec-aa64550a3f01704c1a23aeab057bfb58e96100b7.tar.gz |
gpio: Add fast access to GPIO level
The current gpio_get_level() is pretty slow because it looks things up each
time. Add a new function to find out the register address and mask to use
to check the value for a particular GPIO.
Time-critical code can then use this to check a GPIO.
BUG=chrome-os-partner:10146
TEST=manual:
build and boot on snow;
Power on the board, hold power button for 10s and see that it powers off
Power control still works, thus GPIOs are functional
Change-Id: Ifc6c56f5cb811e0243e7712725a51948eabd42ab
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26175
Diffstat (limited to 'include')
-rw-r--r-- | include/gpio.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/gpio.h b/include/gpio.h index b70e40f9a1..e03acfb0c9 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -66,6 +66,18 @@ int gpio_pre_init(void); int gpio_get_level(enum gpio_signal signal); /** + * Get faster access to a GPIO level + * + * Use this function to find out the register address and mask for a GPIO + * value. Then you can just check that instead of calling gpio_get_level(). + * + * @param signal Signal to return details for + * @param mask Mask value to use + * @return pointer to register to read to get GPIO value + */ +uint16_t *gpio_get_level_reg(enum gpio_signal signal, uint32_t *mask); + +/** * Returns the name of a given GPIO signal. * * @param signal Signal to return. |