mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
arm64: rockchip: gpio: Give friendlier name to gpio
By default name the gpio P<bank><bankpin> This make it easier to find the gpio when reading schematics or DTS. Sponsored by: Diablotin Systems Differential Revision: https://reviews.freebsd.org/D30287
This commit is contained in:
parent
af2253f61c
commit
bc1bb80564
1 changed files with 4 additions and 1 deletions
|
|
@ -209,14 +209,17 @@ static int
|
|||
rk_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
|
||||
{
|
||||
struct rk_gpio_softc *sc;
|
||||
uint32_t bank;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
if (pin >= 32)
|
||||
return (EINVAL);
|
||||
|
||||
bank = pin / 8;
|
||||
pin = pin - (bank * 8);
|
||||
RK_GPIO_LOCK(sc);
|
||||
snprintf(name, GPIOMAXNAME, "gpio%d", pin);
|
||||
snprintf(name, GPIOMAXNAME, "P%c%d", bank + 'A', pin);
|
||||
RK_GPIO_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue