You need to sign in or sign up before continuing.
  1. 31 5月, 2019 1 次提交
  2. 23 4月, 2019 2 次提交
  3. 08 4月, 2019 1 次提交
  4. 29 3月, 2019 3 次提交
  5. 21 2月, 2019 2 次提交
    • M
      gpio: of: Handle both enable-gpio{,s} · 21b4ab8f
      Marek Vasut 提交于
      Handle both enable-gpio and enable-gpios properties of the GPIO
      regulator in the quirk. The later is the preferred modern name
      of the property.
      Signed-off-by: NMarek 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: Thierry Reding <treding@nvidia.com>
      Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
      Cc: linux-renesas-soc@vger.kernel.org
      To: linux-gpio@vger.kernel.org
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      21b4ab8f
    • T
      gpio: of: Restrict enable-gpio quirk to regulator-gpio · 692ef26e
      Thierry Reding 提交于
      Commit 0e7d6f94 ("gpio: of: Apply regulator-gpio quirk only to
      enable-gpios") breaks the device tree ABI specified in the device tree
      bindings for fixed regulators (compatible "regulator-fixed"). According
      to these bindings the polarity of the GPIO is exclusively controlled by
      the presence or absence of the enable-active-high property. As such the
      polarity quirk implemented in of_gpio_flags_quirks() must be applied to
      the GPIO specified for fixed regulators.
      
      However, commit 0e7d6f94 ("gpio: of: Apply regulator-gpio quirk only
      to enable-gpios") restricted the quirk to the enable-gpios property for
      fixed regulators as well, whereas according to the commit message itself
      it should only apply to "regulator-gpio" compatible device tree nodes.
      
      Fix this by actually implementing what the offending commit intended,
      which is to ensure that the quirk is applied to the GPIO specified by
      the "enable-gpio" property for the "regulator-gpio" bindings only.
      
      This fixes a regression on Jetson TX1 where the fixed regulator for the
      HDMI +5V pin relies on the flags quirk for the proper polarity.
      
      Fixes: 0e7d6f94 ("gpio: of: Apply regulator-gpio quirk only to enable-gpios")
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Tested-by: NMarek Vasut <marek.vasut@gmail.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      692ef26e
  6. 18 2月, 2019 1 次提交
    • M
      gpio: of: Apply regulator-gpio quirk only to enable-gpios · 0e7d6f94
      Marek Vasut 提交于
      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: NMarek 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: NLinus Walleij <linus.walleij@linaro.org>
      0e7d6f94
  7. 13 2月, 2019 1 次提交
    • T
      gpio: add core support for pull-up/pull-down configuration · d449991c
      Thomas Petazzoni 提交于
      This commit adds support for configuring the pull-up and pull-down
      resistors available in some GPIO controllers. While configuring
      pull-up/pull-down is already possible through the pinctrl subsystem,
      some GPIO controllers, especially simple ones such as GPIO expanders
      on I2C, don't have any pinmuxing capability and therefore do not use
      the pinctrl subsystem.
      
      This commit implements the GPIO_PULL_UP and GPIO_PULL_DOWN flags,
      which can be used from the Device Tree, to enable a pull-up or
      pull-down resistor on a given GPIO.
      
      The flag is simply propagated all the way to the core GPIO subsystem,
      where it is used to call the gpio_chip ->set_config callback with the
      appropriate existing PIN_CONFIG_BIAS_* values.
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      d449991c
  8. 25 1月, 2019 1 次提交
  9. 18 12月, 2018 1 次提交
    • L
      gpio/mmc/of: Respect polarity in the device tree · 89a5e15b
      Linus Walleij 提交于
      The device tree bindings for the MMC card detect and
      write protect lines specify that these should be active
      low unless "cd-inverted" or "wp-inverted" has been
      specified.
      
      However that is not how the kernel code has worked. It
      has always respected the flags passed to the phandle in
      the device tree, but respected the "cd-inverted" and
      "wp-inverted" flags such that if those are set, the
      polarity will be the inverse of that specified in the
      device tree.
      
      Switch to behaving like the old code did and fix the
      regression.
      
      Fixes: 81c85ec1 ("gpio: OF: Parse MMC-specific CD and WP properties")
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      89a5e15b
  10. 29 11月, 2018 1 次提交
    • L
      gpio: OF: Parse MMC-specific CD and WP properties · 81c85ec1
      Linus Walleij 提交于
      When retrieveing CD (card detect) and WP (write protect)
      GPIO handles from the device tree, make sure to assign
      them active low by default unless the "cd-inverted" or
      "wp-inverted" properties are set. These properties mean
      that respective signal is active HIGH since the SDHCI
      specification stipulates that this kind of signals
      should be treated as active LOW.
      
      If the twocell GPIO flag is also specified as active
      low, well that's nice and we will silently ignore the
      tautological specification.
      
      If however the GPIO line is specified as active low
      in the GPIO flasg cell and "cd-inverted" or "wp-inverted"
      is also specified, the latter takes precedence and we
      print a warning.
      
      The current effect on the MMC slot-gpio core are as
      follows:
      
      For CD GPIOs: no effect. The current code in
      mmc/core/host.c calls mmc_gpiod_request_cd() with
      the "override_active_level" argument set to true,
      which means that whatever the GPIO descriptor
      thinks about active low/high will be ignored, the
      core will use the MMC_CAP2_CD_ACTIVE_HIGH to keep
      track of this and reads the raw value from the
      GPIO descriptor, totally bypassing gpiolibs inversion
      semantics. I plan to clean this up at a later point
      passing the handling of inversion semantics over
      to gpiolib, so this patch prepares the ground for
      that.
      
      Fow WP GPIOs: this is probably fixing a bug, because
      the code in mmc/core/host.c calls mmc_gpiod_request_ro()
      with the "override_active_level" argument set to false,
      which means it will respect the inversion semantics of
      the gpiolib and ignore the MMC_CAP2_RO_ACTIVE_HIGH
      flag for everyone using this through device tree.
      However the code in host.c confusingly goes to great
      lengths setting up the MMC_CAP2_RO_ACTIVE_HIGH flag
      from the GPIO descriptor and by reading the "wp-inverted"
      property of the node. As far as I can tell this is all
      in vain and the inversion is broken: device trees that
      use "wp-inverted" do not work as intended, instead the
      only way to actually get inversion on a line is by
      setting the second cell flag to GPIO_ACTIVE_HIGH (which
      will be the default) or GPIO_ACTIVE_LOW if they want
      the proper MMC semantics. Presumably all device trees do
      this right but we need to parse and handle this properly.
      
      Cc: linux-mmc@vger.kernel.org
      Cc: linux-gpio@vger.kernel.org
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      81c85ec1
  11. 26 11月, 2018 1 次提交
  12. 25 9月, 2018 1 次提交
  13. 11 9月, 2018 1 次提交
    • L
      gpio: of: Handle SPI chipselect legacy bindings · 6953c57a
      Linus Walleij 提交于
      The SPI chipselects are assumed to be active low in the current
      binding, so when we want to use GPIO descriptors and handle
      the active low/high semantics in gpiolib, we need a special
      parsing quirk to deal with this.
      
      We check for the property "spi-cs-high" and if that is
      NOT present we assume the CS line is active low.
      
      If the line is tagged as active low in the device tree and
      has no "spi-cs-high" property all is fine, the device
      tree and the SPI bindings are in agreement.
      
      If the line is tagged as active high in the device tree with
      the second cell flag and has no "spi-cs-high" property we
      enforce active low semantics (as this is the exception we can
      just tag on the flag).
      
      If the line is tagged as active low with the second cell flag
      AND tagged with "spi-cs-high" the SPI active high property
      takes precedence and we print a warning.
      
      Cc: Mark Brown <broonie@kernel.org>
      Cc: linux-spi@vger.kernel.org
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6953c57a
  14. 31 8月, 2018 1 次提交
    • V
      gpio: Fix crash due to registration race · d49b48f0
      Vincent Whitchurch 提交于
      gpiochip_add_data_with_key() adds the gpiochip to the gpio_devices list
      before of_gpiochip_add() is called, but it's only the latter which sets
      the ->of_xlate function pointer.  gpiochip_find() can be called by
      someone else between these two actions, and it can find the chip and
      call of_gpiochip_match_node_and_xlate() which leads to the following
      crash due to a NULL ->of_xlate().
      
       Unhandled prefetch abort: page domain fault (0x01b) at 0x00000000
       Modules linked in: leds_gpio(+) gpio_generic(+)
       CPU: 0 PID: 830 Comm: insmod Not tainted 4.18.0+ #43
       Hardware name: ARM-Versatile Express
       PC is at   (null)
       LR is at of_gpiochip_match_node_and_xlate+0x2c/0x38
       Process insmod (pid: 830, stack limit = 0x(ptrval))
        (of_gpiochip_match_node_and_xlate) from  (gpiochip_find+0x48/0x84)
        (gpiochip_find) from  (of_get_named_gpiod_flags+0xa8/0x238)
        (of_get_named_gpiod_flags) from  (gpiod_get_from_of_node+0x2c/0xc8)
        (gpiod_get_from_of_node) from  (devm_fwnode_get_index_gpiod_from_child+0xb8/0x144)
        (devm_fwnode_get_index_gpiod_from_child) from  (gpio_led_probe+0x208/0x3c4 [leds_gpio])
        (gpio_led_probe [leds_gpio]) from  (platform_drv_probe+0x48/0x9c)
        (platform_drv_probe) from  (really_probe+0x1d0/0x3d4)
        (really_probe) from  (driver_probe_device+0x78/0x1c0)
        (driver_probe_device) from  (__driver_attach+0x120/0x13c)
        (__driver_attach) from  (bus_for_each_dev+0x68/0xb4)
        (bus_for_each_dev) from  (bus_add_driver+0x1a8/0x268)
        (bus_add_driver) from  (driver_register+0x78/0x10c)
        (driver_register) from  (do_one_initcall+0x54/0x1fc)
        (do_one_initcall) from  (do_init_module+0x64/0x1f4)
        (do_init_module) from  (load_module+0x2198/0x26ac)
        (load_module) from  (sys_finit_module+0xe0/0x110)
        (sys_finit_module) from  (ret_fast_syscall+0x0/0x54)
      
      One way to fix this would be to rework the hairy registration sequence
      in gpiochip_add_data_with_key(), but since I'd probably introduce a
      couple of new bugs if I attempted that, simply add a check for a
      non-NULL of_xlate function pointer in
      of_gpiochip_match_node_and_xlate().  This works since the driver looking
      for the gpio will simply fail to find the gpio and defer its probe and
      be reprobed when the driver which is registering the gpiochip has fully
      completed its probe.
      Signed-off-by: NVincent Whitchurch <vincent.whitchurch@axis.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      d49b48f0
  15. 29 8月, 2018 1 次提交
  16. 11 8月, 2018 1 次提交
  17. 24 7月, 2018 1 次提交
  18. 16 5月, 2018 1 次提交
  19. 27 3月, 2018 1 次提交
  20. 27 2月, 2018 2 次提交
    • C
      gpio: Handle deferred probing in of_find_gpio() properly · ce27fb2c
      Chen-Yu Tsai 提交于
      of_get_named_gpiod_flags() used directly in of_find_gpio() or indirectly
      through of_find_spi_gpio() or of_find_regulator_gpio() can return
      -EPROBE_DEFER. This gets overwritten by the subsequent of_find_*_gpio()
      calls.
      
      This patch fixes this by trying of_find_spi_gpio() or
      of_find_regulator_gpio() only if deferred probing was not requested by
      the previous of_get_named_gpiod_flags() call.
      
      Fixes: 6a537d48 ("gpio: of: Support regulator nonstandard GPIO properties")
      Fixes: c8582339 ("gpio: of: Support SPI nonstandard GPIO properties")
      Signed-off-by: NChen-Yu Tsai <wens@csie.org>
      [Augmented to fit with Maxime's patch]
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      ce27fb2c
    • M
      gpiolib: Keep returning EPROBE_DEFER when we should · 6662ae6a
      Maxime Ripard 提交于
      Commits c8582339 ("gpio: of: Support SPI nonstandard GPIO properties")
      and 6a537d48 ("gpio: of: Support regulator nonstandard GPIO
      properties") have introduced a regression in the way error codes from
      of_get_named_gpiod_flags are handled.
      
      Previously, those errors codes were returned immediately, but the two
      commits mentioned above are now overwriting the error pointer, meaning that
      whatever value has been returned will be dropped in favor of whatever the
      two new functions will return.
      
      This might not be a big deal except for EPROBE_DEFER, on which GPIOlib
      customers will depend on, and that will now be returned as an hard error
      which means that they will not probe anymore, instead of gently deferring
      their probe.
      
      Since EPROBE_DEFER basically means that we have found a valid property but
      there was no GPIO controller registered to handle it, fix this issues by
      returning it as soon as we encounter it.
      
      Fixes: c8582339 ("gpio: of: Support SPI nonstandard GPIO properties")
      Fixes: 6a537d48 ("gpio: of: Support regulator nonstandard GPIO properties")
      Signed-off-by: NMaxime Ripard <maxime.ripard@bootlin.com>
      [Fold in fix to the fix]
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6662ae6a
  21. 12 2月, 2018 1 次提交
    • S
      gpio: Support gpio nexus dt bindings · c11e6f0f
      Stephen Boyd 提交于
      Platforms like 96boards have a standardized connector/expansion
      slot that exposes signals like GPIOs to expansion boards in an
      SoC agnostic way. We'd like the DT overlays for the expansion
      boards to be written once without knowledge of the SoC on the
      other side of the connector. This avoids the unscalable
      combinatorial explosion of a different DT overlay for each
      expansion board and SoC pair.
      
      Now that we have nexus support in the OF core let's change the
      function call here that parses the phandle lists of gpios to use
      the nexus variant. This allows us to remap phandles and their
      arguments through any number of nexus nodes and end up with the
      actual gpio provider being used.
      
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: NStephen Boyd <stephen.boyd@linaro.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      c11e6f0f
  22. 17 1月, 2018 1 次提交
  23. 12 1月, 2018 2 次提交
    • L
      gpio: of: Add special quirk to parse regulator flags · a603a2b8
      Linus Walleij 提交于
      While most GPIOs are indicated to be active low or open drain using
      their twocell flags, we have legacy regulator bindings to take into
      account.
      
      Add a quirk respecting the special boolean active-high and open
      drain flags when parsing regulator nodes for GPIOs.
      
      This makes it possible to get rid of duplicated inversion semantics
      handling in the regulator core and any regulator drivers parsing
      and handling this separately.
      
      Unfortunately the old regulator inversion semantics are specified
      such that the presence or absence of "enable-active-high" solely
      controls the semantics, so we cannot deprecate this in favor
      of the phandle-provided inversion flag, instead any such phandle
      inversion flag provided in the second cell of a GPIO handle must be
      actively ignored, so we print a warning to contain the situation
      and make things easy for the users.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      a603a2b8
    • L
      gpio: of: Support regulator nonstandard GPIO properties · 6a537d48
      Linus Walleij 提交于
      Before it was clearly established that all GPIO properties in the
      device tree shall be named "foo-gpios" (with the deprecated variant
      "foo-gpio" for single lines) we unfortunately merged a few bindings
      for regulators with random phandle names.
      
      As we want to switch the GPIO regulator driver to using descriptors,
      we need devm_gpiod_get() to return something reasonable when looking
      up these in the device tree.
      
      Put in a special #ifdef:ed kludge to do this special lookup only
      for the regulator case and gets compiled out if we're not enabling
      regulators. Supply a whitelist with properties we accept.
      
      Cc: Rob Herring <robh@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6a537d48
  24. 09 1月, 2018 1 次提交
    • L
      gpio: of: Support SPI nonstandard GPIO properties · c8582339
      Linus Walleij 提交于
      Before it was clearly established that all GPIO properties in the
      device tree shall be named "foo-gpios" (with the deprecated variant
      "foo-gpio" for single lines) we unfortunately merged a few bindings
      which named the lines "gpio-foo" instead.
      
      This is most prominent in the GPIO SPI driver in Linux which names
      the lines "gpio-sck", "gpio-mosi" and "gpio-miso".
      
      As we want to switch the GPIO SPI driver to using descriptors, we
      need devm_gpiod_get() to return something reasonable when looking
      up these in the device tree.
      
      Put in a special #ifdef:ed kludge to do this special lookup only
      for the SPI case and gets compiled out if we're not enabling SPI.
      If we have more oddly defined legacy GPIOs like this, they can be
      handled in a similar manner.
      Reviewed-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      c8582339
  25. 22 12月, 2017 1 次提交
  26. 03 12月, 2017 1 次提交
    • A
      gpio: gpiolib: Generalise state persistence beyond sleep · e10f72bf
      Andrew Jeffery 提交于
      General support for state persistence is added to gpiolib with the
      introduction of a new pinconf parameter to propagate the request to
      hardware. The existing persistence support for sleep is adapted to
      include hardware support if the GPIO driver provides it. Persistence
      continues to be enabled by default; in-kernel consumers can opt out, but
      userspace (currently) does not have a choice.
      
      The *_SLEEP_MAY_LOSE_VALUE and *_SLEEP_MAINTAIN_VALUE symbols are
      renamed, dropping the SLEEP prefix to reflect that the concept is no
      longer sleep-specific.  I feel that renaming to just *_MAY_LOSE_VALUE
      could initially be misinterpreted, so I've further changed the symbols
      to *_TRANSITORY and *_PERSISTENT to address this.
      
      The sysfs interface is modified only to keep consistency with the
      chardev interface in enforcing persistence for userspace exports.
      Signed-off-by: NAndrew Jeffery <andrew@aj.id.au>
      Reviewed-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      e10f72bf
  27. 20 10月, 2017 1 次提交
    • A
      gpio: Fix loose spelling · 2cbfca66
      Andrew Jeffery 提交于
      Literally.
      
      I expect "lose" was meant here, rather than "loose", though you could feasibly
      use a somewhat uncommon definition of "loose" to mean what would be meant by
      "lose": "Loose the hounds" for instance, as in "Release the hounds".
      Substituting in "value" for "hounds" gives "release the value", and makes some
      sense, but futher substituting back to loose gives "loose the value" which
      overall just seems a bit anachronistic.
      
      Instead, use modern, pragmatic English and save a character.
      
      Cc: Russell Currey <ruscur@russell.cc>
      Signed-off-by: NAndrew Jeffery <andrew@aj.id.au>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      2cbfca66
  28. 14 8月, 2017 2 次提交
  29. 16 6月, 2017 1 次提交
  30. 29 5月, 2017 1 次提交
  31. 07 4月, 2017 1 次提交
    • L
      gpio: core: Decouple open drain/source flag with active low/high · 4c0facdd
      Laxman Dewangan 提交于
      Currently, the GPIO interface is said to Open Drain if it is Single
      Ended and active LOW. Similarly, it is said as Open Source if it is
      Single Ended and active HIGH.
      
      The active HIGH/LOW is used in the interface for setting the pin
      state to HIGH or LOW when enabling/disabling the interface.
      
      In Open Drain interface, pin is set to HIGH by putting pin in
      high impedance and LOW by driving to the LOW.
      
      In Open Source interface, pin is set to HIGH by driving pin to
      HIGH and set to LOW by putting pin in high impedance.
      
      With above, the Open Drain/Source is unrelated to the active LOW/HIGH
      in interface. There is interface where the enable/disable of interface
      is ether active LOW or HIGH but it is Open Drain type.
      
      Hence decouple the Open Drain with Single Ended + Active LOW and
      Open Source with Single Ended + Active HIGH.
      
      Adding different flag for the Open Drain/Open Source which is valid
      only when Single ended flag is enabled.
      Signed-off-by: NLaxman Dewangan <ldewangan@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      4c0facdd
  32. 30 12月, 2016 1 次提交
  33. 01 11月, 2016 1 次提交
    • M
      gpio: of: fix GPIO drivers with multiple gpio_chip for a single node · c7e9d398
      Masahiro Yamada 提交于
      Sylvain Lemieux reports the LPC32xx GPIO driver is broken since
      commit 762c2e46 ("gpio: of: remove of_gpiochip_and_xlate() and
      struct gg_data").  Probably, gpio-etraxfs.c and gpio-davinci.c are
      broken too.
      
      Those drivers register multiple gpio_chip that are associated to a
      single OF node, and their own .of_xlate() checks if the passed
      gpio_chip is valid.
      
      Now, the problem is of_find_gpiochip_by_node() returns the first
      gpio_chip found to match the given node.  So, .of_xlate() fails,
      except for the first GPIO bank.
      
      Reverting the commit could be a solution, but I do not want to go
      back to the mess of struct gg_data.  Another solution here is to
      take the match by a node pointer and the success of .of_xlate().
      It is a bit clumsy to call .of_xlate twice; for gpio_chip matching
      and for really getting the gpio_desc index.  Perhaps, our long-term
      goal might be to convert the drivers to single chip registration,
      but this commit will solve the problem until then.
      
      Fixes: 762c2e46 ("gpio: of: remove of_gpiochip_and_xlate() and struct gg_data")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Reported-by: NSylvain Lemieux <slemieux.tyco@gmail.com>
      Tested-by: NDavid Lechner <david@lechnology.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      c7e9d398