1. 12 6月, 2015 1 次提交
  2. 10 4月, 2015 2 次提交
    • H
      regulator: output current-limit for all regulators in summary · 23296099
      Heiko Stübner 提交于
      Voltage regulators can have (unregulated) current limits too, so we should
      probably output both voltage and current for all regulators.
      
      Holding the rdev->mutex actually conflicts with _regulator_get_current_limit
      but also is not really necessary, as the global regulator_list_mutex already
      protects us from the regulator vanishing while we go through the list.
      
      On the rk3288-firefly the summary now looks like:
      
       regulator                      use open bypass voltage current     min     max
      -------------------------------------------------------------------------------
       vcc_sys                          0   12      0  5000mV     0mA  5000mV  5000mV
          vcc_lan                       1    1      0  3300mV     0mA  3300mV  3300mV
             ff290000.ethernet                                            0mV     0mV
          vcca_33                       0    0      0  3300mV     0mA  3300mV  3300mV
          vcca_18                       0    0      0  1800mV     0mA  1800mV  1800mV
          vdd10_lcd                     0    0      0  1000mV     0mA  1000mV  1000mV
       [...]
      Suggested-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      23296099
    • H
      regulator: add a summary tree in debugfs · 7c225ec9
      Heiko Stübner 提交于
      On modern systems the regulator hierarchy can get quite long and nested
      with regulators supplying other regulators. In some cases when debugging
      it might be nice to get a tree of these regulators, their consumers
      and the regulation constraints in one go.
      
      To achieve this add a regulator_summary sysfs node, similar to
      clk_summary in the common clock framework, that walks the regulator
      list and creates a tree out of the regulators, their consumers and
      core per-regulator settings.
      
      On a rk3288-firefly the regulator_summary would for example look
      something like:
      
       regulator                      use open bypass   value     min     max
      -----------------------------------------------------------------------
       vcc_sys                          0   12      0  5000mV  5000mV  5000mV
          vcc_lan                       1    1      0  3300mV  3300mV  3300mV
             ff290000.ethernet                                    0mV     0mV
          vcca_33                       0    0      0  3300mV  3300mV  3300mV
          vcca_18                       0    0      0  1800mV  1800mV  1800mV
          vdd10_lcd                     0    0      0  1000mV  1000mV  1000mV
          vccio_sd                      0    0      0  3300mV  3300mV  3300mV
          vcc_20                        0    3      0  2000mV  2000mV  2000mV
             vcc18_lcd                  0    0      0  1800mV  1800mV  1800mV
             vcc_18                     0    2      0  1800mV  1800mV  1800mV
                ff100000.saradc                                   0mV     0mV
                ff0d0000.dwmmc                                 1650mV  1950mV
             vdd_10                     0    0      0  1000mV  1000mV  1000mV
          vdd_log                       0    0      0  1100mV  1100mV  1100mV
          vcc_io                        0    3      0  3300mV  3300mV  3300mV
             ff0f0000.dwmmc                                    3300mV  3400mV
             vcc_flash                  1    1      0  1800mV  1800mV  1800mV
                ff0f0000.dwmmc                                 1700mV  1950mV
             vcc_sd                     1    1      0  3300mV  3300mV  3300mV
                ff0c0000.dwmmc                                 3300mV  3400mV
          vcc_ddr                       0    0      0  1200mV  1200mV  1200mV
          vdd_gpu                       0    0      0  1000mV   850mV  1350mV
          vdd_cpu                       0    1      0   900mV   850mV  1350mV
             cpu0                                               900mV   900mV
          vcc_5v                        0    2      0  5000mV  5000mV  5000mV
             vcc_otg_5v                 0    0      0  5000mV  5000mV  5000mV
             vcc_host_5v                0    0      0  5000mV  5000mV  5000mV
       regulator-dummy                  0    0      0     0mV     0mV     0mV
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      7c225ec9
  3. 02 4月, 2015 1 次提交
  4. 28 3月, 2015 1 次提交
    • G
      regulator: Ensure unique regulator debugfs directory names · a9eaa813
      Guenter Roeck 提交于
      If multiple regulator devices of the same type exist in a system,
      the regulator driver assigns generic names for the regulators it
      provides, and debugfs is enabled, the regulator subsystem attempts
      to create multiple entries with the same name in the regulator debugfs
      directory. This fails for all but the first regulator, resulting in
      multiple "Failed to create debugfs directory" log entries.
      
      To avoid the problem, prepend the debugfs directory name for a regulator
      with its parent device name if available, but only if no explicit
      regulator name was provided.
      
      Cc: Alan Tull <atull@opensource.altera.com>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      a9eaa813
  5. 10 3月, 2015 1 次提交
  6. 09 3月, 2015 2 次提交
    • D
      regulator: core: Fix enable GPIO reference counting · 29d62ec5
      Doug Anderson 提交于
      Normally _regulator_do_enable() isn't called on an already-enabled
      rdev.  That's because the main caller, _regulator_enable() always
      calls _regulator_is_enabled() and only calls _regulator_do_enable() if
      the rdev was not already enabled.
      
      However, there is one caller of _regulator_do_enable() that doesn't
      check: regulator_suspend_finish().  While we might want to make
      regulator_suspend_finish() behave more like _regulator_enable(), it's
      probably also a good idea to make _regulator_do_enable() robust if it
      is called on an already enabled rdev.
      
      At the moment, _regulator_do_enable() is _not_ robust for already
      enabled rdevs if we're using an ena_pin.  Each time
      _regulator_do_enable() is called for an rdev using an ena_pin the
      reference count of the ena_pin is incremented even if the rdev was
      already enabled.  This is not as intended because the ena_pin is for
      something else: for keeping track of how many active rdevs there are
      sharing the same ena_pin.
      
      Here's how the reference counting works here:
      
      * Each time _regulator_enable() is called we increment
        rdev->use_count, so _regulator_enable() calls need to be balanced
        with _regulator_disable() calls.
      
      * There is no explicit reference counting in _regulator_do_enable()
        which is normally just a warapper around rdev->desc->ops->enable()
        with code for supporting delays.  It's not expected that the
        "ops->enable()" call do reference counting.
      
      * Since regulator_ena_gpio_ctrl() does have reference counting
        (handling the sharing of the pin amongst multiple rdevs), we
        shouldn't call it if the current rdev is already enabled.
      
      Note that as part of this we cleanup (remove) the initting of
      ena_gpio_state in regulator_register().  In _regulator_do_enable(),
      _regulator_do_disable() and _regulator_is_enabled() is is clear that
      ena_gpio_state should be the state of whether this particular rdev has
      requested the GPIO be enabled.  regulator_register() was initting it
      as the actual state of the pin.
      
      Fixes: 967cfb18 ("regulator: core: manage enable GPIO list")
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      29d62ec5
    • J
      regulator: Only enable disabled regulators on resume · 0548bf4f
      Javier Martinez Canillas 提交于
      The _regulator_do_enable() call ought to be a no-op when called on an
      already-enabled regulator.  However, as an optimization
      _regulator_enable() doesn't call _regulator_do_enable() on an already
      enabled regulator.  That means we never test the case of calling
      _regulator_do_enable() during normal usage and there may be hidden
      bugs or warnings.  We have seen warnings issued by the tps65090 driver
      and bugs when using the GPIO enable pin.
      
      Let's match the same optimization that _regulator_enable() in
      regulator_suspend_finish().  That may speed up suspend/resume and also
      avoids exposing hidden bugs.
      
      [Use much clearer commit message from Doug Anderson]
      Signed-off-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      0548bf4f
  7. 04 3月, 2015 1 次提交
  8. 23 2月, 2015 1 次提交
  9. 03 2月, 2015 1 次提交
  10. 29 1月, 2015 1 次提交
  11. 15 1月, 2015 1 次提交
  12. 09 1月, 2015 3 次提交
  13. 30 12月, 2014 2 次提交
  14. 05 12月, 2014 1 次提交
  15. 24 11月, 2014 1 次提交
  16. 01 11月, 2014 1 次提交
  17. 20 10月, 2014 1 次提交
    • M
      regulator: Add ena_gpio_initialized to regulator_config · 76f439df
      Markus Pargmann 提交于
      Most drivers do not set the ena_gpio field of struct regulator_config
      before passing it to the regulator core. This is fine as long as the
      gpio identifier that is passed is a positive integer. But the gpio
      identifier 0 is also valid. So we are not able to decide wether we got a
      real gpio identifier or not based on a 0 in ena_gpio.
      
      To be able to decide if it is a valid gpio that got passed, this patch
      adds a ena_gpio_initialized field that should be set if was initialized
      with a correct value, either a gpio >= 0 or a negative error number. The
      core then checks if ena_gpio or ena_gpio_initialized before handling it
      as a gpio. This way we maintain backwards compatibility and fix the
      behaviour for gpio number 0.
      Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      76f439df
  18. 10 9月, 2014 1 次提交
    • M
      regulator: of: Provide simplified DT parsing method · a0c7b164
      Mark Brown 提交于
      Currently regulator drivers which support DT all repeat very similar code
      to supply a list of known regulator identifiers to be matched with DT,
      convert that to platform data which is then matched up with the regulators
      as they are registered. This is both fiddly to get right and for devices
      which can use the standard helpers to provide their operations is the main
      source of code in the driver.
      
      Since this code is essentially identical for most drivers we can factor it
      out into the core, moving the identifiers in the match table into the
      regulator descriptors and also allowing drivers to pass in the name of the
      subnode to search. When a driver provides an of_match string for the
      regulator the core will attempt to use that to obtain init_data, allowing
      the driver to remove all explicit code for DT parsing and simply provide
      data instead.
      
      The current code leaks the phandles for the child nodes, this will be
      addressed incrementally and makes no practical difference for FDT anyway
      as the DT data structures are never freed.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      a0c7b164
  19. 29 8月, 2014 1 次提交
  20. 19 8月, 2014 1 次提交
  21. 17 8月, 2014 3 次提交
  22. 30 7月, 2014 2 次提交
  23. 26 7月, 2014 1 次提交
    • T
      regulator: Add helpers for low-level register access · 04eca28c
      Tuomas Tynkkynen 提交于
      Add helper functions that allow regulator consumers to obtain low-level
      details about the regulator hardware, like the voltage selector register
      address and such. These details can be useful when configuring hardware
      or firmware that want to do low-level access to regulators, with no
      involvement from the kernel.
      
      The use-case for Tegra is a voltage-controlled oscillator clocksource
      which has control logic to change the supply voltage via I2C to achieve
      a desired output clock rate.
      Signed-off-by: NTuomas Tynkkynen <ttynkkynen@nvidia.com>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      04eca28c
  24. 30 6月, 2014 1 次提交
  25. 05 6月, 2014 1 次提交
    • N
      regulator: core: print error value when constraints are not applied · 69d58839
      Nishanth Menon 提交于
      With commit 064d5cd1
      (regulator: core: Fix the init of DT defined fixed regulators)
      We ensure that regulator must be capable of providing it's current
      voltage when constraints are used, however adding the return value in
      the print is a little more informative to explain the nature of the
      failure involved.
      
      So, instead of providing message such as:
      smps9: failed to get the current voltage
      
      having error value added to the message such as:
      smps9: failed to get the current voltage(-22)
      
      is a little more informative for debugging the error.
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      69d58839
  26. 02 6月, 2014 3 次提交
    • A
      regulator: core: Fix the init of DT defined fixed regulators · 064d5cd1
      Alban Bedel 提交于
      When a regulator is defined using DT and it has a single voltage the
      regulator init always tries to apply this voltage. However it fails if
      the regulator isn't settable because it is using an internal low level
      function. To overcome this we now first query the regulator and only
      set it if needed.
      Signed-off-by: NAlban Bedel <alban.bedel@avionic-design.de>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      064d5cd1
    • S
      regulator: core: Disable unused regulators after deferred probing is done · fd482a3e
      Saravana Kannan 提交于
      regulator_init_complete does a scan of regulators which dont have
      always-on or consumers are automatically disabled as being unused.
      However, with deferred probing, late_initcall() is too soon to
      declare a regulator as unused as the regulator itself might not
      have registered due to defferal - Example: A regulator deffered due
      to i2bus not available which in turn is deffered due to pinctrl
      availability.
      
      Since deferred probing is done in late_initcall(), do the cleanup of
      unused regulators by regulator_init_complete in late_initcall_sync
      instead of late_initcall.
      
      Cc: Liam Girdwood <lgirdwood@gmail.com>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Markus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NSaravana Kannan <skannan@codeaurora.org>
      [nm@ti.com: minor rewording]
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      fd482a3e
    • M
      regulator: Don't disable unused regulators we don't have permission for · e9535834
      Mark Brown 提交于
      In the spirit of conservatism that governs our general approach to
      permissions it is better if we don't touch regulators we weren't explicitly
      given permissions to control. This avoids the need to explicitly specify
      unknown regulators in DT as always on, if a regulator is not otherwise
      involved in software control it can be omitted from the DT.
      
      Regulators explicitly given constraints in DT still need to have an always
      on constraint specified as before.
      Signed-off-by: NMark Brown <broonie@linaro.org>
      e9535834
  27. 29 5月, 2014 1 次提交
  28. 26 5月, 2014 1 次提交
  29. 24 5月, 2014 1 次提交
  30. 15 4月, 2014 1 次提交
    • C
      regulator: core: Get and put regulator of_node · 63c7c9e1
      Charles Keepax 提交于
      Currently the regulator core does not take an additional reference to
      the of_node it is passed. This means that the caller must ensure that
      the of_node is valid for the duration of the regulator's existance.
      It is reasonable for the framework to assume it is passed a valid
      of_node but seems onerous for it to assume the caller will keep the node
      valid for the life-time of the regulator, especially when
      devm_regulator_register is used and there will likely be no code in the
      driver called at the point it would be safe to put the of_node.
      
      This patch adds an additional of_node_get when the regulator is
      registered and an of_node_put when it is unregistered in the core. This
      means individual drivers are free to put their of_node references at the
      end of probe letting the regulator core handling it from there. This
      simplifies code on the driver side.
      Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: NMark Brown <broonie@linaro.org>
      63c7c9e1