mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
gpio: bcm-kona: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. Convert the driver to using them. Link: https://lore.kernel.org/r/20250310-gpiochip-set-conversion-v1-2-03798bb833eb@linaro.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
cd7d117a29
commit
d5cc72803b
|
|
@ -149,7 +149,8 @@ static int bcm_kona_gpio_get_dir(struct gpio_chip *chip, unsigned gpio)
|
|||
return val ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
|
||||
}
|
||||
|
||||
static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
|
||||
static int bcm_kona_gpio_set(struct gpio_chip *chip, unsigned int gpio,
|
||||
int value)
|
||||
{
|
||||
struct bcm_kona_gpio *kona_gpio;
|
||||
void __iomem *reg_base;
|
||||
|
|
@ -164,13 +165,15 @@ static void bcm_kona_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
|
|||
|
||||
/* this function only applies to output pin */
|
||||
if (bcm_kona_gpio_get_dir(chip, gpio) == GPIO_LINE_DIRECTION_IN)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
reg_offset = value ? GPIO_OUT_SET(bank_id) : GPIO_OUT_CLEAR(bank_id);
|
||||
|
||||
val = readl(reg_base + reg_offset);
|
||||
val |= BIT(bit);
|
||||
writel(val, reg_base + reg_offset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm_kona_gpio_get(struct gpio_chip *chip, unsigned gpio)
|
||||
|
|
@ -336,7 +339,7 @@ static const struct gpio_chip template_chip = {
|
|||
.direction_input = bcm_kona_gpio_direction_input,
|
||||
.get = bcm_kona_gpio_get,
|
||||
.direction_output = bcm_kona_gpio_direction_output,
|
||||
.set = bcm_kona_gpio_set,
|
||||
.set_rv = bcm_kona_gpio_set,
|
||||
.set_config = bcm_kona_gpio_set_config,
|
||||
.to_irq = bcm_kona_gpio_to_irq,
|
||||
.base = 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user