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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>

-michael



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux