1. 08 Mar, 2019 5 commits
    • Russell King's avatar
      gpio: gpio-omap: fix level interrupt idling · d01849f7
      Russell King authored
      Tony notes that the GPIO module does not idle when level interrupts are
      in use, as the wakeup appears to get stuck.
      
      After extensive investigation, it appears that the wakeup will only be
      cleared if the interrupt status register is cleared while the interrupt
      is enabled. However, we are currently clearing it with the interrupt
      disabled for level-based interrupts.
      
      It is acknowledged that this observed behaviour conflicts with a
      statement in the TRM:
      
      CAUTION
        After servicing the interrupt, the status bit in the interrupt status
        register (GPIOi.GPIO_IRQSTATUS_0 or GPIOi.GPIO_IRQSTATUS_1) must be
        reset and the interrupt line released (by setting the corresponding
        bit of the interrupt status register to 1) before enabling an
        interrupt for the GPIO channel in the interrupt-enable register
        (GPIOi.GPIO_IRQSTATUS_SET_0 or GPIOi.GPIO_IRQSTATUS_SET_1) to prevent
        the occurrence of unexpected interrupts when enabling an interrupt
        for the GPIO channel.
      
      However, this does not appear to be a practical problem.
      
      Further, as reported by Grygorii Strashko <grygorii.strashko@ti.com>,
      the TI Android kernel tree has an earlier similar patch as "GPIO: OMAP:
      Fix the sequence to clear the IRQ status" saying:
      
       if the status is cleared after disabling the IRQ then sWAKEUP will not
       be cleared and gates the module transition
      
      When we unmask the level interrupt after the interrupt has been handled,
      enable the interrupt and only then clear the interrupt. If the interrupt
      is still pending, the hardware will re-assert the interrupt status.
      
      Should the caution note in the TRM prove to be a problem, we could
      use a clear-enable-clear sequence instead.
      
      Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
      Cc: Keerthy <j-keerthy@ti.com>
      Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      [tony@atomide.com: updated comments based on an earlier TI patch]
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Acked-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      d01849f7
    • Axel Lin's avatar
      gpio: amd-fch: Set proper output level for direction_output · f777cda3
      Axel Lin authored
      Current amd_fch_gpio_direction_output implementation ignores the value
      argument, fix it so direction_output will set proper output level.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Reviewed-by: default avatarEnrico Weigelt <info@metux.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      f777cda3
    • Arnd Bergmann's avatar
      x86: apuv2: remove unused variable · deb63b0b
      Arnd Bergmann authored
      The driver was newly introduced but the version that got merged
      produces a harmless compiler warning:
      
      drivers/platform/x86/pcengines-apuv2.c: In function 'apu_board_init':
      drivers/platform/x86/pcengines-apuv2.c:211:6: error: unused variable 'rc' [-Werror=unused-variable]
      
      Remove the evidently useless variable.
      
      Fixes: f8eb0235 ("x86: pcengines apuv2 gpio/leds/keys platform driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-By: default avatarEnrico Weigelt, metux IT consult <info@metux.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      deb63b0b
    • Andy Shevchenko's avatar
      gpio: pca953x: Use PCA_LATCH_INT · 2870b3c5
      Andy Shevchenko authored
      The commit 0cdf21b3
      
        ("gpio: pca953x: set the PCA_PCAL flag also when matching by DT")
      
      introduces a helper macro which tells that chip supports latched interrupts,
      but the macro was never used for ACPI or legacy enumeration.
      
      So, make use of it for legacy and ACPI enumeration.
      
      Cc: H. Nikolaus Schaller <hns@goldelico.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      2870b3c5
    • Randy Dunlap's avatar
      platform/x86: fix PCENGINES_APU2 Kconfig warning · a422bf11
      Randy Dunlap authored
      Fix Kconfig warning for PCENGINES_APU2 symbol:
      
      WARNING: unmet direct dependencies detected for KEYBOARD_GPIO_POLLED
        Depends on [n]: !UML && INPUT [=y] && INPUT_KEYBOARD [=n] && GPIOLIB [=y]
        Selected by [y]:
        - PCENGINES_APU2 [=y] && X86 [=y] && X86_PLATFORM_DEVICES [=y]
      
      Add INPUT_KEYBOARD dependency for KEYBOARD_GPIO_POLLED.
      Add LEDS_CLASS dependency for LEDS_GPIO.
      
      Fixes: f8eb0235 ("x86: pcengines apuv2 gpio/leds/keys platform driver")
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Enrico Weigelt, metux IT consult <info@metux.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      a422bf11
  2. 01 Mar, 2019 2 commits
    • Mark Walton's avatar
      gpio: pca953x: Fix dereference of irq data in shutdown · c378b3aa
      Mark Walton authored
      If a PCA953x gpio was used as an interrupt and then released,
      the shutdown function was trying to extract the pca953x_chip
      pointer directly from the irq_data, but in reality was getting
      the gpio_chip structure.
      
      The net effect was that the subsequent writes to the data
      structure corrupted data in the gpio_chip structure, which wasn't
      immediately obvious until attempting to use the GPIO again in the
      future, at which point the kernel panics.
      
      This fix correctly extracts the pca953x_chip structure via the
      gpio_chip structure, as is correctly done in the other irq
      functions.
      
      Fixes: 0a70fe00 ("gpio: pca953x: Clear irq trigger type on irq shutdown")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMark Walton <mark.walton@serialtek.com>
      Reviewed-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      c378b3aa
    • Linus Walleij's avatar
      gpio: amd-fch: Fix type error found by sparse · e226e3c3
      Linus Walleij authored
      Sparse complains:
      
      gpio-amd-fch.c:45:27: sparse: expected void *
      gpio-amd-fch.c:45:27: sparse: got void [noderef] <asn:2> *
      gpio-amd-fch.c:45:27: sparse: warning: incorrect type in return
      		              expression (different address spaces)
      gpio-amd-fch.c:56:9: sparse:  expected void const volatile [noderef]
      		              <asn:2> *addr
      gpio-amd-fch.c:56:9: sparse:  expected void volatile [noderef] <asn:2> *addr
      gpio-amd-fch.c:56:9: sparse:  got void *ptr
      gpio-amd-fch.c:56:9: sparse:  warning: incorrect type in argument 1 (different address spaces)
      
      I think it is because void * is returned rather than void __iomem *,
      so fix it up.
      
      Cc: Enrico Weigelt <info@metux.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      e226e3c3
  3. 25 Feb, 2019 3 commits
  4. 22 Feb, 2019 4 commits
  5. 21 Feb, 2019 8 commits
  6. 20 Feb, 2019 3 commits
  7. 19 Feb, 2019 8 commits
  8. 17 Feb, 2019 3 commits
    • Marek Vasut's avatar
      gpio: of: Apply regulator-gpio quirk only to enable-gpios · 0e7d6f94
      Marek Vasut authored
      Since commit d6cd33ad ("regulator: gpio: Convert to use descriptors")
      the GPIO regulator had inverted the polarity of the control GPIO. This
      problem manifested itself on systems with DT containing the following
      description (snippet from salvator-common.dtsi):
      
      	gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
      	gpios-states = <1>;
      	states = <3300000 1
      		  1800000 0>;
      
      Prior to the aforementioned commit, the gpio-regulator code used
      gpio_request_array() to claim the GPIO(s) specified in the "gpios"
      DT node, while the commit changed that to devm_gpiod_get_index().
      
      The legacy gpio_request_array() calls gpio_request_one() and then
      gpiod_request(), which parses the DT flags of the "gpios" node and
      populates the GPIO descriptor flags field accordingly.
      
      The new devm_gpiod_get_index() calls gpiod_get_index(), then
      of_find_gpio(), of_get_named_gpiod_flags() with flags != NULL,
      and then of_gpio_flags_quirks(). Since commit a603a2b8
      ("gpio: of: Add special quirk to parse regulator flags"),
      of_gpio_flags_quirks() contains a quirk for regulator-gpio
      which was never triggered by the legacy gpio_request_array()
      code path, but is triggered by devm_gpiod_get_index() code
      path.
      
      This quirk checks whether a GPIO is associated with a fixed
      or gpio-regulator and if so, checks two additional conditions.
      First, whether such GPIO is active-low, and if so, ignores the
      active-low flag. Second, whether the regulator DT node does
      have an "enable-active-high" property and if the property is
      NOT present, sets the GPIO flags as active-low.
      
      The second check triggers a problem, since it is applied to all
      GPIOs associated with a gpio-regulator, rather than only on the
      "enable" GPIOs, as the old code did. This changes the way the
      gpio-regulator interprets the DT description of the control
      GPIOs.
      
      The old code using gpio_request_array() explicitly parsed the
      "enable-active-high" DT property and only applied it to the
      GPIOs described in the "enable-gpios" DT node, and only if
      those were present.
      
      This patch fixes the quirk code by only applying the quirk
      to "enable-gpios", thus restoring the old behavior.
      Signed-off-by: default avatarMarek Vasut <marek.vasut+renesas@gmail.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Jan Kotas <jank@cadence.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
      Cc: linux-renesas-soc@vger.kernel.org
      To: linux-gpio@vger.kernel.org
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      0e7d6f94
    • Linus Walleij's avatar
      Merge tag 'intel-gpio-v5.1-1' of... · 0248baca
      Linus Walleij authored
      Merge tag 'intel-gpio-v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into devel
      
      intel-gpio for v5.1-1
      
      Small clean up for Intel PMIC GPIO drivers, includes:
       - optimizing IRQ handlers by usage of for_each_set_bit()
       - sorting headers alphabetically for better maintenance
       - conversion to SPDX identifier
      
      The following is an automated git shortlog grouped by driver:
      
      crystalcove:
       -  Convert to use SPDX identifier
       -  Sort headers alphabetically
       -  Use for_each_set_bit() in IRQ handler
      
      msic:
       -  Convert to use SPDX identifier
       -  Sort headers alphabetically
       -  Remove duplicate check in IRQ handler
      
      wcove:
       -  Convert to use SPDX identifier
       -  Fix indentation
       -  Sort headers alphabetically
       -  Allow return negative error code from to_reg()
      0248baca
    • Linus Walleij's avatar
      Merge tag 'gpio-v5.1-updates-for-linus' of... · 8fab3d71
      Linus Walleij authored
      Merge tag 'gpio-v5.1-updates-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel
      
      gpio updates for v5.1
      
      - support for a new variant of pca953x
      - documentation fix from Wolfram
      - some tegra186 name changes
      - two minor fixes for madera and altera-a10sr
      8fab3d71
  9. 14 Feb, 2019 4 commits