1. 10 1月, 2018 1 次提交
    • G
      gpio: Add missing open drain/source handling to gpiod_set_value_cansleep() · 1e77fc82
      Geert Uytterhoeven 提交于
      Since commit f11a0446 ("i2c: gpio: Enable working over slow
      can_sleep GPIOs"), probing the i2c RTC connected to an i2c-gpio bus on
      r8a7740/armadillo fails with:
      
          rtc-s35390a 0-0030: error resetting chip
          rtc-s35390a: probe of 0-0030 failed with error -5
      
      More debug code reveals:
      
          i2c i2c-0: master_xfer[0] R, addr=0x30, len=1
          i2c i2c-0: NAK from device addr 0x30 msg #0
          s35390a_get_reg: ret = -6
      
      Commit 02e47980 ("gpio: Alter semantics of *raw* operations to
      actually be raw") moved open drain/source handling from
      gpiod_set_raw_value_commit() to gpiod_set_value(), but forgot to take
      into account that gpiod_set_value_cansleep() also needs this handling.
      The i2c protocol mandates that i2c signals are open drain, hence i2c
      communication fails.
      
      Fix this by adding the missing handling to gpiod_set_value_cansleep(),
      using a new common helper gpiod_set_value_nocheck().
      
      Fixes: 02e47980 ("gpio: Alter semantics of *raw* operations to actually be raw")
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      [removed underscore syntax, added kerneldoc]
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      1e77fc82
  2. 28 12月, 2017 1 次提交
  3. 09 11月, 2017 1 次提交
  4. 08 11月, 2017 13 次提交
  5. 30 10月, 2017 1 次提交
    • L
      gpio: Make it possible for consumers to enforce open drain · f926dfc1
      Linus Walleij 提交于
      Some busses, like I2C, strictly need to have the line handled
      as open drain, i.e. not actively driven high. For this reason
      the i2c-gpio.c bit-banged I2C driver is reimplementing open
      drain handling outside of gpiolib.
      
      This is not very optimal. Instead make it possible for a
      consumer to explcitly express that the line must be handled
      as open drain instead of allowing local hacks papering over
      this issue.
      
      The descriptor tables, whether DT, ACPI or board files, should
      of course have flagged these lines as open drain. E.g.:
      enum gpio_lookup_flags GPIO_OPEN_DRAIN for a board file, or
      gpios = <&foo 42 GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN>; in a
      device tree using <dt-bindings/gpio/gpio.h>
      
      But more often than not, these descriptors are wrong. So
      we need to make it possible for consumers to enforce this
      open drain behaviour.
      
      We now have two new enumerated GPIO descriptor config flags:
      GPIOD_OUT_LOW_OPEN_DRAIN and GPIOD_OUT_HIGH_OPEN_DRAIN
      that will set up the lined enforced as open drain as output
      low or high, using open drain (if the driver supports it)
      or using open drain emulation (setting the line as input
      to drive it high) from the gpiolib core.
      
      Cc: linux-gpio@vger.kernel.org
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f926dfc1
  6. 20 10月, 2017 5 次提交
  7. 04 10月, 2017 2 次提交
    • L
      gpio: Alter semantics of *raw* operations to actually be raw · 02e47980
      Linus Walleij 提交于
      Currently calls to:
      gpiod_direction_output_raw()
      gpiod_set_raw_value()
      gpiod_set_raw_array_value()
      gpiod_set_raw_value_cansleep()
      gpiod_set_raw_array_value_cansleep()
      
      Respect that we do not want to invert the value written, but will
      still apply special open drain/open source semantics if the line has
      an open drain/open source flag.
      
      It also forbids us from driving an output marked as an interrupt
      line.
      
      This does not fit with the function name and expected semantics. In
      the w1 host driver (for example) we need to handle a line as open drain
      but sometimes force it to pull up, which means we should be able to
      use the gpiod_set_raw_value() for this, but it currently does not
      work.
      
      There are also use cases where users actually want to drive a line
      used by an interrupt. This is what they should be expected to use
      the *raw* accessors for.
      
      I have looked over the current users of this API and they do not seem
      to be using the *raw* accessors with open drain or open source so let's
      augment this behaviour before we have users expecting the inconsistent
      semantic.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      02e47980
    • L
      gpio: Get rid of _prefix and __prefixes · fac9d885
      Linus Walleij 提交于
      The arbitrarily marking of a function with _ or __ is taking to mean
      "perform some inner core of the caller" or something like that. At other
      times, this syntax has a totally different meaning.
      
      I don't like this since it is unambious and unhelpful to people reading
      the code, so replace it with _commit() suffixes.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      fac9d885
  8. 22 9月, 2017 1 次提交
  9. 31 8月, 2017 1 次提交
  10. 23 8月, 2017 1 次提交
  11. 14 8月, 2017 4 次提交
    • T
      gpio: Cleanup kerneldoc · 950d55f5
      Thierry Reding 提交于
      Some kerneldoc has become stale or wasn't quite correct from the outset.
      Fix up the most serious issues to silence warnings when building the
      documentation.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      950d55f5
    • R
      gpio: Convert to using %pOF instead of full_name · 7eb6ce2f
      Rob Herring 提交于
      Now that we have a custom printf format specifier, convert users of
      full_name to use %pOF instead. This is preparation to remove storing
      of the full path string for each node.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: Tien Hock Loh <thloh@altera.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: bcm-kernel-feedback-list@broadcom.com
      Cc: Michal Simek <michal.simek@xilinx.com>
      Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
      Cc: linux-gpio@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Acked-by: NGregory Fong <gregory.0xf0@gmail.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      7eb6ce2f
    • G
      gpiolib: allow gpio irqchip to map irqs dynamically · dc749a09
      Grygorii Strashko 提交于
      Now IRQ mappings are always created for all (allowed) GPIOs in gpiochip in
      gpiochip_irqchip_add_key() which goes against the idea of SPARSE_IRQ and,
      as result, leads to:
       - increasing of memory consumption for IRQ descriptors most of which will
      never ever be used (espessially on platform with a high number of GPIOs).
      (sizeof(struct irq_desc) == 256 on my tested platforms)
       - imposibility to use GPIO irqchip APIs by gpio drivers when HW implements
      GPIO IRQ functionality as IRQ crossbar/router which has only limited
      number of IRQ outputs (example from [1], all GPIOs can be mapped on only 8
      IRQs).
      
      Hence, remove static IRQ mapping code from gpiochip_irqchip_add_key() and
      instead replace irq_find_mapping() with irq_create_mapping() in
      gpiochip_to_irq(). Also add additional gpiochip_irqchip_irq_valid() calls
      in gpiochip_to_irq() and gpiochip_irq_map().
      
      After this change gpio2irq mapping will happen the following way when GPIO
      irqchip APIs are used by gpio driver:
       - IRQ mappings will be created statically if driver passes first_irq>0
      vlaue in gpiochip_irqchip_add_key().
       - IRQ mappings will be created dynamically from gpio_to_irq() or
      of_irq_get().
      
      Tested on am335x-evm and dra72-evm-revc.
      - dra72-evm-revc: number of created irq mappings decreased from 402 -> 135
        Mem savings 267*256 = 68352 (66kB)
      - am335x-evm: number of created irq mappings decreased from 188 -> 63
        Mem savings 125*256 = 32000 (31kB)
      
      [1] https://lkml.org/lkml/2017/6/15/428Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      dc749a09
    • T
      gpiolib: request the gpio before querying its direction · 108d23e3
      Timur Tabi 提交于
      Before querying a GPIO to determine its direction, the GPIO should be
      formally requested.  This allows the GPIO driver to block access to
      unavailable GPIOs, which makes it easier for some drivers to support
      sparse GPIO maps.
      Signed-off-by: NTimur Tabi <timur@codeaurora.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      108d23e3
  12. 01 8月, 2017 1 次提交
  13. 29 6月, 2017 1 次提交
  14. 31 5月, 2017 1 次提交
  15. 29 5月, 2017 4 次提交
  16. 22 5月, 2017 1 次提交
  17. 13 4月, 2017 1 次提交