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:
Emmanuel Vadot 2021-05-16 14:47:16 +02:00
parent af2253f61c
commit bc1bb80564

View file

@ -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);