summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDamien Riegel <damien.riegel@savoirfairelinux.com>2017-04-05 02:27:36 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-05 18:52:38 +0300
commitd4c7c5c96c9254017a1aff596a1f43b5bcef7bef (patch)
tree103c5c926f265c3debb18f5df68dbd3e71eae200 /drivers/input
parent2de3b7048d029fef8f5c25faa1483f5e66402e49 (diff)
downloadlinux-d4c7c5c96c9254017a1aff596a1f43b5bcef7bef.tar.xz
Input: pm8xxx-vib - handle separate enable register
Some PMIC vibrator IPs use a separate enable register to turn the vibrator on and off. To detect if a vibrator uses this feature, rely on the enable_mask being non-zero. Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/pm8xxx-vibrator.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
index cf94fa3f5f2e..3dc8ffbc6b9d 100644
--- a/drivers/input/misc/pm8xxx-vibrator.c
+++ b/drivers/input/misc/pm8xxx-vibrator.c
@@ -14,6 +14,7 @@
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
@@ -26,6 +27,9 @@
#define MAX_FF_SPEED 0xff
struct pm8xxx_regs {
+ unsigned int enable_addr;
+ unsigned int enable_mask;
+
unsigned int drv_addr;
unsigned int drv_mask;
unsigned int drv_shift;
@@ -82,7 +86,12 @@ static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on)
return rc;
vib->reg_vib_drv = val;
- return 0;
+
+ if (regs->enable_mask)
+ rc = regmap_update_bits(vib->regmap, regs->enable_addr,
+ on ? regs->enable_mask : 0, val);
+
+ return rc;
}
/**