Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318276
b: refs/heads/master
c: e7ec014
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Dmitry Torokhov committed Jun 12, 2012
1 parent 5e99d1f commit b0d6af8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 56 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 32edbf562cabc0fb927692c86274c3cd2ccde0d0
refs/heads/master: e7ec014a47e4d68fc01561d0541a50650646317c
37 changes: 0 additions & 37 deletions trunk/Documentation/devicetree/bindings/input/twl6040-vibra.txt

This file was deleted.

42 changes: 24 additions & 18 deletions trunk/drivers/input/misc/twl6040-vibra.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,26 @@ static int twl6040_vibra_suspend(struct device *dev)

return 0;
}

#endif

static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);

static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
{
struct twl6040_vibra_data *pdata = pdev->dev.platform_data;
struct device_node *node = pdev->dev.of_node;
struct device *twl6040_core_dev = pdev->dev.parent;
struct device_node *twl6040_core_node = NULL;
struct vibra_info *info;
int vddvibl_uV = 0;
int vddvibr_uV = 0;
int ret;

if (!pdata && !node) {
#ifdef CONFIG_OF
twl6040_core_node = of_find_node_by_name(twl6040_core_dev->of_node,
"vibra");
#endif

if (!pdata && !twl6040_core_node) {
dev_err(&pdev->dev, "platform_data not available\n");
return -EINVAL;
}
Expand All @@ -287,14 +292,18 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
vddvibl_uV = pdata->vddvibl_uV;
vddvibr_uV = pdata->vddvibr_uV;
} else {
of_property_read_u32(node, "vibldrv_res", &info->vibldrv_res);
of_property_read_u32(node, "vibrdrv_res", &info->vibrdrv_res);
of_property_read_u32(node, "viblmotor_res",
of_property_read_u32(twl6040_core_node, "ti,vibldrv-res",
&info->vibldrv_res);
of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res",
&info->vibrdrv_res);
of_property_read_u32(twl6040_core_node, "ti,viblmotor-res",
&info->viblmotor_res);
of_property_read_u32(node, "vibrmotor_res",
of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res",
&info->vibrmotor_res);
of_property_read_u32(node, "vddvibl_uV", &vddvibl_uV);
of_property_read_u32(node, "vddvibr_uV", &vddvibr_uV);
of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV",
&vddvibl_uV);
of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV",
&vddvibr_uV);
}

if ((!info->vibldrv_res && !info->viblmotor_res) ||
Expand Down Expand Up @@ -351,8 +360,12 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev)

info->supplies[0].supply = "vddvibl";
info->supplies[1].supply = "vddvibr";
ret = regulator_bulk_get(info->dev, ARRAY_SIZE(info->supplies),
info->supplies);
/*
* When booted with Device tree the regulators are attached to the
* parent device (twl6040 MFD core)
*/
ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev,
ARRAY_SIZE(info->supplies), info->supplies);
if (ret) {
dev_err(info->dev, "couldn't get regulators %d\n", ret);
goto err_regulator;
Expand Down Expand Up @@ -418,20 +431,13 @@ static int __devexit twl6040_vibra_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id twl6040_vibra_of_match[] = {
{.compatible = "ti,twl6040-vibra", },
{ },
};
MODULE_DEVICE_TABLE(of, twl6040_vibra_of_match);

static struct platform_driver twl6040_vibra_driver = {
.probe = twl6040_vibra_probe,
.remove = __devexit_p(twl6040_vibra_remove),
.driver = {
.name = "twl6040-vibra",
.owner = THIS_MODULE,
.pm = &twl6040_vibra_pm_ops,
.of_match_table = twl6040_vibra_of_match,
},
};
module_platform_driver(twl6040_vibra_driver);
Expand Down

0 comments on commit b0d6af8

Please sign in to comment.