]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Input: drv260x - add check for ERM mode and LRA Libraries
authorDan Murphy <dmurphy@ti.com>
Tue, 26 Aug 2014 22:36:55 +0000 (15:36 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 26 Aug 2014 22:42:03 +0000 (15:42 -0700)
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.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/drv260x.c

index a7a19e68f4a7b1a9873206b853e77307b7dd3077..cab87f5ce6d377d5686937e9025eb3782f85d79e 100644 (file)
@@ -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);