2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 06:34:11 +08:00

gpio fixes for v5.5-rc2

- fix gpio-xtensa build failure
 - fix a regression in gpio-mockup
 - fix a gcc warning in gpio-aspeed
 - fix a section mismatch problem in xgs-iproc
 - fix a problem with emulated open-drain outputs in gpiolib core
 - switch to bitops in gpio-pca953x after converting the driver to
   using bitmap
 - add a missed file to MAINTAINERS entry
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl3zYMcACgkQEacuoBRx
 13K7ww/+IYdVcK6rL8i+ETS1PeABZQ8LOjmwKyCi3P5PfjzV8sdNf9JOEoxFpNTE
 Uj0zSdchnaxD8foQC/ykuL5X+yIuw/eImXd+KvRrToNW8XhQ2anNkXER6jLZc2Ie
 4GxZa8ktmguu2935wAYXv9CbXj0uFkeKGpt64WgM8/UD2qi2U6NLPuMU549tEwDg
 kVRxCD21boVBsYZRdIcUh4NNZWK6KZfvkw+j9+573T441zks8UU6gb7D82O6YaQs
 8iqu8ZQhG4lQXHuY1eD4lHptmzGZqG40inPp+TR5cEhp4KUJrvgZYTeFYav18kyn
 AvYPn71HKoV3XiaYlsQ5Pvnorq+24QGZX2ylxU/gCu4YfLBrBVxbrk8IbEBIdwkh
 PiIuADn2VGzbT024D7/wQelhvcgee2+w8uWEa8woYCbjI+DwPVpaRlCJaXrHnBVO
 Z0B+mblD7bnDTuMWPluqC4slmnJbweKSIRjBkEzBXLRJPq6Lc4uo47Unf4CefElX
 36OkeZHOPgs7RDTj038VKjIKba0qbEuoEkDvNZ8CBVAakDfrECGOCqTkGf5hEAZ7
 dZXY/cSbkeCnp8aADyCgZ2pRoX7gAklSaPOPf4mX30XCuMG7di27w5DXQXCML/3k
 sPj9CF+3B7j5oXxyeookzfLKq+FH5x6iOBa35uPr3abh9HiLS7k=
 =dqqa
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v5.5-rc2-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes

gpio fixes for v5.5-rc2

- fix gpio-xtensa build failure
- fix a regression in gpio-mockup
- fix a gcc warning in gpio-aspeed
- fix a section mismatch problem in xgs-iproc
- fix a problem with emulated open-drain outputs in gpiolib core
- switch to bitops in gpio-pca953x after converting the driver to
  using bitmap
- add a missed file to MAINTAINERS entry
This commit is contained in:
Linus Walleij 2019-12-13 14:24:41 +01:00
commit 279b1fed09
7 changed files with 29 additions and 24 deletions

View File

@ -7031,6 +7031,7 @@ L: linux-acpi@vger.kernel.org
S: Maintained
F: Documentation/firmware-guide/acpi/gpio-properties.rst
F: drivers/gpio/gpiolib-acpi.c
F: drivers/gpio/gpiolib-acpi.h
GPIO IR Transmitter
M: Sean Young <sean@mess.org>

View File

@ -107,7 +107,7 @@ static void __iomem *bank_reg(struct aspeed_sgpio *gpio,
return gpio->base + bank->irq_regs + GPIO_IRQ_STATUS;
default:
/* acturally if code runs to here, it's an error case */
BUG_ON(1);
BUG();
}
}

View File

@ -226,7 +226,7 @@ static int gpio_mockup_get_direction(struct gpio_chip *gc, unsigned int offset)
int direction;
mutex_lock(&chip->lock);
direction = !chip->lines[offset].dir;
direction = chip->lines[offset].dir;
mutex_unlock(&chip->lock);
return direction;
@ -395,7 +395,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
struct gpio_chip *gc;
struct device *dev;
const char *name;
int rv, base;
int rv, base, i;
u16 ngpio;
dev = &pdev->dev;
@ -447,6 +447,9 @@ static int gpio_mockup_probe(struct platform_device *pdev)
if (!chip->lines)
return -ENOMEM;
for (i = 0; i < gc->ngpio; i++)
chip->lines[i].dir = GPIO_LINE_DIRECTION_IN;
if (device_property_read_bool(dev, "named-gpio-lines")) {
rv = gpio_mockup_name_lines(dev, chip);
if (rv)

View File

@ -568,16 +568,18 @@ static void pca953x_irq_mask(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct pca953x_chip *chip = gpiochip_get_data(gc);
irq_hw_number_t hwirq = irqd_to_hwirq(d);
chip->irq_mask[d->hwirq / BANK_SZ] &= ~BIT(d->hwirq % BANK_SZ);
clear_bit(hwirq, chip->irq_mask);
}
static void pca953x_irq_unmask(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct pca953x_chip *chip = gpiochip_get_data(gc);
irq_hw_number_t hwirq = irqd_to_hwirq(d);
chip->irq_mask[d->hwirq / BANK_SZ] |= BIT(d->hwirq % BANK_SZ);
set_bit(hwirq, chip->irq_mask);
}
static int pca953x_irq_set_wake(struct irq_data *d, unsigned int on)
@ -635,8 +637,7 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct pca953x_chip *chip = gpiochip_get_data(gc);
int bank_nb = d->hwirq / BANK_SZ;
u8 mask = BIT(d->hwirq % BANK_SZ);
irq_hw_number_t hwirq = irqd_to_hwirq(d);
if (!(type & IRQ_TYPE_EDGE_BOTH)) {
dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
@ -644,15 +645,8 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
return -EINVAL;
}
if (type & IRQ_TYPE_EDGE_FALLING)
chip->irq_trig_fall[bank_nb] |= mask;
else
chip->irq_trig_fall[bank_nb] &= ~mask;
if (type & IRQ_TYPE_EDGE_RISING)
chip->irq_trig_raise[bank_nb] |= mask;
else
chip->irq_trig_raise[bank_nb] &= ~mask;
assign_bit(hwirq, chip->irq_trig_fall, type & IRQ_TYPE_EDGE_FALLING);
assign_bit(hwirq, chip->irq_trig_raise, type & IRQ_TYPE_EDGE_RISING);
return 0;
}
@ -661,10 +655,10 @@ static void pca953x_irq_shutdown(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct pca953x_chip *chip = gpiochip_get_data(gc);
u8 mask = BIT(d->hwirq % BANK_SZ);
irq_hw_number_t hwirq = irqd_to_hwirq(d);
chip->irq_trig_raise[d->hwirq / BANK_SZ] &= ~mask;
chip->irq_trig_fall[d->hwirq / BANK_SZ] &= ~mask;
clear_bit(hwirq, chip->irq_trig_raise);
clear_bit(hwirq, chip->irq_trig_fall);
}
static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pending)

View File

@ -280,7 +280,7 @@ static int iproc_gpio_probe(struct platform_device *pdev)
return 0;
}
static int __exit iproc_gpio_remove(struct platform_device *pdev)
static int iproc_gpio_remove(struct platform_device *pdev)
{
struct iproc_gpio_chip *chip;

View File

@ -44,15 +44,14 @@ static inline unsigned long enable_cp(unsigned long *cpenable)
unsigned long flags;
local_irq_save(flags);
RSR_CPENABLE(*cpenable);
WSR_CPENABLE(*cpenable | BIT(XCHAL_CP_ID_XTIOP));
*cpenable = xtensa_get_sr(cpenable);
xtensa_set_sr(*cpenable | BIT(XCHAL_CP_ID_XTIOP), cpenable);
return flags;
}
static inline void disable_cp(unsigned long flags, unsigned long cpenable)
{
WSR_CPENABLE(cpenable);
xtensa_set_sr(cpenable, cpenable);
local_irq_restore(flags);
}

View File

@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc *desc)
chip = gpiod_to_chip(desc);
offset = gpio_chip_hwgpio(desc);
/*
* Open drain emulation using input mode may incorrectly report
* input here, fix that up.
*/
if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) &&
test_bit(FLAG_IS_OUT, &desc->flags))
return 0;
if (!chip->get_direction)
return -ENOTSUPP;