Commit Graph

1828 Commits

Author SHA1 Message Date
David Collins 68c63443f8 regulator: cpr-regulator: add a linked list for cpr-regulator devices
Add a global linked list named cpr_regulator_list to keep track
of all cpr-regulator devices.  It can be used when analyzing RAM
dumps in order find out the state of cpr-regulator devices at the
time of a crash.

Change-Id: Ic2abc76c02799edd641e49ee0dfe003614802b11
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-06-05 15:43:42 -07:00
David Collins f7005b9fdc regulator: cpr-regulator: add debugfs support for multiple devices
The cpr_enable module parameter is currently tied to a global
pointer, the_cpr, which corresponds to the last cpr-regulator
device probed.  This means that it is not possible to enable or
disable the CPR controller for the cpr-regulator devices that
probed first.

Remove the the_cpr pointer and the cpr_enable module parameter.
Replace them with a debugfs node for each cpr-regulator device
which can be used to enable and disable CPR individually.

Also fix the callback for the existing debug_info debugfs node
since it depends upon the_cpr.

New Debug Interface:

/sys/module/cpr_regulator/parameters/debug_enable
	Integer in which bit 0 enables kernel log messages
	generated when handling CPR interrupts and bit 1 enables
	other cpr-regulator log messages.  This parameter affects
	all cpr-regulator devices.

/sys/kernel/debug/regulator/<regulator-name>/cpr_enable
	Integer which controls whether or not CPR is enabled for
	a particular cpr-regulator device.  A value of 0
	corresponds to CPR disabled and a value of 1 corresponds
	to CPR enabled.  <regulator-name> corresponds to
	the name of the cpr-regulator device which is specified
	via the regulator-name device tree property.

/sys/kernel/debug/regulator/<regulator-name>/debug_info
	CPR status information for a particular cpr-regulator
	device.  <regulator-name> corresponds to the name of the
	cpr-regulator device which is specified via the
	regulator-name device tree property.

Old Debug Interface:

/sys/module/cpr_regulator/parameters/debug_enable
	Integer in which bit 0 enables kernel log messages
	generated when handling CPR interrupts and bit 1 enables
	other cpr-regulator log messages.  This parameter affects
	all cpr-regulator devices.

/sys/module/cpr_regulator/parameters/cpr_enable
	Integer which controls whether or not CPR is enabled for
	the last cpr-regulator device probed.  A value of 0
	corresponds to CPR disabled and a value of 1 corresponds
	to CPR enabled.  This parameter incorrectly does not
	control the CPR enable state for the first cpr-regulator
	devices probed.

/sys/kernel/debug/regulator/<regulator-name>/debug_info
	CPR status information for the last cpr-regulator device
	probed (regardless of which cpr-regulator device it seems
	to be associated with).  <regulator-name> corresponds to
	the name of the cpr-regulator device which is specified
	via the regulator-name device tree property.

Change-Id: I404ebdb3180f7dd9ae095867f7545d274be29e62
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-06-05 13:51:54 -07:00
David Collins aa319baab4 regulator: spm-regulator: fall back on SPMI write if msm_spm_set_vdd fails
Update the spm-regulator driver so that it falls back on an SPMI
register write if the msm_spm_set_vdd() call to set the voltage
of a regulator fails.  This retry mechanism is needed because
msm_spm_set_vdd() is not guaranteed to work for all regulators at
all times.  It can only work if at least one processor core
powered by the regulator is online.  Unfortunately, the clock
driver may request a voltage during the process of bringing the
first such core online.

Change-Id: I93980d603a324da2b8d21e0b78958ff5032168b0
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-06-02 14:17:04 -07:00
Anirudh Ghayal 91fa810f14 power: ncp6335d: Add debugfs node to read/write registers
The debugfs node allow read/write access to all the NCP
registers. Useful in validating the regulator.

Change-Id: Ia313afad45efccc6831ffea641a3575ef43dbdd0
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2014-05-31 17:16:29 +05:30
Linux Build Service Account 9a9ac906f2 Merge "regulator: qpnp-regulator: print register values for unsupported regulators" 2014-05-29 16:59:52 -07:00
Linux Build Service Account f673cdc512 Merge "regulator: cpr-regulator: add support for target quotient unpacking" 2014-05-25 05:44:20 -07:00
Linux Build Service Account 9afe89cbb3 Merge "regulator: cpr-regulator: add initial voltage reference property support" 2014-05-25 05:44:19 -07:00
Linux Build Service Account 97c6e3fdd7 Merge "regulator: cpr-regulator: add support for arbitrary number of fuse corners" 2014-05-25 05:44:18 -07:00
David Collins 1531214fe7 regulator: cpr-regulator: add support for target quotient unpacking
Some SoCs have extremely limited fuse space.  In order to save
fuse bits, the CPR target quotients are packed to take up less
space.  Add support to unpack the target quotient for each fuse
corner using an offset and multiplier.

Change-Id: Ie1b49b8e881dbb239277876c8a4ae8603832e878
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-05-22 15:11:20 -07:00
David Collins 3cbee4bc43 regulator: cpr-regulator: add initial voltage reference property support
Add support in the cpr-regulator driver for a new device tree
property named qcom,cpr-init-voltage-ref which specifies the
reference voltages to use when decoding initial voltage fuse
values.  This property decouples inital voltage fuse decoding
from the specification of CPR ceiling voltages.  This feature
is needed since some SoCs utilize reference voltages which
are different from the ceiling voltages.

Change-Id: I87cd8a053253fa538e773aefa774c53ab69063a2
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-05-22 15:06:22 -07:00
Fenglin Wu ea781109ae regulator: tps65132: add low power mode control for enable pins
Add ti,en-gpio-lpm property to set the enable pins to input/pull
down state when the boost regulator being disabled. This can reduce the
rock bottom power numbers when system entering into sleep state with the
regulators disabled.

Take this chance to correct a typo of drive-strength property specified
in tps65132-en-pin pin group node for msm8916 QRD SKUH board.

Change-Id: I2c2df1f4893c31deeba02c3b2988d1157bdb7b61
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-05-22 13:48:19 +08:00
David Collins cb99ebc754 regulator: cpr-regulator: add support for arbitrary number of fuse corners
Some SoCs utilize more than three CPR fuse corners.  Add support
for an arbitrary number of fuse corners which is specified via
the device tree property qcom,cpr-fuse-corners.

Update the description for device tree properties that have fixed
sizes to support exactly three fuse corners (SVS, Nominal, Turbo)
in order to denote that their size is now dependent upon the
value of qcom,cpr-fuse-corners.  Also replace all fixed size
arrays in the cpr-regulator driver which are used to hold fuse
corner data with dynamically allocated arrays.

Change-Id: Iead3e6e1fba329bf745970925f9faa2a5a227dcf
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-05-21 16:03:29 -07:00
Fenglin Wu 8c64821ad6 regulator: fan53555: update slew rate according to voltage step
Currently, the voltage transition slew rate setting for fan53555 is
based on 10 mV voltage scaling step. For regulator with a scaling step
other than 10 mV, the slew rate has a relationship between voltage
scaling step and the slew rate based on 10 mV voltage scaling step.

Change the slew rate setting according to the voltage scaling step, and
round it to a lower avaiable value if it is an itermediate one.

Change-Id: Iccb13ebcb4bac15d76420602363bdcdfe5fc0a2d
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-05-19 12:45:35 +08:00
Linux Build Service Account 3be27197fb Merge "regulator: fan53555: change initcall level for early probe" 2014-05-09 19:06:19 -07:00
Linux Build Service Account ddf0bb032a Merge "regulator: fan53555: add support for die revision 23 chips" 2014-05-09 19:06:17 -07:00
Linux Build Service Account 52ac0ae115 Merge "Revert "regulator: onsemi-ncp6335d: add support for tlmm spare register control"" 2014-05-09 19:06:13 -07:00
Fenglin Wu a69f699b55 regulator: fan53555: change initcall level for early probe
ACPU clock driver initialization has dependency on regulator driver
initialization. The cpufreq driver requires the ACPU clock handle which
in turn requires the APC regulator handle.

In commit cf54c951db ("clock-a7/krait:
Change initcall level for early probe"), the cpufreq driver was modified
to use subsys_initcall level and ACPU clock driver changed to use
arch_initcall level. Change fan53555 regulator driver to arch_initcall
level to make sure the cpufreq driver can probe successfully.

Change-Id: I0914648c04f50dd542ed872aaa76afe674607546
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-05-07 11:01:54 +08:00
Fenglin Wu 0e1317a41d regulator: fan53555: add support for die revision 23 chips
The chips with die revision 23 have 600 mV minimum voltage and 12.5 mV
step size. Add support for chips with this die revision.

Change-Id: Ie63637bdcfae73a706f364e74908d285c2a60954
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-05-07 10:59:32 +08:00
Fenglin Wu ba99c9f487 Revert "regulator: onsemi-ncp6335d: add support for tlmm spare register control"
TLMM_SPARE register will be controlled at bootloader. Remove the
TLMM_SPARE register access in onsemi-ncp6335d regulator driver.

This reverts commit e61b7c5004.

Change-Id: I73319ff47c6656e2c042736ad507c73ddb9065c8
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-05-07 10:48:18 +08:00
David Collins 110eeb54b2 regulator: qpnp-regulator: print register values for unsupported regulators
Print out the type, subtype, and digital major revision register
values when a regulator fails to match supported variants.  This
will help when debugging PMIC simulator issues.

Change-Id: I4d0ca163921e6f14737df2977c39cf43b3d303d3
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-05-05 17:23:27 -07:00
Linux Build Service Account 16296e0178 Merge "Merge upstream linux-stable v3.10.36 into msm-3.10" 2014-05-05 15:09:00 -07:00
Linux Build Service Account d7baab722a Merge "regulator: cpr-regulator: remove SVS CPR quotient constraints" 2014-05-01 11:23:55 -07:00
Tirupathi Reddy 9fbfcf8116 regulator: cpr-regulator: remove SVS CPR quotient constraints
Remove the target quotient validation check which requires the
nominal corner target quotient to be strictly greater than the
SVS corner target quotient. This check unnecessarily disables
CPR on targets which have an SVS quotient that is programmed to
be equal to the nominal quotient.

Change-Id: Ibb8e70d67c1042168e6a711915ef0dfe2fe34b96
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2014-05-01 12:19:57 +05:30
Ian Maund 356fb13538 Merge upstream linux-stable v3.10.36 into msm-3.10
* commit 'v3.10.36': (494 commits)
  Linux 3.10.36
  netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages
  mm: close PageTail race
  net: mvneta: rename MVNETA_GMAC2_PSC_ENABLE to MVNETA_GMAC2_PCS_ENABLE
  x86: fix boot on uniprocessor systems
  Input: cypress_ps2 - don't report as a button pads
  Input: synaptics - add manual min/max quirk for ThinkPad X240
  Input: synaptics - add manual min/max quirk
  Input: mousedev - fix race when creating mixed device
  ext4: atomically set inode->i_flags in ext4_set_inode_flags()
  Linux 3.10.35
  sched/autogroup: Fix race with task_groups list
  e100: Fix "disabling already-disabled device" warning
  xhci: Fix resume issues on Renesas chips in Samsung laptops
  Input: wacom - make sure touch_max is set for touch devices
  KVM: VMX: fix use after free of vmx->loaded_vmcs
  KVM: x86: handle invalid root_hpa everywhere
  KVM: MMU: handle invalid root_hpa at __direct_map
  Input: elantech - improve clickpad detection
  ARM: highbank: avoid L2 cache smc calls when PL310 is not present
  ...

Change-Id: Ib68f565291702c53df09e914e637930c5d3e5310
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2014-04-23 16:23:49 -07:00
Tirupathi Reddy c2f75df354 regulator: onsemi: Change initcall level for early probe
ACPU clock driver initialization has dependency on regulator
driver initialization.

The cpufreq driver to successfully register requires the acpu
clock handle which in turn requires the apc regulator handle.

In a recent change the init-call ordering of the cpufreq and
acpu-clock drivers has changed to register them early. Move the
onsemi regulator initialization to arch_initcall() to handle
this modification.

Change-Id: I68d089df66ba559bf39c7d3f67702e1f98546f7c
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2014-04-22 08:21:25 +05:30
Fenglin Wu 26ceda2970 regulator: tps65132-regulator: add driver for TPS65132 regulator chip
TPS65132 is a dual output regulator chip. It is usually used for
providing positive and negative supply voltages for LCD panel source
driver ICs.

The chip has a positive supply rail and a negative supply rail. Both
rails support 4V~6V output voltage range and each rail can be
controlled separately.

Change-Id: I6012bc8dd0f19a8cd6a94fe00457fc65b8408346
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-04-11 16:36:26 +08:00
David Collins b6d59001f6 regulator: spm-regulator: add support for bypassing spm APIs
Add support in the spm-regulator driver to configure the PMIC
regulator voltage via SPMI instead of via SPM.  This can be used
when simulated chips do not have fully functional SPM models.

Change-Id: Id75b3dd580ed267dfc5c647d36756690d32b774f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-04-02 14:08:59 -07:00
David Collins 09c37939cd regulator: cpr-regulator: add support for reading spanned fuse parameters
Add support in the cpr-regulator driver for reading the following
fuse parameters which may span two fuse rows:
qcom,cpr-fuse-target-quot, qcom,cpr-fuse-ro-sel, and
qcom,cpr-fuse-init-voltage.  This feature is required for new
chips which pack CPR parameters tightly without regard for fuse
row boundaries.

Change-Id: Idc28a54a37cdc0e40d25ca56e6726b76fc0db213
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-04-02 14:08:58 -07:00
David Collins e3d80caa8a regulator: cpr-regulator: add support for target quotient fuse size
The CPR target quotient register fields have a length of 12 bits.
However, some targets have a very limited number of fuse bits and
thus encode the target quotients for the different voltage
corners with less than 12 bits.  Add support in the cpr-regulator
driver for the optional device tree property
qcom,cpr-fuse-target-quot-size which can be used to specify the
bit length of the target quotient fuse values for each corner.

Change-Id: Ibdb3e2b1adc415480fdf47977b9d1b8c3dc0193d
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-04-02 14:08:48 -07:00
David Collins b6032b7809 regulator: cpr-regulator: make qcom,cpr-fuse-bp-cpr-disable prop optional
Update the cpr-regulator driver and documentation in order to
make the qcom,cpr-fuse-bp-cpr-disable device tree property
optional.  Some targets do not allocate a fuse bit for the
purpose of disabling CPR so this property cannot be considered
required.

Change-Id: I39aa59e92585c87b97714fc1684b17f3b9c0523f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-03-31 11:45:22 -07:00
David Collins 9a261c1244 regulator: spm-regulator: add support for FTS 2.5 type regulators
Add support for QPNP PMIC FTS 2.5 type regulators.  This type of
regulator supports auto mode control, auto phase control, and
three phases enabled at one time.  The FTS 2.5 voltage mapping is
similar to that of existing FTS 2 except for an additional
offset.

Change-Id: I0fa7876ce916f2d039d18a7d89ce7b32c783f68d
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-03-31 11:45:22 -07:00
David Collins f2f044152c regulator: qpnp-regulator: add support for FTS 2.5 type regulators
Add support for QPNP PMIC FTS 2.5 type regulators.  This type of
regulator supports auto mode control, auto phase control, and
three phases enabled at one time.  The FTS 2.5 voltage mapping is
similar to that of existing FTS 2 except for an additional
offset.

Change-Id: I8c8a3498896fab795d3151a61e19c5b62bd02c2e
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-03-31 11:45:21 -07:00
Markus Pargmann 0f79475d04 regulator: core: Replace direct ops->disable usage
commit 66fda75f47dc583f1c187556e9a2c082dd64f8c6 upstream.

There are many places where ops->disable is called directly. Instead we
should use _regulator_do_disable() which also handles gpio regulators.

To be able to use the wrapper function from _regulator_force_disable(),
I moved the _notifier_call_chain() call from _regulator_do_disable() to
_regulator_disable(). This way, _regulator_force_disable() can use
different flags for _notifier_call_chain() without calling it twice.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-31 09:58:13 -07:00
Ke Liu e4c100e57f regulator: cpr-regulator: Improve CPR interrupt handling
disable_irq() is not an efficient call and could cause potential deadlock.
Improve the interrupt handling by removing disable_irq and enable_irq
completely, and instead, checking the state of the interrupt source
(LOOP_EN and BUSY bits) in ISR to bail out immediately if any condition is
not met.

CRs-Fixed: 630182
Change-Id: Ieedadf4f0db4febc41ab85f383af683bdaf34615
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-03-28 20:53:35 -07:00
Markus Pargmann 783d444c6d regulator: core: Replace direct ops->enable usage
commit 30c219710358c5cca2f8bd2e9e547c6aadf7cf8b upstream.

There are some direct ops->enable in the regulator core driver. This is
a potential issue as the function _regulator_do_enable() handles gpio
regulators and the normal ops->enable calls. These gpio regulators are
simply ignored when ops->enable is called directly.

One possible bug is that boot-on and always-on gpio regulators are not
enabled on registration.

This patch replaces all ops->enable calls by _regulator_do_enable.

[Handle missing enable operations -- broonie]

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-23 21:38:14 -07:00
Fenglin Wu 4bbbbb43b9 regulator: cpr-regulator: set pvs_version to 0 if PVS fuse not present
Some devices do not have PVS version fuse bits. In such cases the
qcom,pvs-version-fuse-sel property cannot be specified. Initialize
pvs_version to 0 in the case that qcom,pvs-version-fuse-sel is not
present. This allows virtual corners to be used when there are no PVS
version fuse bits.

Change-Id: I835cc12c942a464bfda354fe53b9361ff352cf31
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-03-18 10:00:04 +08:00
Linux Build Service Account 8f423d527c Merge "regulator: cpr-regulator: Add support for mem-acc regulator requests" 2014-03-12 02:03:12 -07:00
Linux Build Service Account e80d10ffb5 Merge "regulator: mem-acc-regulator: Add a driver to control the MEM ACC" 2014-03-12 02:03:11 -07:00
Anirudh Ghayal 0901f3e8b7 regulator: cpr-regulator: Add support for mem-acc regulator requests
The memory accelerator controls delays while accessing
memories. These delays vary based on the power-mode.
Provide the power-mode (corner) information from CPR
to the memory accelerator driver through the regulator
interface.

Change-Id: I9c13df1695d760aa7b4797f3ba5dc65590cf21e6
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2014-03-11 20:56:02 -07:00
Anirudh Ghayal ced3bc99bf regulator: mem-acc-regulator: Add a driver to control the MEM ACC
The memory accelerator (MEM ACC) controls the delays applied during
memory access. These delays vary based on the power-mode (corner)
on which the memory is connected. This driver adds a regulator
interface to configure the power-mode of the memory accelerator
based on the APC (application processor) corner.

Change-Id: I830ff000f8a16c4d3de5bdebf48d424354ddb086
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2014-03-11 20:48:20 -07:00
Ashay Jaiswal de54c8d801 regulator: rpm-smd-regulator: move regulator init to arch_initcall
RPM regulator initialization is done at module_init level which is
late in the boot-up sequence and drivers dependent on regulators
do probe deferral.
Move RPM regulator initialization to arch_init level to minimize
probe deferrals by dependent drivers.

Change-Id: I3e0bc7cb46a90eb62418122869c70345da9217ee
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2014-03-06 08:29:46 +05:30
David Collins 7ed1d261a2 regulator: spm-regulator: check spm status in probe function
Check the status of the spm driver using msm_spm_probe_done()
inside of the spm-regulator probe function.  Return any error
code from the probe function.  This ensures that spm-regulator
will defer its probe in the case that the spm driver has not
yet probed.

Change-Id: I6d006cee6289bd51e38271e70f81c7a4622016ee
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-03-05 14:07:11 -08:00
Fenglin Wu 1721e37cab regulator: cpr-regulator: make CPR scheme fuse checking optional
The CPR scheme fuse bit is used for indicating if a global or local
target scheme is used for CPR. It will be eliminated on some future
devices.

Make the "qcom,cpr-fuse-bp-scheme" property optional to allow the
future devices without a scheme fuse bit to boot up successfully.

Change-Id: I892e763a0875ec8a5abec8798485defae9b3252b
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-02-26 02:34:36 -08:00
Fenglin Wu 2f99b7b696 regulator: cpr-regulator: make cpr redundant fuse checking optional
Currently, CPR redundant fuse checking for CPR ring oscillation
selection and target quotient values is mandatory.

However, some devices lack these redundant fuse bits in order to save
space. Therefore, redefine the affected device tree properties as
optional and update the cpr-regulator driver so that it can function
without them.

Change-Id: I5461fc4b173fac318986d7762bbcb15ba86a5a88
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-02-26 02:34:11 -08:00
Wu Fenglin 26263a3312 regulator: cpr-regulator: add support for per corner initial voltage fuses
A new initial voltage coding scheme has been introduced which defines
the initial voltage for each fuse corner using its own fuse value.
Previously, the initial voltage for all fuse corners was determined
from a single PVS bin fuse value. Add support in the cpr-regulator
driver for this new initial voltage coding scheme.

Each fuse encodes the initial voltage for a fuse corner as follows. The
MSB of the fuse value is a sign bit. The remaining bits define an offset.
The offset has units of a predetermined step size which is captured in
device tree. The initial voltage is then: ceiling_voltage - sign *
offset.

Change-Id: I6d48f3c68d62adc730fd406f937f7f3033b73552
Signed-off-by: Wu Fenglin <fenglinw@codeaurora.org>
2014-02-26 02:33:47 -08:00
David Collins a1806c181c regulator: move the cpr-regulator driver to the drivers/regulator directory
Move the cpr-regulator driver from the arch/arm/mach-msm
directory into the drivers/regulator directory.  Moving this
driver out of the arch/arm/mach-msm directory allows it to be
shared with architectures other than 'arm'.  In particular,
moving it allows it to be used by arm64.

Change-Id: I0b487c7fae42c260e06f5b70d1716bfbef065f4b
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-02-25 16:53:04 -08:00
David Collins f009e46e0a regulator: move the spm-regulator driver to the drivers/regulator directory
Move the spm-regulator driver from the arch/arm/mach-msm
directory into the drivers/regulator directory.  Moving this
driver out of the arch/arm/mach-msm directory allows it to be
shared with architectures other than 'arm'.  In particular,
moving it allows it to be used by arm64.

Also move the header file for the spm-regulator driver from the
arch/arm/mach-msm directory into the include/linux/regulator
directory.  Moving the header file requires updating all files
which include it.

Change-Id: I0c5a20a5f3512ef19c9cdb939342224d11667650
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-02-25 16:52:36 -08:00
Murali Nalajala 7b118eb174 msm: move rpm-smd and rpm-notifier headers to new directory
Move rpm-smd and rpm-notifier headers to a machine independent
directory in kernel. Change the source files which are referring
to these headers and point them to a new location.

Change-Id: I69f0c1189ac9c69d8e869534f2f6689bf3ac980e
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
2014-02-08 19:36:00 +05:30
Ke Liu ad02dda34a regulator: onsemi-ncp6335d: add device tree support for mode selection
Add support to the onsemi-ncp6335d driver to select which regulator
operating mode to utilize. There are two possible mode selections: PWM mode
and auto mode. If no mode property is specified in device tree, the
regulator will operate in the hardware default mode.

CRs-Fixed: 607899
Change-Id: I2e21c452a3ea3963146d9abbc7e89e811fd90388
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-01-27 16:24:01 -08:00
Ke Liu e61b7c5004 regulator: onsemi-ncp6335d: add support for tlmm spare register control
Certain Qualcomm chips mux the output of some GPIOs using the TLMM_SPARE
register. Add support for a device tree property which can be used to
specify a mask and value to write into this register so that the VSEL GPIO
can be toggled successfully on affected devices. When the appropriate bits
in the TLMM_SPARE register are written, the physical output of the GPIO can
be controlled normally via GPIO control registers.

Change-Id: Ic8a0886886a44687931ab5cb8150383cd84db2f6
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-01-21 09:54:01 -08:00
Ke Liu 926986f176 regulator: onsemi-ncp6335d: add list_voltage callback function
This callback function can help perform validation of the
regulator-min-microvolt and regulator-max-microvolt properties at runtime
automatically.

Change-Id: I63917e06c4fa881f67d938d0c53e7ad71ebda25f
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-01-21 09:54:01 -08:00
Ke Liu dca5415671 regulator: fan53555: add support for device tree and option 13 feature
Add device tree support. Add support for restoring voltage select register
from back up register. Add support for setting vsel pin by gpio output
according to device tree information. Add option to disable regulator
suspend method. Add set_voltage_time_sel to regulator_ops. Add support for
option 13's voltage range.

Change-Id: Iab9b160ff83c66f59cccedbd23d4aed7acb7d7a3
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2014-01-20 16:40:16 -08:00
Ke Liu b81edfe6d5 regulator: onsemi-ncp6335d: add support for device tree
Add device tree support. Add support for restoring working register
from back up register. Add support for setting vsel pin by gpio output
according to device tree flag. Change ncp6335d_regulator_init into a
global function.

Signed-off-by: Ke Liu <keliu@codeaurora.org>
Change-Id: I5ce861dd307b28e0782d051b105956b10eb1afab
2014-01-15 16:02:34 -08:00
David Collins 94da2480fd regulator: move the rpm-regulator-smd driver to drivers/regulator directory
Move the rpm-regulator-smd driver from the arch/arm/mach-msm
directory into the drivers/regulator directory.  Also rename it
from rpm-regulator-smd.c to rpm-smd-regulator.c so that it
matches the naming scheme of the other regulator drivers. Moving
this driver out of the arch/arm/mach-msm directory allows it to
be shared with architectures other than 'arm'.

Also move the header file from the arch/arm/mach-msm/include/mach
directory into the include/linux/regulator directory.  Moving the
header file requires updating all drivers which include it.

Change the compatible property values so that they match the new
driver name.

Change-Id: I20f2a4503c198ba9d1d04a77b03411dcc98e8aa1
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-12-19 15:27:48 -08:00
David Collins e1832733c6 regulator: qpnp-regulator: fix qpnp_print_actions const usage
The const keyword is not being used correctly for the
qpnp_print_actions array in qpnp-regulator.c.  The array pointer
itself should be specified as const as well.

Change-Id: I0d6f2323d3add646696a7d1453cb58300258c215
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-12-18 16:41:31 -08:00
Ian Maund f06163e6d0 msm: reap unused kernel files
This change removes source files from the kernel tree that
were not being used during make. The list of used files
was generated using an annotated make log and was then
compared with new files added since the public release of
kernel version 3.10.00. New files which were added but
not used have been removed from the tree.

A diff was also run to determine the list of files that had
been modified since the release of kernel version 3.10.00.
These files were then scrubbed based on the current kernel
configuration, removing invalid and unused conditionals.

Some files which support planned functionality or are
useful in debugging have been excluded from this reap.

Change-Id: Ia44a224d3cea7bc78dd45e8a8279860d35d4b008
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2013-11-21 17:45:28 -08:00
Ashay Jaiswal a4c0413573 regulator: qpnp-regulator: Add support for ULT LDO and SMPS regulators
Add support for QPNP PMIC ULT LDO and SMPS regulators.
ULT LDO/SMPS are regulators designed for PMIC chips with minimal
set of features to achieve better area efficiency.

Change-Id: I52ef77d5c60713c9bd2dfc5e3cde5f4df44ebacd
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2013-10-22 10:41:03 +05:30
David Collins cce20202de Revert "regulator: Enable supply regulator if child rail is enabled."
This reverts commit b2296bd43e.

The change results in the following incorrect behavior.
If a given regulator has a parent supply and the regulator is
enabled either before or during regulator_register(), then
regulator_enable() is called on the supply.  Unfortunately, there
is no matching regulator_disable() call.  This means that the
parent supply will stay enabled forever even if the child is
disabled later.

The stated goal of the change was to enable the parent of a
regulator which was enabled based on its machine constraints.
However, the only constraints that leads to enable() being called
for a regulator are boot-on or always-on.  If these have been
specified for a child regulator then they should have also been
specified for its parent regulator.  Therefore, there should be
no need to explicitly enable the parent when the child is
registered.

Change-Id: Ib8e6db65dcd44c27ef99509ff0cfd2f8e16e9f65
CRs-Fixed: 540315
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-13 16:28:28 -07:00
David Collins f095303cc3 regulator: qpnp-regulator: add support for low-noise LDO type regulators
Add support for QPNP PMIC low-noise (LN) LDO type regulators.
This type of regulator provides very clean and constant voltage
at low current.  LN LDOs are used to power oscillators and RF
buffers.

Change-Id: Ibda540899b93bbb750f554e728d118b635bdbc0f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 17:19:43 -07:00
David Collins 19ab91a5a5 regulator: qpnp-regulator: maintain current voltage range whenever possible
Voltage spikes may occur if the voltage range of a regulator is
changed while the regulator is enabled.  Therefore, modify the
voltage setting function so that the current voltage range is
used whenever possible.

Change-Id: I13dda99c751acfe083f2bcaacf09348d317fc0e7
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 17:19:43 -07:00
David Collins d77f44e7a3 regulator: qpnp-regulator: Add support for reading all possible voltages
Extend the voltage range configuration data so that it fully
describes all possible set point values for each regulator type
in addition to specifying which range to use in the case of
overlap.

Change-Id: Ifdef83720f1c9ef6f74e64ce27ec5e7e27ccba9f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 17:19:01 -07:00
David Collins 27f5fe3641 regulator: qpnp-regulator: Add support for boost-bypass type regulators
Add support for QPNP PMIC boost-bypass type regulators.  This
type of regulator is designed to output a configurable minimum
voltage.  If the input voltage is above the set point voltage,
then the regulator automatically enters bypass mode such that the
output voltage is equal to the input voltage.  If the input
voltage is below the set point voltage, then it is boosted up to
the set point voltage.

Change-Id: I93704339b7cb730fae099471bf8ec872dae54c04
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 17:18:39 -07:00
David Collins a0899db5e2 regulator: Call proxy-consumer functions for each regulator registered
Add a call to regulator_proxy_consumer_register() at the end of
regulator_register() and a call to
regulator_proxy_consumer_unregister() at the beginning of
regulator_unregister().  These calls ensure that proxy consumer
features may be used by any type of regulator regardless of the
driver supporting it.

Change-Id: Ia70da1df47042fa673c42f389136557f868d19a3
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 17:16:26 -07:00
David Collins bba9f3a122 regulator: qpnp-regulator: Don't print errors during probe deferral
Make the error printing statements after the qpnp-regulator
drivers calls regulator_register() conditional upon the error
code not being -EPROBE_DEFER.  This removes some unnecessary
kernel log messages that take place when a qpnp-regulator device
attempts to probe before its parent regulator.

Change-Id: I92d4ed61a238d384bae43458e3ca86c0079380c0
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 17:06:23 -07:00
David Collins cc67c9a55a regulator: qpnp-regulator: Reset OCP count during voltage switch enable
Reset the OCP counter for voltage switches which use the OCP IRQ
in the qpnp_regulator_vs_enable callback function.  Resetting the
counter here ensures that a voltage switch is always able to
reach its final output voltage when a valid load is connected if
only one OCP event occurs while enabling the switch.

Change-Id: Ie5b2d5271c81ef4b3cb9c9d874ca66af5530ddc7
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 16:33:09 -07:00
David Collins 7e93e93514 regulator: qpnp-regulator: Add support for voltage switch OCP IRQ
Add support for a voltage switch OCP interrupt handler which
toggles the switch off and back on after an overcurrent event
takes place.  This toggling should only be performed for a
specified maximum number of times with a specified delay between
subsequent retries.  Disabling a voltage switch is the only way
to clear the latched over-current state.

Change-Id: I8dbc54ff7bc54c1309ee59c1a282d5e4af2f0ec6
CRs-Fixed: 469134
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 16:23:15 -07:00
David Collins 49f9232ccf regulator: qpnp-regulator: Correct voltage switch OCP control
Correct the register values used to override and not override
voltage switch over current protection (OCP).  Also update
documentation to explain exactly how OCP enablement works.
Remove the OCP enable time delay property since it cannot be used
effectively to avoid OCP triggering due to high in-rush current.

Change-Id: I046dd3a42d3f8ec7f3b9689a958b617fbca35254
CRs-Fixed: 469134
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 16:23:15 -07:00
David Collins 0a9e29b850 regulator: qpnp-regulator: Add support to configure voltage switch mode
Add support for a device tree property, qcom,hpm-enable, which
can be used to configure a voltage switch type regulator to be in
high power mode (HPM).  When a switch is in HPM, over current
protection and soft start are enabled at all times.

The new property can also be used for other types of regulators.
However, this will likely not have the intended result as the
mode of non-voltage switch regulators is controlled at runtime
via regulator framework APIs.

Change-Id: Id3fca7ebbe3eb13b557e6d483494f218989cd64c
CRs-Fixed: 469134
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 16:23:14 -07:00
Anirudh Ghayal 6ff93ad44e regulator: ncp6335d: Add sleep mode configuration
Sleep mode configures the regulator to enter into a sleep
state when both EN and VSEL are low. There is a significant
reduction in the leakage current in this mode.

Enable the same for 8x25q.

Change-Id: I7377bf9d702633b9eddcea8f3503cc270bb95c95
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-09-04 15:45:25 -07:00
Utsab Bose 162d6320d1 regulator: onsemi-ncp6335d: Add regulator driver at subsys initcall
Add the onsemi-ncp6335d regulator driver at subsys initcall
as the regulator_get() is used by acpuclock driver at device initcall.
This resolves the dependency chain.

Signed-off-by: Utsab Bose <ubose@codeaurora.org>
Change-Id: Ia7a18218066486c40080b25d57e979372467d8bd
2013-09-04 15:40:55 -07:00
David Collins a667617270 regulator: qpnp-regulator: Assign selector value in set_voltage() callbacks
Assign a value to the selector pointer that is passed into
set_voltage() callback functions in the qpnp-regulator driver.
The value assigned to the selector pointer should correctly map
to the regulator voltage through the list_voltage() callback
function.

Change-Id: I7d72feb77e6122982a46c626741450108742fb8b
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 15:37:47 -07:00
David Collins 62ee3149f0 regulator: stub: Add device tree support
Add support into the stub-regulator driver so that stub-regulator
devices may be specified via device tree.

Change-Id: Ib72ef7c8caacb50955cd7c182e790300daf152ce
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 15:30:33 -07:00
Anirudh Ghayal 990e862f18 drivers: regulator: Add support for OnSemi NCP6335D regulator
This driver supports OnSemi NCP6335D synchronous buck converter.
The NCP6335D is a step-down switching voltage regulator which
provides a voltage range from 0.6 to 1.4V. The regulator is
controlled via the I2C interface.

Change-Id: I237fe781d5c54d2b3ffc65096b9e83c387d3b6f5
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-09-04 15:28:16 -07:00
David Collins 8ce0616722 regulator: qpnp-regulator: Add support for various LDO subtypes
Add support for the following QPNP PMIC LDO subtypes:
N600_STEPPER
N1200_STEPPER
LV_P50
LV_P150
LV_P300
LV_P600
LV_P1200

The register control interface and output voltage mapping for
LDOs of these subtypes are identical to existing NMOS and PMOS
LDO subtypes.

The STEPPER variants add a new register to enable and control the
speed of stepping between voltage set points.  This feature
allows for very smooth voltage transitions.  All manipulation of
the stepping control registers will be handled by boot loaders.

The LV variants are identical to the base PLDO subtypes except
that they have a different ESD structure.

Change-Id: Ib20f3d39bd2ad6210975bcb80431ee133c895278
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 15:19:18 -07:00
David Collins 5618e623e8 regulator: qpnp-regulator: Update boost regulator current limit reg address
Update the address used for the boost regulator current limit
register to reflect the correctly location in hardware.  The
proper address is 0x4A, not 0x40.

Change-Id: Ieefcd072858691940103664a2130a6c69341448f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 15:11:50 -07:00
David Collins f73d901372 regulator: qpnp-regulator: Add support for rev 1 N1200 and N600 LDOs
The mapping between voltage control register set point values and
physical output voltage changes for range 1 of N1200 and N600
LDOs between PM8941 v1 and PM8941 v2.  LDOs with the previous
mapping have digital major revision equal to 0.  LDOs with the
new mapping have digital major revision equal to 1.  Modify the
qpnp-regulator driver so that the digital major revision register
value is taken into account when deciding which voltage mapping
to utilize.  N1200 and N600 regulators have identical
(range, voltage set point) --> output voltage mapping.

N1200 LDO range 1 hardware set points (rev=0):
375 mV to 768.75 mV with 6.25 mV step size

N1200 LDO range 1 hardware set points (rev=1):
375 mV to 1537.5 mV with 12.5 mV step size

Configure qpnp-regulator to use only range 0 for N1200 rev 1.
Range 0 is used because there is no benefit to using ranges 1 or
2 given that they have the same maximum voltage and step size
and their minimum voltage is greater than or equal to that of
range 0.

Change-Id: Icac6a1d8fccc014a754843d61c1fa40f550f9c77
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 15:11:49 -07:00
Michael Bohan 19b436f1b8 regulator: qpnp: Add property to override type registers
On some regulator hardware, the values read on SPMI offset 0x4 (type)
and 0x5 (subtype) are incorrect. Add a new optional property called
qcom,force-type that allows a user to override the hardware values
with values supplied in the Device Tree.

Change-Id: Id73fe69873f5dc9d0f2623771872aa2eaddd66f1
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
2013-09-04 15:08:20 -07:00
David Collins 566bece9ff regulator: qpnp-regulator: Update FTSMPS voltage ranges to match hardware
Update the FTSMPS voltage ranges so that they accurately reflect
the physical output voltages resulting from set points
programmed on PMIC hardware.

Previous hardware documentation contained these equations:
range == 0: Voutput = setpoint * 5 mV + 80 mV
range == 1: Voutput = setpoint * 10 mV + 160 mV

The actual hardware response is:
range == 0: Voutput = setpoint * 5 mV
range == 1: Voutput = setpoint * 10 mV

Update range data in qpnp-regulator to match the true mapping.

Change-Id: Iabf00591f79705de721f571a347afb15c8b7140e
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 15:08:09 -07:00
Michael Bohan 58a7cae082 spmi: qpnp: Change APIs to take a spmi_resource pointer instead of index
Pointers are more flexible than index numbers, since index
numbers depend upon an additional reference to the array in
question. In particular, we'd like to add a new API to lookup a
devnode based on a predefined name in the Device Tree. This API
will return a spmi_resource, and so it's natural to want to use
this pointer directly with the other existing APIs.

Also introduce a new API spmi_for_each_devnode that can be used
to iterate each spmi_resource in the dev_node array. This
abstracts the traversal of the array, which was previously done
within the existing APIs.

Change-Id: I18f9397e5d78770e840a9f95dd8061201931df6e
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
2013-09-04 14:57:29 -07:00
Michael Bohan 6b556ed08f spmi: Rename qpnp library to be part of the spmi framework
It turns out that the only use cases for the qpnp library use
the existing spmi data structures. As such, there's really
no justification for having the library not be called 'spmi'.
There is nothing Qualcomm specific about this code.

Also cleanup some inconsistencies in the Kernel Doc comments
while we're here.

Change-Id: I1c73c88be740b6f5d38ba2de62de1737981b30fa
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
2013-09-04 14:57:28 -07:00
David Collins a937686f60 regulator: msm-gpio-regulator: Correct gpio_request error handling
The gpio_vreg_request_gpio() function inside of the
msm-gpio-regulator driver can return successfully even if
gpio_request() has failed. This can lead to a kernel crash via
null pointer dereference when later gpio and regulator functions
are called.  Modify gpio_vreg_request_gpio() so that it returns
an error immediately if gpio_request() fails.

Change-Id: I59364eb9efda6c2149b807db9a00e782d8ae6bb8
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:54:01 -07:00
Brandon Leong f193787660 regulator: debugfs: Adding debugfs functions into regulator framework
Move regulator debugfs functions into core.c. This change allows the user
to read and edit regulator information in user space through the debugfs
file system.

Change-Id: I21fa2c1d5d4ab27871ebb543134c2cee5ad70ded
Signed-off-by: Brandon Leong <bleong@codeaurora.org>
2013-09-04 14:50:32 -07:00
Bobby Crabtree cb0d17a6aa regulator: Add support for voltage aggregation
With this patch the regulator core aggregates voltage requests and
applies the minimum voltage range that satisifies all consumers of
a shared regulator supply. Only the voltages of consumers that have
enabled the supply are aggregated.

Updated voltage ranges are applied to the corresponding driver upon
the following events:

1. A consumer that has already enabled the regulator sets a voltage
2. A consumer enables the regulator
3. A consumer disables the regulator

Change-Id: Ib5012886cb77185a2038d45f08f3758faff68f60
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:50:31 -07:00
David Collins 13b515e117 regulator: Remove redundant set_mode call in drms_uA_update
The regulator framework checks if the current mode is the same as the
one being requested inside of regulator_set_mode. However, when
DRMS changing is allowed, regulator_enable calls drms_uA_update.
This function does not check the value of get_mode before calling
set_mode.

Modify drms_uA_update so that set_mode is only called if the requested
mode is different from the current mode returned by get_mode.

Change-Id: Ifb4f3069cf946e8474565ee82508c1ff45b36543
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:50:30 -07:00
Justin Paupore 80d7765be7 regulator: Add regulator_bulk_set_voltage
Add a convenience API to set the voltage on multiple consumers
stored in a struct regulator_bulk_data[] in one API call.

Change-Id: Iaeb5ba8c357a66f1401fb1e142bb03904e8e9c7c
Signed-off-by: Justin Paupore <jpaupore@codeaurora.org>
2013-09-04 14:50:30 -07:00
David Collins 1f9b46d711 regulator: Extend of_get_regulator_init_data to support non-DT consumers
Extend the of_get_regulator_init_data function so that it can
parse an additional property from regulator device tree nodes
which is needed to support non-device tree consumers.

The new property is named qcom,consumer-supplies.  Its value
is a list of strings of the form:

qcom,consumer-supplies = "supply_name1", "device_name1",
                         "supply_name2", "device_name2", ...

Change-Id: Ia689d04e6de568e6889b807eed15df3116de01d2
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:50:29 -07:00
David Collins 0d01b2dd66 regulator: core: Add option to suppress regulator info messages
Each call to regulator_register() results in a line being written
into the kmsg log.  regulator_init_complete() also prints a line for
each unused regulator which is automatically disabled.

Add a function named regulator_suppress_info_printing() which can
be called to disable these print statements.

Change-Id: Ic4c723b7d02a494b4e261858d699d9625da715ea
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:50:28 -07:00
David Collins 267a80d4ee regulator: Add qpnp-regulator driver
Add the qpnp-regulator driver to support regulators found in
Qualcomm plug-and-play (QPNP) PMIC chips.  QPNP chips make use of
Qualcomm's SPMI register convention.  The particular hardware
characteristics of a given regulator can be derived from the
values present in the type and subtype registers.

The qpnp-regulator driver supports probing with either device tree
device specification or with board file specified platform data.

Change-Id: I4f74431a50949763d651faf992b5d2567d05758e
Signed-off-by: David Collins <collinsd@codeaurora.org>
[sboyd: Squash in DT binding document]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:50:28 -07:00
Michael Bohan 3eb9a3700d regulator: Add stub regulator support
Add support for a dummy driver that has an implementation
connected to no real hardware devices. Its purpose is to aid
bringup scenarios by providing clients a regulator interface
that they expect. This driver shouldn't be enabled if a real
device implementation for a particular platform already exists.

Change-Id: Ib83027b4e599ebbc3cb153b2f346bb03495bb746
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
2013-09-04 14:50:27 -07:00
Willie Ruan d633191ab7 regulator: add pm8058 xo buffer driver
As a regulator driver, this xo buffer driver takes the vote from
client and controls (enable or disable) XO (crystal) buffers so
that XO clock output can be started or stopped.

Change-Id: Iccac863af2f56d66799d8fdb3320958014466d8d
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
2013-09-04 14:50:27 -07:00
David Collins a933f21833 regulator: gpio-regulator: create a regulator driver that wraps a GPIO
Create a new regulator driver, gpio-regulator, which wraps around a
GPIO that is the enable signal for a physical regulator.

Change-Id: I541a9a1cd3a6ffe3200ffaeee9f0f62db5e65795
Signed-off-by: David Collins <collinsd@codeaurora.org>
[sboyd: Moved to msm-gpio-regulator to not conflcit with
upstream's version of essentially the same driver]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:50:26 -07:00
David Collins 784a068726 regulator: pm8xxx-regulator: add PM8XXX regulator driver
Create a PM8XXX regulator driver that can support PMIC PM8921
variants including: PM8018, PM8038, and PM8921.

Change-Id: I60d1302e4af9a4c5caa72301c904867acd2ebe0f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:50:25 -07:00
Bobby Crabtree 4700d207f7 regulator: pmic8901-regulator: Add support for PMIC8901 regulator
On 8x60 PMIC LDO/SMPS/LVS are controlled from the apps processor.
This driver talks directly to the PMIC over SSBI through the
PMIC8901 core driver. This driver utilizes the regulator framework
to enable, disable, and change regulator voltage levels.

Change-Id: I21c272a490a2526c2fde9fe3ef7590a57418269a
Signed-off-by: Bobby Crabtree <bobbyc@codeaurora.org>
2013-09-04 14:50:25 -07:00
Bobby Crabtree a6ac865c0b regulator: pmic8058-regulator: add support for PMIC8058 regulator
On 8x60 PMIC LDO/SMPS/LVS are controlled from the apps processor.
This driver talks directly to the PMIC over SSBI through the
PMIC8058 core driver. This driver utilizes the regulator framework
to enable, disable, and change regulator voltage levels.

Change-Id: I25e24a3d2801d345d9f3943d54e34a563b6cc21a
Signed-off-by: Bobby Crabtree <bobbyc@quicinc.com>
2013-09-04 14:50:24 -07:00
David Collins 102da938db regulator: Add proxy consumer driver
Add a proxy consumer driver which can be used to ensure that a
given regulator maintains a certain minimum state during bootup.
Enable state, voltage, and current may be forced to specified
levels.

Change-Id: I0ccc63a41684462684ac737fb2f4129a3e6e4aea
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-08-22 18:09:07 -07:00
Matt Wagantall 853db7207c regulator: Replace error prints in regulator_check_drms() with debug prints
Errors returned from regulator_check_drms() are not treated as fatal
by any of its callers, nor are they passed up through exported
regulator APIs. Instead, these errors are used to indicate that a
regulator does not support multiple current modes.

For example, the exported regulator_set_optimum_mode() API explicitly
discards errors from regulator_check_drms() and returns success anyway
since there is no work to be done to change modes.

To prevent errors from being printed in these cases, downgrade the
rdev_err() prints in regulator_check_drms() to rdev_dbg() prints.

Change-Id: I465dcad59722b0f1fb9384beba01f6411a4a693a
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
2013-07-08 05:52:30 -07:00
Marc Dietrich ec8da805c4 mfd: tps6586x: correct device name of the regulator cell
Change the device name of the regulator function to the one chosen for
MODULE_ALIAS. This fixes kernel auto-module loading for the regulator function.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-24 12:37:47 +01:00
Mark Brown dcbd8eec68 Merge remote-tracking branch 'regulator/fix/palmas' into regulator-linus 2013-05-30 11:58:40 +01:00
Mark Brown 2a66a854f5 Merge remote-tracking branch 'regulator/fix/doc' into regulator-linus 2013-05-30 11:58:39 +01:00
Mark Brown e4bf063cb8 Merge remote-tracking branch 'regulator/fix/dbx500' into regulator-linus 2013-05-30 11:58:37 +01:00
Kishon Vijay Abraham I f232168df0 regulator: palmas: Fix "enable_reg" to point to the correct reg for SMPS10
regulator_enable_regmap() uses enable_reg to enable the regulator.
But enable_reg for smps10 points to SMPS10_STATUS which is a
read-only register. Fixed the same by having enable_reg
set to SMPS10_CTRL.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-05-30 11:55:55 +01:00
Sachin Kamat 3f4d636408 regulator: palmas: Fix incorrect condition
Since 'id' cannot take two values at the same time, the condition
should probably be an OR (||) instead of AND (&&).

Introduced by commit 28d1e8cd67 ("regulator: palma: add ramp delay
support through regulator constraints").

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-30 11:55:46 +01:00
Charles Keepax ce0d10f887 regulator: core: Correct spelling mistake in comment
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-21 10:35:40 -05:00
Linus Torvalds 5647ac0ad4 Removal of GENERIC_GPIO for v3.10
GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any valid
 cases for enableing GENERIC_GPIO without GPIOLIB, even though it is
 possible to do so which has been causing confusion and breakage. This
 branch does the work to completely eliminate GENERIC_GPIO.
 
 However, it is not trivial to just create a branch to remove it. Over
 the course of the v3.9 cycle more code referencing GENERIC_GPIO has been
 added to linux-next that conflicts with this branch. The following must
 be done to resolve the conflicts when merging this branch into mainline:
 
 * "git grep CONFIG_GENERIC_GPIO" should return 0 hits. Matches should be
   replaced with CONFIG_GPIOLIB
 * "git grep '\bGENERIC_GPIO\b'" should return 1 hit in the Chinese
   documentation.
 * Selectors of GENERIC_GPIO should be turned into selectors of GPIOLIB
 * definitions of the option in architecture Kconfig code should be deleted.
 
 Stephen has 3 merge fixup patches[1] that do the above. They are currently
 applicable on mainline as of May 2nd.
 
 [1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg428056.html
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRifUnAAoJEEFnBt12D9kBs2YP/0U6+ia+xYvkVaJc28PDVIzn
 OReZNcJOYU8D5voxz0voaRD0EdcPwjbMu9Kp9aXMHlk4VxevF+8jCc/us0bIjtO1
 VcB5VmSCIhMhxdnBlum11Mk7Vr5MCweyl9NBsypnPt8cl4obMBZHf2yzoodFktNb
 wtyYlOb6FALtc6iDbOO6dG3w9F7FAOLvskUFzdv89m8mupTsBu9jw9NqFDbJHOex
 rxq0Sdd+kWF/nkJVcV5Y6jIdletRlhpipefMJ9diexreHvwqh+c4kJEYZaXgB5+m
 ha95cPbReK1d+RqzM3A8d4irzSVSmq4k7ijI6QkFOr48+AH7XsgKv5so885LKzMN
 IIXg2Phm9i0H8+ecEvhcc4oIYBHJiEKK54Y0qUD9dqbFoDGPTCSqMHdSSMbpAY+J
 bIIXlVzj1En3PPNUJLPt8q8Qz6WxCT9mDST3QSGYnD4o90HT+1R9j92RxGL6McOq
 rUOyJDwmzFvpBvKK4raGdOU435M+ps2NPKKNIRaIGQPPY9rM1kN4YqvhXukEsC9L
 3a3+3cQLh7iKxBHncxeQsJfethP1CPkJnzvF9r+ZZLf2rcPH4pbQIE2uO0XnX/nd
 5/DKi0nGgAJ//GMMzdo3RiOA5zGFjIZ/KMvfhQldpP6qFJRhqdGi6FPlAcwr1z1n
 YnCByPwwlvfC4LTXFOGL
 =xodc
 -----END PGP SIGNATURE-----

Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux

Pull removal of GENERIC_GPIO from Grant Likely:
 "GENERIC_GPIO now synonymous with GPIOLIB.  There are no longer any
  valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it
  is possible to do so which has been causing confusion and breakage.
  This branch does the work to completely eliminate GENERIC_GPIO."

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux:
  gpio: update gpio Chinese documentation
  Remove GENERIC_GPIO config option
  Convert selectors of GENERIC_GPIO to GPIOLIB
  blackfin: force use of gpiolib
  m68k: coldfire: use gpiolib
  mips: pnx833x: remove requirement for GENERIC_GPIO
  openrisc: default GENERIC_GPIO to false
  avr32: default GENERIC_GPIO to false
  xtensa: remove explicit selection of GENERIC_GPIO
  sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB
  powerpc: remove redundant GENERIC_GPIO selection
  unicore32: default GENERIC_GPIO to false
  unicore32: remove unneeded select GENERIC_GPIO
  arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB
  arm: remove redundant GENERIC_GPIO selection
  mips: alchemy: require gpiolib
  mips: txx9: change GENERIC_GPIO to GPIOLIB
  mips: loongson: use GPIO driver on CONFIG_GPIOLIB
  mips: remove redundant GENERIC_GPIO select
2013-05-09 09:59:16 -07:00
Sachin Kamat 3d75095a53 regulator: dbx500: Make local symbol static
power_state_active_get is used only in this file. Make it static.
While at it also move this function definition inside the
CONFIG_REGULATOR_DEBUG macro as it is called only from within it.
This also avoids further build warning related to unused definition.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-08 13:42:30 +01:00
Robert P. J. Day 31d6eebf7e regulator: Fix kernel-doc generation warnings.
Add a couple kernel-doc lines to get rid of kernel-doc generation
warnings, no functional change.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-02 15:42:54 +01:00
Mark Brown bee5465814 Merge remote-tracking branch 'regulator/topic/wm8994' into v3.9-rc8 2013-04-28 02:13:50 +01:00
Mark Brown bcd5d1d978 Merge remote-tracking branch 'regulator/topic/twl' into v3.9-rc8 2013-04-28 02:13:49 +01:00
Mark Brown 32e40be1e2 Merge remote-tracking branch 'regulator/topic/tps80031' into v3.9-rc8 2013-04-28 02:13:48 +01:00
Mark Brown 64dceea446 Merge remote-tracking branch 'regulator/topic/tps6586x' into v3.9-rc8 2013-04-28 02:13:48 +01:00
Mark Brown 813dc1b086 Merge remote-tracking branch 'regulator/topic/tps65023' into v3.9-rc8 2013-04-28 02:13:47 +01:00
Mark Brown 22a712b90c Merge remote-tracking branch 'regulator/topic/tps62360' into v3.9-rc8 2013-04-28 02:13:47 +01:00
Mark Brown eea8e85e3b Merge remote-tracking branch 'regulator/topic/s5m8767' into v3.9-rc8 2013-04-28 02:13:46 +01:00
Mark Brown fbf6630d70 Merge remote-tracking branch 'regulator/topic/rc5t583' into v3.9-rc8 2013-04-28 02:13:46 +01:00
Mark Brown ae5f5203e5 Merge remote-tracking branch 'regulator/topic/palmas' into v3.9-rc8 2013-04-28 02:13:45 +01:00
Mark Brown 95328a190e Merge remote-tracking branch 'regulator/topic/max8998' into v3.9-rc8 2013-04-28 02:13:44 +01:00
Mark Brown 9eaec296d0 Merge remote-tracking branch 'regulator/topic/max8997' into v3.9-rc8 2013-04-28 02:13:43 +01:00
Mark Brown 8ca5e1fa9e Merge remote-tracking branch 'regulator/topic/max8973' into v3.9-rc8 2013-04-28 02:13:43 +01:00
Mark Brown a2c05e91b9 Merge remote-tracking branch 'regulator/topic/max8952' into v3.9-rc8 2013-04-28 02:13:43 +01:00
Mark Brown 2e1be9f7b3 Merge remote-tracking branch 'regulator/topic/max8925' into v3.9-rc8 2013-04-28 02:13:42 +01:00
Mark Brown c4578da56a Merge remote-tracking branch 'regulator/topic/max77686' into v3.9-rc8 2013-04-28 02:13:42 +01:00
Mark Brown 388128ffd6 Merge remote-tracking branch 'regulator/topic/max1586' into v3.9-rc8 2013-04-28 02:13:41 +01:00
Mark Brown 329bd970d8 Merge remote-tracking branch 'regulator/topic/lp8788' into v3.9-rc8 2013-04-28 02:13:41 +01:00
Mark Brown 3dc06c1baf Merge remote-tracking branch 'regulator/topic/gpio' into v3.9-rc8 2013-04-28 02:13:40 +01:00
Mark Brown 5f19a85ba7 Merge remote-tracking branch 'regulator/topic/fan53555' into v3.9-rc8 2013-04-28 02:13:39 +01:00
Mark Brown 1d60a4cf97 Merge remote-tracking branch 'regulator/topic/enable-invert' into v3.9-rc8 2013-04-28 02:13:37 +01:00
Mark Brown 0e340ce1dd Merge remote-tracking branch 'regulator/topic/core' into v3.9-rc8 2013-04-28 02:13:37 +01:00
Mark Brown 97844ede94 Merge remote-tracking branch 'regulator/topic/ascend' into v3.9-rc8 2013-04-28 02:13:36 +01:00
Mark Brown 83b0dd9ea3 Merge remote-tracking branch 'regulator/topic/as3711' into v3.9-rc8 2013-04-28 02:13:36 +01:00
Mark Brown f50b7f2b51 Merge remote-tracking branch 'regulator/topic/arizona' into v3.9-rc8 2013-04-28 02:13:35 +01:00
Mark Brown c98cac899b Merge remote-tracking branch 'regulator/topic/ab8500' into v3.9-rc8 2013-04-28 02:13:34 +01:00
Mark Brown 9e63d23056 Merge remote-tracking branch 'regulator/topic/ab3100' into v3.9-rc8 2013-04-28 02:13:33 +01:00
Axel Lin 78040b630f regulator: mc13892: Fix MC13892_SWITCHERS0_SWxHI bit in set_voltage_sel
It is necessary to clear MC13892_SWITCHERS0_SWxHI bit when set voltage to the
voltage range from 1100000 to 1375000. Leaving MC13892_SWITCHERS0_SWxHI bit
untouched may result in wrong voltage setting.

For example, currently switch voltage from 1400000 to 1300000 will set the
voltage to 1800000 because the HI bit is still set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2013-04-28 02:13:02 +01:00
Axel Lin 020501f1a0 regulator: Remove NULL test before calling regulator_unregister()
It's safe to call regulator_unregister() with NULL, thus remove the NULL test
before regulator_unregister() calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2013-04-28 02:11:19 +01:00
Alexander Shiyan 86b139f0f3 regulator: mc13783: Add device tree probe support
Patch adds device tree probe support for mc13783-regulator driver.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2013-04-28 02:10:00 +01:00
Alexander Shiyan eb0d8e7a14 regulator: mc13xxx: Add warning of incorrect names of regulators
This patch adds a warning about incorrect regulators instead of
printing the names of non-information message about the wrong amount.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2013-04-28 02:10:00 +01:00
Axel Lin 3ecf198eab regulator: max77686: Don't update max77686->opmode if update register fails
Ensure max77686->opmode always has correct status.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
2013-04-28 02:07:52 +01:00
Axel Lin 71622e15dd regulator: max8952: Add missing config.of_node setting for regulator register
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-26 18:17:01 +01:00
Axel Lin 018fd856ce regulator: ab3100: Fix regulator register error handling
Ensure to unregister all regulators before return error in probe().

The regulator register order depends on the regulator ID pass to
ab3100_regulator_register() function. Thus we need to scan ab3100_regulator_desc
and find the index of successfully registered regulators, or alternatively just
call ab3100_regulators_remove() to unregister all registered regulators.

Since current code uses a static ab3100_regulators table, explicitly set
reg->rdev = NULL after regulator_unregister() call to ensure calling
ab3100_regulators_remove() in the unwind path always work.

Also move ab3100_regulators_remove() to avoid forward declaration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-26 16:33:10 +01:00
Axel Lin b92f567deb regulator: tps6524x: Use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-26 16:32:05 +01:00
Axel Lin 6dcbc200fe regulator: lp8788-buck: Use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:50:23 +01:00
Axel Lin a32f9e0202 regulator: lp872x: Use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:50:23 +01:00
Axel Lin 3bdf599289 regulator: mc13892: Use regulator_map_voltage_ascend for mc13892_sw_regulator_ops
Both mc13892_sw1 and mc13892_sw voltage table have ascendant voltage list.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:49:46 +01:00
Axel Lin c4bbfbd548 regulator: tps65023: Use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:49:28 +01:00
Axel Lin 2040541afb regulator: tps65023: Merge tps65020 ldo1 and ldo2 vsel table
tps65020 ldo1 and ldo2 vsel tables are identical, merge them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:49:27 +01:00
Axel Lin a1bb63a80c regulator: tps6507x: Use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Use regulator_map_voltage_ascend for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-25 11:48:37 +01:00
Linus Walleij 8735bc2fe6 regulator: ab3100: device tree support
This implements device tree support for the AB3100 regulators
driver. The initial settings are moved out of platform data
and into the driver for the device tree case, as it appears
that there is no way to supply this as AUXDATA for an I2C
device. The style and bindings are heavily inspired by
Lee Jones' style for AB8500.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-24 10:54:07 +01:00
Linus Walleij 9b31835341 regulator: ab3100: refactor probe to use IDs
This refactors the AB3100 regulator probe to use regulator IDs
and pass this to a separate registration function. This works
much smoother when migrating to device tree, as we can use a
match table with this regulator ID encoded in the .driver_data.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-24 10:53:59 +01:00
Axel Lin b27032ca3e regulator: max8973: Don't override control1 variable when set ramp delay bits
Current code overrides control1 variable when setting ramp delay bits.
Fix it by just setting ramp_delay bits.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-24 10:52:28 +01:00
Axel Lin bc49c87ec7 regulator: tps80031: Convert tps80031_dcdc_ops to [get|set]_voltage_sel_regmap
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:47:38 +01:00
Axel Lin 58fa6ab42c regulator: tps80031: Fix LDO2 track mode for TPS80031 or TPS80032-ES1.0
Currently we have a special code in tps80031_ldo_set_voltage_sel() to handle
LDO2 track mode for TPS80031 or TPS80032-ES1.0. The purpose is to address below
issues:

Issue description:
- LDO2 traking mode is enabled
- LDO2 tracks SMPS2 voltage.
- LDO2 automatically switch-off when LDO2_CFG_VOLTAGE is changed to some discrete values (non exhaustive list):
            00011001, 00011010, 00011011, 00011100, .
- LDO2 switch-on again when LDO2_CFG_VOLTAGE is changed to other values (non exhaustive list):
        00011000, 00010111, .

LDOs have reserved codes. For these codes, LDO is switch-off.

In tracking, LDO2 ref comes from SMPS2.
However LDO2 enable is still gated by LDO2 VSEL decoding.
As a result, in tracking mode LDO2 will be disabled for following code (SMPS VSEL format):
000000 & 100000 (MSB not decoded)
011001 & 111001 (MSB not decoded)
011010 & 111010 (MSB not decoded)
011100 & 111100 (MSB not decoded)
011101 & 111101 (MSB not decoded)
011110 & 111110 (MSB not decoded)

However, current code has below bugs:
1. It uses regulator_list_voltage_linear, so list_voltage() still shows above
   invalid selectors have supported voltage.
2. Current code may return -EINVAL in tps80031_ldo_set_voltage_sel() for
   supported voltage. This is because when we use regulator_list_voltage_linear
   as list_voltage callback, regulator core will default use
   regulator_map_voltage_linear(). regulator_map_voltage_linear() has an
   assumption that the voltages are linear which is not true for this case.

   For example,
   when request voltage range is: min_uV=950000 uV && max_uV=1200000 uV
   regulator_map_voltage_linear() returns the selector is 29 (0x1D),
   set_voltage_sel() returns -EINVAL.
   (The selector is in invalid range, 0x19 ~ 0x1f).

   In above case, map_voltage() should find the lowest valid voltage within
   specific range (selector = 0x20) and set_voltage_sel() should successfully
   set the voltage to 987500 uV.

This patch fixes these issues by:
1. Add checking valid setting for LDO2 track mode of TPS80031 or TPS80032-ES1.0
   in list_voltage.  So it returns -EINVAL for invalid selectors.
2. Implement tps80031_ldo_map_voltage, use regulator_map_voltage_iterate()
   to find the lowest voltage within specific range for TPS80031 or
   TPS80032-ES1.0. This is required when the voltage map is no longer linear.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:47:37 +01:00
Axel Lin 4d673bbc58 regulator: tps6586x: Convert to use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Thus use regulator_map_voltage_ascend is more efficient than the default
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:41:06 +01:00
Axel Lin 9fa8175f0f regulator: tps65910: Convert to use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Some regulators have more than 200 supported voltages.
e.g.
For TPS65910_REG_VDD1 and TPS65910_REG_VDD2:
n_voltages = VDD1_2_NUM_VOLT_FINE * VDD1_2_NUM_VOLT_COARSE
           = 73 * 3
           = 219

Thus it worth converting to regulator_map_voltage_ascend rather than use
default regulator_map_voltage_iterate.

For consistent, convert all regulators to regulator_map_voltage_ascend.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:41:06 +01:00
Axel Lin b50003b69d regulator: lp3972: Convert to use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Thus use regulator_map_voltage_ascend is more efficient than the default
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:39:33 +01:00
Axel Lin 3e655618e1 regulator: lp3971: Convert to use regulator_map_voltage_ascend
All regulators have ascendant voltage list in this driver.
Thus use regulator_map_voltage_ascend is more efficient than the default
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:39:27 +01:00
Axel Lin 46bcb006ae regulator: tps65023: Use [set|get]_voltage_sel_regmap instead of open coded
Simply the [get|set]_voltage_sel implementation by using
regulator_[set|get]_voltage_sel_regmap instead of open coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:32:56 +01:00
Axel Lin 1864b67090 regulator: tps62360: Fix off-by-one shift for ramp_ctrl
According to the datasheet[1]

Register 0x06h Description: RmpCtrl (REGISTER ADDRESS: 0x06h Read/Write)
BIT[5..7]:
        RMP[2:0] Output voltage ramp timing
        D7-D5   Slope
        000     32mV/us
        001     16mV/us
        010     8mV/us
        ...
        110     0.5mV/us
        111     0.25mV/us

Thus to get correct ramp_ctrl value, we need to right-shift 5 bits.

[1] http://www.ti.com/lit/ds/symlink/tps62360.pdf

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:26:56 +01:00
Axel Lin 0ea34b5786 regulator: palmas: Fix off-by-one for ramp_delay and register value mapping
Datasheet says:
Time Step (TSTEP) selection, when changing the output voltage, the new value is
reached through successive voltage steps (if not bypassed). The equivalent
programmable slew rate of the output voltage is:

TSTEP[1:0]: 00 Jump (no slope control)
TSTEP[1:0]: 01 10mV/us
TSTEP[1:0]: 10 5mV/us (default)
TSTEP[1:0]: 11 2.5mV/us

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-22 13:34:42 +01:00
Axel Lin e31089c608 regulator: palmas: Add missing ctrl_addr setting for SMPS10
The ctrl_addr setting for SMPS10 is missed, thus palmas_smps_init() read/write
wrong register for SMPS10 in current code. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-22 13:27:16 +01:00
Axel Lin f22c2bae2e regulator: palmas: Don't update tstep register for SMPS3 and SMPS7
SMPS3 and SMPS7 do not have tstep_addr setting, so current code actually
writes 0 to smps12_ctl (offset is 0) register when set_ramp_delay callback
is called for SMPS3 and SMPS7.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-19 11:47:29 +01:00
Axel Lin 3df4a81c46 regulator: palmas: Fix min_uV for LDO8 tracking mode
When SMPS45 is set to off and LDO8 tracking is enabled, the output voltage can
be set from 0.45 to 1.65 V. Thus set min_uV to be 450000.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18 18:35:17 +01:00
Axel Lin 5d9de8b121 regulator: ab8500: Get rid of voltage_shift field from struct ab8500_regulator_info
The voltage_shift can be calculated from voltage_mask.
Let's remove voltage_shift fied from struct ab8500_regulator_info, this change
can prevent missing voltage_shift setting issue.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18 18:26:35 +01:00
Axel Lin 9135d3bcec regulator: ab8500: Remove unused voltage_shift field from struct expand_register
The voltage_shift field of struct expand_register is not used now, remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18 18:26:30 +01:00
Laxman Dewangan 51d3a0c999 regulator: palmas: preserve modes of rails during enable/disable
The Palma device like TPS65913 have the mode mask which is also
used for enable/disable the rails. The mode bits are defined as
	00: OFF
	01: AUTO
	10: ECO
	11: Forced PWM

and modes are set accordingly as
	REGULATOR_MODE_NORMAL: AUTO
	REGULATOR_MODE_IDLE: ECO
	REGULATOR_MODE_FAST: PWM

Two issue observed:
1. If client calls following sequence:
	regulator_enable(),
	regulator_set_mode(FAST),
	regulator_disable()

	and again the regulator_enable() then the mode is reset
	to NORMAL inplace of keeping the mode as FAST.

	Fixing this by storing the current mode configured by client
	and restoring modes when enable() is called after disable().

2. In following sequence, the regulator get enabled:
	regulator_disable()
	regulator_set_mode(FAST),

	Fixing this by updating new mode in register only if it is
	enabled.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18 18:23:53 +01:00
Laxman Dewangan 28d1e8cd67 regulator: palma: add ramp delay support through regulator constraints
Currently Palma regulator driver support the ramp delay
through rail specific platform data.

As regulator framework support the configuration of ramp
delay through regulator constraint, using the framework
method and removing the platform specific data approach.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18 18:23:20 +01:00
Axel Lin fcf371ee56 regulator: core: Add regulator_map_voltage_ascend() API
A lot of regulator hardware has ascendant voltage list.
This patch adds regulator_map_voltage_ascend() and export it.

Drivers that have ascendant voltage list can use this as their map_voltage()
operation, this is more efficient than default regulator_map_voltage_iterate()
function.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18 12:09:32 +01:00
Axel Lin b4d12a7929 regulator: ab8500: Fix set voltage for AB8540_LDO_AUX3
When setting voltage for AB8540_LDO_AUX3, current code only updates one of
info->voltage_reg and info->expand_register registers which is wrong.
To ensure we set to correct voltage, it always needs to clear or set
expand_register.voltage_mask bit of expand_register.

The function of the expand register bit is the following (from the user manual):
0: VAUX3 output voltage is determined by Vaux3Sel bit settings in register
   VldoCVaux3Sel
1: VAUX3 output voltage is set to 3.05V regardless of Vaux3Sel settings in
   register VldoCVaux3Sel (VldoCVaux3Sel is the register at 0x0421)

So when going to 3.05V, set the expand register bit.
When leaving 3.05V for another voltage, set the target voltage before clearing
the expand register bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:09:27 +01:00
Axel Lin 7384744d2d regulator: ab8500-ext: Remove enable() and disable() functions
Both enable() and disable() functions have only one caller, thus remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:08:38 +01:00
Axel Lin 66511fa4a7 regulator: ab8500-ext: Don't update info->update_val if set_mode() fails
This ensures info->update_val status is still correct if set_mode() call fails.
Otherwise, get_mode() may return wrong status if a set_mode() call fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:08:33 +01:00
Axel Lin 0b665062a1 regulator: ab8500: Don't update lp_mode_req flag in set_mode() error paths
Currently, set invalid mode setting for shared mode regulators may change
sm->lp_mode_req flag. This patch ensures we don't set lp_mode_req flag to wrong
status if set_mode() fails.

This patch includes some clean up, and these changes makes this patch looks like
code refactor. The clean up is mainly to avoid adding ugly code to handle
failure paths.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:08:27 +01:00
Axel Lin f04adc5ab3 regulator: ab8500: Don't update info->update_val if write to register fails
This patch ensures info->update_val is consistent with current register value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:08:22 +01:00
Laxman Dewangan 17c11a7603 regulator: palmas: add support for LDO8 tracking mode
LDO8 of Palma device like tps65913 support the tracking mode
on which LDO8 track the SMPS45 voltage when SMPS45 is ON
and use the LDO8.VOLTAGE_SEL register when SMPS45 is OFF.

On track mode, the steps of voltage change for LDO8 is 25mV
where in non-tracking mode it is 50mV. Set the steps accordingly.
Number of voltage count is still same for both the cases.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:05:19 +01:00
Laxman Dewangan aa07f02793 regulator: palmas: support for external regulator through control outputs
Palmas device have control outputs like REGEN1, REGEN2, REGEN3,
SYSEN1 and SYSEN2. These control outputs can be used for controlling
external voltage switches to enabled/disable voltage outputs.

Add support of these control outputs through regulator framework.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:05:10 +01:00
Laxman Dewangan 30590d0480 regulator: palmas: clear sleep bits if not selected
Clear the sleep/warm reset bits when it is not selected through
regulator platform data. This will make sure that configuration
is inline with the platform data regardless of boot/POR
configuration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 15:03:06 +01:00
Nishanth Menon 1e4b545cdd regulator: core: return err value for regulator_get if there is no DT binding
commit 6d191a5fc7
(regulator: core: Don't defer probe if there's no DT binding for a supply)

Attempted to differentiate between regulator_get() with an actual
DT binding for the supply and when there is none to avoid unnecessary
deferal.
However, ret value supplied by regulator_dev_lookup() is being
ignored by regulator_get(). So, exit with the appropriate return value.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 14:58:17 +01:00
Axel Lin d6c7d73192 regulator: as3711: Use a static of_regulator_match table for of_regulator_match
The same table can be used for multiple instance of pdev, so we don't need to
allocate memory for of_regulator_match table per pdev.

match->driver_data points to the corresponding entry of as3711_reg_info,
however it is not used in current code, thus this patch does not set
driver_data in the of_regulator_match table.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 14:41:07 +01:00
Axel Lin 241896ce8d regulator: ab8500: Optimize ab8540_aux3_regulator_get_voltage_sel
We can save a register read operation in some case if read
expand_register first.
If info->expand_register.voltage_mask bit is set, no need to read
voltage_reg.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-16 12:23:27 +01:00
Axel Lin bcffe53fcb regulator: rc5t583: Remove unused fields from struct rc5t583_regulator_info
The *dev and *mfd of struct rc5t583_regulator_info are not used after convert
to use regmap, remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-16 12:22:06 +01:00
Alexandre Courbot 76ec9d18b8 Convert selectors of GENERIC_GPIO to GPIOLIB
GENERIC_GPIO is now equivalent to GPIOLIB and features that depended on
GENERIC_GPIO can now depend on GPIOLIB to allow removal of this option.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
2013-04-16 18:47:14 +09:00
Axel Lin a2f07305e5 regulator: max8997: Test pdata by NULL checking instead of IS_ERR_OR_NULL
pdata is either a valid pointer or NULL, use NULL checking rather than
IS_ERR_OR_NULL macro.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-15 17:21:18 +01:00
Axel Lin 375dc9c141 regulator: ab8500: Fix voltage_shift setting for AB8540_LDO_DMIC
The voltage_mask is 0xc0, thus we need to set voltage_shift = 6 to get correct
selector in get_voltage_sel and set_voltage_sel.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-15 16:54:25 +01:00
Axel Lin e4fc9d6d9f regulator: ab8500: Fix voltage_mask for AB8505_LDO_AUDIO
The voltage_mask and voltage_shift settings of AB8505_LDO_AUDIO are not matched.
It looks like a typo in the voltage_mask settings.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-12 13:29:33 +01:00
Sylwester Nawrocki 3ea9389656 regulator: wm8994: Use GPIO parsed from DT when registering regulators
Ensure the regulators are registered with a GPIO parsed from the device
tree when available.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-11 17:56:21 +01:00
Axel Lin 42e8c811ba regulator: ab8500: Unregister ab8500-ext regulators in probe() failure path
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-11 17:43:56 +01:00
Axel Lin 3480c0cab6 regulator: ab8500-ext: Make the return type of ab8500_ext_regulator_exit() void
ab8500_ext_regulator_exit() never fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-11 17:43:50 +01:00
Axel Lin e343ab08bd regulator: ab8500-ext: Remove get_voltage to avoid duplicate implementation
The implementation of ab8500_ext_fixed_get_voltage is identical to
ab8500_ext_list_voltage. We can avoid the duplicate implementation by just
remove get_voltage. For fixed regulator, regulator core will call
list_voltage(rdev, 0) to get voltage if both get_voltage get_voltage_sel are
not implemented.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-08 11:23:56 +01:00
Axel Lin bcbba9de0f regulator: ab8500-ext: Remove unnecessary checking for ab9540 and ab8540
This code was added by commit 0fe17e20a6
"regulator: ab8500-ext: Add support for AB9540 regulators"
and commit bd44e2cb "regulator: ab8500: Also check for AB8505 based platforms"

The original patch[1] is to set info->desc.ops = &ab9540_ext_regulator_ops.

However, ab9540_ext_regulator_ops is identical to ab8500_ext_regulator_ops[2].
Thus we can complete remove the unnecessary checking for ab9540 and ab8540.

[1] https://lkml.org/lkml/2013/3/28/333
[2] https://lkml.org/lkml/2013/4/1/178

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-08 11:23:49 +01:00
Axel Lin 9ab51a0eb4 regulator: ab8500-ext: Get rid of is_enabled from struct ab8500_ext_regulator_info
The intention of this patch is to simplify the code.

Maintain the is_enabled flag is not trivial, it not only needs to set/clear the
flag in disable()/enable() but also needs to set the flag in is_enable() to get
initial status. The only benefit of keeping is_enabled flag is just save a
register read when set_mode(). Remove is_enabled flag makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-08 11:23:45 +01:00
Axel Lin 438e695b87 regulator: ab8500: Get rid of is_enabled from struct ab8500_regulator_info
The intention of this patch is to simplify the code.

Maintain the is_enabled flag is not trivial, it not only needs to set/clear the
flag in disable()/enable() but also needs to set the flag in is_enable() to get
initial status. The only benefit of keeping is_enabled flag is just save a
register read when set_mode(). Remove is_enabled flag makes the code simpler.

This patch also moves ab8500_regulator_is_enabled() close to
ab8500_regulator_[en|dis]able functions.
This is required to avoid a forward declaration because now we call
ab8500_regulator_is_enabled() in ab8500_regulator_set_mode().
This change also makes the code better in readability by moving similar
functions to one place.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-08 11:23:31 +01:00
Mark Brown e3d27775fc regulator: wm8994: Provide default init data
Almost all systems use the regulators on the WM8994 series devices to
provide DCVDD and AVDD1 so if no init data is supplied then set up the
supplies for the user. This simplifies integration of the device into
systems, especially when device tree is supported.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-07 20:24:07 +01:00
Axel Lin cd2a55d2eb regulator: ab8500: Remove ab8500_regulator_set_voltage_time_sel
All users of ab8500_regulator_volt_mode_ops and ab8500_regulator_volt_ops
do not set info->desc.enable_time, thus set_voltage_time_sel() always returns 0.
Remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05 11:23:10 +01:00
Tomasz Figa 3ff4aa95b3 regulator: max8952: Add Device Tree support
This patch adds Device Tree support to max8952 regulator driver.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05 11:20:52 +01:00
Tomasz Figa 3ec6eb9cc2 regulator: max8952: Separate constraints from platform data struct
This patch modifies platform data structure of max8952 driver to
use pointer to regulator_init_data struct instead of embedding it.

This is a prerequisite for adding Device Tree support for the driver.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05 11:20:51 +01:00
Andrew Bresticker 0f7b87f0ac regulator: core: don't require a supply when supply_name is specified
Regulator drivers may specify regulator_desc->supply_name which
regulator_register() will use to find the supply node for a regulator.
If no supply was specified in the device tree or the supply has yet
to be registered regulator_register() will fail, deferring the probe
of the regulator.  In the case where no supply node was specified in the
device tree, there is no supply and it is pointless to try and find one
later, so go ahead and add the regulator without the supply.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05 10:55:22 +01:00
Mark Brown 0565021655 regulator: wm8994: Convert to module_platform_driver()
The regulators can only be used to supply the CODEC so we don't need to
worry about users that still need fudges for init ordering issues.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-05 10:44:23 +01:00
Axel Lin b5366e5edc regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops
For fixed voltage, we can just set min_uV and use regulator_list_voltage_linear
for list_voltage callback. Regulator core will call list_voltage(rdev, 0) if
both get_voltage get_voltage_sel are not implemented. Thus we can also remove
lp8788_ldo_fixed_get_voltage() function.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:46:29 +01:00
Axel Lin 80abd60d98 regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays
The id for DLDOx matches the entries in enum lp8788_ldo_id and it's easy to
calculate the id for ALDOx. Thus remove lp8788_dldo_id and lp8788_aldo_id
arrays.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:46:14 +01:00
Axel Lin aca45e9e2f regulator: ab8500: Add missing volt_table setting for AB8540_LDO_TVOUT
This is required for regulator_list_voltage_table() to properly work.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:29 +01:00
Axel Lin d7816ab09b regulator: ab8500: Fix list_voltage for fixed voltage regulators
commit b080c78a4e
"regulator: ab8500: Update voltage handling for fixed voltage regulators"
removes min_uV settings and sets volt_table for all fixed voltages, thus
we can not use regulator_list_voltage_linear now. Use
regulator_list_voltage_table instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:28 +01:00
Lee Jones da45edc7f8 regulator: ab8500: Shuffle init functions into a more logical order
The ab*_match[] arrays should be moved out of the way, instead of
bunched in the middle of the initialisation functions. This patch
moves all initialisation code which currently resides above these
arrays down to be grouped with the others. This makes the whole
thing slightly easier to read.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-03 18:40:28 +01:00