15 Mar, 2017

1 commit

  • Given the intent behind gpiod_get_optional() and friends it does not make
    sense to return -ENOSYS when GPIOLIB is disabled: the driver is expected to
    work just fine without gpio so let's behave as if gpio was not found.
    Otherwise we have to special-case -ENOSYS in drivers.

    Note that there was objection that someone might forget to enable GPIOLIB
    when dealing with a platform that has device that actually specifies
    optional gpio and we'll break it. I find this unconvincing as that would
    have to be the *only GPIO* in the system, which is extremely unlikely.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Linus Walleij

    Dmitry Torokhov
     

31 Jan, 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
     

13 Dec, 2016

1 commit

  • Pull GPIO updates from Luinus Walleij:
    "Bulk GPIO changes for the v4.10 kernel cycle:

    Core changes:

    - Simplify threaded interrupt handling: instead of passing numbed
    parameters to gpiochip_irqchip_add_chained() we create a new call:
    gpiochip_irqchip_add_nested() so the two types are clearly
    semantically different. Also make sure that all nested chips call
    gpiochip_set_nested_irqchip() which is necessary for IRQ resend to
    work properly if it happens.

    - Return error on seek operations for the chardev.

    - Clamp values set as part of gpio[d]_direction_output() so that
    anything != 0 will be send down to the driver as "1" not the value
    passed in.

    - ACPI can now support naming of GPIO lines, hogs and holes in the
    GPIO lists.

    New drivers:

    - The SX150x driver was deemed unfit for the GPIO subsystem and was
    moved over to a combined GPIO+pinctrl driver in the pinctrl
    subsystem.

    New features:

    - Various cleanups to various drivers"

    * tag 'gpio-v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (49 commits)
    gpio: merrifield: Implement gpio_get_direction callback
    gpio: merrifield: Add support for hardware debouncer
    gpio: chardev: Return error for seek operations
    gpio: arizona: Tidy up probe error path
    gpio: arizona: Remove pointless set of platform drvdata
    gpio: pl061: delete platform data handling
    gpio: pl061: move platform data into driver
    gpio: pl061: rename variable from chip to pl061
    gpio: pl061: rename state container struct
    gpio: pl061: use local state for parent IRQ storage
    gpio: set explicit nesting on drivers
    gpio: simplify adding threaded interrupts
    gpio: vf610: use builtin_platform_driver
    gpio: axp209: use correct register for GPIO input status
    gpio: stmpe: fix interrupt handling bug
    gpio: em: depnd on ARCH_SHMOBILE
    gpio: zx: depend on ARCH_ZX
    gpio: x86: update config dependencies for x86 specific hardware
    gpio: mb86s7x: use builtin_platform_driver
    gpio: etraxfs: use builtin_platform_driver
    ...

    Linus Torvalds
     

25 Nov, 2016

1 commit

  • This tries to simplify the use of CONFIG_GPIOLIB_IRQCHIP when
    using threaded interrupts: add a new call
    gpiochip_irqchip_add_nested() to indicate that we're dealing
    with a nested rather than a chained irqchip, then create a
    separate gpiochip_set_nested_irqchip() to mirror
    the gpiochip_set_chained_irqchip() call to connect the
    parent and child interrupts.

    In the nested case gpiochip_set_nested_irqchip() does nothing
    more than call irq_set_parent() on each valid child interrupt,
    which has little semantic effect in the kernel, but this is
    probably still formally correct.

    Update all drivers using nested interrupts to use
    gpiochip_irqchip_add_nested() so we can now see clearly
    which these users are.

    The DLN2 driver can drop its specific hack with
    .irq_not_threaded as we now recognize whether a chip is
    threaded or not from its use of gpiochip_irqchip_add_nested()
    signature rather than from inspecting .can_sleep.

    We rename the .irq_parent to .irq_chained_parent since this
    parent IRQ is only really kept around for the chained
    interrupt handlers.

    Cc: Lars Poeschel
    Cc: Octavian Purdila
    Cc: Daniel Baluta
    Cc: Bin Gao
    Cc: Mika Westerberg
    Cc: Ajay Thomas
    Cc: Semen Protsenko
    Cc: Alexander Stein
    Cc: Phil Reid
    Cc: Bartosz Golaszewski
    Cc: Patrice Chotard
    Signed-off-by: Linus Walleij

    Linus Walleij
     

20 Oct, 2016

1 commit


23 Sep, 2016

2 commits

  • Linus Walleij
     
  • When using GPIO irqchip helpers to setup irqchip for a gpiolib based
    driver, it is not possible to select which GPIOs to add to the IRQ domain.
    Instead it just adds all GPIOs which is not always desired. For example
    there might be GPIOs that for some reason cannot generated normal
    interrupts at all.

    To support this we add a flag irq_need_valid_mask to struct gpio_chip. When
    this flag is set the core allocates irq_valid_mask that holds one bit for
    each GPIO the chip has. By default all bits are set but drivers can
    manipulate this using set_bit() and clear_bit() accordingly.

    Then when gpiochip_irqchip_add() is called, this mask is checked and all
    GPIOs with bit is set are added to the IRQ domain created for the GPIO
    chip.

    Suggested-by: Linus Walleij
    Signed-off-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Mika Westerberg
     

08 Aug, 2016

1 commit


13 Jun, 2016

1 commit


27 Apr, 2016

1 commit


10 Apr, 2016

1 commit

  • This has been a totally undocumented feature for years so add some
    generic concepts and documentation about open drain/source, include
    some facts on how we now support for hardware.

    Cc: Michael Hennerich
    Cc: Nicolas Saenz Julienne
    Cc: H. Nikolaus Schaller
    Signed-off-by: Linus Walleij

    Linus Walleij
     

25 Feb, 2016

1 commit


21 Nov, 2015

1 commit


06 Nov, 2015

1 commit

  • Pull documentation update from Jon Corbet:
    "There is a nice new document from Neil on how pathname lookups work
    and some new CAN driver documentation. Beyond that, we have
    kernel-doc fixes, a bit more work to support reproducible builds, and
    the usual collection of small fixes"

    * tag 'docs-for-linus' of git://git.lwn.net/linux: (34 commits)
    Documentation: add new description of path-name lookup.
    Documentation/vm/slub.txt: document slabinfo-gnuplot.sh
    Doc: ABI/stable: Fix typo in ABI/stable
    doc: Clarify that nmi_watchdog param is for hardlockups
    Typo correction for description in gpio document.
    DocBook: Fix kernel-doc to be case-insensitive for private:
    kernel-docs.txt: update kernelnewbies reference
    Doc:kvm: Fix typo in Doc/virtual/kvm
    Documentation/Changes: Add bc in "Current Minimal Requirements" section
    Documentation/email-clients.txt: remove trailing whitespace
    DocBook: Use a fixed encoding for output
    MAINTAINERS: The docs tree has moved
    Docs/kernel-parameters: Add earlycon devicetree usage
    SubmittingPatches: make Subject examples match the de facto standard
    Documentation: gpio: mention that -gpio has been deprecated
    Documentation: cgroups: just fix a few typos
    Documentation: Update kselftest.txt
    Documentation: DMA API: Be more explicit that nents is always the same
    Documentation: Update the default value of crashkernel low
    zram: update documentation
    ...

    Linus Torvalds
     

27 Oct, 2015

2 commits


20 Oct, 2015

1 commit


12 Oct, 2015

1 commit


25 Sep, 2015

1 commit

  • The gpiolib supports parsing DT properties of the form -gpio
    but it was only added for compatibility with older DT bindings that got
    it wrong and should not be used in newer bindings.

    The commit that added support for this was:

    dd34c37aa3e8 ("gpio: of: Allow -gpio suffix for property names")

    but didn't update the documentation to explain this so it's been a source
    of confusion. So let's make clear this in the GPIO documentation.

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: Jonathan Corbet

    Javier Martinez Canillas
     

14 Sep, 2015

3 commits


17 Aug, 2015

1 commit


21 Jul, 2015

1 commit


25 Jun, 2015

1 commit

  • Pull documentation updates from Jonathan Corbet:
    "The main thing here is Ingo's big subdirectory documenting feature
    support for each architecture. Beyond that, it's the usual pile of
    fixes, tweaks, and small additions"

    * tag 'docs-for-linus' of git://git.lwn.net/linux-2.6: (79 commits)
    doc:md: fix typo in md.txt.
    Documentation/mic/mpssd: don't build x86 userspace when cross compiling
    Documentation/prctl: don't build tsc tests when cross compiling
    Documentation/vDSO: don't build tests when cross compiling
    Doc:ABI/testing: Fix typo in sysfs-bus-fcoe
    Doc: Docbook: Change wikipedia's URL from http to https in scsi.tmpl
    Doc: Change wikipedia's URL from http to https
    Documentation/kernel-parameters: add missing pciserial to the earlyprintk
    Doc:pps: Fix typo in pps.txt
    kbuild : Fix documentation of INSTALL_HDR_PATH
    Documentation: filesystems: updated struct file_operations documentation in vfs.txt
    kbuild: edit explanation of clean-files variable
    Doc: ja_JP: Fix typo in HOWTO
    Move freefall program from Documentation/ to tools/
    Documentation: ARM: EXYNOS: Describe boot loaders interface
    Doc:nfc: Fix typo in nfc-hci.txt
    vfs: Minor documentation fix
    Doc: networking: txtimestamp: fix printf format warning
    Documentation, intel_pstate: Improve legacy mode internal governors description
    Documentation: extend use case for EXPORT_SYMBOL_GPL()
    ...

    Linus Torvalds
     

04 Jun, 2015

1 commit


22 May, 2015

1 commit


12 May, 2015

1 commit

  • Remove gpiod_sysfs_set_active_low (and gpio_sysfs_set_active_low) which
    allowed code to change the polarity of a gpio line even after it had
    been exported through sysfs.

    Drivers should not care, and generally does not know, about gpio-line
    polarity which is a hardware feature that needs to be described by
    firmware.

    It is currently possible to define gpio-line polarity in device-tree and
    acpi firmware or using platform data. Userspace can also change the
    polarity through sysfs.

    Note that drivers using the legacy gpio interface could still use
    GPIOF_ACTIVE_LOW to change the polarity before exporting the gpio.

    There are no in-kernel users of this interface.

    Cc: Jonathan Corbet
    Cc: Harry Wei
    Cc: Arnd Bergmann
    Cc: linux-doc@vger.kernel.org
    Cc: linux-kernel@zh-kernel.org
    Cc: linux-arch@vger.kernel.org
    Signed-off-by: Johan Hovold
    Reviewed-by: Alexandre Courbot
    Signed-off-by: Linus Walleij

    Johan Hovold
     

18 Apr, 2015

1 commit

  • Pull documentation updates from Jonathan Corbet:
    "Numerous fixes, the overdue removal of the i2o docs, some new Chinese
    translations, and, hopefully, the README fix that will end the flow of
    identical patches to that file"

    * tag 'docs-for-linus' of git://git.lwn.net/linux-2.6: (34 commits)
    Documentation/memcg: update memcg/kmem status
    Documentation: blackfin: Makefile: Typo building issue
    Documentation/vm/pagemap.txt: correct location of page-types tool
    Documentation/memory-barriers.txt: typo fix
    doc: Add guest_nice column to example output of `cat /proc/stat'
    Documentation/kernel-parameters: Move "eagerfpu" to its right place
    Documentation: gpio: Update ACPI part of the document to mention _DSD
    docs/completion.txt: Various tweaks and corrections
    doc: completion: context, scope and language fixes
    Documentation:Update Documentation/zh_CN/arm64/memory.txt
    Documentation:Update Documentation/zh_CN/arm64/booting.txt
    Documentation: Chinese translation of arm64/legacy_instructions.txt
    DocBook media: fix broken EIA hyperlink
    Documentation: tweak the maintainers entry
    README: Change gzip/bzip2 to xz compression format
    README: Update version number reference
    doc:pci: Fix typo in Documentation/PCI
    Documentation: drm: Use '->' when describing access through pointers.
    Documentation: Remove mentioning of block barriers
    Documentation/email-clients.txt: Fix one grammar mistake, add extra info about TB
    ...

    Linus Torvalds
     

04 Apr, 2015

1 commit


10 Mar, 2015

1 commit


05 Mar, 2015

2 commits

  • Add device managed variants of gpiod_get_array() / gpiod_put_array()
    functions for conveniently obtaining and disposing of an entire array
    of GPIOs with one function call.

    Signed-off-by: Rojhalat Ibrahim
    Reviewed-by: Alexandre Courbot
    Signed-off-by: Linus Walleij

    Rojhalat Ibrahim
     
  • Introduce new functions for conveniently obtaining and disposing of
    an entire array of GPIOs with one function call.

    ACPI parts tested by Mika Westerberg, DT parts tested by Rojhalat
    Ibrahim.

    Change log:
    v5: move the ACPI functions to gpiolib-acpi.c
    v4: - use shorter names for members of struct gpio_descs
    - rename lut_gpio_count to platform_gpio_count for clarity
    - add check for successful memory allocation
    - use ERR_CAST()
    v3: - rebase on current linux-gpio devel branch
    - fix ACPI GPIO counting
    - allow for zero-sized arrays
    - make the flags argument mandatory for the new functions
    - clarify documentation
    v2: change interface

    Suggested-by: Alexandre Courbot
    Signed-off-by: Rojhalat Ibrahim
    Reviewed-by: Alexandre Courbot
    Reviewed-by: Mika Westerberg
    Tested-by: Mika Westerberg
    Tested-by: Rojhalat Ibrahim
    Signed-off-by: Linus Walleij

    Rojhalat Ibrahim
     

29 Jan, 2015

1 commit


15 Dec, 2014

1 commit

  • Pull take two of the GPIO updates:
    "Same stuff as last time, now with a fixup patch for the previous
    compile error plus I ran a few extra rounds of compile-testing.

    This is the bulk of GPIO changes for the v3.19 series:

    - A new API that allows setting more than one GPIO at the time. This
    is implemented for the new descriptor-based API only and makes it
    possible to e.g. toggle a clock and data line at the same time, if
    the hardware can do this with a single register write. Both
    consumers and drivers need new calls, and the core will fall back
    to driving individual lines where needed. Implemented for the
    MPC8xxx driver initially

    - Patched the mdio-mux-gpio and the serial mctrl driver that drives
    modems to use the new multiple-setting API to set several signals
    simultaneously

    - Get rid of the global GPIO descriptor array, and instead allocate
    descriptors dynamically for each GPIO on a certain GPIO chip. This
    moves us closer to getting rid of the limitation of using the
    global, static GPIO numberspace

    - New driver and device tree bindings for 74xx ICs

    - New driver and device tree bindings for the VF610 Vybrid

    - Support the RCAR r8a7793 and r8a7794

    - Guidelines for GPIO device tree bindings trying to get things a bit
    more strict with the advent of combined device properties

    - Suspend/resume support for the MVEBU driver

    - A slew of minor fixes and improvements"

    * tag 'gpio-v3.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (33 commits)
    gpio: mcp23s08: fix up compilation error
    gpio: pl061: document gpio-ranges property for bindings file
    gpio: pl061: hook request if gpio-ranges avaiable
    gpio: mcp23s08: Add option to configure IRQ output polarity as active high
    gpio: fix deferred probe detection for legacy API
    serial: mctrl_gpio: use gpiod_set_array function
    mdio-mux-gpio: Use GPIO descriptor interface and new gpiod_set_array function
    gpio: remove const modifier from gpiod_get_direction()
    gpio: remove gpio_descs global array
    gpio: mxs: implement get_direction callback
    gpio: em: Use dynamic allocation of GPIOs
    gpio: Check if base is positive before calling gpio_is_valid()
    gpio: mcp23s08: Add simple IRQ support for SPI devices
    gpio: mcp23s08: request a shared interrupt
    gpio: mcp23s08: Do not free unrequested interrupt
    gpio: rcar: Add r8a7793 and r8a7794 support
    gpio-mpc8xxx: add mpc8xxx_gpio_set_multiple function
    gpiolib: allow simultaneous setting of multiple GPIO outputs
    gpio: mvebu: add suspend/resume support
    gpio: gpio-davinci: remove duplicate check on resource
    ..

    Linus Torvalds
     

27 Nov, 2014

1 commit

  • Introduce new functions gpiod_set_array & gpiod_set_raw_array to the consumer
    interface which allow setting multiple outputs with just one function call.
    Also add an optional set_multiple function to the driver interface. Without an
    implementation of that function in the chip driver outputs are set
    sequentially.

    Implementing the set_multiple function in a chip driver allows for:
    - Improved performance for certain use cases. The original motivation for this
    was the task of configuring an FPGA. In that specific case, where 9 GPIO
    lines have to be set many times, configuration time goes down from 48 s to
    20 s when using the new function.
    - Simultaneous glitch-free setting of multiple pins on any kind of parallel
    bus attached to GPIOs provided they all reside on the same chip and bank.

    Limitations:
    Performance is only improved for normal high-low outputs. Open drain and
    open source outputs are always set separately from each other. Those kinds
    of outputs could probably be accelerated in a similar way if we could
    forgo the error checking when setting GPIO directions.

    Change log:
    v6: - rebase on current linux-gpio devel branch
    v5: - check can_sleep property per chip
    - remove superfluous checks
    - supplement documentation
    v4: - add gpiod_set_array function for setting logical values
    - change interface of the set_multiple driver function to use
    unsigned long as type for the bit fields
    - use generic bitops (which also use unsigned long for bit fields)
    - do not use ARCH_NR_GPIOS any more
    v3: - add documentation
    - change commit message
    v2: - use descriptor interface
    - allow arbitrary groups of GPIOs spanning multiple chips

    Signed-off-by: Rojhalat Ibrahim
    Reviewed-by: Alexandre Courbot
    Reviewed-by: Mark Brown
    Signed-off-by: Linus Walleij

    Rojhalat Ibrahim
     

05 Nov, 2014

1 commit


29 Oct, 2014

1 commit


10 Oct, 2014

1 commit

  • Pull GPIO changes from Linus Walleij:
    "This is the bulk of GPIO changes for the v3.18 development cycle:

    - Increase the default ARCH_NR_GPIO from 256 to 512. This was done
    to avoid having a custom header for the x86
    architecture - GPIO is custom and complicated enough as it is
    already! We want to move to a radix to store the descriptors going
    forward, and finally get rid of this fixed array size altogether.

    - Endgame patching of the gpio_remove() semantics initiated by
    Abdoulaye Berthe. It is not accepted by the system that the
    removal of a GPIO chip fails during eg reboot or shutdown, and
    therefore the return value has now painfully been refactored away.
    For special cases like GPIO expanders on a hot-pluggable bus like
    USB, we may later add some gpiochip_try_remove() call, but for the
    cases we have now, return values are moot.

    - Some incremental refactoring of the gpiolib core and ACPI GPIO
    library for more descriptor usage.

    - Refactor the chained IRQ handler set-up method to handle also
    threaded, nested interrupts and set up the parent IRQ correctly.
    Switch STMPE and TC3589x drivers to use this registration method.

    - Add a .irq_not_threaded flag to the struct gpio_chip, so that also
    GPIO expanders that block but are still not using threaded IRQ
    handlers.

    - New drivers for the ARM64 X-Gene SoC GPIO controller.

    - The syscon GPIO driver has been improved to handle the "DSP GPIO"
    found on the TI Keystone 2 SoC:s.

    - ADNP driver switched to use gpiolib irqchip helpers.

    - Refactor the DWAPB driver to support being instantiated from and
    MFD cell (platform device).

    - Incremental feature improvement in the Zynq, MCP23S08, DWAPB, OMAP,
    Xilinx and Crystalcove drivers.

    - Various minor fixes"

    * tag 'gpio-v3.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (52 commits)
    gpio: pch: Build context save/restore only for PM
    pinctrl: abx500: get rid of unused variable
    gpio: ks8695: fix 'else should follow close brace '}''
    gpio: stmpe: add verbose debug code
    gpio: stmpe: fix up interrupt enable logic
    gpio: staticize xway_stp_init()
    gpio: handle also nested irqchips in the chained handler set-up
    gpio: set parent irq on chained handlers
    gpiolib: irqchip: use irq_find_mapping while removing irqchip
    gpio: crystalcove: support virtual GPIO
    pinctrl: bcm281xx: make Kconfig dependency more strict
    gpio: kona: enable only on BCM_MOBILE or for compile testing
    gpio, bcm-kona, LLVMLinux: Remove use of __initconst
    gpio: Fix ngpio in gpio-xilinx driver
    gpio: dwapb: fix pointer to integer cast
    gpio: xgene: Remove unneeded #ifdef CONFIG_OF guard
    gpio: xgene: Remove unneeded forward declation for struct xgene_gpio
    gpio: xgene: Fix missing spin_lock_init()
    gpio: ks8695: fix switch case indentation
    gpiolib: add irq_not_threaded flag to gpio_chip
    ...

    Linus Torvalds