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>
#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>
#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;
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;
}
/**