Commit Graph

2251 Commits

Author SHA1 Message Date
Stephen Warren 5b01bd11b7 regulator: palmas: fix typo in enable_reg calculation
When setting up .enable_reg for an SMPS regulator, presumably we should
call PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, ...) rather than using
LDO_BASE. This change makes the LCD panel and HDMI work again on the
NVIDIA Dalmore board anyway.

Fixes: 318dbb02b5 ("regulator: palmas: Fix SMPS enable/disable/is_enabled")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Nishanth Menon <nm@ti.com>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-24 11:58:36 +01:00
Keerthy d6f83370ed regulator: palmas: Add tps65917 PMIC support
Add tps65917 PMIC support.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-23 12:30:56 +01:00
Keerthy cac9e91624 regulator: palmas: add driver data and modularize the probe
add driver data and modularize the probe.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-23 12:30:56 +01:00
Keerthy 9f057dc1d0 regulator: palmas: Shift the reg_info structure definition to the header file
Shift the reg_info structure definition to the header file.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-23 12:30:56 +01:00
Graham Williams 636f4a31e3 regulator: bcm590xx: fix vbus name
The vbus regulator was not getting its name set. This results
in the sysfs entry being empty. The lack of a bcm590xx_regs[]
table entry also upsets Coverity runs. Add the table entry
so the name gets set properly.

Signed-off-by: Graham Williams <graham.williams@linaro.org>
Acked-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-22 12:00:14 +01:00
Axel Lin 03187c72db regulator: ab8500: Remove ab8500_regulator_debug_init/exit()
CONFIG_REGULATOR_AB8500_DEBUG is always not defined.
ab8500_regulator_debug_init() is not called at all now,
ab8500_regulator_debug_exit() simply return 0, thus remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-22 11:51:47 +01:00
Axel Lin a5c1a41601 regulator: ab8500: Remove ab8500_regulator_of_probe()
Now this is a DT-only driver because non-devicetree probe path is removed,
so merge ab8500_regulator_of_probe() into ab8500_regulator_probe().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-22 11:51:44 +01:00
Sachin Kamat 53ddddcad5 regulator: ltc3589: Staticize ltc3589_reg_defaults
'ltc3589_reg_defaults' is local to this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 11:33:15 +01:00
Nishanth Menon 318dbb02b5 regulator: palmas: Fix SMPS enable/disable/is_enabled
We use regmap regulator ops to enable/disable and check if regulator
is enabled for various SMPS. However, these depend on valid
enable_reg, enable_mask and enable_value in regulator descriptor.

Currently we do not populate these for SMPS other than SMPS10, this
results in spurious results as regmap assumes that the values are
valid and ends up reading register 0x0 RTC:SECONDS_REG on Palmas
variants that do have RTC! To fix this, we update proper parameters
for the descriptor fields.

Further, we want to ensure the behavior consistent with logic
prior to commit dbabd624d4, where, once you do a set_mode,
enable/disable ensure the logic remains consistent and configures
Palmas to the configuration that we set with set_mode (since the
configuration register is common). To do this, we can rely on the
regulator core's regulator_register behavior where the regulator
descriptor pointer provided by the regulator driver is stored. (no
reallocation and copy is done). This lets us update the enable_value
post registration, to remain consistent with the mode we configure as
part of set_mode.

Fixes: dbabd624d4 ("regulator: palmas: Reemove open coded functions with helper functions")
Reported-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 11:22:09 +01:00
Robert Baldyga d0540f91cf mfd: max77693: Remove unnecessary wrapper functions
This patch removes wrapper functions used to access regmap, and
make driver using regmap_*() functions instead.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-17 15:16:10 +01:00
Mark Brown c9ac065928 Merge remote-tracking branches 'regulator/fix/as3722', 'regulator/fix/ltc3589' and 'regulator/fix/palmas' into regulator-linus 2014-06-16 16:05:57 +01:00
Axel Lin 73d23ca732 regulator: ltc3589: Use of_get_child_by_name
of_find_node_by_name() walks the allnodes list, and can thus walk
outside of the parent node. Use of_get_child_by_name() instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-16 15:56:33 +01:00
Linus Torvalds 4251c2a670 Most of this is cleaning up various driver sysfs permissions so we can
re-add the perm check (we unified the module param and sysfs checks, but
 the module ones were stronger so we weakened them temporarily).
 
 Param parsing gets documented, and also "--" now forces args to be
 handed to init (and ignored by the kernel).
 
 Module NX/RO protections get tightened: we now set them before calling
 parse_args().
 
 Cheers,
 Rusty.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTl+oJAAoJENkgDmzRrbjxtUEP/jIXml01jE2HquOJ/DfrCJOt
 ry5L5Iy8wVBRotTszrXqlD6+W8fLYsEdhM65Wof1H7X1qjaulqYZmrL7bQn4rIGN
 YPUmO5rOzECeAPNW5+e2JLnR4bmS99gVcWzJFCHUBd7Z8ceKaoIk7/XvUg6Mdjg7
 v0kJ5X+U9da2sVYYcZ71euth4ADLFDRNRexA1mPI6mKzJLOBgfvCBWZnkFVdBcjd
 VmL6ceFo/yP9Ed4pgG/4uXq1dZ4ZttpjPusDmNcjq+snOzsQb4tW+KB2Pr6iTwQy
 TDt7lQm5+xfUXgUG/S5L6PYn10P44Voo7AEJa+QK5YPSOY/eRVA0h4/ayP0vqDaJ
 LpZjqXbW77G4yOgEV9KRFLLXiFXykTh2TyCPYL5G2XVXQp1OmViu2f21JWJLFLgL
 mqOXYWdowOGVOOoTgwxIdxczCFCATJUaU5Ig6ay8C02E2mCwIV+IaGSdpsCiyjz/
 dNNumMxWg0NMo/c0YG4K3Ake6ZaGrwbnuJYijaEj6mgpifhh7k4yhFciXGLpkLnS
 Yuo4ORO0GX34z1+bX0iwrgMGPdy7+BnbXsDdWJsbsnwnKKes/Sp44fNl4lPwdM3n
 siaPsxmfAtl9EGqbkU1Fk+x5+X/Lv2I/7/nX5n53520RLkJJpbeMDfHUqpbrqeUN
 JNUTOZ9o72EqDVKnn175
 =IxSN
 -----END PGP SIGNATURE-----

Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull module updates from Rusty Russell:
 "Most of this is cleaning up various driver sysfs permissions so we can
  re-add the perm check (we unified the module param and sysfs checks,
  but the module ones were stronger so we weakened them temporarily).

  Param parsing gets documented, and also "--" now forces args to be
  handed to init (and ignored by the kernel).

  Module NX/RO protections get tightened: we now set them before calling
  parse_args()"

* tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  module: set nx before marking module MODULE_STATE_COMING.
  samples/kobject/: avoid world-writable sysfs files.
  drivers/hid/hid-picolcd_fb: avoid world-writable sysfs files.
  drivers/staging/speakup/: avoid world-writable sysfs files.
  drivers/regulator/virtual: avoid world-writable sysfs files.
  drivers/scsi/pm8001/pm8001_ctl.c: avoid world-writable sysfs files.
  drivers/hid/hid-lg4ff.c: avoid world-writable sysfs files.
  drivers/video/fbdev/sm501fb.c: avoid world-writable sysfs files.
  drivers/mtd/devices/docg3.c: avoid world-writable sysfs files.
  speakup: fix incorrect perms on speakup_acntsa.c
  cpumask.h: silence warning with -Wsign-compare
  Documentation: Update kernel-parameters.tx
  param: hand arguments after -- straight to init
  modpost: Fix resource leak in read_dump()
2014-06-11 16:09:14 -07:00
Dan Carpenter ce44beb7c0 regulator: 88pm800: remove duplicate PM800_BUCK3 define
The PM800_BUCK3 define is cut and pasted twice so we can remove the
second instance.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-09 20:58:39 +01:00
Alexander Shiyan 7dd33c1d57 regulator: mc13xxx: Remove unnecessary locks
Read-modify-write sequence is already protected by regmap, so no
additional locks need. This patch remove such locks from mc13xxx
regulator driver.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-09 20:52:33 +01:00
Alexander Shiyan 3865e11d7b regulator: mc13xxx: Remove unused field "hi_bit"
Field "hi_bit" is not used anywhere in the driver.
This patch removes this excess field.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-09 20:50:35 +01:00
Axel Lin 2628b10070 regulator: tps6586x: Use regulator_list_voltage_linear for dvm/ldo4/sw2
The voltage tables for dvm/ldo4/sw2 are actually linear mapping.
Thus convert dvm/ldo4/sw2 to use regulator_list_voltage_linear.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-06 11:16:08 +01:00
Jingoo Han c969faadf0 regulator: bcm590xx: remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-06 11:08:35 +01:00
Nishanth Menon 6b7f2d82d5 regulator: palmas: Fix SMPS list for 0V
get_voltage_sel reads from SMPS register - if the read selector value
is 0, the SMPS is actually disabled - So, this is in addition to the
ctrl_register that may also be used to enable/disable the SMPS.

The original logic(prior to commit dbabd624d4) used to be:
static int palmas_map_voltage_smps(struct regulator_dev *rdev,
               int min_uV, int max_uV)
<snip>
       if (min_uV == 0)
               return 0;

To handle this scenario, with the transition to regulator_list
implementation, we seem to have missed the data necessary to mark as
one of the valid entries as "0" 'disabled regulator' which results in
0 volts - So, stick with pre-existing logic.

Without this added to the list, palmas regulator driver,
on probe, attempts to setup constraints and in the case of
OMAP5uEVM, SMPS9 (which is mapped for 2v1 audio supply) fails in
regulator_list_voltage_linear_range mapping of '0', and as a fall back
of constraints not being applied, the entire regulator list is not
enumerated due to assumption that something system wide has gone bad
on with the PMIC.

Fixes: dbabd624d4 ("regulator: palmas: Reemove open coded functions with helper functions")
Reported-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-05 12:40:51 +01:00
Nishanth Menon 69d588392b regulator: core: print error value when constraints are not applied
With commit 064d5cd110
(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: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-05 12:36:51 +01:00
Linus Torvalds 312c76f1a3 regulator: Updates for v3.16
The bulk of the changes for this release are a few new drivers however
 there are a couple of noticable core changes and the usual stream of
 cleanups and fixes:
 
  - Move disable of unused regulators later in init so it comes after
    deferred probe has iterated making startup smoother.
  - Fixes reference counting of the DT nodes for constraints from Charles
    Keepax.  This has little practical impact since all real users of
    the regulator bindings use FDT which doesn't need the reference
    counting.
  - Lots of cleanups, especially to the Samsung drivers.
  - Support for Linear Technologies LTC3589, Texas Instruments TPS658640
    and X-Powers AXP20x.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTjaRuAAoJELSic+t+oim96AAP/jNtqLoBLIz6Idwg29Jd3Gj+
 X3R+5NfuS0kccvKvIbHmKygwJ6hY9anBsKQ28AH6VUAgcUqrPnWiRyl4iZAyMSQZ
 bweQ1QSAIxjAD9J+hMSMU65h3pKh7t6k20dumEUOJZ/ZuPmYj5aks3dy+DKSIkF2
 GDG1SVonxheuhUbxEPnXlz5pSnFtERQQMGPdYzk3RxqdeDeVr6Oanlxuo/IKagPP
 vm6BFFutEcSk4KpkEQF+iGxIDTzTFGjMe2TzDu1ubxsxcL+5sNh8rkN9rbqQ0fdo
 fGMZuo9AXEPXNDwY6ug0Mxoqhg0vrf8NSnEWjM6zQJELKH6H4KMhwAGjstCDkFer
 rsuZXeIM1Mk1wrPP6QWLvHVqwS9GUXki82ZgUpDOn61HpRLUu6bKY8eWoq3UM79S
 qiRoNSW7eggI0/71IrzumWWE8HEufEJEgGNAqwFPkBywCg+biXjkHlcXdyBMCpqy
 kUev0QVJb3FHBnyIdMAVm8hrreejh+frl2Nc+aIEhYZxc3idvVqKl1lvjbObt6PM
 FK52n8c/WlQxLZ8+isv0b1+pwT6QHeLzBvBA8mE6+Mn4vLzQKT4nofQU4PSASRSM
 UqkaSMhaaJ4WRXlNdhkp721EbRAltrTwzjMS/7lTTZRyN9g9ODOhDnzRT2f3J8F1
 JYS22jFTL5ywNR6GFcq0
 =JrfM
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into next

Pull regulator updates from Mark Brown:
 "The bulk of the changes for this release are a few new drivers however
  there are a couple of noticable core changes and the usual stream of
  cleanups and fixes:

   - move disable of unused regulators later in init so it comes after
     deferred probe has iterated making startup smoother.
   - fixes to reference counting of the DT nodes for constraints from
     Charles Keepax.  This has little practical impact since all real
     users of the regulator bindings use FDT which doesn't need the
     reference counting.
   - lots of cleanups, especially to the Samsung drivers.
   - support for Linear Technologies LTC3589, Texas Instruments
     TPS658640 and X-Powers AXP20x"

* tag 'regulator-v3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (64 commits)
  regulator: pbias: remove unnecessary OOM messages
  regulator: max8649: remove unnecessary OOM messages
  regulator: core: Fix the init of DT defined fixed regulators
  regulator: core: Disable unused regulators after deferred probing is done
  regulator: Don't disable unused regulators we don't have permission for
  regulator: axp20x: Use regulator_map_voltage_ascend for LDO4
  regulator: use of_property_read_{bool|u32}()
  regulator: Fix regulator_get_{optional,exclusive}() documentation
  regulators: Add definition of regulator_set_voltage_time() for !CONFIG_REGULATOR
  regulator: arizona-ldo1: add missing #include
  regulator: pfuze100: Support enable/disable for fixed regulator
  regulator: ltc3589: Remove ltc3589_list_voltage_fixed function
  regulator: ltc3589: Fix module dependency
  regulator: tps6586x: Remove unused to_tps6586x_dev() function
  regulator: tps65218: Convert to use regulator_set_voltage_time_sel
  regulator: tps6586x: Add support for the TPS658640
  regulator: tps6586x: Prepare supporting fixed regulators
  regulator: pfuze100: Don't allocate an invalid gpio
  regulator: pfuze100: Support SWB enable/disable
  regulator: fixed: use of_property_read_{bool|u32}()
  ...
2014-06-03 11:44:48 -07:00
Thierry Reding 2050afde19 regulator: as3722: Make 0 a valid selector
As of commit 064d5cd110 (regulator: core: Fix the init of DT defined
fixed regulators) the regulator core tries to query the current voltage
of a regulator when applying constraints. This exposes a bug in the
AS3722 regulator driver which fails to read the voltage of disabled
regulators. The reason is that the hardware is programmed to a selector
of 0, but none of the voltage tables include 0 as a valid selector. The
datasheets indicate that 0 is a valid selector when the regulators are
powered off.

To fix this, add a range including selector 0 to the voltage tables.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-03 16:51:19 +01:00
Linus Torvalds 4046136afb Char / misc driver patches for 3.16-rc1
Here is the big char / misc driver updates for 3.16-rc1.
 
 Lots of different driver updates for a variety of different drivers and
 minor driver subsystems.
 
 All have been in linux-next with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iEYEABECAAYFAlONWI8ACgkQMUfUDdst+ykvQACdGxTChdEU7edElDAXeelVmu8v
 D1UAoLDvqwUsN7t5v+WG2wkOvhf5MEA7
 =tVMP
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc into next

Pull char/misc driver patches from Greg KH:
 "Here is the big char / misc driver update for 3.16-rc1.

  Lots of different driver updates for a variety of different drivers
  and minor driver subsystems.

  All have been in linux-next with no reported issues"

* tag 'char-misc-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (79 commits)
  hv: use correct order when freeing monitor_pages
  spmi: of: fixup generic SPMI devicetree binding example
  applicom: dereferencing NULL on error path
  misc: genwqe: fix uninitialized return value in genwqe_free_sync_sgl()
  miscdevice.h: Simple syntax fix to make pointers consistent.
  MAINTAINERS: Add miscdevice.h to file list for char/misc drivers.
  mcb: Add support for shared PCI IRQs
  drivers: Remove duplicate conditionally included subdirs
  misc: atmel_pwm: only build for supported platforms
  mei: me: move probe quirk to cfg structure
  mei: add per device configuration
  mei: me: read H_CSR after asserting reset
  mei: me: drop harmful wait optimization
  mei: me: fix hw ready reset flow
  mei: fix memory leak of mei_clients array
  uio: fix vma io range check in mmap
  drivers: uio_dmem_genirq: Fix memory leak in uio_dmem_genirq_probe()
  w1: do not unlock unheld list_mutex in __w1_remove_master_device()
  w1: optional bundling of netlink kernel replies
  connector: allow multiple messages to be sent in one packet
  ...
2014-06-03 08:06:56 -07:00
Mark Brown 978371cbab Merge remote-tracking branch 'regulator/topic/tps6586x' into regulator-next 2014-06-02 17:08:14 +01:00
Mark Brown b58e917bf9 Merge remote-tracking branches 'regulator/topic/s5m8767', 'regulator/topic/stub', 'regulator/topic/tps65090', 'regulator/topic/tps65217' and 'regulator/topic/tps65218' into regulator-next 2014-06-02 17:08:12 +01:00
Mark Brown 4c04ef25b8 Merge remote-tracking branches 'regulator/topic/palmas', 'regulator/topic/pbias', 'regulator/topic/pfuze100', 'regulator/topic/s2mpa01' and 'regulator/topic/s2mps11' into regulator-next 2014-06-02 17:08:08 +01:00
Mark Brown 2c7a6a3547 Merge remote-tracking branches 'regulator/topic/fixed', 'regulator/topic/id-const', 'regulator/topic/ltc3589', 'regulator/topic/max8649' and 'regulator/topic/of' into regulator-next 2014-06-02 17:08:05 +01:00
Mark Brown 8ff15e0909 Merge remote-tracking branches 'regulator/topic/arizona', 'regulator/topic/axp20' and 'regulator/topic/bcm590xx' into regulator-next 2014-06-02 17:08:03 +01:00
Mark Brown 42398dbdea Merge remote-tracking branch 'regulator/topic/core' into regulator-next 2014-06-02 17:08:02 +01:00
Mark Brown dc49f3d5eb Merge remote-tracking branch 'regulator/topic/constraints' into regulator-next 2014-06-02 17:08:01 +01:00
Mark Brown 277b1be9d4 Merge remote-tracking branch 'regulator/fix/s2mpa01' into regulator-linus 2014-06-02 17:07:59 +01:00
Jingoo Han 0ee42bb1f8 regulator: pbias: remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-02 15:14:51 +01:00
Jingoo Han 6e27e99613 regulator: max8649: remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-02 15:12:16 +01:00
Alban Bedel 064d5cd110 regulator: core: Fix the init of DT defined fixed regulators
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: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01 19:19:43 +01:00
Saravana Kannan fd482a3e3e regulator: core: Disable unused regulators after deferred probing is done
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: Saravana Kannan <skannan@codeaurora.org>
[nm@ti.com: minor rewording]
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01 19:16:12 +01:00
Mark Brown e953583456 regulator: Don't disable unused regulators we don't have permission for
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: Mark Brown <broonie@linaro.org>
2014-06-01 19:16:11 +01:00
Axel Lin b88703567b regulator: axp20x: Use regulator_map_voltage_ascend for LDO4
The voltages in axp20x_ldo4_data table are in ascendant order, so use
regulator_map_voltage_ascend.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01 13:42:42 +01:00
Sergei Shtylyov 1e050eabb6 regulator: use of_property_read_{bool|u32}()
Use more compact of_property_read_{bool|u32}() calls instead of the
of_{find|get}_property() calls in of_get_regulation_constraints() where
possible (note that of_property_read_{bool|u32}() were already used to read
some properties).

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01 11:56:23 +01:00
Stephen Boyd 69c3f7239e regulator: Fix regulator_get_{optional,exclusive}() documentation
regulator_get_optional() doesn't hold an exclusive reference to
the regulator. Fix the documentation and reword the exclusive
documentation to fix the grammatical error "this reference is
held".

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-28 21:25:24 +01:00
Arnd Bergmann 7b22b9a5ab regulator: arizona-ldo1: add missing #include
commit 2cce4be9e6 "regulator: arizona-ldo1: Add processing of init_data
from device tree" added a call to of_get_child_by_name() but
did not add an #include to the header file declaring that function.

I got a build error when doing randconfig testing on this, which
is fixed by this patch to include of.h.

drivers/regulator/arizona-ldo1.c:192:2: error: implicit declaration of function 'of_get_child_by_name' [-Werror=implicit-function-declaration]
drivers/regulator/arizona-ldo1.c:193:2: error: implicit declaration of function 'of_parse_phandle' [-Werror=implicit-function-declaration]
drivers/regulator/arizona-ldo1.c:213:2: error: implicit declaration of function 'of_node_put' [-Werror=implicit-function-declaration]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 20:52:42 +01:00
Axel Lin ab3ca774a2 regulator: pfuze100: Support enable/disable for fixed regulator
Current code has .enable_reg and .enable_mask settings, but the implementation
for corresponding callbacks are missing. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Robin Gong <b38343@freescale.com>
Acked-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 12:25:57 +01:00
Axel Lin c0c14e6af9 regulator: ltc3589: Remove ltc3589_list_voltage_fixed function
When fixed_uV is set and n_voltage is 1, regulator core will return
rdev->desc->fixed_uV in regulator_get_voltage() and regulator_list_voltage().

Rename ltc3589_standby_regulator_ops to ltc3589_fixed_standby_regulator_ops,
this makes the code clear that the ops is for fixed voltage regulator.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 12:06:35 +01:00
Axel Lin ac1d686846 regulator: ltc3589: Fix module dependency
Make this driver depend on I2C and select REGMAP_I2C to fix build failure.
Also allows this driver to be built as module.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 12:06:32 +01:00
Axel Lin ae8b70c9d8 regulator: tps6586x: Remove unused to_tps6586x_dev() function
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 12:04:39 +01:00
Axel Lin 5ab9be4274 regulator: tps65218: Convert to use regulator_set_voltage_time_sel
Use regulator_set_voltage_time_sel() instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 17:03:06 +01:00
Alban Bedel 6c46ccc8bb regulator: tps6586x: Add support for the TPS658640
The TPS658640 has a different set of output voltage for most LDO and
the RTC LDO isn't settable. This chip also report 2 different version
ID, as the datasheet doesn't list the possible values the second ID
has simply been named TPS658640v2.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 16:48:02 +01:00
Alban Bedel ad0b40fee4 regulator: tps6586x: Prepare supporting fixed regulators
Add the required definitions and macros to allow easily adding fixed
regulators. This required for the TPS658640 that doesn't allow setting
the LDO_RTC output voltage.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 16:47:40 +01:00
Sean Cross fe788b0955 regulator: pfuze100: Don't allocate an invalid gpio
Previously, the PFUZE100 would try to allocate gpio0 io0 because
config.ena_gpio defaults to 0, which can be a valid GPIO.  To prevent this
from happening, set this parameter to -EINVAL.

Signed-off-by: Sean Cross <xobs@kosagi.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 16:45:23 +01:00
Sean Cross a6dcf9782f regulator: pfuze100: Support SWB enable/disable
The SWB regulators have the ability to be turned on and off.  Add
enable/disable support for these regulators.

Signed-off-by: Sean Cross <xobs@kosagi.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 16:45:16 +01:00
Sergei Shtylyov 4127f696f9 regulator: fixed: use of_property_read_{bool|u32}()
Use more compact of_property_read_{bool|u32}() calls instead of the
of_{find|get}_property() calls.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 16:19:36 +01:00
Philipp Zabel 3eb2c7ecb7 regulator: Add LTC3589 support
This patch adds support for the Linear Technology LTC3589, LTC3589-1,
and LTC3589-2 8-output I2C voltage regulator ICs.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 15:54:57 +01:00
Krzysztof Kozlowski 112da5cb43 regulator: s2mpa01: Use correct register for buck1 ramp delay
Fix the register for ramp delay of buck1 regulator. Buck1 and buck6
share the field (offset 4) in ramp delay register S2MPA01_REG_RAMP2.

The driver used the same register and field for ramp delay of buck3 and
buck1. This lead to updating of ramp delay of buck3 when setting buck1
and actually the ramp delay of buck1 was never set.

Fixes: f187927146 ("regulator: Add support for S2MPA01 regulator")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: <stable@vger.kernel.org>
2014-05-26 15:39:12 +01:00
Axel Lin 366986274c regulator: core: Use map_voltage_linear_range by default for list_voltage_linear_range
Use map_voltage_linear_range() if list_voltage_linear_range() is in use and
nothing is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 14:36:55 +01:00
Lee Jones 9f8c0fe954 regulator: Constify the pointer to alias name array
Toughen-up checks for read-only regulator names.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-23 18:55:23 +01:00
Keerthy dbabd624d4 regulator: palmas: Reemove open coded functions with helper functions
Reemove open coded functions with helper functions.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-22 11:32:12 +01:00
Matt Porter c6466950e9 regulator: bcm590xx: Add support for regulators on secondary I2C slave
The bcm590xx MFD driver now exposes a secondary regmap descriptor
making the registers for regulators on the secondary I2C slave address
available.  Add support for GPLDO1-6 and VBUS regulators found within
this register range.

Signed-off-by: Matt Porter <mporter@linaro.org>
Acked-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-05-21 10:40:16 +01:00
Greg Kroah-Hartman 6a57bad6e7 Update extcon for v3.16
This patchset add resource-managed functions to automatically control the memory
 and unregistration operation of extcon. Also, This series support new MAX77836
 extcon device driver on existing MAX14577 device because existed a little
 difference between MAX77836 and MAX14577. Finally, Fix minor issue of extcon
 driver.
 
 Detailed description for patchset:
 1. Add resource-managed functions
 - Add resource-managed functions to automatically free the memory of extcon
 structure and to control unregistration behavior as following. This new devm_*
 functions applied all of extcon drivers in drivers/extcon/.
 : devm_extcon_dev_register/unregister()
 : devm_extcon_dev_allocate/free()
 : extcon_dev_allocate/free() for devm_extcon_dev_allocate/free()
 
 2. Add new MAX77836 extcon device
 - Support MAX77836 device on existing MAX14577 device driver using
 different compatible string. This patchset has dependency on MFD/
 Regulator/Extcon. So, Lee Jones(MFD Maintainer) created Immutable
 branch between MFD and Extcon due for v3.16 merge-window and then
 I merged this patchset from MFD git repo[1] to Extcon git repo.
 : [1] git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
   (branch: ib-mfd-extcon-3.16)
 
 3. Fix minor issue of extcon driver
 - extcon-palmas driver
 : Fix issue of extcon device name for probe
 - extcon-max14577
 : Fix probe failure about handling wrong return value.
 : Properly Handle return value of regmap_irq_get_virq function.
 - extcon-max8997/max77693 driver
 : Fix NULL pointer exception on missing pdata
 
 4. Code clean for extcon driver
 - extcon-max8997/max77693
 : Use power efficient workqueue for delayed cable detection
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJTepzmAAoJEJzN3yze689TSHMP/2l/pzI1IVqEQIzDnf6ga9AT
 rHo7kdLya+TxLBggasj21N9jprI3145bkWBL00EcnZkqrav7ctnU71347u7wkMzg
 pREYwK0OZAeF33rjbCrCPVrUL55XuTzipf4phtcKDSxmbFh/OdRZe4/vOEo0mBxE
 kTKb0zaePz0jeCur/ajxnZ1E/2DkKTsvUyiYSUYQ1FAjY4RvKkW/3qDYXqMetoYZ
 7sJdH5cpbsdGdQj74axuFWqvnINH1i9LY2gGw30tLKa7D15r72wBfA9HuRB/P5XB
 prvVb19wYLgkfxevZenvDjmyqeMUkFnk2a25Ntd3xndeaBJSCIM9y9tXxtz/fWyq
 ZPgsE0ma/E2PkKt4c4/mg1BzAGyL8lXU0SEivp03iLV3ByK2rmug7NdwG0Tw0/iE
 rcx3cdr7QvK4wSgaOt2Hcv+QLqXDZ7onrt3fhx+eHyD5X1ThRCCKbdr+H08eWnqw
 zGJQ6Ru4nrzZ1NS8bJuAjpKLfWwEWhN1QwvJ/Aw13yP/CIRtWgik+m1cUVTZriJL
 rlcdKJHbs8lGw07oROurmcEcKCBdr8HDZ4Ajht4qv7LQnYZK4q1N7xbbaI1tqTjb
 CawoA2ZfZMjNPkt97wwYselL2eRHVEHg5AwhzhVVPzbf/GxGU3GR2NLUeJBzbTaQ
 TtZbRo8l8GRGT5dGp86J
 =7wRd
 -----END PGP SIGNATURE-----

Merge tag 'extcon-next-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for v3.16

This patchset add resource-managed functions to automatically control the memory
and unregistration operation of extcon. Also, This series support new MAX77836
extcon device driver on existing MAX14577 device because existed a little
difference between MAX77836 and MAX14577. Finally, Fix minor issue of extcon
driver.

Detailed description for patchset:
1. Add resource-managed functions
- Add resource-managed functions to automatically free the memory of extcon
structure and to control unregistration behavior as following. This new devm_*
functions applied all of extcon drivers in drivers/extcon/.
: devm_extcon_dev_register/unregister()
: devm_extcon_dev_allocate/free()
: extcon_dev_allocate/free() for devm_extcon_dev_allocate/free()

2. Add new MAX77836 extcon device
- Support MAX77836 device on existing MAX14577 device driver using
different compatible string. This patchset has dependency on MFD/
Regulator/Extcon. So, Lee Jones(MFD Maintainer) created Immutable
branch between MFD and Extcon due for v3.16 merge-window and then
I merged this patchset from MFD git repo[1] to Extcon git repo.
: [1] git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
  (branch: ib-mfd-extcon-3.16)

3. Fix minor issue of extcon driver
- extcon-palmas driver
: Fix issue of extcon device name for probe
- extcon-max14577
: Fix probe failure about handling wrong return value.
: Properly Handle return value of regmap_irq_get_virq function.
- extcon-max8997/max77693 driver
: Fix NULL pointer exception on missing pdata

4. Code clean for extcon driver
- extcon-max8997/max77693
: Use power efficient workqueue for delayed cable detection
2014-05-20 09:44:38 +09:00
Boris BREZILLON a6016c523e regulator: AXP20x: fix wrong call to of_find_node_by_name
The of_find_node_by_name function will search for a DT node named
"regulators" after the provided np node, but will not ensure that this node
is a child of np.
This might result in retrieving a "regulators" node that is not related to
the axp20x PMIC.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Acked-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-19 17:40:06 +01:00
Krzysztof Kozlowski 0608032a90 regulator: s2mpa01: Use rdev_get_id() to access id of regulator
Use regulator API rdev_get_id() to access id of regulator.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-17 14:30:06 +01:00
Krzysztof Kozlowski b203e0dfe1 regulator: s2mps11: Fix accidental enable of buck6 ramp delay
S2MPS11 supports enabling/disabling ramp delay only for buck[2346].
Other bucks have ramp delay enabled always.

However the bit shift for enabling buck6 ramp delay in register is equal
to 0. When ramp delay was set for the bucks unsupporting enable/disable
(buck[15789] and buck10), the ramp delay for buck6 was also enabled.

Fixes: b96244fad9 ("regulator: s2mps11: Don't check enable_shift before setting enable ramp rate")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-17 14:29:26 +01:00
Krzysztof Kozlowski 51e2fc0a25 regulator: s2mpa01: Fix accidental enable of buck4 ramp delay
S2MPA01 supports enabling/disabling ramp delay only for buck[1234].
Other bucks have ramp delay enabled always.

However the bit shift for enabling buck4 ramp delay in register is equal
to 0. When ramp delay was set for the bucks unsupporting enable/disable
(buck[56789] and buck10), the ramp delay for buck4 was also enabled.

Fixes: f7b1a8dc1c ("regulator: s2mpa01: Don't check enable_shift before setting enable ramp rate")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-17 14:28:09 +01:00
Pawel Moll 3b9334ac83 mfd: vexpress: Convert custom func API to regmap
Components of the Versatile Express platform (configuration
microcontrollers on motherboard and daughterboards in particular)
talk to each other over a custom configuration bus. They
provide miscellaneous functions (from clock generator control
to energy sensors) which are represented as platform devices
(and Device Tree nodes). The transactions on the bus can
be generated by different "bridges" in the system, some
of which are universal for the whole platform (for the price
of high transfer latencies), others restricted to a subsystem
(but much faster).

Until now drivers for such functions were using custom "func"
API, which is being replaced in this patch by regmap calls.
This required:

* a rework (and move to drivers/bus directory, as suggested
  by Samuel and Arnd) of the config bus core, which is much
  simpler now and uses device model infrastructure (class)
  to keep track of the bridges; non-DT case (soon to be
  retired anyway) is simply covered by a special device
  registration function

* the new config-bus driver also takes over device population,
  so there is no need for special matching table for
  of_platform_populate nor "simple-bus" hack in the arm64
  model dtsi file (relevant bindings documentation has
  been updated); this allows all the vexpress devices
  fit into normal device model, making it possible
  to remove plenty of early inits and other hacks in
  the near future

* adaptation of the syscfg bridge implementation in the
  sysreg driver, again making it much simpler; there is
  a special case of the "energy" function spanning two
  registers, where they should be both defined in the tree
  now, but backward compatibility is maintained in the code

* modification of the relevant drivers:

  * hwmon - just a straight-forward API change
  * power/reset driver - API change
  * regulator - API change plus error handling
    simplification
  * osc clock driver - this one required larger rework
    in order to turn in into a standard platform driver

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mike Turquette <mturquette@linaro.org>
2014-05-15 17:02:18 +01:00
Rusty Russell 71e06af26c drivers/regulator/virtual: avoid world-writable sysfs files.
In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-05-14 10:53:55 +09:30
Charles Keepax 6f1c9c57b4 regulator: arizona-micsupp: Add missing #include
of.h is presently being included through asm-generic/gpio.h so will not
be included on some architectures, causing implicit declaration errors
for of_get_child_by_name, of_parse_phandle and of_node_put.

This patch adds the direct include that should be there.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-08 18:16:51 +01:00
Jingoo Han cfe6e3334e regulator: max8952: Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 20:56:47 +01:00
Jingoo Han 1439afd8db regulator: vexpress: Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 20:56:25 +01:00
Jingoo Han a74cf0c207 regulator: st-pwm: Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 20:56:09 +01:00
Jingoo Han 2449df9f90 regulator: palmas: Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 20:55:41 +01:00
Jingoo Han a799baab12 regulator: anatop: Make of_device_id array const
Make of_device_id array const, because all OF functions
handle it as const.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 20:55:41 +01:00
Doug Anderson c122c5b682 regulator: tps65090: Fix tps65090 crash on Tegra Dalmore
The patch (60e91b5 regulator: tps65090: Allow setting the overcurrent
wait time) introduced a crash on Tegra Dalmore.  On Dalmore the device
tree doesn't have an entry for all of the FETs so it leaves tps_pdata
NULL in some cases.  Add a check for NULL like the rest of the code
does.

Reported-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-02 09:33:30 -07:00
Krzysztof Kozlowski de5d05637f regulator: s2mps11: Allow GPIO 0 to be used as external control on S2MPS14
GPIO 0 is a valid GPIO so allow using it as external control for
S2MPS14 regulators.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-01 10:53:50 -07:00
Krzysztof Kozlowski eba430c7ea regulator: s5m8767: Allow GPIO 0 to be used as external control
GPIO 0 is a valid GPIO so allow using it as external control for
regulator.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-01 10:50:38 -07:00
Doug Anderson ed11f1ead5 regulator: tps65090: Make FETs more reliable by adding retries
An issue was discovered with tps65090 where sometimes the FETs
wouldn't actually turn on when requested (they would report
overcurrent).  The most problematic FET was the one used for the LCD
backlight on the Samsung ARM Chromebook (FET1).  Problems were
especially prevalent when the device was plugged in to AC power (when
the backlight voltage was higher).

Mitigate the problem by adding retries on the enables of the FETs,
which works around the problem fairly effectively.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michael Spang <spang@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-29 10:05:07 -07:00
Krzysztof Kozlowski 8a82b408ac regulator: max14577: Add support for MAX77836 regulators
Add support for MAX77836 chipset and its additional two LDO regulators.
These LDO regulators are controlled by the PMIC block with additional
regmap (different I2C slave address).

The MAX77836 charger and safeout regulators are almost identical to
MAX14577. The registers layout is the same, except values for charger's
current. The patch adds simple mapping between device type and supported
current by the charger regulator.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-04-23 14:09:45 +01:00
Charles Keepax 2cce4be9e6 regulator: arizona-ldo1: Add processing of init_data from device tree
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 18:35:06 +01:00
Charles Keepax 4a8c475f5f regulator: arizona-ldo1: Move setup processing from arizona-core
It is more idiomatic to process things relating to the regulator in its
driver. This patch moves both processing of device tree relating to the
regulator and checking if the regulator is external from arizona-core
into the regulator driver.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 18:35:03 +01:00
Charles Keepax 36bcdf1bb6 regulator: arizona-micsupp: Add processing of init_data from device tree
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 18:34:49 +01:00
Charles Keepax 13b3fde808 regulator: core: Use devres for releasing of_regulator_match of_nodes
Rather than requiring individual drivers to put the of_nodes returned
from of_regulator_match use devres to put them. This also has the
benefit it makes the life-time of the of_nodes match the lifetime of
the init data also contained in the of_regulator_match structure, which
seems more consistent.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 18:12:09 +01:00
Axel Lin 5957ae1fdc regulator: tps65217: Use regulator_map_voltage_ascend for LDO1
The voltages in LDO1_VSEL_table are in ascendant order, so use
regulator_map_voltage_ascend.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 17:21:00 +01:00
Doug Anderson 290414499c regulator: tps65090: Allow setting the overcurrent wait time
The tps65090 regulator allows you to specify how long you want it to
wait before detecting an overcurrent condition.  Allow specifying that
through the device tree (or through platform data).

Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michael Spang <spang@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 16:02:00 +01:00
Axel Lin 073a77d03e regulator: tps65217: Remove *rdev[] from struct tps65217
Now this driver uses devm_regulator_register() so we don't need to save rdev
pointer to tps->rdev[i] for cleanup.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 15:47:39 +01:00
Axel Lin 75dbf0a0f9 regulator: pbias: Convert to use regulator_[enable|is_enabled]_regmap
Since commit ca5d1b3524
"regulator: helpers: Modify helpers enabling multi-bit control",
we can set enable_val setting for device that use multiple bits for control
when using regmap enable/disable/bypass ops.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-15 10:28:46 +01:00
Axel Lin 60e8c1e34d regulator: pbias: Convert to use regmap helper functions
This patch converts this driver to use the regmap helper functions provided by
regulator core.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 22:16:25 +01:00
Axel Lin 1cb7b43f67 regulator: pbias: Fix is_enabled callback implementation
The is_enabled implementation is wrong in some cases:
e.g. for pbias_mmc_omap5: enable_mask is : BIT(27) | BIT(25) | BIT(26)
However, pbias_regulator_enable() only sets BIT(27) | BIT(26) bits.
So is_enabled callback will always return false in this case.
Fix the logic to compare the register value with info->enable rather than
info->enable_mask.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 22:16:25 +01:00
Krzysztof Kozlowski 97f53d710b regulator: s2mps11: Add external GPIO control for S2MPS14
Add support for external control over GPIO for LDO10, LDO11 and LDO12
S2MPS14 regulators. External control can be turned on by writing 0x0 to
control register which in case of other regulators is used for disabling
them. These LDO10-LDO12 regulators can be disabled only by I2C GPIO or
PWREN pin so the patch actually allows proper way of disabling them.

Additionally the GPIO control has two benefits:
 - It is faster than toggling it over I2C bus.
 - It allows disabling the regulator during suspend to RAM; The AP will
   enable it during resume.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 22:12:42 +01:00
Krzysztof Kozlowski 011703835f regulator: s2mps11: Move DTS parsing code to separate function
Refactor code for parsing DTS to increase a little code readability. The
behaviour should not change.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 22:12:42 +01:00
Krzysztof Kozlowski e80fb721ca regulator: s5m8767: Remove regulator_dev pointer from state container
Don't store pointer to regulator_dev returned by
devm_regulator_register() in state container. It isn't used anywhere
outside of probe.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:03:41 +01:00
Charles Keepax 63c7c9e16c regulator: core: Get and put regulator of_node
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: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:01:24 +01:00
Charles Keepax 3764806440 regulator: core: Add helper to put of_nodes from matches
As of_regulator_match will take an of_node reference to each matched
regulator, it makes sense to provide a helper to put all those
references. This patch does that.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:01:24 +01:00
Charles Keepax bd0dda744c regulator: core: Add of_node_get to of_regulator_match
Currently, of_regulator_match does not increment the reference count of
the of_nodes it takes new references to. This could cause the node
pointer held to be invalid, by the time it is passed to the regulator
core. This patchs adds an of_node_get when we copy each of_node pointer
into the match structure.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:01:24 +01:00
Carlo Caione dfe7a1b058 regulator: AXP20x: Add support for regulators subsystem
AXP202 and AXP209 come with two synchronous step-down DC-DCs and five
LDOs. This patch introduces basic support for those regulators.

Signed-off-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:00:34 +01:00
Linus Torvalds c0c4cf0645 regulator: Fixes for v3.15
A few driver specific fixes that have come in over the merge window,
 all only relevant for the specific driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTR8B/AAoJELSic+t+oim9+EoQAJjRksEJnlSTxKPd7AaYH/CD
 PiDYSqK5vgmOgEFJW83Dcf94EM75G11W4bWK6JvWcd2eq8j65+cZRjmjcVvhClKj
 2iI8vz1gkEKoZb8MeVQsH1e1QNp4sZXPvrPsvQ0O56apw7oyI1dAkpYkHFR5D/C9
 d3btXtPu6rlCLCyIn9XsCXe9ZD4rgeYdLF5mA8ouYwHja8Ou0xyeZGUO6rI30ZMo
 3DVJ2yq8GGDHbtoAaL4G2aY0l8//bAg3VxrmR9q8TQLnvZTXFpmvbgGszmHLqSRl
 PGcNDF87zzwLEclOuJNJLF7dmFMwhg3Ejn+G1cDPZF0dkdisDKk8Rzqo4bkQ2a/u
 Xja7W/Lhnc61j04Sx01wN6suv8jKqHfrHMmK5rM6wPe2KaAnkpPc0ACSwJ+OKO+u
 GruHdDS+bgY2839XCLR7+kds8Rs7gGl8H3qo68Jha3Wn2Uw0TIOZSbVJnGiYkjP5
 4KndZDj1DoJGk+7OGYVEKj+W36C6ubN9dPdfqlX64s4ARbScX2pTaYJPov7DcROK
 Frllv1wfJ0UILpdjp43hJRvYPSewROPxxUydKObG46hk8IDq1lOhim414tbuDNCp
 IvPMstIFqxXb83iqMYRzsUWw7Fmbq81zJaq0OUfjRpz4BfzAyG1gavtua11pFMvE
 AKbU/j/GTNljh69mr9GK
 =mEb8
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A few driver specific fixes that have come in over the merge window,
  all only relevant for the specific driver"

* tag 'regulator-v3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: bcm590xx: Set n_voltages for linear reg
  regulator: s5m8767: Fix carried over ena_gpio assignment
  regulator: s2mps11: Don't check enable_shift before setting enable ramp rate
  regulator: s2mpa01: Don't check enable_shift before setting enable ramp rate
2014-04-11 13:30:05 -07:00
Mark Brown 039df7a7cb Merge remote-tracking branches 'regulator/fix/bcm590xx', 'regulator/fix/s2m' and 'regulator/fix/s5m8767' into regulator-linus 2014-04-10 23:39:38 +01:00
Tim Kryger 1e7914058e regulator: bcm590xx: Set n_voltages for linear reg
Fix the macro used to define linear range regulators to include the
number of voltages.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Acked-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-10 23:10:36 +01:00
Linus Torvalds 97e18dc007 MMC highlights for 3.15:
Core:
  - CONFIG_MMC_UNSAFE_RESUME=y is now default behavior.
  - DT bindings for SDHCI UHS, eMMC HS200, high-speed DDR, at 1.8/1.2V.
  - Add GPIO descriptor based slot-gpio card detect API.
 
 Drivers:
  - dw_mmc: Refactor SOCFPGA support as a variant inside dw_mmc-pltfm.c.
  - mmci: Support HW busy detection on ux500.
  - omap: Support MMC_ERASE.
  - omap_hsmmc: Support MMC_PM_KEEP_POWER, MMC_PM_WAKE_SDIO_IRQ, (a)cmd23.
  - rtsx: Support pre-req/post-req async.
  - sdhci: Add support for Realtek RTS5250 controllers.
  - sdhci-acpi: Add support for 80860F16, fix 80860F14/SDIO card detect.
  - sdhci-msm: Add new driver for Qualcomm SDHCI chipset support.
  - sdhci-pxav3: Add support for Marvell Armada 380 and 385 SoCs.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJTRLHLAAoJEHNBYZ7TNxYMoqEQAOULXl1SHt0aHn5I0cfdVnRm
 J3i56MqarwXQOse/qJrg8/uKsggAu0ivTlQ7x1h6bpXmzHqvOtZhSoO9BqGEvxOU
 WNeA9ouaKMx3gCpIAwl9Odox+d2E+91nRfxU3fZTDITy554fREXmIpWiidjFPR7n
 2oHT0yvGuLjunTC8MhxSB0OsggoIDXDTVPxrcf2k+AcAZAMlCMDNirN9+JbhiVM9
 PNESapMyQAbFy18BGzCt5lO2o6aRileaSdX4BFTW4lx2LSPryUVV3cnfIH4zlytW
 joVDWyU5kAtQgfhoEhTsWJld+cwHsMUrl/FOfhMvBWbPMxLJnbFx8b459nKJDM5j
 NUo29KQxxHgWblGYx+F5SYuTloqWtX5iQWsez9g38Z/3UtjHR++o3+auwTFsZFRe
 7EusZqsXdKggx1iiW/5afgb+tFOiCe5WOOQv29YdqWurPhaSK2Nr1aprD4RRiMeT
 IG9qBLhHFLl8Pv0nTdEGbJHhAhihja6w2ul+i/8JSaDOYAGFbEn47MC8JfrKAnpw
 WovxkSqMroMhjI+51cwJnVtdczQWx5kpjqDY0VaJlKvOfcwyOuyTU+s2vrHVDMZS
 a0HgaXeVxr5IcDTz2zo1f6UbM4k2z/Ka0LOOSPqyOYOpFuT6VkXhgOVq6fsRpnaN
 /9CUirULwF5ej0oz38hk
 =6S8w
 -----END PGP SIGNATURE-----

Merge tag 'mmc-updates-for-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc

Pull MMC updates from Chris Ball:
 "MMC highlights for 3.15:

  Core:
   - CONFIG_MMC_UNSAFE_RESUME=y is now default behavior
   - DT bindings for SDHCI UHS, eMMC HS200, high-speed DDR, at 1.8/1.2V
   - Add GPIO descriptor based slot-gpio card detect API

  Drivers:
   - dw_mmc: Refactor SOCFPGA support as a variant inside dw_mmc-pltfm.c
   - mmci: Support HW busy detection on ux500
   - omap: Support MMC_ERASE
   - omap_hsmmc: Support MMC_PM_KEEP_POWER, MMC_PM_WAKE_SDIO_IRQ, (a)cmd23
   - rtsx: Support pre-req/post-req async
   - sdhci: Add support for Realtek RTS5250 controllers
   - sdhci-acpi: Add support for 80860F16, fix 80860F14/SDIO card detect
   - sdhci-msm: Add new driver for Qualcomm SDHCI chipset support
   - sdhci-pxav3: Add support for Marvell Armada 380 and 385 SoCs"

* tag 'mmc-updates-for-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (102 commits)
  mmc: sdhci-acpi: Intel SDIO has broken card detect
  mmc: sdhci-pxav3: add support for the Armada 38x SDHCI controller
  mmc: sdhci-msm: Add platform_execute_tuning implementation
  mmc: sdhci-msm: Initial support for Qualcomm chipsets
  mmc: sdhci-msm: Qualcomm SDHCI binding documentation
  sdhci: only reprogram retuning timer when flag is set
  mmc: rename ARCH_BCM to ARCH_BCM_MOBILE
  mmc: sdhci: Allow for irq being shared
  mmc: sdhci-acpi: Add device id 80860F16
  mmc: sdhci-acpi: Fix broken card detect for ACPI HID 80860F14
  mmc: slot-gpio: Add GPIO descriptor based CD GPIO API
  mmc: slot-gpio: Split out CD IRQ request into a separate function
  mmc: slot-gpio: Record GPIO descriptors instead of GPIO numbers
  Revert "dts: socfpga: Add support for SD/MMC on the SOCFPGA platform"
  mmc: sdhci-spear: use generic card detection gpio support
  mmc: sdhci-spear: remove support for power gpio
  mmc: sdhci-spear: simplify resource handling
  mmc: sdhci-spear: fix platform_data usage
  mmc: sdhci-spear: fix error handling paths for DT
  mmc: sdhci-bcm-kona: fix build errors when built-in
  ...
2014-04-09 08:39:39 -07:00
Krzysztof Kozlowski f4fbb3ce34 regulator: s5m8767: Fix carried over ena_gpio assignment
During registration of regulators if external control for regulator was
set in DTS the ena_gpio and ena_gpio_flags fields of regulator_config
were set to proper values.

However the same regulator_config was used in next iterations of loop so
the ena_gpio fields carried over to next regulators.

The issue was not observed as ena_gpio is supported only for Buck9
regulator which is often the last regulator parsed from DTS.
Be sure to clear ena_gpio config fields before registering the
regulator.

Fixes: ee1e0994ab (regulator: s5m8767: Use GPIO for controlling Buck9/eMMC)
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-07 13:39:58 +01:00
Linus Torvalds 159d8133d0 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "Usual rocket science -- mostly documentation and comment updates"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  sparse: fix comment
  doc: fix double words
  isdn: capi: fix "CAPI_VERSION" comment
  doc: DocBook: Fix typos in xml and template file
  Bluetooth: add module name for btwilink
  driver core: unexport static function create_syslog_header
  mmc: core: typo fix in printk specifier
  ARM: spear: clean up editing mistake
  net-sysfs: fix comment typo 'CONFIG_SYFS'
  doc: Insert MODULE_ in module-signing macros
  Documentation: update URL to hfsplus Technote 1150
  gpio: update path to documentation
  ixgbe: Fix format string in ixgbe_fcoe.
  Kconfig: Remove useless "default N" lines
  user_namespace.c: Remove duplicated word in comment
  CREDITS: fix formatting
  treewide: Fix typo in Documentation/DocBook
  mm: Fix warning on make htmldocs caused by slab.c
  ata: ata-samsung_cf: cleanup in header file
  idr: remove unused prototype of idr_free()
2014-04-02 16:23:38 -07:00
Axel Lin b96244fad9 regulator: s2mps11: Don't check enable_shift before setting enable ramp rate
Current code misses updating the register when enable_shift is 0.
e.g. S2MPS11_BUCK9_RAMP_SHIFT and S2MPS11_BUCK6_RAMP_EN_SHIFT are 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-02 20:53:16 +01:00
Axel Lin f7b1a8dc1c regulator: s2mpa01: Don't check enable_shift before setting enable ramp rate
Current code misses updating the register when enable_shift is 0.
e.g. S2MPA01_BUCK4_RAMP_EN_SHIFT is 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-02 20:52:45 +01:00
Mark Brown 5481b348e8 Merge remote-tracking branches 'regulator/topic/tps65218', 'regulator/topic/tps6524x', 'regulator/topic/tps6586x', 'regulator/topic/tps65910', 'regulator/topic/tps80031', 'regulator/topic/wm831x', 'regulator/topic/wm8350' and 'regulator/topic/wm8994' into regulator-next 2014-03-26 16:58:25 +00:00