1. 01 8月, 2017 1 次提交
  2. 29 6月, 2017 1 次提交
  3. 31 5月, 2017 1 次提交
  4. 29 5月, 2017 4 次提交
  5. 22 5月, 2017 1 次提交
  6. 13 4月, 2017 1 次提交
  7. 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
  8. 21 3月, 2017 1 次提交
  9. 17 3月, 2017 1 次提交
  10. 14 3月, 2017 1 次提交
  11. 05 2月, 2017 1 次提交
  12. 31 1月, 2017 1 次提交
  13. 26 1月, 2017 3 次提交
  14. 19 1月, 2017 1 次提交
  15. 11 1月, 2017 2 次提交
  16. 30 12月, 2016 1 次提交
  17. 07 12月, 2016 1 次提交
    • L
      gpio: chardev: Return error for seek operations · f4e81c52
      Lars-Peter Clausen 提交于
      The GPIO chardev is used for management tasks (allocating line and event
      handles) and does neither support read() nor write() operations. Hence it
      does not make much sense to allow seek operations.
      
      Currently the chardev uses noop_llseek() for its seek implementation. This
      function does not move the pointer and simply returns the current position
      (always 0 for the GPIO chardev). noop_llseek() is primarily meant for
      devices that can not support seek, but where there might be a user that
      depends on the seek() operation succeeding. For newly added devices that
      can not support seek operations it is recommended to use no_llseek(), which
      will return an error. For more information see commit 6038f373
      ("llseek: automatically add .llseek fop").
      
      Unfortunately this was overlooked when the GPIO chardev ABI was introduced.
      But it is highly unlikely that since then userspace applications have
      appeared that rely on being able to perform non-failing seek operations on
      a GPIO chardev file descriptor. So it should be safe to change from
      noop_llseel() to no_seek(). Also use nonseekable_open() in the chardev
      open() callback to clear the FMODE_SEEK, FMODE_PREAD and FMODE_PWRITE flags
      from the file. Neither of these should be set on a file that does not
      support seek operations.
      
      Cc: stable@vger.kernel.org
      Fixes: 3c702e99 ("gpio: add a userspace chardev ABI for GPIOs")
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f4e81c52
  18. 25 11月, 2016 1 次提交
    • L
      gpio: simplify adding threaded interrupts · d245b3f9
      Linus Walleij 提交于
      This tries to simplify the use of CONFIG_GPIOLIB_IRQCHIP when
      using threaded interrupts: add a new call
      gpiochip_irqchip_add_nested() to indicate that we're dealing
      with a nested rather than a chained irqchip, then create a
      separate gpiochip_set_nested_irqchip() to mirror
      the gpiochip_set_chained_irqchip() call to connect the
      parent and child interrupts.
      
      In the nested case gpiochip_set_nested_irqchip() does nothing
      more than call irq_set_parent() on each valid child interrupt,
      which has little semantic effect in the kernel, but this is
      probably still formally correct.
      
      Update all drivers using nested interrupts to use
      gpiochip_irqchip_add_nested() so we can now see clearly
      which these users are.
      
      The DLN2 driver can drop its specific hack with
      .irq_not_threaded as we now recognize whether a chip is
      threaded or not from its use of gpiochip_irqchip_add_nested()
      signature rather than from inspecting .can_sleep.
      
      We rename the .irq_parent to .irq_chained_parent since this
      parent IRQ is only really kept around for the chained
      interrupt handlers.
      
      Cc: Lars Poeschel <poeschel@lemonage.de>
      Cc: Octavian Purdila <octavian.purdila@intel.com>
      Cc: Daniel Baluta <daniel.baluta@intel.com>
      Cc: Bin Gao <bin.gao@linux.intel.com>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
      Cc: Semen Protsenko <semen.protsenko@globallogic.com>
      Cc: Alexander Stein <alexander.stein@systec-electronic.com>
      Cc: Phil Reid <preid@electromag.com.au>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Patrice Chotard <patrice.chotard@st.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      d245b3f9
  19. 15 11月, 2016 3 次提交
    • L
      gpio: tag line labels used for interrupts · 3940c34a
      Linus Walleij 提交于
      When a GPIO line is marked as used for an interrupt, it is
      helpful to set the label to "interrupt" so we know what is
      going on when inspecting the lines.
      
      If a GPIO is already properly named by gpiod_get*() we don't
      need to do this. It only happens when a line is used from
      the irqchip side of a GPIO driver without communicating
      with the GPIO side, such as when gpiochip is used as interrupt
      provider in the device tree.
      
      If the line is still marked as used by "interrupt" when we
      unmark it as used by an interrupt, also remove this label
      from the descriptor.
      
      Also shape up the code around unmarking IRQ lines.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      3940c34a
    • L
      gpio: clamp values on gpio[d]_direction_output() · ad17731d
      Linus Walleij 提交于
      I saw weird values != [0,1] being passed down to drivers
      in their .set_direction_output() callbacks. Go over the
      gpiolib and make sure to hammer it to [0,1] before hitting
      the driver to avoid undesired side effects.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      ad17731d
    • L
      gpio: do not double-check direction on sleeping chips · 60f8339e
      Linus Walleij 提交于
      When locking a GPIO line as IRQ, we go to lengths to
      double-check that the line is really set as input before
      marking it as used for IRQ. This is not good on GPIO chips
      that can sleep, because this function is called in IRQ-safe
      context. Just skip this if it can't be checked quickly.
      
      Currently this happens on sleeping expanders such as STMPE
      or TC3589x:
      
      BUG: scheduling while atomic: swapper/1/0x00000002
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper Not tainted 4.9.0-rc1+ #38
      Hardware name: Nomadik STn8815
      [<c000f2e0>] (unwind_backtrace) from [<c000d244>] (show_stack+0x10/0x14)
      [<c000d244>] (show_stack) from [<c0037b78>] (__schedule_bug+0x54/0x80)
      [<c0037b78>] (__schedule_bug) from [<c042df14>] (__schedule+0x3a0/0x460)
      [<c042df14>] (__schedule) from [<c042e028>] (schedule+0x54/0xb8)
      (...)
      
      This patch fixes that problem and relies on the direction
      read from the chip when it was added.
      
      Cc: stable@vger.kernel.org
      Fixes: 9c10280d ("gpio: flush direction status in gpiochip_lock_as_irq()")
      Cc: Patrice Chotard <patrice.chotard@st.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      60f8339e
  20. 01 11月, 2016 1 次提交
    • L
      gpio: GPIO_GET_LINE{HANDLE,EVENT}_IOCTL: Fix file descriptor leak · 953b956a
      Lars-Peter Clausen 提交于
      When allocating a new line handle or event a file is allocated that it is
      associated to. The file is attached to a file descriptor of the current
      process and the file descriptor is returned to userspace using
      copy_to_user(). If this copy operation fails the line handle or event
      allocation is aborted, all acquired resources are freed and an error is
      returned.
      
      But the file struct is not freed and left attached to the userspace
      application and even though the file descriptor number was not copied it is
      trivial to guess. If a userspace application performs a IOCTL on such a
      left over file descriptor it will trigger a use-after-free and if the file
      descriptor is closed (latest when the application exits) a double-free is
      triggered.
      
      anon_inode_getfd() performs 3 tasks, allocate a file struct, allocate a
      file descriptor for the current process and install the file struct in the
      file descriptor. As soon as the file struct is installed in the file
      descriptor it is accessible by userspace (even if the IOCTL itself hasn't
      completed yet), this means uninstalling the fd on the error path is not an
      option, since userspace might already got a reference to the file.
      
      Instead anon_inode_getfd() needs to be broken into its individual steps.
      The allocation of the file struct and file descriptor is done first, then
      the copy_to_user() is executed and only if it succeeds the file is
      installed.
      
      Since the file struct is reference counted it can not be just freed, but
      its reference needs to be dropped, which will also call the release()
      callback, which will free the state attached to the file. So in this case
      the normal error cleanup path should not be taken.
      
      Cc: stable@vger.kernel.org
      Fixes: d932cd49 ("gpio: free handles in fringe cases")
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      953b956a
  21. 21 10月, 2016 8 次提交
  22. 04 10月, 2016 1 次提交
    • L
      gpio: acpi: separation of concerns · 031ba28a
      Linus Walleij 提交于
      The generic GPIO library directly implement code for acpi_find_gpio()
      which is only used with CONFIG_ACPI. This was probably done because
      OF did the same thing, but I removed that so remove this too.
      
      Rename the internal acpi_find_gpio() in gpiolib-acpi.c to
      acpi_populate_gpio_lookup() which seems to be more appropriate anyway
      so as to avoid a namespace clash with the same function.
      
      Make the stub return -ENOENT rather than -ENOSYS (as that is for
      syscalls!).
      
      For some reason the sunxi pin control driver was including the private
      gpiolib header, it works just fine without it so remove that oneliner.
      
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      031ba28a
  23. 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
  24. 23 9月, 2016 1 次提交
    • M
      gpiolib: Make it possible to exclude GPIOs from IRQ domain · 79b804cb
      Mika Westerberg 提交于
      When using GPIO irqchip helpers to setup irqchip for a gpiolib based
      driver, it is not possible to select which GPIOs to add to the IRQ domain.
      Instead it just adds all GPIOs which is not always desired. For example
      there might be GPIOs that for some reason cannot generated normal
      interrupts at all.
      
      To support this we add a flag irq_need_valid_mask to struct gpio_chip. When
      this flag is set the core allocates irq_valid_mask that holds one bit for
      each GPIO the chip has. By default all bits are set but drivers can
      manipulate this using set_bit() and clear_bit() accordingly.
      
      Then when gpiochip_irqchip_add() is called, this mask is checked and all
      GPIOs with bit is set are added to the IRQ domain created for the GPIO
      chip.
      Suggested-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      79b804cb
  25. 13 9月, 2016 1 次提交