aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/twl6040-vibra.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/misc/twl6040-vibra.c')
-rw-r--r--drivers/input/misc/twl6040-vibra.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index c34f6c0371c4..c8a288ae1d5b 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -251,7 +251,6 @@ static int twl6040_vibra_suspend(struct device *dev)
251 251
252 return 0; 252 return 0;
253} 253}
254
255#endif 254#endif
256 255
257static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); 256static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
@@ -259,13 +258,19 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
259static int __devinit twl6040_vibra_probe(struct platform_device *pdev) 258static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
260{ 259{
261 struct twl6040_vibra_data *pdata = pdev->dev.platform_data; 260 struct twl6040_vibra_data *pdata = pdev->dev.platform_data;
262 struct device_node *node = pdev->dev.of_node; 261 struct device *twl6040_core_dev = pdev->dev.parent;
262 struct device_node *twl6040_core_node = NULL;
263 struct vibra_info *info; 263 struct vibra_info *info;
264 int vddvibl_uV = 0; 264 int vddvibl_uV = 0;
265 int vddvibr_uV = 0; 265 int vddvibr_uV = 0;
266 int ret; 266 int ret;
267 267
268 if (!pdata && !node) { 268#ifdef CONFIG_OF
269 twl6040_core_node = of_find_node_by_name(twl6040_core_dev->of_node,
270 "vibra");
271#endif
272
273 if (!pdata && !twl6040_core_node) {
269 dev_err(&pdev->dev, "platform_data not available\n"); 274 dev_err(&pdev->dev, "platform_data not available\n");
270 return -EINVAL; 275 return -EINVAL;
271 } 276 }
@@ -287,14 +292,18 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
287 vddvibl_uV = pdata->vddvibl_uV; 292 vddvibl_uV = pdata->vddvibl_uV;
288 vddvibr_uV = pdata->vddvibr_uV; 293 vddvibr_uV = pdata->vddvibr_uV;
289 } else { 294 } else {
290 of_property_read_u32(node, "vibldrv_res", &info->vibldrv_res); 295 of_property_read_u32(twl6040_core_node, "ti,vibldrv-res",
291 of_property_read_u32(node, "vibrdrv_res", &info->vibrdrv_res); 296 &info->vibldrv_res);
292 of_property_read_u32(node, "viblmotor_res", 297 of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res",
298 &info->vibrdrv_res);
299 of_property_read_u32(twl6040_core_node, "ti,viblmotor-res",
293 &info->viblmotor_res); 300 &info->viblmotor_res);
294 of_property_read_u32(node, "vibrmotor_res", 301 of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res",
295 &info->vibrmotor_res); 302 &info->vibrmotor_res);
296 of_property_read_u32(node, "vddvibl_uV", &vddvibl_uV); 303 of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV",
297 of_property_read_u32(node, "vddvibr_uV", &vddvibr_uV); 304 &vddvibl_uV);
305 of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV",
306 &vddvibr_uV);
298 } 307 }
299 308
300 if ((!info->vibldrv_res && !info->viblmotor_res) || 309 if ((!info->vibldrv_res && !info->viblmotor_res) ||
@@ -351,8 +360,12 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
351 360
352 info->supplies[0].supply = "vddvibl"; 361 info->supplies[0].supply = "vddvibl";
353 info->supplies[1].supply = "vddvibr"; 362 info->supplies[1].supply = "vddvibr";
354 ret = regulator_bulk_get(info->dev, ARRAY_SIZE(info->supplies), 363 /*
355 info->supplies); 364 * When booted with Device tree the regulators are attached to the
365 * parent device (twl6040 MFD core)
366 */
367 ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev,
368 ARRAY_SIZE(info->supplies), info->supplies);
356 if (ret) { 369 if (ret) {
357 dev_err(info->dev, "couldn't get regulators %d\n", ret); 370 dev_err(info->dev, "couldn't get regulators %d\n", ret);
358 goto err_regulator; 371 goto err_regulator;
@@ -418,12 +431,6 @@ static int __devexit twl6040_vibra_remove(struct platform_device *pdev)
418 return 0; 431 return 0;
419} 432}
420 433
421static const struct of_device_id twl6040_vibra_of_match[] = {
422 {.compatible = "ti,twl6040-vibra", },
423 { },
424};
425MODULE_DEVICE_TABLE(of, twl6040_vibra_of_match);
426
427static struct platform_driver twl6040_vibra_driver = { 434static struct platform_driver twl6040_vibra_driver = {
428 .probe = twl6040_vibra_probe, 435 .probe = twl6040_vibra_probe,
429 .remove = __devexit_p(twl6040_vibra_remove), 436 .remove = __devexit_p(twl6040_vibra_remove),
@@ -431,7 +438,6 @@ static struct platform_driver twl6040_vibra_driver = {
431 .name = "twl6040-vibra", 438 .name = "twl6040-vibra",
432 .owner = THIS_MODULE, 439 .owner = THIS_MODULE,
433 .pm = &twl6040_vibra_pm_ops, 440 .pm = &twl6040_vibra_pm_ops,
434 .of_match_table = twl6040_vibra_of_match,
435 }, 441 },
436}; 442};
437module_platform_driver(twl6040_vibra_driver); 443module_platform_driver(twl6040_vibra_driver);