Commit Graph

57 Commits

Author SHA1 Message Date
Subbaraman Narayanamurthy 283728060c regulator: cpr-regulator: improve handling of incorrect target quotients
Currently, if the fused target quotient of a fuse corner (SVS)
is less than the target quotient of the previous fuse corner
(SVS2), then CPR closed loop operation is disabled permanently.
However, it would be good to adjust the target quotients before
doing the conditional check above so that the adjustments will
be applied before the decision is made.

Disable CPR closed-loop operation only if the ring oscillators
(RO) are same between the adjacent fuse corners so that
closed-loop operation is allowed for the targets that have
different RO.

In addition, when the aforementioned condition exists, set the
scaling factor for that fuse corner to zero so that it does not
end up as a huge unsigned integer value.

Also, if the CPR regulator device uses the quotient offset for
the quotient interpolation and it ends up using the same RO for
the adjacent fuse corners, then fall back to using target
quotient based linear interpolation instead of the quotient
offset based one. This ensures that the interpolation is
performed correctly in the scenario above.

CRs-Fixed: 841986
Change-Id: I05880858bf5279545734e20e6d76298e24dec6ce
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2015-06-09 16:40:45 -07:00
David Collins 38136f952b regulator: cpr-regulator: fix race condition in CPU hotplug callback
Fix a race condition which occurs when setting the voltage corner
of a cpr-regulator device from both the regulator framework and
the CPU hotplug paths simultaneously.  This issue was introduced
by this change: 48ba32f0eb1a452e2e6f3d7477bdf5288e32b43d -
"regulator: cpr-regulator: add online CPUs based voltage
adjustment support"

This race condition can cause crashes due to undervolting on
boards which define per-online-core target quotient or initial
voltage adjustments when the following events occur:

    0. Initial state: regulator at corner X
        (i.e. cpr_vreg->corner = X)
    1. cpr_regulator_set_voltage() called from the regulator
        framework path for corner Y where Y > X
    2. cpr_regulator_cpu_callback() is executed and reads
        cpr_vreg->corner finding its value equal to X
    3. cpr_regulator_cpu_callback() calls
        cpr_regulator_set_voltage() to set corner X (this is
        blocked waiting on the mutex)
    4. cpr_regulator_set_voltage() call from the regulator
        framework path finishes setting corner Y and releases the mutex
    5. cpr_regulator_set_voltage() call from hotplug path begins
        switching to corner X
    6. cpr_regulator_set_voltage() call from hotplug path
        finishes switching to corner X
    7. The voltage for corner X is insufficient for the processor
        frequency which requested corner Y leading to a crash
        (likely from an L2 cache bit flip)

Correct this race condition by taking the mutex lock before
accessing any cpr_vreg struct members in
cpr_regulator_cpu_callback().

Change-Id: I019f0246f068be8eeabe8b24dc5e7bd67ef5d2dd
Signed-off-by: David Collins <collinsd@codeaurora.org>
2015-05-28 12:16:58 -07:00
Tirupathi Reddy 439a4d0a49 regulator: cpr-regulator: Fix CPR initialization code for invalid quotients
Allow normal CPR driver initialization even when the fused CPR
target quotients are invalid so that necessary data structures
are allocated and initialized.  The device is allowed to run
using open-loop voltages with CPR disabled in this case.

CRs-Fixed: 823331
Change-Id: Iff1bf978290571df8e757c6eaf8b168e2be8972c
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2015-05-04 22:45:37 -07:00
David Collins 7ea105a412 regulator: cpr-regulator: add online CPUs based voltage adjustment support
Add support to adjust the CPR target quotients and/or the CPR initial
voltages (a.k.a open loop voltages) per corner based on the number of
online CPUs. This will help in saving power when the cores are
hot-plugged.

CRs-Fixed: 773979
Change-Id: I474ceed824cfb0cde172feb27bc20c185a4f854d
Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
Signed-off-by: Ke Liu <keliu@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2015-02-26 01:41:39 -08:00
Linux Build Service Account 804bc29cef Merge "regulator: cpr-regulator: Add minimum difference allowed for quotients" 2015-01-17 20:28:28 -08:00
Tirupathi Reddy c9018aabb5 regulator: cpr-regulator: Add minimum difference allowed for quotients
Sometimes after power-optimization adjustments to the fused quotients
the values may end up in a non-increasing order (NOM > TURBO) or
may get very close to each other. In the former case the driver
disables CPR. To avoid this, add support for specifying a minimum quotient
difference between 2 fuse corners. If this difference is not met add a
configurable quotient offset to the fuse corner quotient.

Example:
	cpr-fuse-min-quot-diff = <0 0 40>;
	cpr-min-quot-diff-adjustment = <0 0 104>;

	CPR log snippet:
		Corner[2] adjusted quotient = 1275
		Corner[3] adjusted quotient = 1261

	After adjustment applied:
		Corner[3] revised adjusted quotient = 1379

Change-Id: Iec8b9a703a0018620f6d1d23326e6a32c3bf88d0
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2015-01-13 19:13:16 +05:30
Ke Liu 5432bdbb6a regulator: cpr-regulator: add debugfs support for cpr voltage limits
Add support for checking the corresponding value for cpr ceiling, floor
and max_ceiling for the currently operating virtual corner.

CRs-Fixed: 773272
Change-Id: Ic1c42c0253ed6d6c84ce2cad26492d4e46f1ff83
Signed-off-by: Ke Liu <keliu@codeaurora.org>
2015-01-08 15:13:03 -08:00
Subbaraman Narayanamurthy be9c367109 regulator: cpr-regulator: support CPR closed loop based on the fuse version
In some SoCs, CPR closed loop should not be enabled for certain
CPR fusing revisions. Currently, there is no support to disable the
closed loop operation based on the fuse version. Add support for that
through qcom,cpr-allowed property.

The above property is tied with qcom,cpr-fuse-version-map property
so that this can be supported well for a particular fuse revision or
PVS bin or speed bin.

Change-Id: I7d315d0d739d60d755f2d3c40f4568c3c5f42bc9
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2014-12-31 10:07:41 -08:00
Subbaraman Narayanamurthy 48f93b0780 regulator: cpr-regulator: Add support for fuse based quotient offset
In some SOCs, quotient offsets per fuse corner can be programmed
in the fuse so that the software can make use of them without the
need to calculate them. Add support to read those quotient offsets
which are defined per fuse corner and use them to obtain the
quotient scaling factors, so that the quotient for a particular
frequency can be calculated.

In addition, add support to adjust target quotient offset based
on the values read from device tree.

Change-Id: I63c3376ea43eaff276bdeb0fdd7000c024abd46e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2014-12-05 11:25:18 -08:00
Anirudh Ghayal b0392e0c05 regulator: cpr-regulator: Add a DT property for min. quotient difference
There are targets where the minimum target quotient difference between the
highest and (highest - 1) fuse corner may be lower than 50. Add an optional
property to allow passing this value as platform data. If the property
is not present use a default value of 50.

Change-Id: I72901d82743e6fb0915a7e53cefbd4861d0ca3db
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2014-11-27 11:52:47 +05:30
Fenglin Wu f38a3fadca regulator: cpr-regulator: Add wildcard for matching some fuse bits values
Add wildcard 0xffffffff for matching arbitrary speed bin and PVS version
values in qcom,cpr-speed-bin-max-corners,
qcom,cpr-voltage-ceiling-override and qcom,cpr-voltage-floor-override
properties.

Change-Id: I69505c9e1b397d1fa01ee4cf47cc178a77ddf02b
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-11-19 16:01:27 +05:30
Anirudh Ghayal dcf4a3a9c2 regulator: cpr-regulator: Add virtual-corner voltage/quotient adjustment
Add support to adjust the target quotient and init-voltage per virtual
corner. The adjustment values are specified via DT properties.
This allows finer granularity for quotient/voltage adjustments.

Change-Id: I3deffb070a0156acf9ceaa138357ae208a86df59
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2014-11-19 16:01:13 +05:30
David Collins 624bba6037 regulator: cpr-regulator: add support for per-RO CPR step quotient
Add support for using a different CPR step quotient value for
each possible ring oscillator (RO).  This ensures that equivalent
CPR dynamic voltage margins can be achieved on a given chip
regardless of which RO is used.

Also clear all RBCPR_GCNT_TARGET registers before switching
voltage corners so that only the expected RO is used.  This is
needed in order to support different RO's for each fuse corner.

Change-Id: If28d30c0f979669f46936f4e064119a69834d1e1
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-11-12 15:08:28 -08:00
David Collins e92cc16641 regulator: cpr-regulator: add support for initial voltage adjustment
Add support for initial voltage adjustment that is decided based
upon the values read out of a combination of fuse parameters.
This allows for precise control of initial voltages in order to
compensate for differences in characterization procedures used
along with specific CPR fuse revision and ring oscillator select
values.

Change-Id: I108931f2abe4186307c397e229e0fe34bf2761c6
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-11-06 15:16:11 -08:00
David Collins ba9d2d1968 regulator: cpr-regulator: add support for fine grained quotient adjustment
Add support for quotient adjustment that is decided based upon
the values read out of a combination of fuse parameters.  The
existing quotient adjustment only allows for a single set of
values that is applied to all chips.

Change-Id: Ic6e4c28db3da7ea49a161273f66d0602f9711ac1
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-11-06 15:02:53 -08:00
David Collins 859a4d882d regulator: cpr-regulator: add support for reading CPR fuse revision
Add support in the cpr-regulator driver for reading the CPR
fusing revision fuse parameter.  The location of this parameter
is defined using the qcom,cpr-fuse-revision device tree property.
The fusing revision value can be used on some chips in order to
determine what kind of adjustments are required.

Change-Id: I7355c41503bbc67c5114f56060920251397abc41
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-11-03 15:42:42 -08:00
David Collins 94e4b7b488 regulator: cpr-regulator: add support for fuse bit remapping
On certain targets some fuse parameters are split between
non-contiguous fuse rows.  The various device tree fuse
specification properties cannot handle such a layout.  Therefore,
add support for a pair of device tree properties which can be
used to remap arbitrary combinations of fuse bits into a single
contiguous range of virtual fuse rows.  These remapped fuse rows
can then be referenced by all other device tree fuse properties.

Change-Id: I9adba2547e91f124fa02f9c199b591166e2f9147
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-23 18:33:37 -07:00
David Collins 3d3905421a regulator: cpr-regulator: add support for redundant initial voltage fuses
Add support for a second set of per-fuse-corner initial voltage
fuses parameters which are utilized when a given chip is
configured to use redundant fuses.

Change-Id: I173eb87b11824cc18296fde2089a662e6834b274
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-23 18:33:27 -07:00
David Collins 3d32f8968c regulator: cpr-regulator: fix reading of >= 32 bit fuse parameters
The bit mask values calculated in the cpr_read_efuse_param()
function are not correct because the constant '1' is not
automatically promoted to unsigned long long int.  Therefore,
add explicit ULL suffixes to the constants so that the mask
values are calculated correctly.

Change-Id: Ic5e7ff02b5910b075d717fc4e0b5e81bd59ef810
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-22 13:27:56 -07:00
Linux Build Service Account 3384eda6c3 Merge "regulator: cpr-regulator: change CPR debug message level for OPP table" 2014-10-17 03:11:32 -07:00
Fenglin Wu 7febe37686 regulator: cpr-regulator: change CPR debug message level for OPP table
Change the CPR debug message level from error to debug if filling the
OPP table failed. This is to avoid logging the error messages on the
platforms which do not have pm_opp enabled.

Change-Id: I430ae7a38ae41ade8e7b94346f6fda77e8f5cb9c
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2014-10-16 14:31:45 +08:00
David Collins 31a41c69fd regulator: cpr-regulator: add support for CPR ceiling voltage reduction
Add support for a pair of device tree properties which specify
if the CPR ceiling voltage may be reduced to either the per-fuse-
corner initial voltage fuse value or the per-virtual-corner
interpolated initial voltage value (i.e. the open-loop voltage).

These properties can be used to save power on targets where the
closed-loop settled CPR voltage never needs to exceed the
open-loop initial voltage.

Change-Id: I359b6d8e0c98f4b7f00f7bd90efc72c2aa3865a7
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-13 18:22:30 -07:00
Linux Build Service Account 6d856ad7a7 Merge "regulator: cpr-regulator: reduce the minimum allowed quotient difference" 2014-10-12 11:50:38 -07:00
Fenglin Wu 3df0a8ff99 regulator: cpr-regulator: add support for all possible quotient scaling
Add support for CPR target quotient scaling for the virtual
corners between all adjacent pairs of fuse corners.  Currently
target quotient scaling only occurs for the virtual corners that
fall between the highest and second highest fuse corners.

This modification ensures that further power savings are
possible on boards that have multiple virtual corners associated
with the lower fuse corners.

Change-Id: I078f32557531ffb8305d8e7e8225658da821aef4
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-08 14:21:48 -07:00
David Collins 378a8065c5 regulator: cpr-regulator: correctly round open-loop voltage values
Ensure that all per-virtual-corner open-loop voltage values are
rounded up to the nearest supported regulator set point.

Change-Id: Id2bbb71f525f058f6bf49aa957dc70bed7c4be2c
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-08 13:33:48 -07:00
David Collins 21e8ae1775 regulator: cpr-regulator: fill OPP table with corner to open-loop voltage
Use linear interpolation of frequencies to calculate the CPR
open-loop voltage for each virtual voltage corner.  Fill an
operating point table associated with the regulator device with
<virtual corner, open loop voltage> pairs.

The open-loop voltage values are used as initial voltages when
CPR is enabled.  They are also used all the time when CPR is
disabled.

Change-Id: I424ee8a6178e85525601a9d24d161e602ac602f9
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-06 16:11:30 -06:00
David Collins c647178223 regulator: cpr-regulator: reduce the minimum allowed quotient difference
Reduce the minimum CPR target quotient difference allowed between
the highest and second highest fuse corners from 100 to 50.  This
ensures that CPR stays enabled for VDD_APC1 on MSM8994v2.  The
CPR ring oscillators used for VDD_APC1 on MSM8994v2 output low
values.  Therefore, the difference between the Turbo and Nominal
target quotient fuse values may legitimately be less than 100.

Change-Id: Ia662dd05f3af9148a63298900970cdb0c0824c50
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-10-03 14:55:05 -07:00
David Collins 73919a5f21 regulator: cpr-regulator: add support for per-virtual-corner voltage limits
Add support for per-virtual-corner ceiling and floor voltage
limits to be specified via device tree.  These limits override
the required per-fuse-corner limits also specified via device
tree.

Specifying per-virtual-corner floor voltages allows for further
power savings on chips which can safely operate at lower voltages
for the lower CPU frequenices associated with a given fuse
corner.

Change-Id: I3712bb34a55155780445cbecbd5190e2da31c35a
CRs-Fixed: 721967
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-09-26 13:44:55 -07:00
David Collins 1a279f0c66 regulator: cpr-regulator: log up and down threshold values
Print the CPR up and down threshold values into the kernel log so
that it is easy to verify that a given device is utilizing
correct values.

Change-Id: Ib690918cda16e72ea77df40e6f0b425bc9c35580
CRs-Fixed: 723371
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-09-11 15:36:24 -07:00
Vikram Mulukutla 4f6308620c drivers: regulator: cpr-regulator: Add support for the new scm_call2 API
The scm library has added support for a new secure world
interface that is more aligned to the ARMv8 SMC calling
convention. Use the new API while maintaining backward
compatibility.

Change-Id: I9e93d2120d91a014da244dd1291eaa941235c4a8
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
2014-08-22 15:33:12 -07:00
David Collins ed37f85190 regulator: cpr-regulator: fix of_property_read_bool() usage
The function of_property_read_bool() is used in several places
in the cpr-regulator driver to test for the existence of
non-boolean device tree properties.  These calls will work as
expected; however, of_property_read_bool() is only meant to be
used for reading boolean device tree properties.

Replace all usages of of_property_read_bool() which test for
non-boolean property existence with of_find_property().

Change-Id: Icafaa209443d9fd24b5bbbc023c1fb70f9928249
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-08-04 17:07:04 -07:00
David Collins b577004d38 regulator: cpr-regulator: remove unnecessary pointer checks in callbacks
Remove cpr_vreg pointer NULL checks in cpr-regulator debugfs
callback functions.  The cpr_vreg pointer is guaranteed to be
valid in these callback functions so there is no need to check
it.  Additionally, the print statements inside of the NULL checks
where incorrectly referencing cpr_vreg after it was known to be
NULL.

Change-Id: Id2efd9f28f97ce448fd86f03922ca2cfd63173a8
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-29 17:16:40 -07:00
David Collins 93192a1b84 regulator: cpr-regulator: use debug log level for ISR unknown flag message
Change the cpr-regulator interrupt handler log message that is
printed if an unknown IRQ status bit is set from err to debug
log level.  This message is printed in the case that software
changes the voltage corner of a cpr-regulator device during the
interval between when a CPR interrupt physically triggers and
when the handler for it is executed.  Since this behavior does
not correspond to an error case, the message should only be
printed for debugging purposes.

Change-Id: Ib1a00e456186586e1ccd025a817bf60b04f59745
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-22 14:46:50 -07:00
David Collins ae00a3088e regulator: cpr-regulator: disable all debug printing by default
Recent targets trigger many CPR interrupts while in steady state.
This results in a huge amount of noise in the kernel log since
CPR interrupt messages are printed by default.  Change the
default behavior so that no CPR debug messages are printed.

It is still possible to re-enable cpr-regulator debug printing
at runtime from userspace if necessary.

Change-Id: I24227c08c27e1039278a36d758463bcdd78b93aa
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-17 12:58:17 -07:00
David Collins 35924314ed regulator: cpr-regulator: define quotient scaling usage without speed bin
Explicitly define the values to use for the
qcom,cpr-speed-bin-max-corners device tree property in order to
support CPR target quotient scaling when no speed bin fuse is
present.

Change-Id: Ibb7ce486402b0d4a24e4862ccd68d91ad938465e
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-17 12:58:15 -07:00
David Collins 02e36442ca regulator: cpr-regulator: print regulator name in all log messages
Update all kernel log printing statements in the cpr-regulator
driver so that they include the name of the regulator that the
message corresponds to.  This ensures that it is possible to
distinguish messages generated by different regulator devices on
boards that have more than one cpr-regulator device.

Change-Id: I84c7a85ce98375e450a65a3623d407a626324cfe
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-08 11:51:42 -07:00
Linux Build Service Account 5f790c5663 Merge "regulator: cpr-regulator: do not enable CPR if vreg_enable is false" 2014-07-03 21:10:09 -07:00
Linux Build Service Account a3917c7ca7 Merge "regulator: cpr-regulator: correct corner handling in cpr_regulator_enable" 2014-07-03 21:10:08 -07:00
David Collins 1f247be454 regulator: cpr-regulator: do not enable CPR if vreg_enable is false
Modify the cpr-regulator driver so that CPR is not enabled (i.e.
LOOP_EN set to 1) in the case that vreg_enable is false.  At the
same time, move vreg_enable setting statements inside of mutex
protected blocks in order to avoid race conditions between the
debugfs, regulator, and suspend/resume call paths.

If CPR is enabled while vreg_enable is false, then unexpected CPR
interrupts will likely fire due to the physical APC voltage not
matching the logical value.  The physical APC voltage is only
guaranteed to change after the enable callback is called at which
point vreg_enable is set to true.

Change-Id: I1cff2db1d0527f6675d7592a64ed6303da6dcacf
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-02 15:51:20 -07:00
David Collins 940f6990f0 regulator: cpr-regulator: correct corner handling in cpr_regulator_enable
Modify the cpr-regulator driver so that cpr_corner_restore() is
called in place of cpr_corner_switch() in the
cpr_regulator_enable() function.  This is needed because the
cpr_corner_switch() call will always have no effect since the
corner value passed in is cpr_vreg->corner.  By not updating the
corner related register values, it is possible to get stuck in a
situation where CPR is enabled for a corner but the target
quotient being used corresponds to a different corner.  If the
new corner is supposed to have a higher target quotient than the
previous corner, then this situation can result in a crash due to
undervolting the processor.

Change-Id: I4f7192a187641e140062ebea72c4c62edddc6421
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-02 15:51:20 -07:00
David Collins 0335113fc2 regulator: cpr-regulator: add support for clamp timer interval control
Update the cpr-regulator driver so that the clamp timer interval
register parameter can be configured for a given cpr-regulator
device via the qcom,cpr-clamp-timer-interval device tree
property.  The clamp timer interval defines a delay to wait with
the CPR controller loop disabled after the CPU clamp signal
changes or a new sensor bypass or mask register value is written.

A non-zero clamp timer interval value can be used to handle
resetting CPR sensors that are disabled on processors that make
use of BHS type switches for power collapsing.

A side effect of using a non-zero clamp timer interval value is
that software will not be able to determine the error or
error_steps values associated with a given CPR up or down
recommendation.

Change-Id: Ied5d689848d042ee60488f5001b0ca267627497a
CRs-Fixed: 687809
Signed-off-by: David Collins <collinsd@codeaurora.org>
2014-07-01 17:26:48 -07:00
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 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
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
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
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