diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 12:32:01 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-17 12:32:01 -0800 |
commit | 58cf279acac3080ce03eeea5ca268210b3165fe1 (patch) | |
tree | 54997706fbfea2cd9fd4c4044edbd8ecdc154dfb /drivers/pinctrl/samsung | |
parent | 6606b342febfd470b4a33acb73e360eeaca1d9bb (diff) | |
parent | c474e348778bdf5b453a2cdff4b2b1f9e000f343 (diff) | |
download | linux-58cf279acac3080ce03eeea5ca268210b3165fe1.tar.bz2 |
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/samsung')
-rw-r--r-- | drivers/pinctrl/samsung/pinctrl-exynos.c | 3 | ||||
-rw-r--r-- | drivers/pinctrl/samsung/pinctrl-exynos5440.c | 16 | ||||
-rw-r--r-- | drivers/pinctrl/samsung/pinctrl-samsung.c | 17 |
3 files changed, 16 insertions, 20 deletions
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 16e2293cc2bc..051b5bf701a8 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -176,7 +176,8 @@ static int exynos_irq_request_resources(struct irq_data *irqd) ret = gpiochip_lock_as_irq(&bank->gpio_chip, irqd->hwirq); if (ret) { - dev_err(bank->gpio_chip.dev, "unable to lock pin %s-%lu IRQ\n", + dev_err(bank->gpio_chip.parent, + "unable to lock pin %s-%lu IRQ\n", bank->name, irqd->hwirq); return ret; } diff --git a/drivers/pinctrl/samsung/pinctrl-exynos5440.c b/drivers/pinctrl/samsung/pinctrl-exynos5440.c index 82dc109f7ed4..00ab63abf1d9 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos5440.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos5440.c @@ -15,7 +15,7 @@ #include <linux/io.h> #include <linux/slab.h> #include <linux/err.h> -#include <linux/gpio.h> +#include <linux/gpio/driver.h> #include <linux/device.h> #include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> @@ -539,7 +539,7 @@ static const struct pinconf_ops exynos5440_pinconf_ops = { /* gpiolib gpio_set callback function */ static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->dev); + struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc); void __iomem *base = priv->reg_base; u32 data; @@ -553,7 +553,7 @@ static void exynos5440_gpio_set(struct gpio_chip *gc, unsigned offset, int value /* gpiolib gpio_get callback function */ static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->dev); + struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc); void __iomem *base = priv->reg_base; u32 data; @@ -566,7 +566,7 @@ static int exynos5440_gpio_get(struct gpio_chip *gc, unsigned offset) /* gpiolib gpio_direction_input callback function */ static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset) { - struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->dev); + struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc); void __iomem *base = priv->reg_base; u32 data; @@ -586,7 +586,7 @@ static int exynos5440_gpio_direction_input(struct gpio_chip *gc, unsigned offset static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->dev); + struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc); void __iomem *base = priv->reg_base; u32 data; @@ -607,7 +607,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse /* gpiolib gpio_to_irq callback function */ static int exynos5440_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->dev); + struct exynos5440_pinctrl_priv_data *priv = gpiochip_get_data(gc); unsigned int virq; if (offset < 16 || offset > 23) @@ -817,7 +817,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev, priv->gc = gc; gc->base = 0; gc->ngpio = EXYNOS5440_MAX_PINS; - gc->dev = &pdev->dev; + gc->parent = &pdev->dev; gc->set = exynos5440_gpio_set; gc->get = exynos5440_gpio_get; gc->direction_input = exynos5440_gpio_direction_input; @@ -825,7 +825,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev, gc->to_irq = exynos5440_gpio_to_irq; gc->label = "gpiolib-exynos5440"; gc->owner = THIS_MODULE; - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, priv); if (ret) { dev_err(&pdev->dev, "failed to register gpio_chip %s, error " "code: %d\n", gc->label, ret); diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 48294e7449a4..f67b1e958589 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -50,11 +50,6 @@ static LIST_HEAD(drvdata_list); static unsigned int pin_base; -static inline struct samsung_pin_bank *gc_to_pin_bank(struct gpio_chip *gc) -{ - return container_of(gc, struct samsung_pin_bank, gpio_chip); -} - static int samsung_get_group_count(struct pinctrl_dev *pctldev) { struct samsung_pinctrl_drv_data *pmx = pinctrl_dev_get_drvdata(pctldev); @@ -522,7 +517,7 @@ static const struct pinconf_ops samsung_pinconf_ops = { /* gpiolib gpio_set callback function */ static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + struct samsung_pin_bank *bank = gpiochip_get_data(gc); const struct samsung_pin_bank_type *type = bank->type; unsigned long flags; void __iomem *reg; @@ -546,7 +541,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) { void __iomem *reg; u32 data; - struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + struct samsung_pin_bank *bank = gpiochip_get_data(gc); const struct samsung_pin_bank_type *type = bank->type; reg = bank->drvdata->virt_base + bank->pctl_offset; @@ -571,7 +566,7 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc, u32 data, mask, shift; unsigned long flags; - bank = gc_to_pin_bank(gc); + bank = gpiochip_get_data(gc); type = bank->type; drvdata = bank->drvdata; @@ -619,7 +614,7 @@ static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset, */ static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + struct samsung_pin_bank *bank = gpiochip_get_data(gc); unsigned int virq; if (!bank->irq_domain) @@ -914,11 +909,11 @@ static int samsung_gpiolib_register(struct platform_device *pdev, gc = &bank->gpio_chip; gc->base = drvdata->pin_base + bank->pin_base; gc->ngpio = bank->nr_pins; - gc->dev = &pdev->dev; + gc->parent = &pdev->dev; gc->of_node = bank->of_node; gc->label = bank->name; - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, bank); if (ret) { dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n", gc->label, ret); |