Lines Matching full:info
55 struct vibra_info *info = data;
56 struct twl6040 *twl6040 = info->twl6040;
61 dev_warn(info->dev, "Left Vibrator overcurrent detected\n");
66 dev_warn(info->dev, "Right Vibrator overcurrent detected\n");
74 static void twl6040_vibra_enable(struct vibra_info *info)
76 struct twl6040 *twl6040 = info->twl6040;
79 ret = regulator_bulk_enable(ARRAY_SIZE(info->supplies), info->supplies);
81 dev_err(info->dev, "failed to enable regulators %d\n", ret);
85 twl6040_power(info->twl6040, 1);
104 info->enabled = true;
107 static void twl6040_vibra_disable(struct vibra_info *info)
109 struct twl6040 *twl6040 = info->twl6040;
113 twl6040_power(info->twl6040, 0);
115 regulator_bulk_disable(ARRAY_SIZE(info->supplies), info->supplies);
117 info->enabled = false;
144 static void twl6040_vibra_set_effect(struct vibra_info *info)
146 struct twl6040 *twl6040 = info->twl6040;
151 volt = regulator_get_voltage(info->supplies[0].consumer) / 1000;
152 vibdatl = twl6040_vibra_code(volt, info->vibldrv_res,
153 info->viblmotor_res,
154 info->weak_speed, info->direction);
157 volt = regulator_get_voltage(info->supplies[1].consumer) / 1000;
158 vibdatr = twl6040_vibra_code(volt, info->vibrdrv_res,
159 info->vibrmotor_res,
160 info->strong_speed, info->direction);
168 struct vibra_info *info = container_of(work,
173 ret = twl6040_get_vibralr_status(info->twl6040);
175 dev_info(info->dev, "Vibra is configured for audio\n");
179 if (info->weak_speed || info->strong_speed) {
180 if (!info->enabled)
181 twl6040_vibra_enable(info);
183 twl6040_vibra_set_effect(info);
184 } else if (info->enabled)
185 twl6040_vibra_disable(info);
192 struct vibra_info *info = input_get_drvdata(input);
194 info->weak_speed = effect->u.rumble.weak_magnitude;
195 info->strong_speed = effect->u.rumble.strong_magnitude;
196 info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1;
198 schedule_work(&info->play_work);
205 struct vibra_info *info = input_get_drvdata(input);
207 cancel_work_sync(&info->play_work);
209 if (info->enabled)
210 twl6040_vibra_disable(info);
216 struct vibra_info *info = platform_get_drvdata(pdev);
218 cancel_work_sync(&info->play_work);
220 if (info->enabled)
221 twl6040_vibra_disable(info);
232 struct vibra_info *info;
244 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
245 if (!info) {
250 info->dev = &pdev->dev;
252 info->twl6040 = dev_get_drvdata(pdev->dev.parent);
255 &info->vibldrv_res);
257 &info->vibrdrv_res);
259 &info->viblmotor_res);
261 &info->vibrmotor_res);
265 if ((!info->vibldrv_res && !info->viblmotor_res) ||
266 (!info->vibrdrv_res && !info->vibrmotor_res)) {
267 dev_err(info->dev, "invalid vibra driver/motor resistance\n");
271 info->irq = platform_get_irq(pdev, 0);
272 if (info->irq < 0)
275 error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
278 "twl6040_irq_vib", info);
280 dev_err(info->dev, "VIB IRQ request failed: %d\n", error);
284 info->supplies[0].supply = "vddvibl";
285 info->supplies[1].supply = "vddvibr";
291 ARRAY_SIZE(info->supplies),
292 info->supplies);
294 dev_err(info->dev, "couldn't get regulators %d\n", error);
299 error = regulator_set_voltage(info->supplies[0].consumer,
302 dev_err(info->dev, "failed to set VDDVIBL volt %d\n",
309 error = regulator_set_voltage(info->supplies[1].consumer,
312 dev_err(info->dev, "failed to set VDDVIBR volt %d\n",
318 INIT_WORK(&info->play_work, vibra_play_work);
320 info->input_dev = devm_input_allocate_device(&pdev->dev);
321 if (!info->input_dev) {
322 dev_err(info->dev, "couldn't allocate input device\n");
326 input_set_drvdata(info->input_dev, info);
328 info->input_dev->name = "twl6040:vibrator";
329 info->input_dev->id.version = 1;
330 info->input_dev->close = twl6040_vibra_close;
331 __set_bit(FF_RUMBLE, info->input_dev->ffbit);
333 error = input_ff_create_memless(info->input_dev, NULL, vibra_play);
335 dev_err(info->dev, "couldn't register vibrator to FF\n");
339 error = input_register_device(info->input_dev);
341 dev_err(info->dev, "couldn't register input device\n");
345 platform_set_drvdata(pdev, info);