diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-08-08 09:02:09 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-08-08 09:02:09 -0700 |
| commit | 6f1a42cbc9806578ce38353eea21fa74cc3ba306 (patch) | |
| tree | c62e11c96063e63c1c728a6f1ae5269d8a983a88 /drivers/soc | |
| parent | a42bc74491c288eeb1ee18646b7f781a36392464 (diff) | |
| parent | 7eb49b32510798f8cafa2f927192d2ad32de925a (diff) | |
Merge "qcom: qpnp-haptic: Disable haptics when enable time specified is zero"
Diffstat (limited to 'drivers/soc')
| -rw-r--r-- | drivers/soc/qcom/qpnp-haptic.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/soc/qcom/qpnp-haptic.c b/drivers/soc/qcom/qpnp-haptic.c index d86f8671705a..38cc86963181 100644 --- a/drivers/soc/qcom/qpnp-haptic.c +++ b/drivers/soc/qcom/qpnp-haptic.c @@ -2233,13 +2233,23 @@ static void qpnp_hap_td_enable(struct timed_output_dev *dev, int time_ms) timed_dev); int rc; - if (time_ms <= 0) + if (time_ms < 0) return; + mutex_lock(&hap->lock); + + if (time_ms == 0) { + /* disable haptics */ + hrtimer_cancel(&hap->hap_timer); + hap->state = 0; + schedule_work(&hap->work); + mutex_unlock(&hap->lock); + return; + } + if (time_ms < 10) time_ms = 10; - mutex_lock(&hap->lock); if (is_sw_lra_auto_resonance_control(hap)) hrtimer_cancel(&hap->auto_res_err_poll_timer); |
