Commit d4c7c5c9 authored by Damien Riegel's avatar Damien Riegel Committed by Dmitry Torokhov

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: default avatarDamien Riegel <damien.riegel@savoirfairelinux.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 2de3b704
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -26,6 +27,9 @@ ...@@ -26,6 +27,9 @@
#define MAX_FF_SPEED 0xff #define MAX_FF_SPEED 0xff
struct pm8xxx_regs { struct pm8xxx_regs {
unsigned int enable_addr;
unsigned int enable_mask;
unsigned int drv_addr; unsigned int drv_addr;
unsigned int drv_mask; unsigned int drv_mask;
unsigned int drv_shift; unsigned int drv_shift;
...@@ -82,7 +86,12 @@ static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on) ...@@ -82,7 +86,12 @@ static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on)
return rc; return rc;
vib->reg_vib_drv = val; 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;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment