Lines Matching refs:vib
74 static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on) in pm8xxx_vib_set() argument
77 unsigned int val = vib->reg_vib_drv; in pm8xxx_vib_set()
78 const struct pm8xxx_regs *regs = vib->regs; in pm8xxx_vib_set()
81 val |= (vib->level << regs->drv_shift) & regs->drv_mask; in pm8xxx_vib_set()
85 rc = regmap_write(vib->regmap, regs->drv_addr, val); in pm8xxx_vib_set()
89 vib->reg_vib_drv = val; in pm8xxx_vib_set()
92 rc = regmap_update_bits(vib->regmap, regs->enable_addr, in pm8xxx_vib_set()
104 struct pm8xxx_vib *vib = container_of(work, struct pm8xxx_vib, work); in pm8xxx_work_handler() local
105 const struct pm8xxx_regs *regs = vib->regs; in pm8xxx_work_handler()
109 rc = regmap_read(vib->regmap, regs->drv_addr, &val); in pm8xxx_work_handler()
117 if (vib->speed) { in pm8xxx_work_handler()
118 vib->active = true; in pm8xxx_work_handler()
119 vib->level = ((VIB_MAX_LEVELS * vib->speed) / MAX_FF_SPEED) + in pm8xxx_work_handler()
121 vib->level /= 100; in pm8xxx_work_handler()
123 vib->active = false; in pm8xxx_work_handler()
124 vib->level = VIB_MIN_LEVEL_mV / 100; in pm8xxx_work_handler()
127 pm8xxx_vib_set(vib, vib->active); in pm8xxx_work_handler()
138 struct pm8xxx_vib *vib = input_get_drvdata(dev); in pm8xxx_vib_close() local
140 cancel_work_sync(&vib->work); in pm8xxx_vib_close()
141 if (vib->active) in pm8xxx_vib_close()
142 pm8xxx_vib_set(vib, false); in pm8xxx_vib_close()
156 struct pm8xxx_vib *vib = input_get_drvdata(dev); in pm8xxx_vib_play_effect() local
158 vib->speed = effect->u.rumble.strong_magnitude >> 8; in pm8xxx_vib_play_effect()
159 if (!vib->speed) in pm8xxx_vib_play_effect()
160 vib->speed = effect->u.rumble.weak_magnitude >> 9; in pm8xxx_vib_play_effect()
162 schedule_work(&vib->work); in pm8xxx_vib_play_effect()
169 struct pm8xxx_vib *vib; in pm8xxx_vib_probe() local
175 vib = devm_kzalloc(&pdev->dev, sizeof(*vib), GFP_KERNEL); in pm8xxx_vib_probe()
176 if (!vib) in pm8xxx_vib_probe()
179 vib->regmap = dev_get_regmap(pdev->dev.parent, NULL); in pm8xxx_vib_probe()
180 if (!vib->regmap) in pm8xxx_vib_probe()
187 INIT_WORK(&vib->work, pm8xxx_work_handler); in pm8xxx_vib_probe()
188 vib->vib_input_dev = input_dev; in pm8xxx_vib_probe()
193 error = regmap_read(vib->regmap, regs->drv_addr, &val); in pm8xxx_vib_probe()
198 error = regmap_write(vib->regmap, regs->drv_addr, val); in pm8xxx_vib_probe()
202 vib->regs = regs; in pm8xxx_vib_probe()
203 vib->reg_vib_drv = val; in pm8xxx_vib_probe()
208 input_set_drvdata(input_dev, vib); in pm8xxx_vib_probe()
209 input_set_capability(vib->vib_input_dev, EV_FF, FF_RUMBLE); in pm8xxx_vib_probe()
225 platform_set_drvdata(pdev, vib); in pm8xxx_vib_probe()
231 struct pm8xxx_vib *vib = dev_get_drvdata(dev); in pm8xxx_vib_suspend() local
234 pm8xxx_vib_set(vib, false); in pm8xxx_vib_suspend()