1. 10 Feb, 2013 2 commits
    • Lee Jones's avatar
      pinctrl/abx500: replace IRQ offsets with table read-in values · a6a16d27
      Lee Jones authored
      The ABx500 GPIO controller used to provide a set of virtual contiguous
      IRQs for use by sub-devices, but they have been removed after a request
      from Mainline Maintainers. Now the AB8500 core driver deals with almost
      all IRQ related issues instead.
      
      The ABx500 GPIO driver is now only used to convert between GPIO and IRQ
      numbers which is actually quite difficult, as the ABx500 GPIO's
      associated IRQs are clustered together throughout the interrupt number
      space at irregular intervals. To solve this quandary, we have placed the
      read-in values into the existing cluster information table to use during
      conversion.
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      [Moved irq_base removal into this patch]
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      a6a16d27
    • Lee Jones's avatar
      pinctrl/abx500: move IRQ handling to ab8500-core · ac652d79
      Lee Jones authored
      In its current state the gpio-ab8500 driver looks after some GPIO
      lines found on the AB8500 MFD chip. It also controls all of its
      own IRQ handling for these GPIOs by inventing some virtual IRQs
      and handing those out to sub-devices. There has been quite a bit
      of controversy over this and it was a contributing factor to the
      driver being marked as BROKEN in Mainline.
      
      The reason for adopting this method was due to added complexity
      in the hardware. Unusually, each GPIO has two separate IRQs
      associated with it, one for a rising and a different one for a
      falling interrupt. Using this method complicates matters further
      because the GPIO IRQs are actually sandwiched between a bunch
      of IRQs which are handled solely by the AB8500 core driver.
      
      The best way for us to take this forward is to get rid of the
      virtual IRQs and only hand out the rising IRQ lines. If a
      sub-driver wishes to request a falling interrupt, they can do
      so by requesting a rising line in the normal way. They just
      have to add IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_BOTH, if
      they require both in the flags. Then if a falling IRQ is
      triggered, the AB8500 core driver will know how to handle the
      added complexity accordingly. This should greatly simply things.
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      [Augment to keep irq_base for a while (removed later)]
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      ac652d79
  2. 08 Feb, 2013 1 commit
  3. 07 Feb, 2013 2 commits
  4. 06 Feb, 2013 3 commits
  5. 05 Feb, 2013 18 commits
  6. 01 Feb, 2013 5 commits
  7. 30 Jan, 2013 7 commits
  8. 29 Jan, 2013 1 commit
  9. 23 Jan, 2013 1 commit
    • Linus Walleij's avatar
      drivers/pinctrl: grab default handles from device core · ab78029e
      Linus Walleij authored
      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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarLinus 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: default avatarStephen Warren <swarren@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      ab78029e