1. 08 11月, 2017 11 次提交
  2. 25 10月, 2017 1 次提交
    • L
      gpio: mmio: Make pin2mask() a private business · 24efd94b
      Linus Walleij 提交于
      The vtable call pin2mask() was introducing a vtable function call
      in every gpiochip callback for a generic MMIO GPIO chip. This was
      not exactly efficient. (Maybe link-time optimization could get rid of
      it, I don't know.)
      
      After removing all external calls into this API we can make it a
      boolean flag in the struct gpio_chip call and sink the function into
      the gpio-mmio driver yielding encapsulation and potential speedups.
      
      Cc: Anton Vorontsov <anton@enomsg.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      24efd94b
  3. 20 10月, 2017 2 次提交
  4. 14 8月, 2017 3 次提交
  5. 29 5月, 2017 1 次提交
  6. 13 4月, 2017 1 次提交
  7. 26 1月, 2017 1 次提交
    • M
      pinctrl / gpio: Introduce .set_config() callback for GPIO chips · 2956b5d9
      Mika Westerberg 提交于
      Currently we already have two pin configuration related callbacks
      available for GPIO chips .set_single_ended() and .set_debounce(). In
      future we expect to have even more, which does not scale well if we need
      to add yet another callback to the GPIO chip structure for each possible
      configuration parameter.
      
      Better solution is to reuse what we already have available in the
      generic pinconf.
      
      To support this, we introduce a new .set_config() callback for GPIO
      chips. The callback takes a single packed pin configuration value as
      parameter. This can then be extended easily beyond what is currently
      supported by just adding new types to the generic pinconf enum.
      
      If the GPIO driver is backed up by a pinctrl driver the GPIO driver can
      just assign gpiochip_generic_config() (introduced in this patch) to
      .set_config and that will take care configuration requests are directed
      to the pinctrl driver.
      
      We then convert the existing drivers over .set_config() and finally
      remove the .set_single_ended() and .set_debounce() callbacks.
      Suggested-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      2956b5d9
  8. 19 1月, 2017 1 次提交
  9. 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
  10. 24 10月, 2016 1 次提交
  11. 12 10月, 2016 1 次提交
  12. 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
  13. 15 9月, 2016 1 次提交
    • P
      gpio: don't include module.h in shared driver header · d47529b2
      Paul Gortmaker 提交于
      Most shared headers in include/linux don't need to know what the
      internals of a struct module are; all they care about is that it
      is a struct and hence they may require a pointer to one.
      
      The advantage in this is that module.h is including a lot of stuff
      itself, and an otherwise empty C file that just contains module.h
      will result in ~750kB from CPP (compared to say 12kB from init.h)
      
      So we have approximately 50 instances of "struct module;" in the
      various include/linux headers already that help us keep module.h
      out of other headers; here we do the same for gpio.
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: linux-gpio@vger.kernel.org
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      d47529b2
  14. 05 4月, 2016 1 次提交
    • L
      gpio: support native single-ended hardware drivers · c663e5f5
      Linus Walleij 提交于
      Some GPIO controllers has a special hardware bit we can flip
      to support open drain / source. This means that on these hardwares
      we do not need to emulate OD/OS by setting the line to input
      instead of actively driving it high/low. Add an optional vtable
      callback to the driver set_single_ended() so that driver can
      implement this in hardware if they have it.
      
      We may need a pinctrl_gpio_set_config() call at some point to
      propagate this down to a backing pin control device on systems
      with split GPIO/pin control.
      Reported-by: NMichael Hennerich <michael.hennerich@analog.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      c663e5f5
  15. 23 2月, 2016 1 次提交
  16. 19 2月, 2016 1 次提交
  17. 16 2月, 2016 3 次提交
  18. 12 2月, 2016 3 次提交
  19. 09 2月, 2016 1 次提交
    • L
      gpio: make the gpiochip a real device · ff2b1359
      Linus Walleij 提交于
      GPIO chips have been around for years, but were never real devices,
      instead they were piggy-backing on a parent device (such as a
      platform_device or amba_device) but this was always optional.
      GPIO chips could also exist without any device at all, with its
      struct device *parent (ex *dev) pointer being set to null.
      
      When sysfs was in use, a mock device would be created, with the
      optional parent assigned, or just floating orphaned with NULL
      as parent.
      
      If sysfs is active, it will use this device as parent.
      
      We now create a gpio_device struct containing a real
      struct device and move the subsystem over to using that. The
      list of struct gpio_chip:s is augmented to hold struct
      gpio_device:s and we find gpio_chips:s by first looking up
      the struct gpio_device.
      
      The struct gpio_device is designed to stay around even if the
      gpio_chip is removed, so as to satisfy users in userspace
      that need a backing data structure to hold the state of the
      session initiated with e.g. a character device even if there is
      no physical chip anymore.
      
      From this point on, gpiochips are devices.
      
      Cc: Johan Hovold <johan@kernel.org>
      Cc: Michael Welling <mwelling@ieee.org>
      Cc: Markus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      ff2b1359
  20. 13 1月, 2016 1 次提交
    • A
      gpio: generic: make bgpio_pdata always visible · c474e348
      Arnd Bergmann 提交于
      Board files that define their own bgpio_pdata are broken when
      CONFIG_GPIO_GENERIC is disabled and the bgpio_pdata structure
      definition is hidden by the #ifdef:
      
      arch/arm/mach-clps711x/board-autcpu12.c:148:15: error: variable 'autcpu12_mmgpio_pdata' has initializer but incomplete type
       static struct bgpio_pdata autcpu12_mmgpio_pdata __initdata = {
      arch/arm/mach-clps711x/board-autcpu12.c:149:2: error: unknown field 'base' specified in initializer
        .base = AUTCPU12_MMGPIO_BASE,
      
      Since the board files should generally not care what drivers are
      enabled, this makes the structure definition visible again.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: 0f4630f3 ("gpio: generic: factor into gpio_chip struct")
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      c474e348
  21. 05 1月, 2016 2 次提交
    • L
      gpio: generic: factor into gpio_chip struct · 0f4630f3
      Linus Walleij 提交于
      The separate struct bgpio_chip has been a pain to handle, both
      by being confusingly similar in name to struct gpio_chip and
      for being contained inside a struct so that struct gpio_chip
      is contained in a struct contained in a struct, making several
      steps of dereferencing necessary.
      
      Make things simpler: include the fields directly into
      <linux/gpio/driver.h>, #ifdef:ed for CONFIG_GENERIC_GPIO, and
      get rid of the <linux/basic_mmio_gpio.h> altogether. Prefix
      some of the member variables with bgpio_* and add proper
      kerneldoc while we're at it.
      
      Modify all users to handle the change and use a struct
      gpio_chip directly. And while we're at it: replace all
      container_of() dereferencing by gpiochip_get_data() and
      registering the gpio_chip with gpiochip_add_data().
      
      Cc: arm@kernel.org
      Cc: Alexander Shiyan <shc_work@mail.ru>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <kernel@pengutronix.de>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-omap@vger.kernel.org
      Cc: linux-samsung-soc@vger.kernel.org
      Cc: bcm-kernel-feedback-list@broadcom.com
      Acked-by: NGregory Fong <gregory.0xf0@gmail.com>
      Acked-by: NLiviu Dudau <Liviu.Dudau@arm.com>
      Acked-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Acked-by: NLee Jones <lee.jones@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      0f4630f3
    • L
      gpio: add a data pointer to gpio_chip · b08ea35a
      Linus Walleij 提交于
      This adds a void * pointer to gpio_chip so that driver can
      assign and retrieve some states. This is done to get rid of
      container_of() calls for gpio_chips embedded inside state
      containers, so we can remove the need to have the gpio_chip
      or later (planned) struct gpio_device be dynamically allocated
      at registration time, so that its struct device can be properly
      reference counted and not bound to its parent device (e.g.
      a platform_device) but instead live on after unregistration
      if it is opened by e.g. a char device or sysfs.
      
      The data is added with the new function gpiochip_add_data()
      and for compatibility we add static inline wrapper function
      gpiochip_add() that will call gpiochip_add_data() with
      NULL as argument. The latter will be removed once we have
      exorcised gpiochip_add() from the kernel.
      
      gpiochip_get_data() is added as a static inline accessor
      for drivers to quickly get their data out.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      b08ea35a
  22. 27 12月, 2015 1 次提交
    • V
      gpio: update gpiochip .get() callback description · 60befd2e
      Vladimir Zapolskiy 提交于
      Since gpiochip .get() callback may return a negative error value, it
      strictly limits the range of possible non-error returned values to
      a subset of [30:0] bitmask, however on practice on success all
      gpiochip drivers return either 0 for low signal or 1 for high signal,
      this is assured by "gpio: *: Be sure to clamp return value" series of
      changes. To avoid any confusion, misinterpretation and potential
      errors while developing gpiochip drivers in future convert this
      implicit assumption to a mandatory rule.
      
      For output signals with unknown output signal state gpiochip drivers
      should return a negative error instead of 0.
      Signed-off-by: NVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      60befd2e