[PATCH v5 4/4] gpio: gpio-tps6594: add GPIO support for TPS6594 PMIC

Michael Walle michael at walle.cc
Wed Nov 23 00:40:19 PST 2022


Am 2022-11-23 06:35, schrieb Matt Ranostay:

> +static int tps6594_regmap_xlate(struct gpio_regmap *gpio,
> +				    unsigned int base, unsigned int offset,
> +				    unsigned int *reg, unsigned int *mask)
> +{
> +	if (base == TPS6594_GPIO_CONF) {
> +		*reg = base + offset;
> +		*mask = GPIO_CFG_MASK;
> +	} else {
> +		unsigned int line = offset % GPIO_BANK_SIZE;
> +		unsigned int stride = offset / GPIO_BANK_SIZE;
> +
> +		*reg = base + stride;
> +		*mask = BIT(line);
> +	}

This looks like a duplcate from gpio_regmap_simple_xlate(). Maybe
we can export it and do

if (base == TPS6594_GPIO_CONF) {
	*reg = base + offset;
	*mask = GPIO_CFG_MASK;
} else {
	return gpio_regmap_simple_xlate(gpio, base, offset, reg, mask);
}

Apart from that
Reviewed-by: Michael Walle <michael at walle.cc>

-michael



More information about the linux-arm-kernel mailing list