backlight: qcom-spmi-wled: update check for OVP fault in probe

When OVP fault is detected during WLED driver probe, SW first needs to
confirm that OVP event is sustained over a minimum time duration
before fixing it. After reading fault status and seeing OVP is set,
add time delay equal to OVP_INT_TIMER value, and ensure OVP fault
is still seen, before running auto calibration algorithm.

Change-Id: I4fbc75fa1f63af53fe2e1b5298e0e277cc8a74b8
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
This commit is contained in:
Jishnu Prakash 2021-02-17 16:32:09 +05:30 • committed by Gerrit - the friendly Code Review server
commit 0e83ac3b49

View file

@ -990,7 +990,7 @@ static bool wled_auto_cal_required(struct wled *wled)
static int wled_auto_calibrate_at_init(struct wled *wled)
{
int rc;
int rc, delay_time_us;
bool fault_set;
if (!wled->cfg.auto_calib_enabled)
@ -1003,6 +1003,23 @@ static int wled_auto_calibrate_at_init(struct wled *wled)
}
if (fault_set) {
wled_get_ovp_delay(wled, &delay_time_us);
if (delay_time_us < 20000)
usleep_range(delay_time_us, delay_time_us + 1000);
else
msleep(delay_time_us / 1000);
rc = wled_get_ovp_fault_status(wled, &fault_set);
if (rc < 0) {
pr_err("Error in getting OVP fault_sts, rc=%d\n", rc);
return rc;
}
if (!fault_set) {
pr_debug("WLED OVP fault cleared, not running auto calibration\n");
return rc;
}
mutex_lock(&wled->lock);
rc = wled_auto_calibrate(wled);
mutex_unlock(&wled->lock);