26 #include <linux/module.h>
33 #include <linux/input.h>
34 #include <linux/slab.h>
40 #define EFFECT_DIR_180_DEG 0x8000
56 static void vibra_disable_leds(
void)
84 static void vibra_disable(
struct vibra_info *info)
140 struct vibra_info *info = input_get_drvdata(input);
150 static int twl4030_vibra_open(
struct input_dev *input)
152 struct vibra_info *info = input_get_drvdata(input);
156 dev_err(&input->dev,
"couldn't create workqueue\n");
162 static void twl4030_vibra_close(
struct input_dev *input)
164 struct vibra_info *info = input_get_drvdata(input);
176 #ifdef CONFIG_PM_SLEEP
177 static int twl4030_vibra_suspend(
struct device *
dev)
180 struct vibra_info *info = platform_get_drvdata(pdev);
188 static int twl4030_vibra_resume(
struct device *dev)
190 vibra_disable_leds();
196 twl4030_vibra_suspend, twl4030_vibra_resume);
213 struct device_node *twl4030_core_node = pdev->
dev.parent->of_node;
217 if (!pdata && !twl4030_core_node) {
218 dev_dbg(&pdev->
dev,
"platform_data not available\n");
227 info->
coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node);
230 info->
input_dev = input_allocate_device();
232 dev_err(&pdev->
dev,
"couldn't allocate input device\n");
237 input_set_drvdata(info->
input_dev, info);
239 info->
input_dev->name =
"twl4030:vibrator";
242 info->
input_dev->open = twl4030_vibra_open;
243 info->
input_dev->close = twl4030_vibra_close;
248 dev_dbg(&pdev->
dev,
"couldn't register vibrator to FF\n");
252 ret = input_register_device(info->
input_dev);
254 dev_dbg(&pdev->
dev,
"couldn't register input device\n");
258 vibra_disable_leds();
260 platform_set_drvdata(pdev, info);
274 struct vibra_info *info = platform_get_drvdata(pdev);
277 input_unregister_device(info->
input_dev);
279 platform_set_drvdata(pdev,
NULL);
285 .probe = twl4030_vibra_probe,
288 .name =
"twl4030-vibra",
290 .pm = &twl4030_vibra_pm_ops,