1. 05 Mar, 2012 4 commits
    • Stephen Warren's avatar
      pinctrl: API changes to support multiple states per device · 6e5e959d
      Stephen Warren authored
      The API model is changed from:
      
      p = pinctrl_get(dev, "state1");
      pinctrl_enable(p);
      ...
      pinctrl_disable(p);
      pinctrl_put(p);
      p = pinctrl_get(dev, "state2");
      pinctrl_enable(p);
      ...
      pinctrl_disable(p);
      pinctrl_put(p);
      
      to this:
      
      p = pinctrl_get(dev);
      s1 = pinctrl_lookup_state(p, "state1");
      s2 = pinctrl_lookup_state(p, "state2");
      pinctrl_select_state(p, s1);
      ...
      pinctrl_select_state(p, s2);
      ...
      pinctrl_put(p);
      
      This allows devices to directly transition between states without
      disabling the pin controller programming and put()/get()ing the
      configuration data each time. This model will also better suit pinconf
      programming, which doesn't have a concept of "disable".
      
      The special-case hogging feature of pin controllers is re-written to use
      the regular APIs instead of special-case code. Hence, the pinmux-hogs
      debugfs file is removed; see the top-level pinctrl-handles files for
      equivalent data.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarDong Aisheng <dong.aisheng@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      6e5e959d
    • Stephen Warren's avatar
      pinctrl: add usecount to pins for muxing · 0e3db173
      Stephen Warren authored
      Multiple mapping table entries could reference the same pin, and hence
      "own" it. This would be unusual now that pinctrl_get() represents a single
      state for a client device, but in the future when it represents all known
      states for a device, this is quite likely. Implement reference counting
      for pin ownership to handle this.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarDong Aisheng <dong.aisheng@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      0e3db173
    • Stephen Warren's avatar
      pinctrl: refactor struct pinctrl handling in core.c vs pinmux.c · 7ecdb16f
      Stephen Warren authored
      This change separates two aspects of struct pinctrl:
      
      a) The data representation of the parsed mapping table, into:
      
         1) The top-level struct pinctrl object, a single entity returned
            by pinctrl_get().
      
         2) The parsed version of each mapping table entry, struct
            pinctrl_setting, of which there is one per mapping table entry.
      
      b) The code that handles this; the code for (1) above is in core.c, and
         the code to parse/execute each entry in (2) above is in pinmux.c, while
         the iteration over multiple settings is lifted to core.c.
      
      This will allow the following future changes:
      
      1) pinctrl_get() API rework, so that struct pinctrl represents all states
         for the device, and the device can select between them without calling
         put()/get() again.
      
      2) To support that, a struct pinctrl_state object will be inserted into
         the data model between the struct pinctrl and struct pinctrl_setting.
      
      3) The mapping table will be extended to allow specification of pin config
         settings too. To support this, struct pinctrl_setting will be enhanced
         to store either mux settings or config settings, and functions will be
         added to pinconf.c to parse/execute pin configuration settings.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Acked-by: default avatarDong Aisheng <dong.aisheng@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      7ecdb16f
    • Stephen Warren's avatar
      pinctrl: fix and simplify locking · 57b676f9
      Stephen Warren authored
      There are many problems with the current pinctrl locking:
      
      struct pinctrl_dev's gpio_ranges_lock isn't effective;
      pinctrl_match_gpio_range() only holds this lock while searching for a gpio
      range, but the found range is return and manipulated after releading the
      lock. This could allow pinctrl_remove_gpio_range() for that range while it
      is in use, and the caller may very well delete the range after removing it,
      causing pinctrl code to touch the now-free range object.
      
      Solving this requires the introduction of a higher-level lock, at least
      a lock per pin controller, which both gpio range registration and
      pinctrl_get()/put() will acquire.
      
      There is missing locking on HW programming; pin controllers may pack the
      configuration for different pins/groups/config options/... into one
      register, and hence have to read-modify-write the register. This needs to
      be protected, but currently isn't. Related, a future change will add a
      "complete" op to the pin controller drivers, the idea being that each
      state's programming will be programmed into the pinctrl driver followed
      by the "complete" call, which may e.g. flush a register cache to HW. For
      this to work, it must not be possible to interleave the pinctrl driver
      calls for different devices.
      
      As above, solving this requires the introduction of a higher-level lock,
      at least a lock per pin controller, which will be held for the duration
      of any pinctrl_enable()/disable() call.
      
      However, each pinctrl mapping table entry may affect a different pin
      controller if necessary. Hence, with a per-pin-controller lock, almost
      any pinctrl API may need to acquire multiple locks, one per controller.
      To avoid deadlock, these would need to be acquired in the same order in
      all cases. This is extremely difficult to implement in the case of
      pinctrl_get(), which doesn't know which pin controllers to lock until it
      has parsed the entire mapping table, since it contains somewhat arbitrary
      data.
      
      The simplest solution here is to introduce a single lock that covers all
      pin controllers at once. This will be acquired by all pinctrl APIs.
      
      This then makes struct pinctrl's mutex irrelevant, since that single lock
      will always be held whenever this mutex is currently held.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      57b676f9
  2. 02 Mar, 2012 4 commits
  3. 29 Feb, 2012 3 commits
  4. 24 Feb, 2012 4 commits
  5. 22 Feb, 2012 14 commits
  6. 10 Feb, 2012 4 commits
  7. 01 Feb, 2012 3 commits
  8. 31 Jan, 2012 4 commits
    • Linus Torvalds's avatar
      Linux 3.3-rc2 · 62aa2b53
      Linus Torvalds authored
      62aa2b53
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream · d3712b9d
      Linus Torvalds authored
      There are few important bug fixes for LogFS
      
      * tag 'for-linus' of git://github.com/prasad-joshi/logfs_upstream:
        Logfs: Allow NULL block_isbad() methods
        logfs: Grow inode in delete path
        logfs: Free areas before calling generic_shutdown_super()
        logfs: remove useless BUG_ON
        MAINTAINERS: Add Prasad Joshi in LogFS maintiners
        logfs: Propagate page parameter to __logfs_write_inode
        logfs: set superblock shutdown flag after generic sb shutdown
        logfs: take write mutex lock during fsync and sync
        logfs: Prevent memory corruption
        logfs: update page reference count for pined pages
      
      Fix up conflict in fs/logfs/dev_mtd.c due to semantic change in what
      "mtd->block_isbad" means in commit f2933e86: "Logfs: Allow NULL
      block_isbad() methods" clashing with the abstraction changes in the
      commits 7086c19d: "mtd: introduce mtd_block_isbad interface" and
      d58b27ed: "logfs: do not use 'mtd->block_isbad' directly".
      
      This resolution takes the semantics from commit f2933e86, and just
      makes mtd_block_isbad() return zero (false) if the 'block_isbad'
      function is NULL.  But that also means that now "mtd_can_have_bb()"
      always returns 0.
      
      Now, "mtd_block_markbad()" will obviously return an error if the
      low-level driver doesn't support bad blocks, so this is somewhat
      non-symmetric, but it actually makes sense if a NULL "block_isbad"
      function is considered to mean "I assume that all my blocks are always
      good".
      d3712b9d
    • Linus Torvalds's avatar
      Merge branch 'hwmon-for-linus' of... · c5d2bc11
      Linus Torvalds authored
      Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (w83627ehf) Disable setting DC mode for pwm2, pwm3 on NCT6776F
        hwmon: (sht15) fix bad error code
        MAINTAINERS: Drop maintainer for MAX1668 hwmon driver
        MAINTAINERS: Add hwmon entries for Wolfson
        hwmon: (f71805f) Fix clamping of temperature limits
      c5d2bc11
    • Linus Torvalds's avatar
      Merge branch 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 8e2a2880
      Linus Torvalds authored
      Here are some fixes to the pin control system that has accumulated since
      -rc1.  Mainly Tony Lindgren fixed the module load/unload logic and the
      rest are minor fixes and documentation.
      
      * 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: add checks for empty function names
        pinctrl: fix pinmux_hog_maps when ctrl_dev_name is not set
        pinctrl: fix some pinmux typos
        pinctrl: free debugfs entries when unloading a pinmux driver
        pinctrl: unbreak error messages
        Documentation/pinctrl: fix a few syntax errors in code examples
        pinctrl: fix pinconf_pins_show iteration
      8e2a2880