msm: thermal: Add VDD restriction for low temperature conditions

Restrict voltage for key MSM rails when the temperature falls below
the specified low temperature value. Increasing rail voltage is
necessary for timing closure at lower temperatures. MSMs are generally
characterized for nominal temperatures and to prevent failures in extreme
low temperature conditions, increase the voltage of the rails.

During boot, a polling thread will check the temperature for all temp
sensors, as long as one sensor is below threshold, vdd restriction will
be enabled. If all temp sensors are above threshold hysteresis, vdd
restriction will be disabled.

New device nodes were added as below:
sys/module/msm_thermal/vdd_restriction/enabled
                                      /vdd_dig/level
                                              /value
When enabled is set to 1, it will set the vdd restriction for all
regulators to level 0 by default. vdd_dig represents the key MSM rail
name which is defined in device tree. level can be read or write
while value is read only.

When enabled is set to 0, it will relax the vdd restriction by setting
regulators to the min level defined in device tree. level will return
-1, and value will also return -1.

When regulator failed to get a handle from pmic, level will return -2
, and value will also return -2.

Change-Id: I81caa152b75fc49dbac51ec98c5a51933eedcc69
Signed-off-by: Jennifer Liu <chihning@codeaurora.org>
3 files changed