kernel: driver/vibrator: diff vol for long/short vib
This is a workarround to reduce the vibrator strength for long vib. Add attribute "qcom,vib-dis-short-long" in device-tree to enable the function. Now it is applied in caprip product. Change-Id: I41c04e0dfb14c184f999d7d0a4121c10dd763cd5 Signed-off-by: panzh2 <panzh2@lenovo.com> Reviewed-on: https://gerrit.mot.com/1805268 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Wang Wang <wangwang1@lenovo.com> Submit-Approved: Jira Key
This commit is contained in:
1 parent
f043cb1d82
commit
4ca15142c9
1 file changed
+34
@@ -54,6 +54,10 @@ struct vib_ldo_chip {
|
||||
u64 vib_play_ms;
|
||||
bool vib_enabled;
|
||||
bool disable_overdrive;
|
||||
|
||||
bool dis_short_long;
|
||||
int dis_long_ms;
|
||||
int vmax_uV_long;
|
||||
};
|
||||
|
||||
static inline int qpnp_vib_ldo_poll_status(struct vib_ldo_chip *chip)
|
||||
@@ -144,6 +148,13 @@ static int qpnp_vibrator_play_on(struct vib_ldo_chip *chip)
|
||||
int ret;
|
||||
|
||||
volt_uV = chip->vmax_uV;
|
||||
if (chip->dis_short_long) {
|
||||
pr_warn("vib in dis short and long, play ms=%d, dis_longms=%d, vmax_uV=%d, vmax_uV_long=%d\n",
|
||||
chip->vib_play_ms, chip->dis_long_ms, chip->vmax_uV, chip->vmax_uV_long);
|
||||
if (chip->vib_play_ms > chip->dis_long_ms) {
|
||||
volt_uV = chip->vmax_uV_long;
|
||||
}
|
||||
}
|
||||
if (!chip->disable_overdrive)
|
||||
volt_uV = chip->overdrive_volt_uV ? chip->overdrive_volt_uV
|
||||
: min(chip->vmax_uV * 2, QPNP_VIB_LDO_VMAX_UV);
|
||||
@@ -386,6 +397,29 @@ static int qpnp_vib_parse_dt(struct device *dev, struct vib_ldo_chip *chip)
|
||||
return ret;
|
||||
}
|
||||
|
||||
chip->dis_short_long = of_property_read_bool(dev->of_node,
|
||||
"qcom,vib-dis-short-long");
|
||||
if (chip->dis_short_long) {
|
||||
pr_warn("read dis_short_long true");
|
||||
ret = of_property_read_u32(dev->of_node, "qcom,vib-dis-short-long-val",
|
||||
&chip->dis_long_ms);
|
||||
if (ret < 0) {
|
||||
pr_err("qcom,vib-dis-short-long-val property read failed, ret=%d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
pr_warn("read dis_long_ms=%d\n", chip->dis_long_ms);
|
||||
|
||||
ret = of_property_read_u32(dev->of_node, "qcom,vib-ldo-volt-uv-long",
|
||||
&chip->vmax_uV_long);
|
||||
if (ret < 0) {
|
||||
pr_err("qcom,vib-ldo-volt-uv-long property read failed, ret=%d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
pr_warn("read vmax_uV_long=%d\n", chip->vmax_uV_long);
|
||||
}
|
||||
|
||||
chip->disable_overdrive = of_property_read_bool(dev->of_node,
|
||||
"qcom,disable-overdrive");
|
||||
|
||||
|
||||
Reference in new issue
Block a user