diff options
author | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2021-03-22 10:40:51 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-03-28 16:05:02 +0000 |
commit | a603e443eb66e2454d7776ebc6684f4dd8a290ab (patch) | |
tree | ce9e671034141fc2ed3a663c57a4743015b24863 /src/soc/intel/common/block/gpio | |
parent | 5b90c0f158ffa295cc03b7d846cd600ee47c34fa (diff) |
soc/intel/common/gpio: Add function to get GPIO index in group
The gpio_get_index_in_group function returns the index of the GPIO
within its own group
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Change-Id: I7f6b312bd1d0388ef799cd127c88b17bad6a3886
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51647
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/soc/intel/common/block/gpio')
-rw-r--r-- | src/soc/intel/common/block/gpio/gpio.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/gpio/gpio.c b/src/soc/intel/common/block/gpio/gpio.c index 417dfb88b2..ca30fb5dc3 100644 --- a/src/soc/intel/common/block/gpio/gpio.c +++ b/src/soc/intel/common/block/gpio/gpio.c @@ -668,3 +668,13 @@ void gpio_pm_configure(const uint8_t *misccfg_pm_values, size_t num) pcr_rmw8(comm->port, GPIO_MISCCFG, misccfg_pm_mask, misccfg_pm_values[i]); } + +size_t gpio_get_index_in_group(gpio_t pad) +{ + const struct pad_community *comm; + size_t pin; + + comm = gpio_get_community(pad); + pin = relative_pad_in_comm(comm, pad); + return gpio_within_group(comm, pin); +} |