Skip to content

Commit 3b5e159

Browse files
committed
Merge tag 'gpio-fixes-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix bitops logic in gpio-vf610 - return an error if the user tries to use inverted polarity in gpio-mvebu * tag 'gpio-fixes-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: mvebu/pwm: Refuse requests with inverted polarity gpio: gpio-vf610: do not touch other bits when set the target bit
2 parents 317de3d + 3ecb101 commit 3b5e159

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/gpio/gpio-mvebu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,9 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
707707
unsigned long flags;
708708
unsigned int on, off;
709709

710+
if (state->polarity != PWM_POLARITY_NORMAL)
711+
return -EINVAL;
712+
710713
val = (unsigned long long) mvpwm->clk_rate * state->duty_cycle;
711714
do_div(val, NSEC_PER_SEC);
712715
if (val > UINT_MAX + 1ULL)

drivers/gpio/gpio-vf610.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
125125
{
126126
struct vf610_gpio_port *port = gpiochip_get_data(chip);
127127
unsigned long mask = BIT(gpio);
128+
u32 val;
128129

129-
if (port->sdata && port->sdata->have_paddr)
130-
vf610_gpio_writel(mask, port->gpio_base + GPIO_PDDR);
130+
if (port->sdata && port->sdata->have_paddr) {
131+
val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR);
132+
val |= mask;
133+
vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
134+
}
131135

132136
vf610_gpio_set(chip, gpio, value);
133137

0 commit comments

Comments
 (0)