summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubbaraman Narayanamurthy <subbaram@codeaurora.org>2016-10-25 16:40:39 -0700
committerSubbaraman Narayanamurthy <subbaram@codeaurora.org>2016-10-25 20:32:59 -0700
commitec38ffc845936cdb5d51f9f16dd48294bfce6d40 (patch)
tree186180aa6081715eb4f7040fd77b9946a8890dbb
parent71d0b505608b8838935e7df68a7c955f814c3c8f (diff)
leds: qpnp-flash-v2: fix safety timer configuration
Safety timer is using an offset of 1ms whereas it should use 10ms. Fix the calculation to configure safety timer properly. CRs-Fixed: 1076402 Change-Id: If06c421c559277066cf9ffd86e71fe366ab7bf8d Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
-rw-r--r--drivers/leds/leds-qpnp-flash-v2.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/leds/leds-qpnp-flash-v2.c b/drivers/leds/leds-qpnp-flash-v2.c
index 6bf3761d1ac9..325bdb35e8a3 100644
--- a/drivers/leds/leds-qpnp-flash-v2.c
+++ b/drivers/leds/leds-qpnp-flash-v2.c
@@ -83,6 +83,7 @@
#define VPH_DROOP_THRESH_VAL_TO_UV(val) ((val + 25) * 100000)
#define MITIGATION_THRSH_MA_TO_VAL(val_ma) (val_ma / 100)
#define CURRENT_MA_TO_REG_VAL(curr_ma, ires_ua) ((curr_ma * 1000) / ires_ua - 1)
+#define SAFETY_TMR_TO_REG_VAL(duration_ms) ((duration_ms / 10) - 1)
#define FLASH_LED_ISC_WARMUP_DELAY_SHIFT 6
#define FLASH_LED_WARMUP_DELAY_DEFAULT 2
@@ -98,8 +99,6 @@
#define FLASH_LED_VLED_MAX_DEFAULT_UV 3500000
#define FLASH_LED_IBATT_OCP_THRESH_DEFAULT_UA 4500000
#define FLASH_LED_RPARA_DEFAULT_UOHM 0
-#define FLASH_LED_SAFETY_TMR_VAL_OFFSET 1
-#define FLASH_LED_SAFETY_TMR_VAL_DIVISOR 10
#define FLASH_LED_SAFETY_TMR_ENABLE BIT(7)
#define FLASH_LED_LMH_LEVEL_DEFAULT 0
#define FLASH_LED_LMH_MITIGATION_ENABLE 1
@@ -1343,9 +1342,7 @@ static int qpnp_flash_led_parse_each_led_dt(struct qpnp_flash_led *led,
fnode->duration = FLASH_LED_SAFETY_TMR_DISABLED;
rc = of_property_read_u32(node, "qcom,duration-ms", &val);
if (!rc) {
- fnode->duration = (u8)(((val -
- FLASH_LED_SAFETY_TMR_VAL_OFFSET) /
- FLASH_LED_SAFETY_TMR_VAL_DIVISOR) |
+ fnode->duration = (u8)(SAFETY_TMR_TO_REG_VAL(val) |
FLASH_LED_SAFETY_TMR_ENABLE);
} else if (rc == -EINVAL) {
if (fnode->type == FLASH_LED_TYPE_FLASH) {