14 Oct, 2020

1 commit

  • Pull GPIO updates from Linus Walleij:
    "This time very little driver changes but lots of core changes.

    We have some interesting cooperative work for ARM and Intel alike,
    making the GPIO subsystem more and more suitable for industrial
    systems and the like, in addition to the in-kernel users.

    We touch driver core (device properties) and lib/* by adding one
    simple string array free function, these are authored by Andy
    Shevchenko who is a well known and recognized core helpers maintainers
    so this should be fine.

    We also see some Android GKI-related modularization in the MXC
    drivers.

    Core changes:

    - The big core change is the updated (v2) userspace character device
    API.

    This corrects badly designed 64-bit alignment around the line
    events. We also add the debounce request feature. This echoes the
    often quotes passage from Frederick Brooks "The mythical man-month"
    to always throw one away, which we have seen before in things such
    as V4L2. So we put in a new one and deprecate and obsolete the old
    one.

    - All example tools in tools/gpio/* are migrated to the new API to
    set a good example. The libgpiod userspace library has been
    augmented to use this new API pretty much from day 1.

    - Some misc API hardening by using strn* function calls has been
    added as well.

    - Use the simpler IDA interface for GPIO chip instance enumeration.

    - Add device core function for counting string arrays in device
    properties.

    - Provide a generic library function kfree_strarray() that can be
    used throughout the kernel.

    Driver enhancements:

    - The DesignWare dwapb-gpio driver has been enhanced and now uses the
    IRQ handling in the gpiolib core.

    - The mockup and aggregator drivers have seen some substantial code
    clean-up and now use more of the core kernel inftrastructure.

    - Misc cleanups using dev_err_probe().

    - The MXC drivers (Freescale/NXP) can now be built modularized, which
    makes modularized GKI Android kernels happy"

    * tag 'gpio-v5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (73 commits)
    gpiolib: Update header block in gpiolib-cdev.h
    gpiolib: cdev: switch from kstrdup() to kstrndup()
    docs: gpio: add a new document to its index.rst
    gpio: pca953x: Add support for the NXP PCAL9554B/C
    tools: gpio: add debounce support to gpio-event-mon
    tools: gpio: add multi-line monitoring to gpio-event-mon
    tools: gpio: port gpio-event-mon to v2 uAPI
    tools: gpio: port gpio-hammer to v2 uAPI
    tools: gpio: rename nlines to num_lines
    tools: gpio: port gpio-watch to v2 uAPI
    tools: gpio: port lsgpio to v2 uAPI
    gpio: uapi: document uAPI v1 as deprecated
    gpiolib: cdev: support setting debounce
    gpiolib: cdev: support GPIO_V2_LINE_SET_VALUES_IOCTL
    gpiolib: cdev: support GPIO_V2_LINE_SET_CONFIG_IOCTL
    gpiolib: cdev: support edge detection for uAPI v2
    gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL
    gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL
    gpiolib: add build option for CDEV v1 ABI
    gpiolib: make cdev a build option
    ...

    Linus Torvalds
     

14 Sep, 2020

1 commit

  • devprop_gpiochip_set_names() is overly complicated with taking the
    fwnode argument (which requires using dev_fwnode() & of_fwnode_handle()
    in ACPI and OF GPIO code respectively). Let's just switch to using the
    generic device properties.

    This allows us to pull the code setting line names directly into
    gpiochip_add_data_with_key() instead of handling it separately for
    ACPI and OF.

    Signed-off-by: Bartosz Golaszewski
    Reviewed-by: Andy Shevchenko
    Reviewed-by: Mika Westerberg

    Bartosz Golaszewski
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

16 Apr, 2020

1 commit

  • The gpiolib ACPI code uses 2 initcall-s and the called function
    (and used DMI table) is missing __init(const) markers.

    This commit fixes this freeing up some extra memory once the kernel
    has completed booting.

    Acked-by: Mika Westerberg
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200325103956.109284-2-hdegoede@redhat.com
    Signed-off-by: Linus Walleij

    Hans de Goede
     

24 Mar, 2020

1 commit

  • There are at least 3 models of the HP x2 10 models:

    Bay Trail SoC + AXP288 PMIC
    Cherry Trail SoC + AXP288 PMIC
    Cherry Trail SoC + TI PMIC

    Like on the other HP x2 10 models we need to ignore wakeup for ACPI GPIO
    events on the external embedded-controller pin to avoid spurious wakeups
    on the HP x2 10 CHT + AXP288 model too.

    This commit adds an extra DMI based quirk for the HP x2 10 CHT + AXP288
    model, ignoring wakeups for ACPI GPIO events on the EC interrupt pin
    on this model. This fixes spurious wakeups from suspend on this model.

    Fixes: aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism")
    Reported-and-tested-by: Marc Lehmann
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200302111225.6641-4-hdegoede@redhat.com
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Hans de Goede
     

11 Mar, 2020

3 commits

  • Commit aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option +
    quirk mechanism") was added to deal with spurious wakeups on one specific
    model of the HP x2 10 series. In the mean time I have learned that there
    are at least 3 different HP x2 10 models:

    Bay Trail SoC + AXP288 PMIC
    Cherry Trail SoC + AXP288 PMIC
    Cherry Trail SoC + TI PMIC

    And the original quirk is only correct for (and only matches the)
    Cherry Trail SoC + TI PMIC model.

    The Bay Trail SoC + AXP288 PMIC model has different DMI strings, has
    the external EC interrupt on a different GPIO pin and only needs to ignore
    wakeups on the EC interrupt, the INT0002 device works fine on this model.

    This commit adds an extra DMI based quirk for the HP x2 10 BYT + AXP288
    model, ignoring wakeups for ACPI GPIO events on the EC interrupt pin
    on this model. This fixes spurious wakeups from suspend on this model.

    Fixes: aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism")
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200302111225.6641-3-hdegoede@redhat.com
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Hans de Goede
     
  • Commit aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option +
    quirk mechanism") was added to deal with spurious wakeups on one specific
    model of the HP x2 10 series.

    The approach taken there was to add a bool controlling wakeup support for
    all ACPI GPIO events. This was sufficient for the specific HP x2 10 model
    the commit was trying to fix, but in the mean time other models have
    turned up which need a similar workaround to avoid spurious wakeups from
    suspend, but only for one of the pins on which the ACPI tables request
    ACPI GPIO events.

    Since the honor_wakeup option was added to be able to ignore wake events,
    the name was perhaps not the best, this commit renames it to ignore_wake
    and changes it to a string with the following format:
    gpiolib_acpi.ignore_wake=controller@pin[,controller@pin[,...]]

    This allows working around spurious wakeup issues on a per pin basis.

    This commit also reworks the existing quirk for the HP x2 10 so that
    it functions as before.

    Note:
    -This removes the honor_wakeup parameter. This has only been upstream for
    a short time and to the best of my knowledge there are no users using
    this module parameter.

    -The controller@pin[,controller@pin[,...]] syntax is based on an existing
    kernel module parameter using the same controller@pin format. That version
    uses ';' as separator, but in practice that is problematic because grub2
    cannot handle this without taking special care to escape the ';', so here
    we are using a ',' as separator instead which does not have this issue.

    Fixes: aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism")
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200302111225.6641-2-hdegoede@redhat.com
    Acked-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij

    Hans de Goede
     
  • Commit aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option +
    quirk mechanism") added a quirk for some models of the HP x2 10 series.

    There are 2 issues with the comment describing the quirk:
    1) The comment claims the DMI quirk applies to all Cherry Trail based HP x2
    10 models. In the mean time I have learned that there are at least 3
    models of the HP x2 10 models:

    Bay Trail SoC + AXP288 PMIC
    Cherry Trail SoC + AXP288 PMIC
    Cherry Trail SoC + TI PMIC

    And this quirk's DMI matches only match the Cherry Trail SoC + TI PMIC
    SoC, which is good because we want a slightly different quirk for the
    others. This commit updates the comment to make it clear that the quirk
    is only for the Cherry Trail SoC + TI PMIC models.

    2) The comment says that it is ok to disable wakeup on all ACPI GPIO event
    handlers, because there is only the one for the embedded-controller
    events. This is not true, there also is a handler for the special
    INT0002 device which is related to USB wakeups. We need to also disable
    wakeups on that one because the device turns of the USB-keyboard built
    into the dock when closing the lid. The XHCI controller takes a while
    to notice this, so it only notices it when already suspended, causing
    a spurious wakeup because of this. So disabling wakeup on all handlers
    is the right thing to do, but not because there only is the one handler
    for the EC events. This commit updates the comment to correctly reflect
    this.

    Fixes: aa23ca3d98f7 ("gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism")
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200302111225.6641-1-hdegoede@redhat.com
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Hans de Goede
     

07 Jan, 2020

2 commits

  • On some laptops enabling wakeup on the GPIO interrupts used for ACPI _AEI
    event handling causes spurious wakeups.

    This commit adds a new honor_wakeup option, defaulting to true (our current
    behavior), which can be used to disable wakeup on troublesome hardware
    to avoid these spurious wakeups.

    This is a workaround for an architectural problem with s2idle under Linux
    where we do not have any mechanism to immediately go back to sleep after
    wakeup events, other then for embedded-controller events using the standard
    ACPI EC interface, for details see:
    https://lore.kernel.org/linux-acpi/61450f9b-cbc6-0c09-8b3a-aff6bf9a0b3c@redhat.com/

    One series of laptops which is not able to suspend without this workaround
    is the HP x2 10 Cherry Trail models, this commit adds a DMI based quirk
    which makes sets honor_wakeup to false on these models.

    Cc: stable@vger.kernel.org
    Reviewed-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200105160357.97154-3-hdegoede@redhat.com
    Signed-off-by: Linus Walleij

    Hans de Goede
     
  • Turn the existing run_edge_events_on_boot_blacklist dmi_system_id table
    into a generic quirk table, storing the quirks in the driver_data ptr.

    This is a preparation patch for adding other types of (DMI based) quirks.

    Cc: stable@vger.kernel.org
    Reviewed-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20200105160357.97154-2-hdegoede@redhat.com
    Signed-off-by: Linus Walleij

    Hans de Goede
     

02 Dec, 2019

1 commit

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

    Core changes:

    - Expose pull up/down flags for the GPIO character device to
    userspace.

    After clear input from the RaspberryPi and Beagle communities, it
    has been established that prototyping, industrial automation and
    make communities strongly need this feature, and as we want people
    to use the character device, we have implemented the simple pull
    up/down interface for GPIO lines.

    This means we can specify that a (chip-specific) pull up/down
    resistor can be enabled, but does not offer fine-grained control
    such as cases where the resistance of the same pull resistor can be
    controlled (yet).

    - Introduce devm_fwnode_gpiod_get_index() and start to phase out the
    old symbol devm_fwnode_get_index_gpiod_from_child().

    - A bit of documentation clean-up work.

    - Introduce a define for GPIO line directions and deploy it in all
    GPIO drivers in the drivers/gpio directory.

    - Add a special callback to populate pin ranges when cooperating with
    the pin control subsystem and registering ranges as part of adding
    a gpiolib driver and a gpio_irq_chip driver at the same time. This
    is also deployed in the Intel Merrifield driver.

    New drivers:

    - RDA Micro GPIO controller.

    - XGS-iproc GPIO driver.

    Driver improvements:

    - Wake event and debounce support on the Tegra 186 driver.

    - Finalize the Aspeed SGPIO driver.

    - MPC8xxx uses a normal IRQ handler rather than a chained handler"

    * tag 'gpio-v5.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (64 commits)
    gpio: Add TODO item for regmap helper
    Documentation: gpio: driver.rst: Fix warnings
    gpio: of: Fix bogus reference to gpiod_get_count()
    gpiolib: Grammar s/manager/managed/
    gpio: lynxpoint: Setup correct IRQ handlers
    MAINTAINERS: Replace my email by one @kernel.org
    gpiolib: acpi: Make acpi_gpiochip_alloc_event always return AE_OK
    gpio/mpc8xxx: fix qoriq GPIO reading
    gpio: mpc8xxx: Don't overwrite default irq_set_type callback
    gpiolib: acpi: Print pin number on acpi_gpiochip_alloc_event errors
    gpiolib: fix coding style in gpiod_hog()
    drm/bridge: ti-tfp410: switch to using fwnode_gpiod_get_index()
    gpio: merrifield: Pass irqchip when adding gpiochip
    gpio: merrifield: Add GPIO pin mapping ranges via callback
    gpiolib: Introduce ->add_pin_ranges() callback
    gpio: mmio: remove untrue leftover comment
    gpio: em: Use platform_get_irq() to obtain interrupts
    gpio: tegra186: Add debounce support
    gpio: tegra186: Program interrupt route mapping
    gpio: tegra186: Derive register offsets from bank/port
    ...

    Linus Torvalds
     

21 Nov, 2019

1 commit

  • acpi_gpiochip_alloc_event is used to loop over all _AEI resources, if
    we fail to bind an event handler to one of them, that is not a reason to
    not try the other resources.

    This commit modifies acpi_gpiochip_alloc_event to always return AE_OK,
    so that we will always try to add an event handler for all _AEI resources.

    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20191114102600.34558-2-hdegoede@redhat.com
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Hans de Goede
     

15 Nov, 2019

1 commit


14 Nov, 2019

1 commit

  • The Terra Pad 1061 has the usual micro-USB-B id-pin handler, but instead
    of controlling the actual micro-USB-B it turns the 5V boost for the
    tablet's USB-A connector and its keyboard-cover connector off.

    The actual micro-USB-B connector on the tablet is wired for charging only,
    and its id pin is *not* connected to the GPIO which is used for the
    (broken) id-pin event handler in the DSDT.

    While at it not only add a comment why the Terra Pad 1061 is on the
    blacklist, but also fix the missing comment for the Minix Neo Z83-4 entry.

    Fixes: 61f7f7c8f978 ("gpiolib: acpi: Add gpiolib_acpi_run_edge_events_on_boot option and blacklist")
    Signed-off-by: Hans de Goede
    Reviewed-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Hans de Goede
     

17 Sep, 2019

1 commit

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

    Core changes:

    - Support hierarchical GPIO irqchips.

    We now have three consumers that can use this: Intel IXP4xx,
    ThunderX and Qualcomm SPMI GPIO (in the pinctrl subsystem).

    The support code has been long in the making and hashed out so it
    should be easily adaptable for all hierarchical irqchip parents.
    The code only gets compiled in if hierarchical irqchip is used at
    the topmost irq controller at least, as the hierarchical irqchip
    requires strict hierarchy all the way up in the system.

    - Determine the need for a "valid_mask" for GPIO lines on the
    gpio_chip and conversely for the "valid_mask" for the GPIO
    interrupt chip interrupt lines by looking for a .init_valid_mask()
    callback in the main chip or GPIO interrupt chip respectively.
    Allocate it with bitmap_alloc().

    - Isolate the device tree/open firmware GPIO description code out in
    its own file properly.

    - Isolate the ACPI GPIO description code out in its own file
    properly.

    - Drop a whole lot of #ifdef:s in the main includes: it does not hurt
    to keep the include items around, and we get quicker and clearer
    compile failures if the appropriate kernel symbols are not selected
    for drivers.

    New/deleted drivers:

    - New driver for Aspeed SGPIO.

    - The KS8695 driver is deleted as the platform gets deleted from
    arch/arm in this kernel cycle.

    - The Cirrus Logic Madera driver now supports CS47L92 and CS47L15.

    - The Freescale MPC8xxx now supports LS1028A and LS1088A.

    Driver improvements:

    - We pass the GPIO irqchip intialization by directly filling in the
    struct instead of using set-up functions (the new way) for Intel
    MID, Lynxpoint, Merrifield, XLP, HLWD, Aspeed, ZX, VF610, TQMX86,
    MT7621, Zynq and EP93xx.

    Out-of-band changes:

    - Fix a GPIO header inclusion in Unicore - no response from
    maintainer.

    - Drop FMC subsystem from MAINTAINERS - was deleted in the GPIO tree
    last cycle so let's mop up the shards"

    * tag 'gpio-v5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (82 commits)
    gpiolib: of: add a fallback for wlf,reset GPIO name
    gpio: htc-egpio: Remove unused exported htc_egpio_get_wakeup_irq()
    gpio: remove explicit comparison with 0
    gpio: creg-snps: use devm_platform_ioremap_resource() to simplify code
    gpio: devres: Switch to EXPORT_SYMBOL_GPL()
    gpio: of: Switch to EXPORT_SYMBOL_GPL()
    gpio: of: Make of_gpio_simple_xlate() private
    gpio: of: Make of_get_named_gpiod_flags() private
    gpio: aspeed: Add in ast2600 details to Aspeed driver
    gpio: aspeed: Use ngpio property from device tree if available
    gpio: aspeed: Setup irqchip dynamically
    gpio/aspeed: Fix incorrect number of banks
    gpio: aspeed: Update documentation with ast2600 controllers
    gpio: Initialize the irqchip valid_mask with a callback
    gpiolib: acpi: make acpi_can_fallback_to_crs() static
    gpio: Fix further merge errors
    gpio: Fix up merge collision in include file
    gpio: of: Normalize return code variable name
    gpio: gpiolib: Normalize return code variable name
    gpio: ep93xx: Pass irqchip when adding gpiochip
    ...

    Linus Torvalds
     

11 Sep, 2019

1 commit

  • Another day; another DSDT bug we need to workaround...

    Since commit ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events
    at least once on boot") we call _AEI edge handlers at boot.

    In some rare cases this causes problems. One example of this is the Minix
    Neo Z83-4 mini PC, this device has a clear DSDT bug where it has some copy
    and pasted code for dealing with Micro USB-B connector host/device role
    switching, while the mini PC does not even have a micro-USB connector.
    This code, which should not be there, messes with the DDC data pin from
    the HDMI connector (switching it to GPIO mode) breaking HDMI support.

    To avoid problems like this, this commit adds a new
    gpiolib_acpi.run_edge_events_on_boot kernel commandline option, which
    allows disabling the running of _AEI edge event handlers at boot.

    The default value is -1/auto which uses a DMI based blacklist, the initial
    version of this blacklist contains the Neo Z83-4 fixing the HDMI breakage.

    Cc: stable@vger.kernel.org
    Cc: Daniel Drake
    Cc: Ian W MORRISON
    Reported-by: Ian W MORRISON
    Suggested-by: Ian W MORRISON
    Fixes: ca876c7483b6 ("gpiolib-acpi: make sure we trigger edge events at least once on boot")
    Signed-off-by: Hans de Goede
    Link: https://lore.kernel.org/r/20190827202835.213456-1-hdegoede@redhat.com
    Acked-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Tested-by: Ian W MORRISON
    Signed-off-by: Linus Walleij

    Hans de Goede
     

10 Sep, 2019

1 commit


31 Jul, 2019

2 commits

  • The API, which belongs to GPIO library, is foreign to ACPI headers. Earlier
    we moved out I²C out of the latter, and now it's time for
    acpi_dev_add_driver_gpios() et al.

    For time being the acpi_gpio_get_irq_resource() and acpi_dev_gpio_irq_get()
    are left untouched as they need more thought about.

    Note, it requires uninline acpi_dev_remove_driver_gpios() to keep purity of
    consumer.h.

    Cc: Pierre-Louis Bossart
    Cc: Liam Girdwood
    Cc: Jie Yang
    Cc: Mark Brown
    Cc: alsa-devel@alsa-project.org (moderated list:INTEL ASoC DRIVERS)
    Signed-off-by: Andy Shevchenko
    Link: https://lore.kernel.org/r/20190730104337.21235-3-andriy.shevchenko@linux.intel.com
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • This is a follow up to the commit

    f626d6dfb709 ("gpio: of: Break out OF-only code")

    which broke down OF parts of GPIO library. Here we do the similar to ACPI.

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

    Andy Shevchenko
     

08 Jun, 2019

1 commit

  • When a gpio_chip wants to request a descriptor from itself
    using gpiochip_request_own_desc() it needs to be able to specify
    fully how to use the descriptor, notably line inversion
    semantics. The workaround in the gpiolib.c can be removed
    and cases (such as SPI CS) where we need at times to request
    a GPIO with line inversion semantics directly on a chip for
    workarounds, can be fully supported with this call.

    Fix up some users of the API that weren't really using the
    last flag to set up the line as input or output properly
    but instead just calling direction setting explicitly
    after requesting the line.

    Cc: Martin Sperl
    Signed-off-by: Linus Walleij

    Linus Walleij
     

23 Apr, 2019

6 commits

  • For now, we don't take into account the pin bias settings supplied by ACPI.
    This change is targeting the mentioned gap.

    Signed-off-by: Andy Shevchenko
    Acked-by: Hans de Goede
    Reviewed-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • This helper consolidates all settings of GPIO descriptor lookup flags and
    quirks in the future if any.

    No functional change intended.

    Signed-off-by: Andy Shevchenko
    Acked-by: Hans de Goede
    Reviewed-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • ACPI GpioIo() resource may have different bias settings.
    For now, we distinguish only PullUp() setting in order to configure
    the initial state of a pin.

    Take into consideration the rest of the possible choices as well,
    i.e. PullDown, PullNone and PullDefault, when configuring the initial state
    of the pin.

    Signed-off-by: Andy Shevchenko
    Acked-by: Hans de Goede
    Reviewed-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • Most of the code inside GPIO library is using enum gpiod_flags.
    Some of the function still operate with unsigned int.

    In order to be more consistent and better type checking, convert
    acpi_gpiochip_parse_own_gpio() to use enum gpiod_flags instead of
    unsigned int.

    Signed-off-by: Andy Shevchenko
    Acked-by: Hans de Goede
    Reviewed-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Andy Shevchenko
     
  • Since GPIO library operates with enumerator when it's subject to handle
    the GPIO lookup flags, it will be better to clearly see what default means.

    Thus, introduce GPIO_LOOKUP_FLAGS_DEFAULT entry to describe
    the default assumptions.

    While here, replace 0 by newly introduced constant.

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

    Andy Shevchenko
     
  • The library uses enum gpio_lookup_flags to define the possible
    characteristics of GPIO pin. Since enumerator listed only individual
    bits the common use of it is in a form of a bitmask of
    gpio_lookup_flags GPIO_* values. The more correct type for this is
    unsigned long.

    Due to above convert all users to use unsigned long instead of
    enum gpio_lookup_flags except enumerator definition.

    While here, make field and parameter descriptions consistent as well.

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

    Andy Shevchenko
     

01 Apr, 2019

1 commit

  • This patch does the following bunch of changes:
    - append () to the functions for reference
    - convert gpiochip(s) -> GPIO chip(s)
    - add a note about returned error code type [acpi_find_gpio()]
    - move long summary to a description [acpi_gpio_count()]

    Signed-off-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Bartosz Golaszewski

    Andy Shevchenko
     

09 Mar, 2019

1 commit

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

    Core changes:

    - The big change this time around is the irqchip handling in the
    qualcomm pin controllers, closely coupled with the gpiochip. This
    rework, in a classic fall-between-the-chairs fashion has been
    sidestepped for too long.

    The Qualcomm IRQchips using the SPMI and SSBI transport mechanisms
    have been rewritten to use hierarchical irqchip. This creates the
    base from which I intend to gradually pull support for hierarchical
    irqchips into the gpiolib irqchip helpers to cut down on duplicate
    code.

    We have too many hacks in the kernel because people have been
    working around the missing hierarchical irqchip for years, and once
    it was there, noone understood it for a while. We are now slowly
    adapting to using it.

    This is why this pull requests include changes to MFD, SPMI,
    IRQchip core and some ARM Device Trees pertaining to the Qualcomm
    chip family. Since Qualcomm have so many chips and such large
    deployments it is paramount that this platform gets this right, and
    now it (hopefully) does.

    - Core support for pull-up and pull-down configuration, also from the
    device tree. When a simple GPIO chip supports an "off or on" pull-up
    or pull-down resistor, we provide a way to set this up using
    machine descriptors or device tree.

    If more elaborate control of pull up/down (such as resistance shunt
    setting) is required, drivers should be phased over to use pin
    control. We do not yet provide a userspace ABI for this pull
    up-down setting but I suspect the makers are going to ask for it
    soon enough. PCA953x is the first user of this new API.

    - The GPIO mockup driver has been revamped after some discussion
    improving the IRQ simulator in the process.

    The idea is to make it possible to use the mockup for both testing
    and virtual prototyping, e.g. when you do not yet have a GPIO
    expander to play with but really want to get something to develop
    code around before hardware is available. It's neat. The blackbox
    testing usecase is currently making its way into kernelci.

    - ACPI GPIO core preserves non direction flags when updating flags.

    - A new device core helper for devm_platform_ioremap_resource() is
    funneled through the GPIO tree with Greg's ACK.

    New drivers:

    - TQ-Systems QTMX86 GPIO controllers (using port-mapped I/O)

    - Gateworks PLD GPIO driver (vaccumed up from OpenWrt)

    - AMD G-Series PCH (Platform Controller Hub) GPIO driver.

    - Fintek F81804 & F81966 subvariants.

    - PCA953x now supports NXP PCAL6416.

    Driver improvements:

    - IRQ support on the Nintendo Wii (Hollywood) GPIO.

    - get_direction() support for the MVEBU driver.

    - Set the right output level on SAMA5D2.

    - Drop the unused irq trigger setting on the Spreadtrum driver.

    - Wakeup support for PCA953x.

    - A slew of cleanups in the various Intel drivers"

    * tag 'gpio-v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (110 commits)
    gpio: gpio-omap: fix level interrupt idling
    gpio: amd-fch: Set proper output level for direction_output
    x86: apuv2: remove unused variable
    gpio: pca953x: Use PCA_LATCH_INT
    platform/x86: fix PCENGINES_APU2 Kconfig warning
    gpio: pca953x: Fix dereference of irq data in shutdown
    gpio: amd-fch: Fix type error found by sparse
    gpio: amd-fch: Drop const from resource
    gpio: mxc: add check to return defer probe if clock tree NOT ready
    gpio: ftgpio: Register per-instance irqchip
    gpio: ixp4xx: Add DT bindings
    x86: pcengines apuv2 gpio/leds/keys platform driver
    gpio: AMD G-Series PCH gpio driver
    drivers: depend on HAS_IOMEM for devm_platform_ioremap_resource()
    gpio: tqmx86: Set proper output level for direction_output
    gpio: sprd: Change to use SoC compatible string
    gpio: sprd: Use SoC compatible string instead of wildcard string
    gpio: of: Handle both enable-gpio{,s}
    gpio: of: Restrict enable-gpio quirk to regulator-gpio
    gpio: davinci: use devm_platform_ioremap_resource()
    ...

    Linus Torvalds
     

07 Mar, 2019

1 commit

  • Pull sound updates from Takashi Iwai:
    "We had again a busy development cycle with many new drivers as well as
    lots of core improvements / cleanups. Let's go for highlights:

    ALSA core:

    - PCM locking scheme was refactored for reducing a global rwlock

    - PCM suspend is handled in the device type PM ops now; lots of
    explicit calls were reduced by this action

    - Cleanups about PCM buffer preallocation calls

    - Kill NULL device object in memory allocations

    - Lots of procfs API cleanups

    ASoC core:

    - Support for only powering up channels that are actively being used

    - Cleanups / fixes of topology API

    ASoC drivers:

    - MediaTek BTCVSD for a Bluetooth radio chip, which is the first such
    driver we've had upstream!

    - Quite a few improvements to simplify the generic card drivers,
    especially the merge of the SCU cards into the main generic drivers

    - Lots of fixes for probing on Intel systems to follow more standard
    styles

    - A big refresh and cleanup of the Samsung drivers

    - New drivers: Asahi Kasei Microdevices AK4497, Cirrus Logic CS4341
    and CS35L26, Google ChromeOS embedded controllers, Ingenic JZ4725B,
    MediaTek BTCVSD, MT8183 and MT6358, NXP MICFIL, Rockchip RK3328,
    Spreadtrum DMA controllers, Qualcomm WCD9335, Xilinx S/PDIF and PCM
    formatters

    ALSA drivers:

    - Improvements of Tegra HD-audio controller driver for supporting new
    chips

    - HD-audio codec quirks for ALC294 S4 resume, ASUS laptop, Chrome
    headset button support and Dell workstations

    - Improved DSD support on USB-audio

    - Quirk for MOTU MicroBook II USB-audio

    - Support for Fireface UCX support and Solid State Logic Duende
    Classic/Mini"

    * tag 'sound-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (461 commits)
    ALSA: usb-audio: Add quirk for MOTU MicroBook II
    ASoC: stm32: i2s: skip useless write in slave mode
    ASoC: stm32: i2s: fix race condition in irq handler
    ASoC: stm32: i2s: remove useless callback
    ASoC: stm32: i2s: fix dma configuration
    ASoC: stm32: i2s: fix stream count management
    ASoC: stm32: i2s: fix 16 bit format support
    ASoC: stm32: i2s: fix IRQ clearing
    ASoC: qcom: Kconfig: fix dependency for sdm845
    ASoC: Intel: Boards: Add Maxim98373 support
    ASoC: rsnd: gen: fix SSI9 4/5/6/7 busif related register address
    ALSA: firewire-motu: fix construction of PCM frame for capture direction
    ALSA: bebob: use more identical mod_alias for Saffire Pro 10 I/O against Liquid Saffire 56
    ALSA: hda: Extend i915 component bind timeout
    ASoC: wm_adsp: Improve logging messages
    ASoC: wm_adsp: Add support for multiple compressed buffers
    ASoC: wm_adsp: Refactor compress stream initialisation
    ASoC: wm_adsp: Reorder some functions for improved clarity
    ASoC: wm_adsp: Factor out stripping padding from ADSP data
    ASoC: cs35l36: Fix an IS_ERR() vs NULL checking bug
    ...

    Linus Torvalds
     

04 Mar, 2019

1 commit

  • * acpica:
    ACPICA: Update version to 20190215
    ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting
    ACPICA: ACPI 6.3: add GTDT Revision 3 support
    ACPICA: ACPI 6.3: HMAT updates
    ACPICA: ACPI 6.3: PPTT add additional fields in Processor Structure Flags
    ACPICA: ACPI 6.3: add Error Disconnect Recover Notification value
    ACPICA: ACPI 6.3: MADT: add support for statistical profiling in GICC
    ACPICA: ACPI 6.3: add PCC operation region support for AML interpreter
    ACPICA: ACPI 6.3: SRAT: add Generic Affinity Structure subtable
    ACPICA: ACPI 6.3: Add Trigger order to PCC Identifier structure in PDTT
    ACPICA: ACPI 6.3: Adding predefined methods _NBS, _NCH, _NIC, _NIH, and _NIG
    ACPICA: Update/clarify messages for control method failures
    ACPICA: Debugger: Fix possible fault with the "test objects" command
    ACPICA: Interpreter: Emit warning for creation of a zero-length op region
    ACPICA: Remove legacy module-level code support
    ACPICA: Get rid of acpi_sleep_dispatch()
    ACPICA: Update version to 20190108
    ACPICA: All acpica: Update copyrights to 2019
    ACPICA: acpiexec: Add option to dump extra info for memory leaks
    ACPICA: Convert more ACPI errors to firmware errors

    Rafael J. Wysocki
     

25 Feb, 2019

1 commit


18 Feb, 2019

1 commit


09 Feb, 2019

1 commit


28 Jan, 2019

1 commit


10 Jan, 2019

1 commit

  • __acpi_gpio_update_gpiod_flags purpose is to make the gpiod_flags used
    when requesting a GPIO match the restrictions from the ACPI resource,
    as stored in acpi_gpio_info.flags.

    But acpi_gpio_info.flags only contains direction info, and the
    requester may have passed in special non-direction flags like
    GPIOD_FLAGS_BIT_NONEXCLUSIVE, which we currently clobber.

    This commit modifies __acpi_gpio_update_gpiod_flags to preserve these
    special flags, so that a requested of an ACPI GPIO can e.g. pass
    GPIOD_FLAGS_BIT_NONEXCLUSIV and have it work as intended.

    Acked-by: Mika Westerberg
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Hans de Goede
    Signed-off-by: Linus Walleij

    Hans de Goede
     

07 Jan, 2019

1 commit


29 Dec, 2018

1 commit

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

    Core changes:

    - Some core changes are already in outside of this pull request as
    they came through the regulator tree, most notably
    devm_gpiod_unhinge() that removes devres refcount management from a
    GPIO descriptor. This is needed in subsystems such as regulators
    where the regulator core need to take over the reference counting
    and lifecycle management for a GPIO descriptor.

    - We dropped devm_gpiochip_remove() and devm_gpio_chip_match() as
    nothing needs it. We can bring it back if need be.

    - Add a global TODO so people see where we are going. This helps
    setting the direction now that we are two GPIO maintainers.

    - Handle the MMC CD/WP properties in the device tree core. (The bulk
    of patches activating this code is already merged through the
    MMC/SD tree.)

    - Augment gpiochip_request_own_desc() to pass a flag so we as
    gpiochips can request lines as active low or open drain etc even
    from ourselves.

    New drivers:

    - New driver for Cadence GPIO blocks.

    - New driver for Atmel SAMA5D2 PIOBU GPIO lines.

    Driver improvements:

    - A major refactoring of the PCA953x driver - this driver has been
    around for ages, and is now modernized to reduce code duplication
    that has stacked up and is using regmap to read write and cache
    registers.

    - Intel drivers are now maintained in a separate tree and start with
    a round of cleanups and unifications"

    * tag 'gpio-v4.21-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (99 commits)
    gpio: sama5d2-piobu: Depend on OF_GPIO
    gpio: Add Cadence GPIO driver
    dt-bindings: gpio: Add bindings for Cadence GPIO
    gpiolib-acpi: remove unused variable 'err', cleans up build warning
    gpio: mxs: read pin level directly instead of using .get
    gpio: aspeed: remove duplicated statement
    gpio: add driver for SAMA5D2 PIOBU pins
    dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
    gpio/mmc/of: Respect polarity in the device tree
    dt-bindings: gpio: rcar: Add r8a774c0 (RZ/G2E) support
    memory: omap-gpmc: Get the header of the enum
    ARM: omap1: Fix new user of gpiochip_request_own_desc()
    gpio: pca953x: Add regmap dependency for PCA953x driver
    gpio: raspberrypi-exp: decrease refcount on firmware dt node
    gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB
    gpio: pca953x: Restore registers after suspend/resume cycle
    gpio: pca953x: Zap single use of pca953x_read_single()
    gpio: pca953x: Zap ad-hoc reg_output cache
    gpio: pca953x: Zap ad-hoc reg_direction cache
    gpio: pca953x: Perform basic regmap conversion
    ...

    Linus Torvalds
     

21 Dec, 2018

1 commit


14 Dec, 2018

1 commit

  • Before things go out of hand, make it possible to pass
    flags when requesting "own" descriptors from a gpio_chip.
    This is necessary if the chip wants to request a GPIO with
    active low semantics, for example.

    Cc: Janusz Krzysztofik
    Cc: Thomas Petazzoni
    Cc: Jason Cooper
    Cc: Jiri Kosina
    Cc: Roger Quadros
    Reviewed-by: Gregory CLEMENT
    Signed-off-by: Linus Walleij

    Linus Walleij
     

07 Dec, 2018

1 commit

  • Commit 78d3a92edbfb ("gpiolib-acpi: Register GpioInt ACPI event handlers
    from a late_initcall") deferred the entire acpi_gpiochip_request_interrupt
    call for each event resource.

    This means it also delays the gpiochip_request_own_desc(..., "ACPI:Event")
    call. This is a problem if some AML code reads the GPIO pin before we
    run the deferred acpi_gpiochip_request_interrupt, because in that case
    acpi_gpio_adr_space_handler() will already have called
    gpiochip_request_own_desc(..., "ACPI:OpRegion") causing the call from
    acpi_gpiochip_request_interrupt to fail with -EBUSY and we will fail to
    register an event handler.

    acpi_gpio_adr_space_handler is prepared for acpi_gpiochip_request_interrupt
    already having claimed the pin, but the other way around does not work.

    One example of a problem this causes, is the event handler for the OTG
    ID pin on a Prowise PT301 tablet not registering, keeping the port stuck
    in whatever mode it was in during boot and e.g. only allowing charging
    after a reboot.

    This commit fixes this by only deferring the request_irq call and the
    initial run of edge-triggered IRQs instead of deferring all of
    acpi_gpiochip_request_interrupt.

    Cc: stable@vger.kernel.org
    Fixes: 78d3a92edbfb ("gpiolib-acpi: Register GpioInt ACPI event ...")
    Signed-off-by: Hans de Goede
    Reviewed-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Linus Walleij

    Hans de Goede