Lines Matching refs:info
55 struct vibra_info *info = data; in twl6040_vib_irq_handler() local
56 struct twl6040 *twl6040 = info->twl6040; in twl6040_vib_irq_handler()
61 dev_warn(info->dev, "Left Vibrator overcurrent detected\n"); in twl6040_vib_irq_handler()
66 dev_warn(info->dev, "Right Vibrator overcurrent detected\n"); in twl6040_vib_irq_handler()
74 static void twl6040_vibra_enable(struct vibra_info *info) in twl6040_vibra_enable() argument
76 struct twl6040 *twl6040 = info->twl6040; in twl6040_vibra_enable()
79 ret = regulator_bulk_enable(ARRAY_SIZE(info->supplies), info->supplies); in twl6040_vibra_enable()
81 dev_err(info->dev, "failed to enable regulators %d\n", ret); in twl6040_vibra_enable()
85 twl6040_power(info->twl6040, 1); in twl6040_vibra_enable()
104 info->enabled = true; in twl6040_vibra_enable()
107 static void twl6040_vibra_disable(struct vibra_info *info) in twl6040_vibra_disable() argument
109 struct twl6040 *twl6040 = info->twl6040; in twl6040_vibra_disable()
113 twl6040_power(info->twl6040, 0); in twl6040_vibra_disable()
115 regulator_bulk_disable(ARRAY_SIZE(info->supplies), info->supplies); in twl6040_vibra_disable()
117 info->enabled = false; in twl6040_vibra_disable()
144 static void twl6040_vibra_set_effect(struct vibra_info *info) in twl6040_vibra_set_effect() argument
146 struct twl6040 *twl6040 = info->twl6040; in twl6040_vibra_set_effect()
151 volt = regulator_get_voltage(info->supplies[0].consumer) / 1000; in twl6040_vibra_set_effect()
152 vibdatl = twl6040_vibra_code(volt, info->vibldrv_res, in twl6040_vibra_set_effect()
153 info->viblmotor_res, in twl6040_vibra_set_effect()
154 info->weak_speed, info->direction); in twl6040_vibra_set_effect()
157 volt = regulator_get_voltage(info->supplies[1].consumer) / 1000; in twl6040_vibra_set_effect()
158 vibdatr = twl6040_vibra_code(volt, info->vibrdrv_res, in twl6040_vibra_set_effect()
159 info->vibrmotor_res, in twl6040_vibra_set_effect()
160 info->strong_speed, info->direction); in twl6040_vibra_set_effect()
168 struct vibra_info *info = container_of(work, in vibra_play_work() local
173 ret = twl6040_get_vibralr_status(info->twl6040); in vibra_play_work()
175 dev_info(info->dev, "Vibra is configured for audio\n"); in vibra_play_work()
179 if (info->weak_speed || info->strong_speed) { in vibra_play_work()
180 if (!info->enabled) in vibra_play_work()
181 twl6040_vibra_enable(info); in vibra_play_work()
183 twl6040_vibra_set_effect(info); in vibra_play_work()
184 } else if (info->enabled) in vibra_play_work()
185 twl6040_vibra_disable(info); in vibra_play_work()
192 struct vibra_info *info = input_get_drvdata(input); in vibra_play() local
194 info->weak_speed = effect->u.rumble.weak_magnitude; in vibra_play()
195 info->strong_speed = effect->u.rumble.strong_magnitude; in vibra_play()
196 info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; in vibra_play()
198 schedule_work(&info->play_work); in vibra_play()
205 struct vibra_info *info = input_get_drvdata(input); in twl6040_vibra_close() local
207 cancel_work_sync(&info->play_work); in twl6040_vibra_close()
209 if (info->enabled) in twl6040_vibra_close()
210 twl6040_vibra_disable(info); in twl6040_vibra_close()
216 struct vibra_info *info = platform_get_drvdata(pdev); in twl6040_vibra_suspend() local
218 cancel_work_sync(&info->play_work); in twl6040_vibra_suspend()
220 if (info->enabled) in twl6040_vibra_suspend()
221 twl6040_vibra_disable(info); in twl6040_vibra_suspend()
233 struct vibra_info *info; in twl6040_vibra_probe() local
245 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in twl6040_vibra_probe()
246 if (!info) { in twl6040_vibra_probe()
252 info->dev = &pdev->dev; in twl6040_vibra_probe()
254 info->twl6040 = dev_get_drvdata(pdev->dev.parent); in twl6040_vibra_probe()
257 &info->vibldrv_res); in twl6040_vibra_probe()
259 &info->vibrdrv_res); in twl6040_vibra_probe()
261 &info->viblmotor_res); in twl6040_vibra_probe()
263 &info->vibrmotor_res); in twl6040_vibra_probe()
269 if ((!info->vibldrv_res && !info->viblmotor_res) || in twl6040_vibra_probe()
270 (!info->vibrdrv_res && !info->vibrmotor_res)) { in twl6040_vibra_probe()
271 dev_err(info->dev, "invalid vibra driver/motor resistance\n"); in twl6040_vibra_probe()
275 info->irq = platform_get_irq(pdev, 0); in twl6040_vibra_probe()
276 if (info->irq < 0) in twl6040_vibra_probe()
279 error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, in twl6040_vibra_probe()
282 "twl6040_irq_vib", info); in twl6040_vibra_probe()
284 dev_err(info->dev, "VIB IRQ request failed: %d\n", error); in twl6040_vibra_probe()
288 info->supplies[0].supply = "vddvibl"; in twl6040_vibra_probe()
289 info->supplies[1].supply = "vddvibr"; in twl6040_vibra_probe()
295 ARRAY_SIZE(info->supplies), in twl6040_vibra_probe()
296 info->supplies); in twl6040_vibra_probe()
298 dev_err(info->dev, "couldn't get regulators %d\n", error); in twl6040_vibra_probe()
303 error = regulator_set_voltage(info->supplies[0].consumer, in twl6040_vibra_probe()
306 dev_err(info->dev, "failed to set VDDVIBL volt %d\n", in twl6040_vibra_probe()
313 error = regulator_set_voltage(info->supplies[1].consumer, in twl6040_vibra_probe()
316 dev_err(info->dev, "failed to set VDDVIBR volt %d\n", in twl6040_vibra_probe()
322 INIT_WORK(&info->play_work, vibra_play_work); in twl6040_vibra_probe()
324 info->input_dev = devm_input_allocate_device(&pdev->dev); in twl6040_vibra_probe()
325 if (!info->input_dev) { in twl6040_vibra_probe()
326 dev_err(info->dev, "couldn't allocate input device\n"); in twl6040_vibra_probe()
330 input_set_drvdata(info->input_dev, info); in twl6040_vibra_probe()
332 info->input_dev->name = "twl6040:vibrator"; in twl6040_vibra_probe()
333 info->input_dev->id.version = 1; in twl6040_vibra_probe()
334 info->input_dev->close = twl6040_vibra_close; in twl6040_vibra_probe()
335 __set_bit(FF_RUMBLE, info->input_dev->ffbit); in twl6040_vibra_probe()
337 error = input_ff_create_memless(info->input_dev, NULL, vibra_play); in twl6040_vibra_probe()
339 dev_err(info->dev, "couldn't register vibrator to FF\n"); in twl6040_vibra_probe()
343 error = input_register_device(info->input_dev); in twl6040_vibra_probe()
345 dev_err(info->dev, "couldn't register input device\n"); in twl6040_vibra_probe()
349 platform_set_drvdata(pdev, info); in twl6040_vibra_probe()