gpio: fixes for v5.18

- fix bitops logic in gpio-vf610
 - return an error if the user tries to use inverted polarity in gpio-mvebu
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmKHzUoACgkQEacuoBRx
 13LXZQ/9GjDPr4Wgb4jmBvLfiVOGz2DIsWB4Hg0Yurb/rhspCjVt0SicSAx5goty
 ZLNkOxMT0l3vRvmwu+s7CgVq8puqVkwrLc4HgR8K6tX0OGY09B+q0ZnUJ5F1VVUM
 3TFl2OS+zjnkDbTtWijVse8Pa5vAJj6pCNiUIiaLVObsRfo5XPhl8eCZMFYvvrv7
 okKIhgfzI6GKX9IGJTubmxlCl6kp3ovmk2oswXAeQbSdWvb9g64ucqFdnkXuwFfm
 p+y+VtE5XzsCvrgeavE9SQ1Vs2VpVOA5Ls1KKx5ZBjSFdguFturo8NtRt69BviCA
 MYPlLcHH7n5RlV6i7o/11RRNHW2cCoAZqTlCbb+e0wIFGCtKUQEZZbhVzWc1PEhZ
 gRzI2d7ytWW0qfpGmUpwx0+vRImk02F47/+kNvjhjoAmrvPdN7q1BnMllLyly6VX
 usOJVGPmKKolZNT4sds8FVqKQOxhbboya8rp4kU36kmpZ05OFocSquoQ1Yd2YM86
 YVkUS4y7SL91SacIJFDrgs5/V2O6il5Ezp2C86ktXKfgDtKsuTRrKrsUfqFSVS9X
 afRjmk5UGVjjPYy6/cocUEibezBshy6MmQslXDs8pcnVZB1BLPn7PzhKhpQnVgdx
 9yuyb9zHR9qkmltoOXnJnw7T2ED2mUvpKN0KmpOHgVRTHTmY0YQ=
 =cAai
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-05-20 08:26:28 -10:00
commit 3b5e1590a2
2 changed files with 9 additions and 2 deletions

View File

@ -707,6 +707,9 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
unsigned long flags;
unsigned int on, off;
if (state->polarity != PWM_POLARITY_NORMAL)
return -EINVAL;
val = (unsigned long long) mvpwm->clk_rate * state->duty_cycle;
do_div(val, NSEC_PER_SEC);
if (val > UINT_MAX + 1ULL)

View File

@ -125,9 +125,13 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
{
struct vf610_gpio_port *port = gpiochip_get_data(chip);
unsigned long mask = BIT(gpio);
u32 val;
if (port->sdata && port->sdata->have_paddr)
vf610_gpio_writel(mask, port->gpio_base + GPIO_PDDR);
if (port->sdata && port->sdata->have_paddr) {
val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR);
val |= mask;
vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
}
vf610_gpio_set(chip, gpio, value);