1. 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
  2. 17 1月, 2018 1 次提交
  3. 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
  4. 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
  5. 22 12月, 2017 1 次提交
  6. 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
  7. 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
  8. 14 8月, 2017 2 次提交
  9. 16 6月, 2017 1 次提交
  10. 29 5月, 2017 1 次提交
  11. 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
  12. 30 12月, 2016 1 次提交
  13. 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
  14. 31 10月, 2016 1 次提交
  15. 24 10月, 2016 1 次提交
  16. 03 10月, 2016 1 次提交
    • L
      gpio: OF: separation of concerns · ea713bc4
      Linus Walleij 提交于
      The generic GPIO library directly implement code for of_find_gpio()
      which is only used with CONFIG_OF and causes compilation problems
      on archs that do not even have stubs for OF functions, especially
      on UM that does not implement any IO remap functions.
      
      Move the function to gpiolib-of.c, implement a static inline stub
      in gpiolib.h returning PTR_ERR(-ENOENT) if CONFIG_OF_GPIO is not
      set and be done with it.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      ea713bc4
  17. 08 9月, 2016 1 次提交
  18. 23 6月, 2016 5 次提交
  19. 08 6月, 2016 1 次提交
  20. 07 6月, 2016 1 次提交
  21. 10 5月, 2016 1 次提交
    • L
      gpio: of: make it possible to name GPIO lines · fd9c5531
      Linus Walleij 提交于
      Make it possible to name the producer side of a GPIO line using
      a "gpio-line-names" property array, modeled on the
      "clock-output-names" property from the clock bindings.
      
      This naming is especially useful for:
      
      - Debugging: lines are named after function, not just opaque
        offset numbers.
      
      - Exploration: systems where some or all GPIO lines are available
        to end users, such as prototyping, one-off's "makerspace usecases"
        users are helped by the names of the GPIO lines when tinkering.
        This usecase has been surfacing recently.
      
      The gpio-line-names attribute is completely optional.
      
      Example output from lsgpio on a patched Snowball tree:
      
      GPIO chip: gpiochip6, "8000e180.gpio", 32 GPIO lines
              line  0: unnamed unused
              line  1: "AP_GPIO161" "extkb3" [kernel]
              line  2: "AP_GPIO162" "extkb4" [kernel]
              line  3: "ACCELEROMETER_INT1_RDY" unused [kernel]
              line  4: "ACCELEROMETER_INT2" unused
              line  5: "MAG_DRDY" unused [kernel]
              line  6: "GYRO_DRDY" unused [kernel]
              line  7: "RSTn_MLC" unused
              line  8: "RSTn_SLC" unused
              line  9: "GYRO_INT" unused
              line 10: "UART_WAKE" unused
              line 11: "GBF_RESET" unused
              line 12: unnamed unused
      
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Amit Kucheria <amit.kucheria@linaro.org>
      Cc: David Mandala <david.mandala@linaro.org>
      Cc: Lee Campbell <leecam@google.com>
      Cc: devicetree@vger.kernel.org
      Acked-by: NRob Herring <robh@kernel.org>
      Reviewed-by: NMichael Welling <mwelling@ieee.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      fd9c5531
  22. 14 4月, 2016 1 次提交
  23. 13 4月, 2016 1 次提交
  24. 05 1月, 2016 1 次提交
  25. 19 11月, 2015 1 次提交
    • L
      gpio: change member .dev to .parent · 58383c78
      Linus Walleij 提交于
      The name .dev in a struct is normally reserved for a struct device
      that is let us say a superclass to the thing described by the struct.
      struct gpio_chip stands out by confusingly using a struct device *dev
      to point to the parent device (such as a platform_device) that
      represents the hardware. As we want to give gpio_chip:s real devices,
      this is not working. We need to rename this member to parent.
      
      This was done by two coccinelle scripts, I guess it is possible to
      combine them into one, but I don't know such stuff. They look like
      this:
      
      @@
      struct gpio_chip *var;
      @@
      -var->dev
      +var->parent
      
      and:
      
      @@
      struct gpio_chip var;
      @@
      -var.dev
      +var.parent
      
      and:
      
      @@
      struct bgpio_chip *var;
      @@
      -var->gc.dev
      +var->gc.parent
      
      Plus a few instances of bgpio that I couldn't figure out how
      to teach Coccinelle to rewrite.
      
      This patch hits all over the place, but I *strongly* prefer this
      solution to any piecemal approaches that just exercise patch
      mechanics all over the place. It mainly hits drivers/gpio and
      drivers/pinctrl which is my own backyard anyway.
      
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Cc: Rafał Miłecki <zajec5@gmail.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
      Cc: Alek Du <alek.du@intel.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.com>
      Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NLee Jones <lee.jones@linaro.org>
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NHans-Christian Egtvedt <egtvedt@samfundet.no>
      Acked-by: NJacek Anaszewski <j.anaszewski@samsung.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      58383c78
  26. 25 9月, 2015 1 次提交
  27. 28 7月, 2015 1 次提交
  28. 16 7月, 2015 2 次提交
  29. 19 5月, 2015 1 次提交
  30. 04 3月, 2015 1 次提交
    • B
      gpio: add GPIO hogging mechanism · f625d460
      Benoit Parrot 提交于
      Based on Boris Brezillion's work this is a reworked patch
      of his initial GPIO hogging mechanism.
      This patch provides a way to initially configure specific GPIO
      when the GPIO controller is probed.
      
      The actual DT scanning to collect the GPIO specific data is performed
      as part of gpiochip_add().
      
      The purpose of this is to allow specific GPIOs to be configured
      without any driver specific code.
      This is particularly useful because board design are getting
      increasingly complex and given SoC pins can now have more
      than 10 mux values, a lot of connections are now dependent on
      external IO muxes to switch various modes.
      
      Specific drivers should not necessarily need to be aware of
      what accounts to a specific board implementation. This board level
      "description" should be best kept as part of the dts file.
      Signed-off-by: NBenoit Parrot <bparrot@ti.com>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f625d460
  31. 23 2月, 2015 1 次提交
  32. 16 1月, 2015 1 次提交