aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
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 /arch/avr32
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 'arch/avr32')
-rw-r--r--arch/avr32/mach-at32ap/pio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 4f61378c3453..5020057ac7a2 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -203,7 +203,7 @@ fail:
203 203
204static int direction_input(struct gpio_chip *chip, unsigned offset) 204static int direction_input(struct gpio_chip *chip, unsigned offset)
205{ 205{
206 struct pio_device *pio = container_of(chip, struct pio_device, chip); 206 struct pio_device *pio = gpiochip_get_data(chip);
207 u32 mask = 1 << offset; 207 u32 mask = 1 << offset;
208 208
209 if (!(pio_readl(pio, PSR) & mask)) 209 if (!(pio_readl(pio, PSR) & mask))
@@ -215,7 +215,7 @@ static int direction_input(struct gpio_chip *chip, unsigned offset)
215 215
216static int gpio_get(struct gpio_chip *chip, unsigned offset) 216static int gpio_get(struct gpio_chip *chip, unsigned offset)
217{ 217{
218 struct pio_device *pio = container_of(chip, struct pio_device, chip); 218 struct pio_device *pio = gpiochip_get_data(chip);
219 219
220 return (pio_readl(pio, PDSR) >> offset) & 1; 220 return (pio_readl(pio, PDSR) >> offset) & 1;
221} 221}
@@ -224,7 +224,7 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value);
224 224
225static int direction_output(struct gpio_chip *chip, unsigned offset, int value) 225static int direction_output(struct gpio_chip *chip, unsigned offset, int value)
226{ 226{
227 struct pio_device *pio = container_of(chip, struct pio_device, chip); 227 struct pio_device *pio = gpiochip_get_data(chip);
228 u32 mask = 1 << offset; 228 u32 mask = 1 << offset;
229 229
230 if (!(pio_readl(pio, PSR) & mask)) 230 if (!(pio_readl(pio, PSR) & mask))
@@ -237,7 +237,7 @@ static int direction_output(struct gpio_chip *chip, unsigned offset, int value)
237 237
238static void gpio_set(struct gpio_chip *chip, unsigned offset, int value) 238static void gpio_set(struct gpio_chip *chip, unsigned offset, int value)
239{ 239{
240 struct pio_device *pio = container_of(chip, struct pio_device, chip); 240 struct pio_device *pio = gpiochip_get_data(chip);
241 u32 mask = 1 << offset; 241 u32 mask = 1 << offset;
242 242
243 if (value) 243 if (value)
@@ -335,7 +335,7 @@ gpio_irq_setup(struct pio_device *pio, int irq, int gpio_irq)
335 */ 335 */
336static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip) 336static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip)
337{ 337{
338 struct pio_device *pio = container_of(chip, struct pio_device, chip); 338 struct pio_device *pio = gpiochip_get_data(chip);
339 u32 psr, osr, imr, pdsr, pusr, ifsr, mdsr; 339 u32 psr, osr, imr, pdsr, pusr, ifsr, mdsr;
340 unsigned i; 340 unsigned i;
341 u32 mask; 341 u32 mask;
@@ -397,7 +397,7 @@ static int __init pio_probe(struct platform_device *pdev)
397 pio->chip.label = pio->name; 397 pio->chip.label = pio->name;
398 pio->chip.base = pdev->id * 32; 398 pio->chip.base = pdev->id * 32;
399 pio->chip.ngpio = 32; 399 pio->chip.ngpio = 32;
400 pio->chip.dev = &pdev->dev; 400 pio->chip.parent = &pdev->dev;
401 pio->chip.owner = THIS_MODULE; 401 pio->chip.owner = THIS_MODULE;
402 402
403 pio->chip.direction_input = direction_input; 403 pio->chip.direction_input = direction_input;
@@ -406,7 +406,7 @@ static int __init pio_probe(struct platform_device *pdev)
406 pio->chip.set = gpio_set; 406 pio->chip.set = gpio_set;
407 pio->chip.dbg_show = pio_bank_show; 407 pio->chip.dbg_show = pio_bank_show;
408 408
409 gpiochip_add(&pio->chip); 409 gpiochip_add_data(&pio->chip, pio);
410 410
411 gpio_irq_setup(pio, irq, gpio_irq_base); 411 gpio_irq_setup(pio, irq, gpio_irq_base);
412 412