06 Aug, 2020

1 commit

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

    There is nothing too exciting in it, but a new macro that fixes a
    build failure on a minor ARM32 platform that appeared yesterday is
    part of it so we better merge it.

    Core changes:

    - Introduce the for_each_requested_gpio() macro to help in dependent
    code all over the place. Also patch a few locations to use it while
    we are at it.

    - Split out the sysfs code into its own file.

    - Split out the character device code into its own file, then make a
    set of refactorings and improvements to this code. We are setting
    the stage to revamp the userspace API a bit in the next cycle.

    - Fix a whole slew of kerneldoc that was wrong or missing.

    New drivers:

    - The PCA953x driver now supports the PCAL9535.

    Driver improvements:

    - A host of incremental modernizations and improvements to the
    PCA953x driver.

    - Incremental improvements to the Xilinx Zynq driver.

    - Some improvements to the GPIO aggregator driver.

    - I ran all over the place switching all threaded and other drivers
    requesting their own IRQ while using the core GPIO IRQ helpers to
    pass the GPIO irq chip as a template instead of calling the
    explicit set-up functions. Next merge window we may retire the old
    code altogether"

    * tag 'gpio-v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (97 commits)
    gpio: wcove: Request IRQ after all initialisation done
    gpio: crystalcove: Free IRQ on error path
    gpio: pca953x: Request IRQ after all initialisation done
    gpio: don't use same lockdep class for all devm_gpiochip_add_data users
    gpio: max732x: Use irqchip template
    gpio: stmpe: Move chip registration
    gpio: rcar: Use irqchip template
    gpio: regmap: fix type clash
    gpio: Correct kernel-doc inconsistency
    gpio: pci-idio-16: Use irqchip template
    gpio: pcie-idio-24: Use irqchip template
    gpio: 104-idio-16: Use irqchip template
    gpio: 104-idi-48: Use irqchip template
    gpio: 104-dio-48e: Use irqchip template
    gpio: ws16c48: Use irqchip template
    gpio: omap: improve coding style for pin config flags
    gpio: dln2: Use irqchip template
    gpio: sch: Add a blank line between declaration and code
    gpio: sch: changed every 'unsigned' to 'unsigned int'
    gpio: ich: changed every 'unsigned' to 'unsigned int'
    ...

    Linus Torvalds
     

04 Aug, 2020

6 commits

  • There is logically better to request IRQ when we initialise all structures.
    Align the driver with the rest on the same matter.

    Signed-off-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200728125504.27786-3-andriy.shevchenko@linux.intel.com
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • It appears that all, but request_irq(), calls in the driver are device managed.
    In unlikely case of devm_gpiochip_add_data() failure the IRQ left requested.
    Free IRQ on error path by switching to devm_request_threaded_irq() API.

    Byproduct of this change is a drop of ->remove() callback completely.

    Fixes: 945e72db36bd ("gpio: crystalcove: Use irqchip template")
    Signed-off-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200728125504.27786-2-andriy.shevchenko@linux.intel.com
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • There is logically better to request IRQ when we initialise all structures.
    Align the driver with the rest on the same matter.

    Signed-off-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200728125504.27786-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • Commit 959bc7b22bd2 ("gpio: Automatically add lockdep keys") documents
    in its commits message its intention to "create a unique class key for
    each driver".

    It does so by having gpiochip_add_data add in-place the definition of
    two static lockdep classes for LOCKDEP use. That way, every caller of
    the macro adds their gpiochip with unique lockdep classes.

    There are many indirect callers of gpiochip_add_data, however, via
    use of devm_gpiochip_add_data. devm_gpiochip_add_data has external
    linkage and all its users will share the same lockdep classes, which
    probably is not intended.

    Fix this by replicating the gpio_chip_add_data statics-in-macro for
    the devm_ version as well.

    Fixes: 959bc7b22bd2 ("gpio: Automatically add lockdep keys")
    Signed-off-by: Ahmad Fatoum
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Bartosz Golaszewski
    Link: https://lore.kernel.org/r/20200731123835.8003-1-a.fatoum@pengutronix.de
    Signed-off-by: Linus Walleij

    Ahmad Fatoum
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Tested-by: Sam Protsenko
    Reviewed-by: Sam Protsenko
    Cc: Sam Protsenko
    Link: https://lore.kernel.org/r/20200726221259.133536-1-linus.walleij@linaro.org

    Linus Walleij
     
  • Make sure to register the GPIO chip after requesting the
    interrupt and setting up the IRQ members of the irqchip.

    Fixes: 9745079609df ("gpio: stmpe: Use irqchip template")
    Reported-by: Serge Semin
    Signed-off-by: Linus Walleij
    Cc: Patrice Chotard
    Link: https://lore.kernel.org/r/20200728072706.348725-1-linus.walleij@linaro.org

    Linus Walleij
     

30 Jul, 2020

1 commit

  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Cc: Biju Das
    Cc: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200722113141.243163-1-linus.walleij@linaro.org

    Linus Walleij
     

29 Jul, 2020

1 commit


23 Jul, 2020

8 commits

  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.
    Also move the IRQ initialization to the special .init_hw()
    callback.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722110649.202223-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722110027.192782-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.
    Also move the IRQ initialization to the special .init_hw()
    callback.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722105517.186137-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.
    Also move the IRQ initialization to the special .init_hw()
    callback.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722104820.174654-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.
    Also move the IRQ initialization to the special .init_hw()
    callback.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722103915.162156-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit call to gpiochip_irqchip_add().

    The irqchip is instead added while adding the gpiochip.
    Also move the IRQ initialization to the special .init_hw()
    callback.

    Signed-off-by: Linus Walleij
    Acked-by: William Breathitt Gray
    Cc: William Breathitt Gray
    Link: https://lore.kernel.org/r/20200722101938.151265-1-linus.walleij@linaro.org

    Linus Walleij
     
  • Change the handling of pin config flags from if/else to switch
    statement to make the code more readable and cleaner.

    Suggested-by: Gustavo A. R. Silva
    Signed-off-by: Drew Fustini
    Acked-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20200722120755.230741-1-drew@beagleboard.org
    Signed-off-by: Linus Walleij

    Drew Fustini
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add(). The irqchip is
    instead added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Tested-by: Andy Shevchenko
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Daniel Baluta
    Cc: Daniel Baluta
    Cc: Octavian Purdila
    Link: https://lore.kernel.org/r/20200722073426.38890-1-linus.walleij@linaro.org

    Linus Walleij
     

22 Jul, 2020

10 commits

  • …ndy/linux-gpio-intel into devel

    intel-gpio for v5.9-1

    * Move GPIO PMIC drivers to use IRQ chip template
    * Introduce for_each_requested_gpio() and convert existing users
    * Replace unsigned by unsigned int in few drivers
    * Fix an issue in kernel doc that validator complains about
    * Move to verbose debug level the IRQ status message in gpio-pch

    The following is an automated git shortlog grouped by driver:

    ARM/orion/gpio:
    - Make use of for_each_requested_gpio()

    crystalcove:
    - Use irqchip template
    - changed every 'unsigned' to 'unsigned int'

    gpiolib:
    - Introduce for_each_requested_gpio_in_range() macro

    gpio-ml-ioh:
    - Fix missing ':' in 'struct ioh_gpio_reg_data

    ich:
    - changed every 'unsigned' to 'unsigned int'

    mvebu:
    - Make use of for_each_requested_gpio()

    pch:
    - Add a blank line between declaration and code
    - changed every 'unsigned' to 'unsigned int'
    - Move IRQ status message to verbose debug level

    pinctrl:
    - at91: Make use of for_each_requested_gpio()

    sch:
    - Add a blank line between declaration and code
    - changed every 'unsigned' to 'unsigned int'

    wcove:
    - Use irqchip template

    xra1403:
    - Make use of for_each_requested_gpio()

    Linus Walleij
     
  • Added a lined between a declaration and other statements according to the
    kernel coding style.

    Signed-off-by: Abanoub Sameh
    Signed-off-by: Andy Shevchenko

    Abanoub Sameh
     
  • Changed 'unsigned' to 'unsigned int'.
    This makes the code more uniform, and compliant with the kernel coding style.

    Signed-off-by: Abanoub Sameh
    Signed-off-by: Andy Shevchenko

    Abanoub Sameh
     
  • Changed 'unsigned' to 'unsigned int'.
    This makes the code more uniform, and compliant with the kernel coding style.

    Signed-off-by: Abanoub Sameh
    Signed-off-by: Andy Shevchenko

    Abanoub Sameh
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Cc: Bin Gao
    Cc: Andy Shevchenko
    Cc: Hans de Goede
    Signed-off-by: Linus Walleij
    Tested-by: Hans de Goede
    Signed-off-by: Andy Shevchenko

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Cc: Andy Shevchenko
    Cc: Kuppuswamy Sathyanarayanan
    Cc: Hans de Goede
    Signed-off-by: Linus Walleij
    Reviewed-by: Kuppuswamy Sathyanarayanan
    Tested-by: Hans de Goede
    Signed-off-by: Andy Shevchenko

    Linus Walleij
     
  • This converts the PPC4xx SPI driver to use GPIO descriptors.

    The driver is already just picking some GPIOs from the device
    tree so the conversion is pretty straight forward. However
    this driver is looking form a pure "gpios" property rather
    than the standard binding "cs-gpios" so we need to add a new
    exception to the gpiolib OF parser to allow this for this
    driver's compatibles.

    Signed-off-by: Linus Walleij
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: https://lore.kernel.org/r/20200714072226.26071-1-linus.walleij@linaro.org
    Signed-off-by: Mark Brown

    Linus Walleij
     
  • Changed 'unsigned' to 'unsigned int'.
    This makes the code more uniform, and compliant with the kernel coding style.

    Signed-off-by: Abanoub Sameh
    Signed-off-by: Andy Shevchenko

    Abanoub Sameh
     
  • Added a lined between a declaration and other statements according to the
    kernel coding style.

    Signed-off-by: Abanoub Sameh
    Signed-off-by: Andy Shevchenko

    Abanoub Sameh
     
  • Changed 'unsigned' to 'unsigned int'.
    This makes the code more uniform, and compliant with the kernel coding style.

    Signed-off-by: Abanoub Sameh
    Signed-off-by: Andy Shevchenko

    Abanoub Sameh
     

20 Jul, 2020

7 commits

  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Tested-by: Andy Shevchenko
    Reviewed-by: Andy Shevchenko
    Cc: Andy Shevchenko
    Cc: Marek Vasut
    Cc: Uwe Kleine-König
    Cc: Adam Ford
    Cc: Vignesh Raghavendra
    Link: https://lore.kernel.org/r/20200717144040.63253-1-linus.walleij@linaro.org

    Linus Walleij
     
  • Modify omap_gpio_set_config() to handle pin config bias flags by calling
    gpiochip_generic_config().

    The pin group for the gpio line must have the corresponding pinconf
    properties:

    PIN_CONFIG_BIAS_PULL_UP requires "pinctrl-single,bias-pullup"
    PIN_CONFIG_BIAS_PULL_DOWN requires "pinctrl-single,bias-pulldown"

    This is necessary for pcs_pinconf_set() to find the requested bias
    parameter in the PIN_MAP_TYPE_CONFIGS_GROUP pinctrl map.

    Signed-off-by: Drew Fustini
    Signed-off-by: Linus Walleij
    Acked-by: Grygorii Strashko
    Acked-by: Tony Lindgren
    Link: https://lore.kernel.org/r/20200715213738.1640030-1-drew@beagleboard.org
    Link: https://lore.kernel.org/r/20200717194043.1774643-1-drew@beagleboard.org

    Drew Fustini
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Cc: Geert Uytterhoeven
    Cc: Anders Darander
    Cc: Roger Quadros
    Link: https://lore.kernel.org/r/20200717144835.68150-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Acked-by: Michael Hennerich
    Cc: Nikolaus Voss
    Cc: Michael Hennerich
    Link: https://lore.kernel.org/r/20200716150502.195821-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Cc: Roland Stigge
    Cc: Lars Poeschel
    Link: https://lore.kernel.org/r/20200716120318.127176-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Cc: Patrice Chotard
    Cc: Alexandre TORGUE
    Link: https://lore.kernel.org/r/20200716100638.112451-1-linus.walleij@linaro.org

    Linus Walleij
     
  • This makes the driver use the irqchip template to assign
    properties to the gpio_irq_chip instead of using the
    explicit calls to gpiochip_irqchip_add_nested() and
    gpiochip_set_nested_irqchip(). The irqchip is instead
    added while adding the gpiochip.

    Signed-off-by: Linus Walleij
    Link: https://lore.kernel.org/r/20200716093459.76378-1-linus.walleij@linaro.org

    Linus Walleij
     

17 Jul, 2020

1 commit

  • Most other drivers fill out the gpio_irq_chip using a
    struct gpio_irq_chip *girq helper variable for ease of
    reading.

    We also make a habit of explicitly assigning NULL and
    zero to the parent IRQs when using ordinary IRQ handlers
    in the driver, mostly for code readability and
    maintenance.

    Signed-off-by: Linus Walleij
    Reviewed-by: Dmitry Osipenko
    Cc: Dmitry Osipenko
    Link: https://lore.kernel.org/r/20200716092835.69176-1-linus.walleij@linaro.org

    Linus Walleij
     

16 Jul, 2020

5 commits

  • Use for_each_set_bit() instead of open-coding it to simplify the code.

    Signed-off-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20200713154429.23662-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • NXP PCA9570 is a 4-bit I2C GPO expander without interrupt functionality.
    Its ports are controlled only by a data byte without register address.

    Signed-off-by: Sungbo Eo
    Reviewed-by: Andy Shevchenko
    Datasheet: https://www.nxp.com/docs/en/data-sheet/PCA9570.pdf
    Link: https://lore.kernel.org/r/20200709134829.216393-1-mans0n@gorani.run
    Signed-off-by: Linus Walleij

    Sungbo Eo
     
  • I noticed on Nexus 7 that after rebooting from downstream kernel to
    upstream, the GPIO interrupt is triggering non-stop despite interrupts
    being disabled for all of GPIOs. This happens because Nexus 7 uses a
    soft-reboot, meaning that bootloader should take care of resetting
    hardware, but the bootloader doesn't do it well. As a result, GPIO
    interrupt may be left ON at a boot time. Let's mask all GPIO interrupts
    at the driver's initialization time in order to resolve the issue.

    Signed-off-by: Dmitry Osipenko
    Reviewed-by: Andy Shevchenko
    Acked-by: Laxman Dewangan
    Link: https://lore.kernel.org/r/20200709171203.12950-7-digetx@gmail.com
    Signed-off-by: Linus Walleij

    Dmitry Osipenko
     
  • This change addresses one of the GPIO-core TODOs for the MAX77620 driver
    which requires modern drivers to use the irqchip template. Instead of
    using the GPIO's irqchip-helpers for creating the IRQ domain, the
    gpio_irq_chip structure is now filled by the driver itself and then
    gpiochip_add_data() takes care of instantiating the IRQ domain for us.

    Suggested-by: Andy Shevchenko
    Signed-off-by: Dmitry Osipenko
    Reviewed-by: Andy Shevchenko
    Acked-by: Laxman Dewangan
    Link: https://lore.kernel.org/r/20200709171203.12950-6-digetx@gmail.com
    Signed-off-by: Linus Walleij

    Dmitry Osipenko
     
  • The platform_get_irq() returns a positive interrupt number on success and
    negative error code on failure (zero shouldn't ever happen in practice, it
    would produce a noisy warning). Hence let's return the error code directly
    instead of overriding it with -ENODEV.

    Suggested-by: Andy Shevchenko
    Signed-off-by: Dmitry Osipenko
    Reviewed-by: Andy Shevchenko
    Acked-by: Laxman Dewangan
    Link: https://lore.kernel.org/r/20200709171203.12950-5-digetx@gmail.com
    Signed-off-by: Linus Walleij

    Dmitry Osipenko