Skip to contentSkip to conversation

input: misc: drv260x: add check for ERM mode and LRA Libraries

PATCH Applied Dan Murphy 2 participants 2 messages Aug 22, 2014 – Aug 26, 2014

Subsystems (2)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/1 input: misc: drv260x: add check for ERM mode and LRA Libraries

Add a check to ensure that LRA libraries are not mixed with the ERM mode.

If ERM mode and the Library is empty "OR" the
LRA library then exit.

As the LRA and empty libraries are not applicable for the ERM actuator.

---
 drivers/input/misc/drv260x.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/input/misc/drv260x.c +8 -0
index a7a19e6..d6a26a7 100644
@@ -564,6 +564,14 @@ static int drv260x_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
+	if (haptics->mode == DRV260X_ERM_MODE &&
+	    haptics->library == DRV260X_LIB_EMPTY ||
+	    haptics->library == DRV260X_LIB_LRA) {
+		dev_err(&client->dev,
+			"ERM Mode with LRA Library mismatch\n");
+		return -EINVAL;
+	}
+
 	haptics->regulator = devm_regulator_get(&client->dev, "vbat");
 	if (IS_ERR(haptics->regulator)) {
 		error = PTR_ERR(haptics->regulator);
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw
Quoted 10 lines · Dan Murphy

Add a check to ensure that LRA libraries are not mixed with the ERM mode.

If ERM mode and the Library is empty "OR" the
LRA library then exit.

As the LRA and empty libraries are not applicable for the ERM actuator.

Applied, thank you.

Quoted 26 lines
---
 drivers/input/misc/drv260x.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/input/misc/drv260x.c +8 -0
index a7a19e6..d6a26a7 100644
@@ -564,6 +564,14 @@ static int drv260x_probe(struct i2c_client *client,
 		return -EINVAL;
 	}
 
+	if (haptics->mode == DRV260X_ERM_MODE &&
+	    haptics->library == DRV260X_LIB_EMPTY ||
+	    haptics->library == DRV260X_LIB_LRA) {
+		dev_err(&client->dev,
+			"ERM Mode with LRA Library mismatch\n");
+		return -EINVAL;
+	}
+
 	haptics->regulator = devm_regulator_get(&client->dev, "vbat");
 	if (IS_ERR(haptics->regulator)) {
 		error = PTR_ERR(haptics->regulator);
Signature · 1 line
1.7.9.5
Signature · 1 line
Dmitry