msm: qpnp-haptic: update play sequence for QWD mode

Haptic auto resonance mode QWD (Quarter Wave Drive) requires
auto resonance to be disabled before getting played. And it has
be enabled back after waiting for 20ms to provide correct
resonance to the motor.

Change-Id: Iacd1ab311500cc4d87ff76de2d74dda45c18997d
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
This commit is contained in:
Mohan Pallaka 2015-07-27 15:51:24 -07:00 committed by Gerrit - the friendly Code Review server
parent c69a4a60de
commit bb2d2f38ce
2 changed files with 17 additions and 6 deletions

View File

@ -61,9 +61,14 @@ Optional properties when qcom,actuator-type is "lra"
"qwd" : quarter wave drive method
"max-qwd" : Maximum QWD
"zxd-eop" : ZXD + End of pattern (This is the Default)
- qcom,lra-high-z : High Z configuration for auto resonance. Possible string values are
"none", "opt1", "opt2" and "opt3" (default)
- qcom,lra-res-cal-period : Auto resonance calibration period. The values range from
4 to 32(default)
Example:
qcom,haptic@c000 {
status = "disabled";
compatible = "qcom,qpnp-haptic";
reg = <0xc000 0x100>;
interrupts = <0x3 0xc0 0x0>,
@ -84,5 +89,7 @@ Example:
qcom,wave-samples = [3e 3e 3e 3e 3e 3e 3e 3e];
qcom,wave-rep-cnt = <1>;
qcom,wave-samp-rep-cnt = <1>;
qcom,lra-auto-res-mode = "zxd";
qcom,lra-high-z = "opt1";
qcom,lra-auto-res-mode = "qwd";
qcom,lra-res-cal-period = <4>;
};

View File

@ -1484,24 +1484,28 @@ static int qpnp_hap_set(struct qpnp_hap *hap, int on)
} else if (hap->play_mode == QPNP_HAP_BUFFER ||
hap->play_mode == QPNP_HAP_DIRECT) {
if (on) {
if (hap->correct_lra_drive_freq ||
hap->auto_res_mode == QPNP_HAP_AUTO_RES_QWD)
qpnp_hap_auto_res_enable(hap, 0);
rc = qpnp_hap_mod_enable(hap, on);
if (rc < 0)
return rc;
if (hap->correct_lra_drive_freq)
qpnp_hap_auto_res_enable(hap, 0);
rc = qpnp_hap_play(hap, on);
if (hap->act_type == QPNP_HAP_LRA &&
hap->correct_lra_drive_freq) {
(hap->correct_lra_drive_freq ||
hap->auto_res_mode == QPNP_HAP_AUTO_RES_QWD)) {
usleep_range(AUTO_RES_ENABLE_TIMEOUT,
(AUTO_RES_ENABLE_TIMEOUT + 1));
rc = qpnp_hap_auto_res_enable(hap, 1);
if (rc < 0)
return rc;
}
if (hap->act_type == QPNP_HAP_LRA &&
hap->correct_lra_drive_freq) {
/*
* Start timer to poll Auto Resonance error bit
*/