Skip to content

Commit 8206650

Browse files
shramamoorthyBartosz Golaszewski
authored andcommitted
gpio: tps65219: Update _IDX & _OFFSET macro prefix
TPS65215 and TPS65219 are overlapping PMIC devices. While their regulator features differe, the GPIO features are the same. In the TPS65219 MFD driver, the 2 PMICs share the same "tps65219-gpio" compatible string to limit support for TPS65215 in this GPIO driver to comments. The TPS6521X_GPIO0_IDX and TPS6521X_GPIO0_OFFSET macro name prefixes are updated to indicate these macros apply to both PMICs. Reviewed-by: Roger Quadros <rogerq@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Jonathan Cormier <jcormier@criticallink.com> Signed-off-by: Shree Ramamoorthy <s-ramamoorthy@ti.com> Link: https://lore.kernel.org/r/20250722181609.1541739-2-s-ramamoorthy@ti.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent 5607f5e commit 8206650

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

drivers/gpio/gpio-tps65219.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* GPIO driver for TI TPS65219 PMICs
3+
* GPIO driver for TI TPS65215/TPS65219 PMICs
44
*
5-
* Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com/
5+
* Copyright (C) 2022, 2025 Texas Instruments Incorporated - http://www.ti.com/
66
*/
77

88
#include <linux/bits.h>
@@ -13,8 +13,15 @@
1313
#include <linux/regmap.h>
1414

1515
#define TPS65219_GPIO0_DIR_MASK BIT(3)
16-
#define TPS65219_GPIO0_OFFSET 2
17-
#define TPS65219_GPIO0_IDX 0
16+
#define TPS6521X_GPIO0_OFFSET 2
17+
#define TPS6521X_GPIO0_IDX 0
18+
19+
/*
20+
* TPS65215 & TPS65219 GPIO mapping
21+
* Linux gpio offset 0 -> GPIO (pin16) -> bit_offset 2
22+
* Linux gpio offset 1 -> GPO1 (pin8 ) -> bit_offset 0
23+
* Linux gpio offset 2 -> GPO2 (pin17) -> bit_offset 1
24+
*/
1825

1926
struct tps65219_gpio {
2027
struct gpio_chip gpio_chip;
@@ -26,7 +33,7 @@ static int tps65219_gpio_get_direction(struct gpio_chip *gc, unsigned int offset
2633
struct tps65219_gpio *gpio = gpiochip_get_data(gc);
2734
int ret, val;
2835

29-
if (offset != TPS65219_GPIO0_IDX)
36+
if (offset != TPS6521X_GPIO0_IDX)
3037
return GPIO_LINE_DIRECTION_OUT;
3138

3239
ret = regmap_read(gpio->tps->regmap, TPS65219_REG_MFP_1_CONFIG, &val);
@@ -42,7 +49,7 @@ static int tps65219_gpio_get(struct gpio_chip *gc, unsigned int offset)
4249
struct device *dev = gpio->tps->dev;
4350
int ret, val;
4451

45-
if (offset != TPS65219_GPIO0_IDX) {
52+
if (offset != TPS6521X_GPIO0_IDX) {
4653
dev_err(dev, "GPIO%d is output only, cannot get\n", offset);
4754
return -ENOTSUPP;
4855
}
@@ -70,7 +77,7 @@ static int tps65219_gpio_set(struct gpio_chip *gc, unsigned int offset, int valu
7077
struct tps65219_gpio *gpio = gpiochip_get_data(gc);
7178
int v, mask, bit;
7279

73-
bit = (offset == TPS65219_GPIO0_IDX) ? TPS65219_GPIO0_OFFSET : offset - 1;
80+
bit = (offset == TPS6521X_GPIO0_IDX) ? TPS6521X_GPIO0_OFFSET : offset - 1;
7481

7582
mask = BIT(bit);
7683
v = value ? mask : 0;
@@ -116,7 +123,7 @@ static int tps65219_gpio_direction_input(struct gpio_chip *gc, unsigned int offs
116123
struct tps65219_gpio *gpio = gpiochip_get_data(gc);
117124
struct device *dev = gpio->tps->dev;
118125

119-
if (offset != TPS65219_GPIO0_IDX) {
126+
if (offset != TPS6521X_GPIO0_IDX) {
120127
dev_err(dev, "GPIO%d is output only, cannot change to input\n", offset);
121128
return -ENOTSUPP;
122129
}
@@ -130,7 +137,7 @@ static int tps65219_gpio_direction_input(struct gpio_chip *gc, unsigned int offs
130137
static int tps65219_gpio_direction_output(struct gpio_chip *gc, unsigned int offset, int value)
131138
{
132139
tps65219_gpio_set(gc, offset, value);
133-
if (offset != TPS65219_GPIO0_IDX)
140+
if (offset != TPS6521X_GPIO0_IDX)
134141
return 0;
135142

136143
if (tps65219_gpio_get_direction(gc, offset) == GPIO_LINE_DIRECTION_OUT)
@@ -178,5 +185,5 @@ module_platform_driver(tps65219_gpio_driver);
178185

179186
MODULE_ALIAS("platform:tps65219-gpio");
180187
MODULE_AUTHOR("Jonathan Cormier <jcormier@criticallink.com>");
181-
MODULE_DESCRIPTION("TPS65219 GPIO driver");
188+
MODULE_DESCRIPTION("TPS65215/TPS65219 GPIO driver");
182189
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)