1. 22 4月, 2014 1 次提交
    • A
      pinctrl: allows not to define the get_group_pins operation · e5b3b2d9
      Antoine Ténart 提交于
      When using a group only pinctrl driver, which does not have any
      information on the pins it is useless to define a get_group_pins
      always returning an empty list of pins.
      
      When not using get_group_pin[1], a driver must implement it so
      pins = NULL and num_pins = 0. This patch makes it the default
      behaviour if not defined in the pinctrl driver when used in
      pinmux enable and disable funtions and in pinctrl_groups_show.
      
      It also adds a check in pinctrl_get_group_pins and return -EINVAL if
      not defined. This function is called in the gpiolib when adding when
      pingroup range. It cannot be used if no group is defined, so this seams
      reasonable.
      
      [1] get_group_pin(struct pinctrl_dev *pctldev,
      		  unsigned selector,
      		  const unsigned **pins,
      		  unsigned *num_pins);
      Signed-off-by: NAntoine Ténart <antoine.tenart@free-electrons.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      e5b3b2d9
  2. 06 2月, 2014 1 次提交
  3. 05 2月, 2014 1 次提交
  4. 16 10月, 2013 1 次提交
  5. 28 8月, 2013 1 次提交
  6. 23 8月, 2013 3 次提交
  7. 25 7月, 2013 1 次提交
  8. 23 7月, 2013 1 次提交
  9. 18 6月, 2013 4 次提交
  10. 16 6月, 2013 2 次提交
  11. 30 4月, 2013 1 次提交
  12. 26 4月, 2013 1 次提交
    • P
      pinctrl: move subsystem mutex to pinctrl_dev struct · 42fed7ba
      Patrice Chotard 提交于
      This mutex avoids deadlock in case of use of multiple pin
      controllers. Before this modification, by using a global
      mutex, deadlock appeared when, for example, a call to
      pinctrl_pins_show() locked the pinctrl_mutex, called the
      ops->pin_dbg_show of a particular pin controller. If this
      pin controller needs I2C access to retrieve configuration
      information and I2C driver is using pinctrl to drive its
      pins, a call to pinctrl_select_state() try to lock again
      pinctrl_mutex which leads to a deadlock.
      
      Notice that the mutex grab from the two direction functions
      was moved into pinctrl_gpio_direction().
      
      For several cases, we can't replace pinctrl_mutex by
      pctldev->mutex, because at this stage, pctldev is
      not accessible :
      	- pinctrl_get()/pinctrl_put()
      	- pinctrl_register_maps()
      
      So add respectively pinctrl_list_mutex and
      pinctrl_maps_mutex in order to protect
      pinctrl_list and pinctrl_maps list instead.
      
      Reintroduce pinctrldev_list_mutex in
      find_pinctrl_by_of_node(),
      pinctrl_find_and_add_gpio_range()
      pinctrl_request_gpio(), pinctrl_free_gpio(),
      pinctrl_gpio_direction(), pinctrl_devices_show(),
      pinctrl_register() and pinctrl_unregister() to
      protect pinctrldev_list.
      
      Changes v2->v3:
      - Fix a missing EXPORT_SYMBOL_GPL() for pinctrl_select_state().
      
      Changes v1->v2:
      - pinctrl_select_state_locked() is removed, all lock mechanism
        is located inside pinctrl_select_state(). When parsing
        the state->setting list, take the per-pin-controller driver
        lock. (Patrice).
      - Introduce pinctrldev_list_mutex to protect pinctrldev_list
        in all functions which parse or modify pictrldev_list.
        (Patrice).
      - move find_pinctrl_by_of_node() from pinctrl/devicetree.c to
        pinctrl/core.c in order to protect pinctrldev_list.
        (Patrice).
      - Sink mutex:es into some functions and remove some _locked
        variants down to where the lists are actually accessed to
        make things simpler. (Linus)
      - Drop *all* mutexes completely from pinctrl_lookup_state()
        and pinctrl_select_state() - no relevant mutex was taken
        and it was unclear what this was protecting against. (Linus)
      
      Reported by : Seraphin Bonnaffe <seraphin.bonnaffe@stericsson.com>
      Signed-off-by: NPatrice Chotard <patrice.chotard@st.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      42fed7ba
  13. 03 4月, 2013 6 次提交
  14. 28 3月, 2013 3 次提交
  15. 07 3月, 2013 2 次提交
  16. 11 2月, 2013 1 次提交
    • L
      pinctrl/pinconfig: add debug interface · 6f9e41f4
      Laurent Meunier 提交于
      This update adds a debugfs interface to modify a pin configuration
      for a given state in the pinctrl map. This allows to modify the
      configuration for a non-active state, typically sleep state.
      This configuration is not applied right away, but only when the state
      will be entered.
      
      This solution is mandated for us by HW validation: in order
      to test and verify several pin configurations during sleep without
      recompiling the software.
      Signed-off-by: NLaurent Meunier <laurent.meunier@st.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6f9e41f4
  17. 30 1月, 2013 1 次提交
  18. 23 1月, 2013 1 次提交
    • L
      drivers/pinctrl: grab default handles from device core · ab78029e
      Linus Walleij 提交于
      This makes the device core auto-grab the pinctrl handle and set
      the "default" (PINCTRL_STATE_DEFAULT) state for every device
      that is present in the device model right before probe. This will
      account for the lion's share of embedded silicon devcies.
      
      A modification of the semantics for pinctrl_get() is also done:
      previously if the pinctrl handle for a certain device was already
      taken, the pinctrl core would return an error. Now, since the
      core may have already default-grabbed the handle and set its
      state to "default", if the handle was already taken, this will
      be disregarded and the located, previously instanitated handle
      will be returned to the caller.
      
      This way all code in drivers explicitly requesting their pinctrl
      handlers will still be functional, and drivers that want to
      explicitly retrieve and switch their handles can still do that.
      But if the desired functionality is just boilerplate of this
      type in the probe() function:
      
      struct pinctrl  *p;
      
      p = devm_pinctrl_get_select_default(&dev);
      if (IS_ERR(p)) {
         if (PTR_ERR(p) == -EPROBE_DEFER)
              return -EPROBE_DEFER;
              dev_warn(&dev, "no pinctrl handle\n");
      }
      
      The discussion began with the addition of such boilerplate
      to the omap4 keypad driver:
      http://marc.info/?l=linux-input&m=135091157719300&w=2
      
      A previous approach using notifiers was discussed:
      http://marc.info/?l=linux-kernel&m=135263661110528&w=2
      This failed because it could not handle deferred probes.
      
      This patch alone does not solve the entire dilemma faced:
      whether code should be distributed into the drivers or
      if it should be centralized to e.g. a PM domain. But it
      solves the immediate issue of the addition of boilerplate
      to a lot of drivers that just want to grab the default
      state. As mentioned, they can later explicitly retrieve
      the handle and set different states, and this could as
      well be done by e.g. PM domains as it is only related
      to a certain struct device * pointer.
      
      ChangeLog v4->v5 (Stephen):
      - Simplified the devicecore grab code.
      - Deleted a piece of documentation recommending that pins
        be mapped to a device rather than hogged.
      ChangeLog v3->v4 (Linus):
      - Drop overzealous NULL checks.
      - Move kref initialization to pinctrl_create().
      - Seeking Tested-by from Stephen Warren so we do not disturb
        the Tegra platform.
      - Seeking ACK on this from Greg (and others who like it) so I
        can merge it through the pinctrl subsystem.
      ChangeLog v2->v3 (Linus):
      - Abstain from using IS_ERR_OR_NULL() in the driver core,
        Russell recently sent a patch to remove it. Handle the
        NULL case explicitly even though it's a bogus case.
      - Make sure we handle probe deferral correctly in the device
        core file. devm_kfree() the container on error so we don't
        waste memory for devices without pinctrl handles.
      - Introduce reference counting into the pinctrl core using
        <linux/kref.h> so that we don't release pinctrl handles
        that have been obtained for two or more places.
      ChangeLog v1->v2 (Linus):
      - Only store a pointer in the device struct, and only allocate
        this if it's really used by the device.
      
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Benoit Cousson <b-cousson@ti.com>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Mitch Bradley <wmb@firmworks.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Cc: Rickard Andersson <rickard.andersson@stericsson.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Reviewed-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      [swarren: fixed and simplified error-handling in pinctrl_bind_pins(), to
      correctly handle deferred probe. Removed admonition from docs not to use
      pinctrl hogs for devices]
      Signed-off-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      ab78029e
  19. 21 1月, 2013 1 次提交
  20. 12 1月, 2013 2 次提交
  21. 26 12月, 2012 1 次提交
  22. 21 11月, 2012 3 次提交
  23. 12 11月, 2012 1 次提交