summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/spear
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-17 15:32:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-17 15:32:01 -0500
commit58cf279acac3080ce03eeea5ca268210b3165fe1 (patch)
tree54997706fbfea2cd9fd4c4044edbd8ecdc154dfb /drivers/pinctrl/spear
parent6606b342febfd470b4a33acb73e360eeaca1d9bb (diff)
parentc474e348778bdf5b453a2cdff4b2b1f9e000f343 (diff)
Merge tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "Here is the bulk of GPIO changes for v4.5. Notably there are big refactorings mostly by myself, aimed at getting the gpio_chip into a shape that makes me believe I can proceed to preserve state for a proper userspace ABI (character device) that has already been proposed once, but resulted in the feedback that I need to go back and restructure stuff. So I've been restructuring stuff. On the way I ran into brokenness (return code from the get_value() callback) and had to fix it. Also, refactored generic GPIO to be simpler. Some of that is still waiting to trickle down from the subsystems all over the kernel that provide random gpio_chips, I've touched every single GPIO driver in the kernel now, oh man I didn't know I was responsible for so much... Apart from that we're churning along as usual. I took some effort to test and retest so it should merge nicely and we shook out a couple of bugs in -next. Infrastructural changes: - In struct gpio_chip, rename the .dev node to .parent to better reflect the fact that this is not the GPIO struct device abstraction. We will add that soon so this would be totallt confusing. - It was noted that the driver .get_value() callbacks was sometimes reporting negative -ERR values to the gpiolib core, expecting them to be propagated to consumer gpiod_get_value() and gpio_get_value() calls. This was not happening, so as there was a mess of drivers returning negative errors and some returning "anything else than zero" to indicate that a line was active. As some would have bit 31 set to indicate "line active" it clashed with negative error codes. This is fixed by the largeish series clamping values in all drivers with !!value to [0,1] and then augmenting the code to propagate error codes to consumers. (Includes some ACKed patches in other subsystems.) - Add a void *data pointer to struct gpio_chip. The container_of() design pattern is indeed very nice, but we want to reform the struct gpio_chip to be a non-volative, stateless business, and keep states internal to the gpiolib to be able to hold on to the state when adding a proper userspace ABI (character device) further down the road. To achieve this, drivers need a handle at the internal state that is not dependent on their struct gpio_chip() so we add gpiochip_add_data() and gpiochip_get_data() following the pattern of many other subsystems. All the "use gpiochip data pointer" patches transforms drivers to this scheme. - The Generic GPIO chip header has been merged into the general <linux/gpio/driver.h> header, and the custom header for that removed. Instead of having a separate mm_gpio_chip struct for these generic drivers, merge that into struct gpio_chip, simplifying the code and removing the need for separate and confusing includes. Misc improvements: - Stabilize the way GPIOs are looked up from the ACPI legacy specification. - Incremental driver features for PXA, PCA953X, Lantiq (patches from the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48 New drivers: - Add a GPIO chip to the ALSA SoC AC97 driver. - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but the branch is merged here too to account for infrastructural changes). - The sx150x driver now supports the sx1502" * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits) gpio: generic: make bgpio_pdata always visible gpiolib: fix chip order in gpio list gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs() gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs() gpio: brcmstb: Allow building driver for BMIPS_GENERIC gpio: brcmstb: Set endian flags for big-endian MIPS gpio: moxart: fix build regression gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() leds: pca9532: use gpiochip data pointer leds: tca6507: use gpiochip data pointer hid: cp2112: use gpiochip data pointer bcma: gpio: use gpiochip data pointer avr32: gpio: use gpiochip data pointer video: fbdev: via: use gpiochip data pointer gpio: pch: Optimize pch_gpio_get() Revert "pinctrl: lantiq: Implement gpio_chip.to_irq" pinctrl: nsp-gpio: use gpiochip data pointer pinctrl: vt8500-wmt: use gpiochip data pointer pinctrl: exynos5440: use gpiochip data pointer pinctrl: at91-pio4: use gpiochip data pointer ...
Diffstat (limited to 'drivers/pinctrl/spear')
-rw-r--r--drivers/pinctrl/spear/pinctrl-plgpio.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 1f0af250dbb5..4c9b863f8267 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -107,7 +107,7 @@ static inline void plgpio_reg_reset(void __iomem *base, u32 pin, u32 reg)
107/* gpio framework specific routines */ 107/* gpio framework specific routines */
108static int plgpio_direction_input(struct gpio_chip *chip, unsigned offset) 108static int plgpio_direction_input(struct gpio_chip *chip, unsigned offset)
109{ 109{
110 struct plgpio *plgpio = container_of(chip, struct plgpio, chip); 110 struct plgpio *plgpio = gpiochip_get_data(chip);
111 unsigned long flags; 111 unsigned long flags;
112 112
113 /* get correct offset for "offset" pin */ 113 /* get correct offset for "offset" pin */
@@ -127,7 +127,7 @@ static int plgpio_direction_input(struct gpio_chip *chip, unsigned offset)
127static int plgpio_direction_output(struct gpio_chip *chip, unsigned offset, 127static int plgpio_direction_output(struct gpio_chip *chip, unsigned offset,
128 int value) 128 int value)
129{ 129{
130 struct plgpio *plgpio = container_of(chip, struct plgpio, chip); 130 struct plgpio *plgpio = gpiochip_get_data(chip);
131 unsigned long flags; 131 unsigned long flags;
132 unsigned dir_offset = offset, wdata_offset = offset, tmp; 132 unsigned dir_offset = offset, wdata_offset = offset, tmp;
133 133
@@ -159,7 +159,7 @@ static int plgpio_direction_output(struct gpio_chip *chip, unsigned offset,
159 159
160static int plgpio_get_value(struct gpio_chip *chip, unsigned offset) 160static int plgpio_get_value(struct gpio_chip *chip, unsigned offset)
161{ 161{
162 struct plgpio *plgpio = container_of(chip, struct plgpio, chip); 162 struct plgpio *plgpio = gpiochip_get_data(chip);
163 163
164 if (offset >= chip->ngpio) 164 if (offset >= chip->ngpio)
165 return -EINVAL; 165 return -EINVAL;
@@ -176,7 +176,7 @@ static int plgpio_get_value(struct gpio_chip *chip, unsigned offset)
176 176
177static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value) 177static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
178{ 178{
179 struct plgpio *plgpio = container_of(chip, struct plgpio, chip); 179 struct plgpio *plgpio = gpiochip_get_data(chip);
180 180
181 if (offset >= chip->ngpio) 181 if (offset >= chip->ngpio)
182 return; 182 return;
@@ -196,7 +196,7 @@ static void plgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
196 196
197static int plgpio_request(struct gpio_chip *chip, unsigned offset) 197static int plgpio_request(struct gpio_chip *chip, unsigned offset)
198{ 198{
199 struct plgpio *plgpio = container_of(chip, struct plgpio, chip); 199 struct plgpio *plgpio = gpiochip_get_data(chip);
200 int gpio = chip->base + offset; 200 int gpio = chip->base + offset;
201 unsigned long flags; 201 unsigned long flags;
202 int ret = 0; 202 int ret = 0;
@@ -248,7 +248,7 @@ err0:
248 248
249static void plgpio_free(struct gpio_chip *chip, unsigned offset) 249static void plgpio_free(struct gpio_chip *chip, unsigned offset)
250{ 250{
251 struct plgpio *plgpio = container_of(chip, struct plgpio, chip); 251 struct plgpio *plgpio = gpiochip_get_data(chip);
252 int gpio = chip->base + offset; 252 int gpio = chip->base + offset;
253 unsigned long flags; 253 unsigned long flags;
254 254
@@ -280,7 +280,7 @@ disable_clk:
280static void plgpio_irq_disable(struct irq_data *d) 280static void plgpio_irq_disable(struct irq_data *d)
281{ 281{
282 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 282 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
283 struct plgpio *plgpio = container_of(gc, struct plgpio, chip); 283 struct plgpio *plgpio = gpiochip_get_data(gc);
284 int offset = d->hwirq; 284 int offset = d->hwirq;
285 unsigned long flags; 285 unsigned long flags;
286 286
@@ -299,7 +299,7 @@ static void plgpio_irq_disable(struct irq_data *d)
299static void plgpio_irq_enable(struct irq_data *d) 299static void plgpio_irq_enable(struct irq_data *d)
300{ 300{
301 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 301 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
302 struct plgpio *plgpio = container_of(gc, struct plgpio, chip); 302 struct plgpio *plgpio = gpiochip_get_data(gc);
303 int offset = d->hwirq; 303 int offset = d->hwirq;
304 unsigned long flags; 304 unsigned long flags;
305 305
@@ -318,7 +318,7 @@ static void plgpio_irq_enable(struct irq_data *d)
318static int plgpio_irq_set_type(struct irq_data *d, unsigned trigger) 318static int plgpio_irq_set_type(struct irq_data *d, unsigned trigger)
319{ 319{
320 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 320 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
321 struct plgpio *plgpio = container_of(gc, struct plgpio, chip); 321 struct plgpio *plgpio = gpiochip_get_data(gc);
322 int offset = d->hwirq; 322 int offset = d->hwirq;
323 void __iomem *reg_off; 323 void __iomem *reg_off;
324 unsigned int supported_type = 0, val; 324 unsigned int supported_type = 0, val;
@@ -359,7 +359,7 @@ static struct irq_chip plgpio_irqchip = {
359static void plgpio_irq_handler(struct irq_desc *desc) 359static void plgpio_irq_handler(struct irq_desc *desc)
360{ 360{
361 struct gpio_chip *gc = irq_desc_get_handler_data(desc); 361 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
362 struct plgpio *plgpio = container_of(gc, struct plgpio, chip); 362 struct plgpio *plgpio = gpiochip_get_data(gc);
363 struct irq_chip *irqchip = irq_desc_get_chip(desc); 363 struct irq_chip *irqchip = irq_desc_get_chip(desc);
364 int regs_count, count, pin, offset, i = 0; 364 int regs_count, count, pin, offset, i = 0;
365 unsigned long pending; 365 unsigned long pending;
@@ -561,7 +561,7 @@ static int plgpio_probe(struct platform_device *pdev)
561 plgpio->chip.get = plgpio_get_value; 561 plgpio->chip.get = plgpio_get_value;
562 plgpio->chip.set = plgpio_set_value; 562 plgpio->chip.set = plgpio_set_value;
563 plgpio->chip.label = dev_name(&pdev->dev); 563 plgpio->chip.label = dev_name(&pdev->dev);
564 plgpio->chip.dev = &pdev->dev; 564 plgpio->chip.parent = &pdev->dev;
565 plgpio->chip.owner = THIS_MODULE; 565 plgpio->chip.owner = THIS_MODULE;
566 plgpio->chip.of_node = pdev->dev.of_node; 566 plgpio->chip.of_node = pdev->dev.of_node;
567 567
@@ -573,7 +573,7 @@ static int plgpio_probe(struct platform_device *pdev)
573 } 573 }
574 } 574 }
575 575
576 ret = gpiochip_add(&plgpio->chip); 576 ret = gpiochip_add_data(&plgpio->chip, plgpio);
577 if (ret) { 577 if (ret) {
578 dev_err(&pdev->dev, "unable to add gpio chip\n"); 578 dev_err(&pdev->dev, "unable to add gpio chip\n");
579 goto unprepare_clk; 579 goto unprepare_clk;