03 Jun, 2020

1 commit

  • [ Upstream commit 0cf253eed5d2bdf7bb3152457b38f39b012955f7 ]

    The driver currently leaves GPIO IRQs unmasked even when the GPIO IRQ
    client has released the GPIO IRQ. This allows the HW to raise IRQs, and
    SW to process them, after shutdown. Fix this by masking the IRQ when it's
    shut down. This is usually taken care of by the irqchip core, but since
    this driver has a custom irq_shutdown implementation, it must do this
    explicitly itself.

    Signed-off-by: Stephen Warren
    Link: https://lore.kernel.org/r/20200427232605.11608-1-swarren@wwwdotorg.org
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin

    Stephen Warren
     

05 Aug, 2019

1 commit

  • We don't need dev_err() messages when platform_get_irq() fails now that
    platform_get_irq() prints an error message itself when something goes
    wrong. Let's remove these prints with a simple semantic patch.

    //
    @@
    expression ret;
    struct platform_device *E;
    @@

    ret =
    (
    platform_get_irq(E, ...)
    |
    platform_get_irq_byname(E, ...)
    );

    if ( \( ret < 0 \| ret

    While we're here, remove braces on if statements that only have one
    statement (manually).

    Cc: linux-gpio@vger.kernel.org
    Cc: Greg Kroah-Hartman
    Signed-off-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20190730181557.90391-16-swboyd@chromium.org
    Acked-by: Bartosz Golaszewski
    Signed-off-by: Linus Walleij

    Stephen Boyd
     

10 Jul, 2019

1 commit

  • Pull GPIO updates from Linus Walleij:
    "This is the big slew of GPIO changes for the v5.3 kernel cycle. This
    is mostly incremental work this time.

    Three important things:

    - The FMC subsystem is deleted through my tree. This happens through
    GPIO as its demise was discussed in relation to a patch decoupling
    its GPIO implementation from the standard way of handling GPIO. As
    it turns out, that is not the only subsystem it reimplements and
    the authors think it is better do scratch it and start over using
    the proper kernel subsystems than try to polish the rust shiny. See
    the commit (ACKed by the maintainers) for details.

    - Arnd made a small devres patch that was ACKed by Greg and goes into
    the device core.

    - SPDX header change colissions may happen, because at times I've
    seen that quite a lot changed during the -rc:s in regards to SPDX.
    (It is good stuff, tglx has me convinced, and it is worth the
    occasional pain.)

    Apart from this is is nothing controversial or problematic.

    Summary:

    Core:

    - When a gpio_chip request GPIOs from itself, it can now fully
    control the line characteristics, both machine and consumer flags.
    This makes a lot of sense, but took some time before I figured out
    that this is how it has to work.

    - Several smallish documentation fixes.

    New drivers:

    - The PCA953x driver now supports the TI TCA9539.

    - The DaVinci driver now supports the K3 AM654 SoCs.

    Driver improvements:

    - Major overhaul and hardening of the OMAP driver by Russell King.

    - Starting to move some drivers to the new API passing irq_chip along
    with the gpio_chip when adding the gpio_chip instead of adding it
    separately.

    Unrelated:

    - Delete the FMC subsystem"

    * tag 'gpio-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (87 commits)
    Revert "gpio: tegra: Clean-up debugfs initialisation"
    gpiolib: Use spinlock_t instead of struct spinlock
    gpio: stp-xway: allow compile-testing
    gpio: stp-xway: get rid of the #include dependency
    gpio: stp-xway: improve module clock error handling
    gpio: stp-xway: simplify error handling in xway_stp_probe()
    gpiolib: Clarify use of non-sleeping functions
    gpiolib: Fix references to gpiod_[gs]et_*value_cansleep() variants
    gpiolib: Document new gpio_chip.init_valid_mask field
    Documentation: gpio: Fix reference to gpiod_get_array()
    gpio: pl061: drop duplicate printing of device name
    gpio: altera: Pass irqchip when adding gpiochip
    gpio: siox: Use devm_ managed gpiochip
    gpio: siox: Add struct device *dev helper variable
    gpio: siox: Pass irqchip when adding gpiochip
    drivers: gpio: amd-fch: make resource struct const
    devres: allow const resource arguments
    gpio: ath79: Pass irqchip when adding gpiochip
    gpio: tegra: Clean-up debugfs initialisation
    gpio: siox: Switch to IRQ_TYPE_NONE
    ...

    Linus Torvalds
     

07 Jul, 2019

1 commit


28 Jun, 2019

1 commit

  • The function tegra_gpio_debuginit() just calls debugfs_create_file()
    and given that there is already a stub function implemented for
    debugfs_create_file() when CONFIG_DEBUG_FS is not enabled, there is
    no need for the function tegra_gpio_debuginit() and so remove it.

    Finally, use a space and not a tab between the #ifdef and
    CONFIG_DEBUG_FS.

    Signed-off-by: Jon Hunter
    Reviewed-by: Bartosz Golaszewski
    Signed-off-by: Linus Walleij

    Jon Hunter
     

27 Jun, 2019

1 commit


05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this software is licensed under the terms of the gnu general public
    license version 2 as published by the free software foundation and
    may be copied distributed and modified under those terms this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 285 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

05 Apr, 2019

1 commit


20 Feb, 2019

1 commit

  • This patch hunk is a lightly modified version of a diff found
    in a Tegra code dump from a product tree. It makes a lot of
    sense because this is what most drivers do.

    Cc: Thierry Reding
    Cc: Stefan Agner
    Cc: Dmitry Osipenko
    Cc: Jon Hunter
    Signed-off-by: Linus Walleij

    Linus Walleij
     

05 Nov, 2018

1 commit


16 Aug, 2018

1 commit

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for the v4.19 kernel cycle.

    I don't know if anything in particular stands out. Maybe the Aspeed
    coprocessor thing from Benji: Aspeed is doing baseboard management
    chips (BMC's) for servers etc.

    These Aspeed's are ARM processors that exist inside (I guess) Intel
    servers, and they are moving forward to using mainline Linux in those.
    This is one of the pieces of the puzzle to achive that. They are doing
    OpenBMC, it's pretty cool: https://lwn.net/Articles/683320/

    Summary:

    Core changes:

    - Add a new API for explicitly naming GPIO consumers, when needed.

    - Don't let userspace set values on input lines. While we do not
    think anyone would do this crazy thing we better plug the hole
    before someone uses it and think it's a nifty feature.

    - Avoid calling chip->request() for unused GPIOs.

    New drivers/subdrivers:

    - The Mediatek MT7621 is supported which is a big win for OpenWRT and
    similar router distributions using this chip, as it seems every
    major router manufacturer on the planet has made products using
    this chip: https://wikidevi.com/wiki/MediaTek_MT7621

    - The Tegra 194 is now supported.

    - The IT87 driver now supports IT8786E and IT8718F super-IO chips.

    - Add support for Rockchip RK3328 in the syscon GPIO driver.

    Driver changes:

    - Handle the get/set_multiple() properly on MMIO chips with inverted
    direction registers. We didn't have this problem until a new chip
    appear that has get/set registers AND inverted direction bits, OK
    now we handle it.

    - A patch series making more error codes percolate upward properly
    for different errors on gpiochip_lock_as_irq().

    - Get/set multiple for the OMAP driver, accelerating these multiple
    line operations if possible.

    - A coprocessor interface for the Aspeed driver. Sometimes a few GPIO
    lines need to be grabbed by a co-processor for doing automated
    tasks, sometimes they are available as GPIO lines. By adding an
    explicit API in this driver we make it possible for the two line
    consumers to coexist. (This work was made available on the
    ib-aspeed branch, which may be appearing in other pull requests.)

    - Implemented .get_direction() and open drain in the SCH311x driver.

    - Continuing cleanup of included headers in GPIO drivers"

    * tag 'gpio-v4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (80 commits)
    gpio: it87: Add support for IT8613
    gpio: it87: add support for IT8718F Super I/O.
    gpiolib: Avoid calling chip->request() for unused gpios
    gpio: tegra: Include the right header
    gpio: mmio: Fix up inverted direction registers
    gpio: xilinx: Use the right include
    gpio: timberdale: Include the right header
    gpio: tb10x: Use the right include
    gpiolib: Fix of_node inconsistency
    gpio: vr41xx: Bail out on gpiochip_lock_as_irq() error
    gpio: uniphier: Bail out on gpiochip_lock_as_irq() error
    gpio: xgene-sb: Don't shadow error code of gpiochip_lock_as_irq()
    gpio: em: Don't shadow error code of gpiochip_lock_as_irq()
    gpio: dwapb: Don't shadow error code of gpiochip_lock_as_irq()
    gpio: bcm-kona: Don't shadow error code of gpiochip_lock_as_irq()
    gpiolib: Don't shadow error code of gpiochip_lock_as_irq()
    gpio: syscon: rockchip: add GRF GPIO support for rk3328
    gpio: omap: Add get/set_multiple() callbacks
    gpio: pxa: remove set but not used variable 'gpio_offset'
    gpio-it87: add support for IT8786E Super I/O
    ...

    Linus Torvalds
     

11 Aug, 2018

1 commit


04 Aug, 2018

1 commit

  • There is a bug in regards to deferred probing within the drivers core
    that causes GPIO-driver to suspend after its users. The bug appears if
    GPIO-driver probe is getting deferred, which happens after introducing
    dependency on PINCTRL-driver for the GPIO-driver by defining "gpio-ranges"
    property in device-tree. The bug in the drivers core is old (more than 4
    years now) and is well known, unfortunately there is no easy fix for it.
    The good news is that we can workaround the deferred probe issue by
    changing GPIO / PINCTRL drivers registration order and hence by moving
    PINCTRL driver registration to the arch_init level and GPIO to the
    subsys_init.

    Signed-off-by: Dmitry Osipenko
    Acked-by: Stefan Agner
    Signed-off-by: Linus Walleij

    Dmitry Osipenko
     

30 Jul, 2018

2 commits

  • Since commit e45d1c80c0ee ("gpio: put GPIO IRQs into their own lock
    class") and commit a0a8bcf4670c ("gpiolib: irqchip: use different
    lockdep class for each gpio irqchip") GPIO lib takes care of lockdep
    classes. In fact, gpiochip_irq_map() overwrites the class anyway, so
    the lockdep class set by the driver is useless. Remove it.

    Signed-off-by: Stefan Agner
    Signed-off-by: Linus Walleij

    Stefan Agner
     
  • Commit 36b312792b97 ("gpiolib: Respect error code of ->get_direction()")
    broke tegra_gpio_irq_set_type() because requesting of GPIO direction must
    be done after enabling GPIO function for a pin.

    This patch fixes drivers probe failure like this:

    gpio gpiochip0: (tegra-gpio): gpiochip_lock_as_irq: cannot get GPIO direction
    tegra-gpio 6000d000.gpio: unable to lock Tegra GPIO 144 as IRQ

    Fixes: 36b312792b97 ("gpiolib: Respect error code of ->get_direction()")
    Signed-off-by: Dmitry Osipenko
    Acked-by: Jon Hunter
    Tested-by: Jon Hunter
    Signed-off-by: Linus Walleij

    Dmitry Osipenko
     

22 Feb, 2018

1 commit


28 Dec, 2017

1 commit

  • The IRQ code already has support for lockdep class for the lock mutex
    in an interrupt descriptor. Extend this to add a second class for the
    request mutex in the descriptor. Not having a class is resulting in
    false positive splats in some code paths.

    Signed-off-by: Andrew Lunn
    Signed-off-by: Thomas Gleixner
    Acked-by: linus.walleij@linaro.org
    Cc: grygorii.strashko@ti.com
    Cc: f.fainelli@gmail.com
    Link: https://lkml.kernel.org/r/1512234664-21555-1-git-send-email-andrew@lunn.ch

    Andrew Lunn
     

22 Sep, 2017

1 commit


14 Aug, 2017

7 commits


02 Aug, 2017

1 commit


26 Jan, 2017

1 commit

  • Currently we already have two pin configuration related callbacks
    available for GPIO chips .set_single_ended() and .set_debounce(). In
    future we expect to have even more, which does not scale well if we need
    to add yet another callback to the GPIO chip structure for each possible
    configuration parameter.

    Better solution is to reuse what we already have available in the
    generic pinconf.

    To support this, we introduce a new .set_config() callback for GPIO
    chips. The callback takes a single packed pin configuration value as
    parameter. This can then be extended easily beyond what is currently
    supported by just adding new types to the generic pinconf enum.

    If the GPIO driver is backed up by a pinctrl driver the GPIO driver can
    just assign gpiochip_generic_config() (introduced in this patch) to
    .set_config and that will take care configuration requests are directed
    to the pinctrl driver.

    We then convert the existing drivers over .set_config() and finally
    remove the .set_single_ended() and .set_debounce() callbacks.

    Suggested-by: Linus Walleij
    Signed-off-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij

    Mika Westerberg
     

22 Jun, 2016

1 commit

  • Commit b546be0db955 ("gpio: tegra: Get rid of all file scoped global
    variables") moved all file scoped variables into the driver-private
    structure to allow potentially multiple instances of the driver. The
    change also included turning the lockdep class into a driver-private
    field, which doesn't work and produces error messages such as this:

    [ 0.142310] BUG: key ffff8000fb3f7ab0 not in .data!

    Make the lockdep class file-scoped again to fix this issue.

    Signed-off-by: Thierry Reding
    Signed-off-by: Linus Walleij

    Thierry Reding
     

30 Apr, 2016

1 commit

  • Implement gpio_get_direction() callback for Tegra GPIO.
    The direction is only valid if the pin is configured as
    GPIO. If pin is not configured in GPIO mode then this
    function return error.

    Signed-off-by: Laxman Dewangan
    Reviewed-by: Stephen Warren
    Acked-by: Jon Hunter
    Signed-off-by: Linus Walleij

    Laxman Dewangan
     

29 Apr, 2016

4 commits


23 Feb, 2016

1 commit


05 Jan, 2016

1 commit


17 Nov, 2015

1 commit

  • The tegra gpio driver creates the debugfs entry irrespective of
    whether the device exists or not. This is enabled on an arm64_defconfig
    and leaves an entry in debugfs on all platforms where it is not
    useful. This patch fixes the issue by creating the entry only when
    a device exists.

    Signed-off-by: Suzuki K. Poulose
    Acked-by: Thierry Reding
    Signed-off-by: Linus Walleij

    Suzuki K. Poulose
     

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
     

28 Jul, 2015

1 commit

  • set_irq_flags is ARM specific with custom flags which have genirq
    equivalents. Convert drivers to use the genirq interfaces directly, so we
    can kill off set_irq_flags. The translation of flags is as follows:

    IRQF_VALID -> !IRQ_NOREQUEST
    IRQF_PROBE -> !IRQ_NOPROBE
    IRQF_NOAUTOEN -> IRQ_NOAUTOEN

    For IRQs managed by an irqdomain, the irqdomain core code handles clearing
    and setting IRQ_NOREQUEST already, so there is no need to do this in
    .map() functions and we can simply remove the set_irq_flags calls. Some
    users also modify IRQ_NOPROBE and this has been maintained although it
    is not clear that is really needed as most platforms don't use probing.
    There appears to be a great deal of blind copy and paste of this code.

    Signed-off-by: Rob Herring
    Cc: Michael Hennerich
    Acked-by: Linus Walleij
    Cc: Alexandre Courbot
    Cc: Ray Jui
    Cc: Stephen Warren
    Cc: Thierry Reding
    Cc: linux-gpio@vger.kernel.org
    Cc: bcm-kernel-feedback-list@broadcom.com
    Cc: linux-tegra@vger.kernel.org
    Signed-off-by: Linus Walleij

    Rob Herring
     

14 Jul, 2015

2 commits