1. 05 2月, 2017 2 次提交
  2. 26 1月, 2017 2 次提交
  3. 25 9月, 2015 2 次提交
    • L
      gpio: keep the GPIO line names internal · f881bab0
      Linus Walleij 提交于
      This refactors the changes to the GPIO line naming mechanism to
      not have so widespread effects, instead we conclude the patch series
      by having created a name attribute in the GPIO descriptor, that need
      not be globally unique, and it will be initialized from the old
      .names array in struct gpio_chip if it exists, then used in the legacy
      sysfs code like the array was used previously.
      
      The associated changes to name lines from the device tree are
      controversial and need to stand alone from this. Resulting changes:
      
      1. Remove the export and the header for the gpio_name_to_desc() as so
      far the only use is inside gpiolib.c. Staticize gpio_name_to_desc()
      and move it above the only function using it.
      
      2. Only print a warning if there are two GPIO lines with the same name.
      The reason is to preserve current behaviour: before the previous
      changes to the naming mechanism this would not reject probing the
      driver, instead the error would occur when trying to export the line
      in sysfs, so restore this behaviour, but print a friendly warning
      if names collide.
      
      Cc: Johan Hovold <johan@kernel.org>
      Cc: Markus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f881bab0
    • M
      gpio: Introduce gpio descriptor 'name' · c0017ed7
      Markus Pargmann 提交于
      The latest gpio hogging mechanism assigns each gpio a 'line-name' in the
      devicetree. The 'name' field is different from the 'label' field.
      'label' is only used for requested GPIOs to describe its current use by
      driver or userspace.
      
      The 'name' field describes the GPIO itself, not the use. This is most
      likely identical to the label in the schematic on the GPIO line and
      should help to find this particular GPIO.
      
      This is equivalent to the gpiochip->names array. However names should be
      stored in the GPIO descriptor. We will use gpiochip->names in the future
      only as initializer for the GPIO descriptors for drivers that assign
      GPIO names hardcoded. All other GPIO names will be parsed from DT and
      directly assigned to the GPIO descriptor.
      
      This patch adds a helper function to find gpio descriptors by name
      instead of gpio number.
      Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      c0017ed7
  4. 06 7月, 2015 1 次提交
  5. 01 6月, 2015 1 次提交
  6. 26 5月, 2015 1 次提交
  7. 12 5月, 2015 1 次提交
    • J
      gpio: remove gpiod_sysfs_set_active_low · 166a85e4
      Johan Hovold 提交于
      Remove gpiod_sysfs_set_active_low (and gpio_sysfs_set_active_low) which
      allowed code to change the polarity of a gpio line even after it had
      been exported through sysfs.
      
      Drivers should not care, and generally does not know, about gpio-line
      polarity which is a hardware feature that needs to be described by
      firmware.
      
      It is currently possible to define gpio-line polarity in device-tree and
      acpi firmware or using platform data. Userspace can also change the
      polarity through sysfs.
      
      Note that drivers using the legacy gpio interface could still use
      GPIOF_ACTIVE_LOW to change the polarity before exporting the gpio.
      
      There are no in-kernel users of this interface.
      
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Harry Wei <harryxiyou@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@zh-kernel.org
      Cc: linux-arch@vger.kernel.org
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      166a85e4
  8. 05 3月, 2015 2 次提交
  9. 04 3月, 2015 1 次提交
  10. 16 1月, 2015 1 次提交
  11. 28 11月, 2014 1 次提交
  12. 27 11月, 2014 1 次提交
    • R
      gpiolib: allow simultaneous setting of multiple GPIO outputs · 5f424243
      Rojhalat Ibrahim 提交于
      Introduce new functions gpiod_set_array & gpiod_set_raw_array to the consumer
      interface which allow setting multiple outputs with just one function call.
      Also add an optional set_multiple function to the driver interface. Without an
      implementation of that function in the chip driver outputs are set
      sequentially.
      
      Implementing the set_multiple function in a chip driver allows for:
      - Improved performance for certain use cases. The original motivation for this
        was the task of configuring an FPGA. In that specific case, where 9 GPIO
        lines have to be set many times, configuration time goes down from 48 s to
        20 s when using the new function.
      - Simultaneous glitch-free setting of multiple pins on any kind of parallel
        bus attached to GPIOs provided they all reside on the same chip and bank.
      
      Limitations:
        Performance is only improved for normal high-low outputs. Open drain and
        open source outputs are always set separately from each other. Those kinds
        of outputs could probably be accelerated in a similar way if we could
        forgo the error checking when setting GPIO directions.
      
      Change log:
        v6: - rebase on current linux-gpio devel branch
        v5: - check can_sleep property per chip
            - remove superfluous checks
            - supplement documentation
        v4: - add gpiod_set_array function for setting logical values
            - change interface of the set_multiple driver function to use
              unsigned long as type for the bit fields
            - use generic bitops (which also use unsigned long for bit fields)
            - do not use ARCH_NR_GPIOS any more
        v3: - add documentation
            - change commit message
        v2: - use descriptor interface
            - allow arbitrary groups of GPIOs spanning multiple chips
      Signed-off-by: NRojhalat Ibrahim <imr@rtschenk.de>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Reviewed-by: NMark Brown <broonie@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      5f424243
  13. 05 11月, 2014 1 次提交
  14. 02 9月, 2014 1 次提交
  15. 21 8月, 2014 1 次提交
  16. 28 7月, 2014 1 次提交
    • A
      gpio: add flags argument to gpiod_get*() functions · 39b2bbe3
      Alexandre Courbot 提交于
      The huge majority of GPIOs have their direction and initial value set
      right after being obtained by one of the gpiod_get() functions. The
      integer GPIO API had gpio_request_one() that took a convenience flags
      parameter allowing to specify an direction and value applied to the
      returned GPIO. This feature greatly simplifies client code and ensures
      errors are always handled properly.
      
      A similar feature has been requested for the gpiod API. Since setting
      the direction of a GPIO is so often the very next action done after
      obtaining its descriptor, we prefer to extend the existing functions
      instead of introducing new functions that would raise the
      number of gpiod getters to 16 (!).
      
      The drawback of this approach is that all gpiod clients need to be
      updated. To limit the pain, temporary macros are introduced that allow
      gpiod_get*() to be called with or without the extra flags argument. They
      will be removed once all consumer code has been updated.
      Signed-off-by: NAlexandre Courbot <acourbot@nvidia.com>
      Reviewed-by: NMark Brown <broonie@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      39b2bbe3
  17. 16 5月, 2014 1 次提交
  18. 09 5月, 2014 1 次提交
    • T
      gpio: Add helpers for optional GPIOs · 29a1f233
      Thierry Reding 提交于
      Introduce gpiod_get_optional() and gpiod_get_index_optional() helpers
      that make it easier for drivers to handle optional GPIOs.
      
      Currently in order to handle optional GPIOs, a driver needs to special
      case error handling for -ENOENT, such as this:
      
      	gpio = gpiod_get(dev, "foo");
      	if (IS_ERR(gpio)) {
      		if (PTR_ERR(gpio) != -ENOENT)
      			return PTR_ERR(gpio);
      
      		gpio = NULL;
      	}
      
      	if (gpio) {
      		/* set up GPIO */
      	}
      
      With these new helpers the above is reduced to:
      
      	gpio = gpiod_get_optional(dev, "foo");
      	if (IS_ERR(gpio))
      		return PTR_ERR(gpio);
      
      	if (gpio) {
      		/* set up GPIO */
      	}
      
      While at it, device-managed variants of these functions are also
      provided.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      29a1f233
  19. 13 2月, 2014 1 次提交
  20. 07 2月, 2014 1 次提交
  21. 06 2月, 2014 1 次提交
  22. 20 10月, 2013 2 次提交