22 Aug, 2017

1 commit


21 Apr, 2016

1 commit


18 Jan, 2016

1 commit

  • 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
    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
    ...

    Linus Torvalds
     

05 Jan, 2016

1 commit


11 Dec, 2015

1 commit


17 Oct, 2015

1 commit

  • Replace all trivial request/free callbacks that do nothing but call into
    pinctrl code with the generic versions.

    Signed-off-by: Jonas Gorski
    Acked-by: Bjorn Andersson
    Acked-by: Heiko Stuebner
    Acked-by: Eric Anholt
    Acked-by: Mika Westerberg
    Acked-by: Andrew Bresticker
    Acked-by: Baruch Siach
    Acked-by: Matthias Brugger
    Acked-by: Lee Jones
    Acked-by: Laxman Dewangan
    Acked-by: Maxime Ripard
    Signed-off-by: Linus Walleij

    Jonas Gorski
     

16 Sep, 2015

1 commit

  • Most interrupt flow handlers do not use the irq argument. Those few
    which use it can retrieve the irq number from the irq descriptor.

    Remove the argument.

    Search and replace was done with coccinelle and some extra helper
    scripts around it. Thanks to Julia for her help!

    Signed-off-by: Thomas Gleixner
    Cc: Julia Lawall
    Cc: Jiang Liu

    Thomas Gleixner
     

18 Jul, 2015

1 commit


02 Jul, 2015

1 commit

  • Pull irq fixes from Thomas Gleixner:
    "This contains:

    - a series of fixes for interrupt drivers to prevent a potential race
    when installing a chained interrupt handler

    - a fix for cpumask pointer misuse

    - a fix for using the wrong interrupt number from struct irq_data

    - removal of unused code and outdated comments

    - a few new helper functions which allow us to cleanup the interrupt
    handling code further in 4.3

    I decided against doing the cleanup at the end of this merge window
    and rather do the preparatory steps for 4.3, so we can run the final
    ABI change at the end of the 4.3 merge window with less risk"

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (26 commits)
    ARM/LPC32xx: Use irq not hwirq for __irq_set_handler_locked()
    genirq: Implement irq_set_handler_locked()/irq_set_chip_handler_name_locked()
    genirq: Introduce helper irq_desc_get_irq()
    genirq: Remove irq_node()
    genirq: Clean up outdated comments related to include/linux/irqdesc.h
    mn10300: Fix incorrect use of irq_data->affinity
    MIPS/ralink: Fix race in installing chained IRQ handler
    MIPS/pci: Fix race in installing chained IRQ handler
    MIPS/ath25: Fix race in installing chained IRQ handler
    MIPS/ath25: Fix race in installing chained IRQ handler
    m68k/psc: Fix race in installing chained IRQ handler
    avr32/at32ap: Fix race in installing chained IRQ handler
    sh/intc: Fix race in installing chained IRQ handler
    sh/intc: Fix potential race in installing chained IRQ handler
    pinctrl/sun4i: Fix race in installing chained IRQ handler
    pinctrl/samsung: Fix race in installing chained IRQ handler
    pinctrl/samsung: Fix race in installing chained IRQ handler
    pinctrl/exynos: Fix race in installing chained IRQ handler
    pinctrl/st: Fix race in installing chained IRQ handler
    pinctrl/adi2: Fix race in installing chained IRQ handler
    ...

    Linus Torvalds
     

25 Jun, 2015

1 commit

  • Fix a race where a pending interrupt could be received and the handler
    called before the handler's data has been setup, by converting to
    irq_set_chained_handler_and_data().

    Search and conversion was done with coccinelle:

    @@
    expression E1, E2, E3;
    @@
    (
    -if (irq_set_chained_handler(E1, E3) != 0)
    - BUG();
    |
    -irq_set_chained_handler(E1, E3);
    )
    -irq_set_handler_data(E1, E2);
    +irq_set_chained_handler_and_data(E1, E3, E2);

    @@
    expression E1, E2, E3;
    @@
    (
    -if (irq_set_chained_handler(E1, E3) != 0)
    - BUG();
    ...
    |
    -irq_set_chained_handler(E1, E3);
    ...
    )
    -irq_set_handler_data(E1, E2);
    +irq_set_chained_handler_and_data(E1, E3, E2);

    Reported-by: Russell King
    Signed-off-by: Thomas Gleixner
    Cc: Julia Lawall
    Cc: Linus Walleij
    Cc: linux-gpio@vger.kernel.org

    Thomas Gleixner
     

10 Jun, 2015

1 commit

  • Currently, pinctrl_register() just returns NULL on error, so the
    callers can not know the exact reason of the failure.

    Some of the pinctrl drivers return -EINVAL, some -ENODEV, and some
    -ENOMEM on error of pinctrl_register(), although the error code
    might be different from the real cause of the error.

    This commit reworks pinctrl_register() to return the appropriate
    error code and modifies all of the pinctrl drivers to use IS_ERR()
    for the error checking and PTR_ERR() for getting the error code.

    Signed-off-by: Masahiro Yamada
    Acked-by: Patrice Chotard
    Acked-by: Thierry Reding
    Acked-by: Heiko Stuebner
    Tested-by: Mika Westerberg
    Acked-by: Mika Westerberg
    Acked-by: Lee Jones
    Acked-by: Sören Brinkmann
    Acked-by: Laurent Pinchart
    Acked-by: Ray Jui
    Acked-by: Antoine Tenart
    Acked-by: Hongzhou Yang
    Acked-by: Wei Chen
    Signed-off-by: Linus Walleij

    Masahiro Yamada
     

06 May, 2015

2 commits

  • While the pinmux_ops are ideally just a vtable for pin mux
    calls, the "strict" setting belongs so intuitively with the
    pin multiplexing that we should move it here anyway. Putting
    it in the top pinctrl_desc makes no sense.

    Cc: Sonic Zhang
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Disallow simultaneous use of the the GPIO and peripheral mux
    functions by setting a flag "strict" in struct pinctrl_desc.

    The blackfin pinmux and gpio controller doesn't allow user to
    set up a pin for both GPIO and peripheral function. So, add flag
    strict in struct pinctrl_desc to check both gpio_owner and
    mux_owner before approving the pin request.

    v2-changes:
    - if strict flag is set, check gpio_owner and mux_onwer in if and
    else clause

    v3-changes:
    - add kerneldoc for this struct
    - augment Documentation/pinctrl.txt

    Signed-off-by: Sonic Zhang
    Signed-off-by: Linus Walleij

    Sonic Zhang
     

05 Sep, 2014

1 commit


04 Sep, 2014

1 commit

  • commit 2243a87d90b42eb38bc281957df3e57c712b5e56
    "pinctrl: avoid duplicated calling enable_pinmux_setting for a pin"
    removed the .disable callback from the struct pinmux_ops,
    making the .enable() callback the only remaining callback.

    However .enable() is a bad name as it seems to imply that a
    muxing can also be disabled. Rename the callback to .set_mux()
    and also take this opportunity to clean out any remaining
    mentions of .disable() from the documentation.

    Acked-by: Stephen Warren
    Acked-by: Bjorn Andersson
    Acked-by: Fan Wu
    Signed-off-by: Linus Walleij

    Linus Walleij
     

22 Jul, 2014

1 commit


11 Jul, 2014

2 commits

  • %d in format string used, but the type is unsigned int

    This was found using a static code analysis program called cppcheck

    Signed-off-by: Rickard Strandqvist
    Signed-off-by: Linus Walleij

    Rickard Strandqvist
     
  • What the patch does:
    1. Call pinmux_disable_setting ahead of pinmux_enable_setting
    each time pinctrl_select_state is called
    2. Remove the HW disable operation in pinmux_disable_setting function.
    3. Remove the disable ops in struct pinmux_ops
    4. Remove all the disable ops users in current code base.

    Notes:
    1. Great thanks for the suggestion from Linus, Tony Lindgren and
    Stephen Warren and Everyone that shared comments on this patch.
    2. The patch also includes comment fixes from Stephen Warren.

    The reason why we do this:
    1. To avoid duplicated calling of the enable_setting operation
    without disabling operation inbetween which will let the pin
    descriptor desc->mux_usecount increase monotonously.
    2. The HW pin disable operation is not useful for any of the
    existing platforms.
    And this can be used to avoid the HW glitch after using the
    item #1 modification.

    In the following case, the issue can be reproduced:
    1. There is a driver that need to switch pin state dynamically,
    e.g. between "sleep" and "default" state
    2. The pin setting configuration in a DTS node may be like this:

    component a {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = ;
    pinctrl-1 = ;
    }

    The "c_grp_setting" config node is totally identical, maybe like
    following one:

    c_grp_setting: c_grp_setting {
    pinctrl-single,pins = ;
    }

    3. When switching the pin state in the following official pinctrl
    sequence:
    pin = pinctrl_get();
    state = pinctrl_lookup_state(wanted_state);
    pinctrl_select_state(state);
    pinctrl_put();

    Test Result:
    1. The switch is completed as expected, that is: the device's
    pin configuration is changed according to the description in the
    "wanted_state" group setting
    2. The "desc->mux_usecount" of the corresponding pins in "c_group"
    is increased without being decreased, because the "desc" is for
    each physical pin while the setting is for each setting node
    in the DTS.
    Thus, if the "c_grp_setting" in pinctrl-0 is not disabled ahead
    of enabling "c_grp_setting" in pinctrl-1, the desc->mux_usecount
    will keep increasing without any chance to be decreased.

    According to the comments in the original code, only the setting,
    in old state but not in new state, will be "disabled" (calling
    pinmux_disable_setting), which is correct logic but not intact. We
    still need consider case that the setting is in both old state
    and new state. We can do this in the following two ways:

    1. Avoid to "enable"(calling pinmux_enable_setting) the "same pin
    setting" repeatedly
    2. "Disable"(calling pinmux_disable_setting) the "same pin setting",
    actually two setting instances, ahead of enabling them.

    Analysis:
    1. The solution #2 is better because it can avoid too much
    iteration.
    2. If we disable all of the settings in the old state and one of
    the setting(s) exist in the new state, the pins mux function
    change may happen when some SoC vendors defined the
    "pinctrl-single,function-off"
    in their DTS file.
    old_setting => disabled_setting => new_setting.
    3. In the pinmux framework, when a pin state is switched, the
    setting in the old state should be marked as "disabled".

    Conclusion:
    1. To Remove the HW disabling operation to above the glitch mentioned
    above.
    2. Handle the issue mentioned above by disabling all of the settings
    in old state and then enable the all of the settings in new state.

    Signed-off-by: Fan Wu
    Acked-by: Stephen Warren
    Acked-by: Patrice Chotard
    Acked-by: Heiko Stuebner
    Acked-by: Maxime Coquelin
    Signed-off-by: Linus Walleij

    Fan Wu
     

22 Apr, 2014

1 commit


04 Apr, 2014

1 commit

  • Pull bulk of gpio updates from Linus Walleij:
    "A pretty big chunk of changes this time, but it has all been on
    rotation in linux-next and had some testing. Of course there will be
    some amount of fixes on top...

    - Merged in a branch of irqchip changes from Thomas Gleixner: we need
    to have new callbacks from the irqchip to determine if the GPIO
    line will be eligible for IRQs, and this callback must be able to
    say "no". After some thinking I got the branch from tglx and have
    switched all current users over to use this.

    - Based on tglx patches, we have added some generic irqchip helpers
    in the gpiolib core. These will help centralize code when GPIO
    drivers have simple chained/cascaded IRQs. Drivers will still
    define their irqchip vtables, but the gpiolib core will take care
    of irqdomain set-up, mapping from local offsets to Linux irqs, and
    reserve resources by marking the GPIO lines for IRQs.

    - Initially the PL061 and Nomadik GPIO/pin control drivers have been
    switched over to use the new gpiochip-to-irqchip infrastructure
    with more drivers expected for the next kernel cycle. The
    factoring of just two drivers still makes it worth it so it is
    already a win.

    - A new driver for the Synopsys DesignWare APB GPIO block.

    - Modify the DaVinci GPIO driver to be reusable also for the new TI
    Keystone architecture.

    - A new driver for the LSI ZEVIO SoCs.

    - Delete the obsolte tnetv107x driver.

    - Some incremental work on GPIO descriptors: have
    gpiod_direction_output() use a logical level, respecting assertion
    polarity through ACTIVE_LOW flags, adding gpiod_direction_output_raw()
    for the case where you want to set that very value. Add
    gpiochip_get_desc() to fetch a GPIO descriptor from a specific
    offset on a certain chip inside driver code.

    - Switch ACPI GPIO code over to using gpiochip_get_desc() and get rid
    of gpio_to_desc().

    - The ACPI GPIO event handling code has been reworked after
    encountering an actual real life implementation.

    - Support for ACPI GPIO operation regions.

    - Generic GPIO chips can now be assigned labels/names from platform
    data.

    - We now clamp values returned from GPIO drivers to the boolean [0,1]
    range.

    - Some improved documentation on how to use the polarity flag was
    added.

    - a large slew of incremental driver updates and non-critical fixes.
    Some targeted for stable"

    * tag 'gpio-v3.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (80 commits)
    gpio: rcar: Add helper variable dev = &pdev->dev
    gpio-lynxpoint: force gpio_get() to return "1" and "0" only
    gpio: unmap gpio irqs properly
    pch_gpio: set value before enabling output direction
    gpio: moxart: Actually set output state in moxart_gpio_direction_output()
    gpio: moxart: Avoid forward declaration
    gpio: mxs: Allow for recursive enable_irq_wake() call
    gpio: samsung: Add missing "break" statement
    gpio: twl4030: Remove redundant assignment
    gpio: dwapb: correct gpio-cells in binding document
    gpio: iop: fix devm_ioremap_resource() return value checking
    pinctrl: coh901: convert driver to use gpiolib irqchip
    pinctrl: nomadik: convert driver to use gpiolib irqchip
    gpio: pl061: convert driver to use gpiolib irqchip
    gpio: add IRQ chip helpers in gpiolib
    pinctrl: nomadik: factor in platform data container
    pinctrl: nomadik: rename secondary to latent
    gpio: Driver for SYSCON-based GPIOs
    gpio: generic: Use platform_device_id->driver_data field for driver flags
    pinctrl: coh901: move irq line locking to resource callbacks
    ...

    Linus Torvalds
     

18 Mar, 2014

1 commit

  • This switches all GPIO and pin control drivers with irqchips
    that were using .startup() and .shutdown() callbacks to lock
    GPIO lines for IRQ usage over to using the .request_resources()
    and .release_resources() callbacks just introduced into the
    irqchip vtable.

    Cc: Thomas Gleixner
    Cc: Jean-Jacques Hiblot
    Signed-off-by: Linus Walleij

    Linus Walleij
     

25 Feb, 2014

1 commit


10 Feb, 2014

3 commits


09 Oct, 2013

2 commits


27 Sep, 2013

2 commits


19 Sep, 2013

1 commit

  • The new ADI GPIO2 controller was introduced since the BF548 and BF60x
    processors. It differs a lot from the old one on BF5xx processors. So,
    create a pinctrl driver under the pinctrl framework.

    - Define gpio ports and pin interrupt controllers as individual platform
    devices.
    - Register a pinctrl driver for the whole GPIO ports and pin interrupt
    devices.
    - Probe pint devices before port devices. Put device instances into
    the global gpio and pint lists.
    - Define peripheral, irq and gpio reservation bit masks for each gpio
    port as runtime resources.
    - Save and restore gpio port and pint status MMRs in syscore PM functions.
    - Create the plug-in subdrivers to hold the pinctrl soc data for bf54x
    and bf60x. Add soc data into struct adi_pinctrl. Initialize the soc data
    in pin controller probe function. Get the pin groups and functions via
    the soc data reference.
    - Call gpiochip_add_pin_range() in gpio device probe function to register
    range cross reference between gpio device and pin control device.
    - Get range by pinctrl_find_gpio_range_from_pin(), find gpio_port object
    by container_of() and find adi_pinctrl by pin control device name.
    - Handle peripheral and gpio requests in pinctrl operation functions.
    - Demux gpio IRQs via the irq_domain created by each GPIO port.

    v2-changes:
    - Remove unlinke() directive.

    v3-changes:
    - Rename struct adi_pmx to adi_pinctrl.
    - Fix the comments of struct gpio_pint.
    - Remove unused pin_base in struct gpio_port.
    - Change pint_assign into bool type.
    - Add comments about the relationship between pint device and port device
    to the driver header.
    - Use BIT macro to shift bit.
    - Remove all bitmap reservation help functions. Inline reservation functions
    into the actual code.
    - Remove gpio and offset mutual reference help functions.
    - Remove all help functions to find gpio_port and adi_pinctrl structs. Get
    range by pinctrl_find_gpio_range_from_pin(), find gpio_port object by
    container_of() and find adi_pinctrl by pin control device name.
    - Pass bool type usage variable to port_setup help function.
    - Separate long bit operations into several lines and add comments.
    - Use debugfs to output all GPIO request information.
    - Avoid to set drvdata to NULL
    - Add explanation to function adi_gpio_init_int()
    - Call gpiochip_add_pin_range() in gpio device probe function to register
    range cross reference between gpio device and pin control device.
    - Remove the reference to pin control device from the gpio_port struct.
    Remove the reference list to gpio device from the adi_pinctrl struct.
    Replace the global adi_pinctrl list with adi_gpio_port_list. Walk through
    the gpio list to do power suspend and resume operations.
    - Remove the global GPIO base from struct adi_pinctrl, define pin base in
    the platform data for each GPIO port device.
    - Initialize adi_pinctrl_setup in arch_initcall().
    - print the status of triggers, whether it is in GPIO mode, if it is
    flagged to be used as IRQ, etc in adi_pin_dbg_show().
    - Create the plug-in subdrivers to hold the pinctrl soc data for bf54x
    and bf60x. Add soc data into struct adi_pinctrl. Initialize the soc data
    in pin controller probe function. Get the pin groups and functions via
    the soc data reference.

    v4-changes:
    - remove useless system_state checking.
    - replace dev_err with dev_warn in both irq and gpio pin cases.
    - comment on relationship between irq type and invert operation.
    - It is not necessary to check the reservation mode of the requested
    pin in IRQ chip operation. Remove the reservation map.
    - Use existing gpio/pinctrl subsystem debugfs files. Remove pinctrl-adi2
    driver specific debugfs output.
    - Add linkport group and function information for bf60x.
    - Separate uart and ctsrts pins into 2 groups.
    - Separate APAPI and alternative ATAPI pins into 2 groups.

    Signed-off-by: Sonic Zhang
    Signed-off-by: Linus Walleij

    Sonic Zhang