Message ID | 1346933541-21547-9-git-send-email-peter.ujfalusi@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Peter, On Thu, Sep 06, 2012 at 03:12:15PM +0300, Peter Ujfalusi wrote: > 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: Peter Ujfalusi <peter.ujfalusi@ti.com> > --- > drivers/input/misc/twl4030-vibra.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c > index fc0ed9b..15620f8 100644 > --- a/drivers/input/misc/twl4030-vibra.c > +++ b/drivers/input/misc/twl4030-vibra.c > @@ -26,6 +26,7 @@ > #include <linux/module.h> > #include <linux/jiffies.h> > #include <linux/platform_device.h> > +#include <linux/of.h> > #include <linux/workqueue.h> > #include <linux/i2c/twl.h> > #include <linux/mfd/twl4030-audio.h> > @@ -194,13 +195,28 @@ static int twl4030_vibra_resume(struct device *dev) > static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, > 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; > + > +#ifdef CONFIG_OF > + if (of_find_node_by_name(node, "codec")) > + return true; > +#endif In patch 6 you added a stub for of_find_node_by_name(), so do you really need this #ifdef? Otherwise it looks good. Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Thanks.
Hi Dmitry, On 09/06/2012 07:19 PM, Dmitry Torokhov wrote: > In patch 6 you added a stub for of_find_node_by_name(), so do you really > need this #ifdef? True. I'll resend the series since I left the #ifdef also in other patch. > Otherwise it looks good. > > Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Thank you, Péter -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index fc0ed9b..15620f8 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c @@ -26,6 +26,7 @@ #include <linux/module.h> #include <linux/jiffies.h> #include <linux/platform_device.h> +#include <linux/of.h> #include <linux/workqueue.h> #include <linux/i2c/twl.h> #include <linux/mfd/twl4030-audio.h> @@ -194,13 +195,28 @@ static int twl4030_vibra_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, 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; + +#ifdef CONFIG_OF + if (of_find_node_by_name(node, "codec")) + return true; +#endif + + return false; +} + static int __devinit twl4030_vibra_probe(struct platform_device *pdev) { struct twl4030_vibra_data *pdata = pdev->dev.platform_data; + struct device_node *twl4030_core_node = pdev->dev.parent->of_node; struct vibra_info *info; int ret; - if (!pdata) { + if (!pdata && !twl4030_core_node) { dev_dbg(&pdev->dev, "platform_data not available\n"); return -EINVAL; } @@ -210,7 +226,7 @@ static int __devinit twl4030_vibra_probe(struct platform_device *pdev) return -ENOMEM; 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); info->input_dev = input_allocate_device();
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: Peter Ujfalusi <peter.ujfalusi@ti.com> --- drivers/input/misc/twl4030-vibra.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)