Skip to content

Commit

Permalink
input: misc: qcom-spmi-haptics: add support for ERM haptics
Browse files Browse the repository at this point in the history
Add support for ERM haptics and DIRECT play mode.

Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
  • Loading branch information
barni2000 committed Nov 19, 2024
1 parent 72bca26 commit 17c6805
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/input/misc/qcom-spmi-haptics.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,11 @@ static int spmi_haptics_write_play_rate(struct spmi_haptics *haptics, u16 play_r
*/
static int spmi_haptics_set_auto_res(struct spmi_haptics *haptics, bool enable)
{
u8 val;
u8 val = 0;

if (haptics->actuator_type == HAP_TYPE_ERM)
return spmi_haptics_write(haptics, haptics->base + HAP_LRA_AUTO_RES_REG,
&val, 1);

// LRAs are the only type to support auto res
if (haptics->actuator_type != HAP_TYPE_LRA)
Expand Down Expand Up @@ -817,23 +821,21 @@ static int spmi_haptics_probe(struct platform_device *pdev)
goto register_fail;
}

// We only support LRAs for now
haptics->actuator_type = HAP_TYPE_LRA;
ret = of_property_read_u32(node, "qcom,actuator-type", &val);
if (!ret) {
if (val != HAP_TYPE_LRA) {
if (val != HAP_TYPE_ERM && val != HAP_TYPE_LRA) {
dev_err(&pdev->dev, "qcom,actuator-type (%d) isn't supported\n", val);
ret = -EINVAL;
goto register_fail;
}
haptics->actuator_type = val;
}

// Only buffer mode is currently supported
haptics->play_mode = HAP_PLAY_BUFFER;
ret = of_property_read_u32(node, "qcom,play-mode", &val);
if (!ret) {
if (val != HAP_PLAY_BUFFER) {
if (val != HAP_PLAY_BUFFER && val != HAP_PLAY_DIRECT) {
dev_err(&pdev->dev, "qcom,play-mode (%d) isn't supported\n", val);
ret = -EINVAL;
goto register_fail;
Expand Down

0 comments on commit 17c6805

Please sign in to comment.