Commit 79026219 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

Input: twl4030-vibra: Support for DT booted kernel

Add support when the kernel has been booted with DT blob. In this case the
pdata is NULL, we need to reach up to the core node and check if the codec
part has been enabled to determine if we need to coexist with the codec or
not.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 7bf7ff6f
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/i2c/twl.h> #include <linux/i2c/twl.h>
#include <linux/mfd/twl4030-audio.h> #include <linux/mfd/twl4030-audio.h>
...@@ -194,13 +195,26 @@ static int twl4030_vibra_resume(struct device *dev) ...@@ -194,13 +195,26 @@ static int twl4030_vibra_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
twl4030_vibra_suspend, twl4030_vibra_resume); twl4030_vibra_suspend, twl4030_vibra_resume);
static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
struct device_node *node)
{
if (pdata && pdata->coexist)
return true;
if (of_find_node_by_name(node, "codec"))
return true;
return false;
}
static int __devinit twl4030_vibra_probe(struct platform_device *pdev) static int __devinit twl4030_vibra_probe(struct platform_device *pdev)
{ {
struct twl4030_vibra_data *pdata = pdev->dev.platform_data; struct twl4030_vibra_data *pdata = pdev->dev.platform_data;
struct device_node *twl4030_core_node = pdev->dev.parent->of_node;
struct vibra_info *info; struct vibra_info *info;
int ret; int ret;
if (!pdata) { if (!pdata && !twl4030_core_node) {
dev_dbg(&pdev->dev, "platform_data not available\n"); dev_dbg(&pdev->dev, "platform_data not available\n");
return -EINVAL; return -EINVAL;
} }
...@@ -210,7 +224,7 @@ static int __devinit twl4030_vibra_probe(struct platform_device *pdev) ...@@ -210,7 +224,7 @@ static int __devinit twl4030_vibra_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->coexist = pdata->coexist; info->coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node);
INIT_WORK(&info->play_work, vibra_play_work); INIT_WORK(&info->play_work, vibra_play_work);
info->input_dev = input_allocate_device(); info->input_dev = input_allocate_device();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment