aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-11-03 15:05:52 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-11-03 15:14:56 -0400
commitd56a289be2ce01d1aa426a6cf45dede14a8db41e (patch)
treec9a058d34420eb2cc1cc85ce8fe7e71eb20e4407 /drivers
parent8ed2757edd0c6bacf20c1c55bd53a0acba565be8 (diff)
Input: pwm-beeper - add devicetree probing support
A very simple binding, the only property is the phandle to the PWM. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/misc/Kconfig2
-rw-r--r--drivers/input/misc/pwm-beeper.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index c8353570344..0f959d744e7 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -441,7 +441,7 @@ config INPUT_PCF8574
441 441
442config INPUT_PWM_BEEPER 442config INPUT_PWM_BEEPER
443 tristate "PWM beeper support" 443 tristate "PWM beeper support"
444 depends on HAVE_PWM 444 depends on HAVE_PWM || PWM
445 help 445 help
446 Say Y here to get support for PWM based beeper devices. 446 Say Y here to get support for PWM based beeper devices.
447 447
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index fc84c8a5114..502544c7e0a 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -75,7 +75,11 @@ static int __devinit pwm_beeper_probe(struct platform_device *pdev)
75 if (!beeper) 75 if (!beeper)
76 return -ENOMEM; 76 return -ENOMEM;
77 77
78 beeper->pwm = pwm_request(pwm_id, "pwm beeper"); 78 beeper->pwm = pwm_get(&pdev->dev, NULL);
79 if (IS_ERR(beeper->pwm)) {
80 dev_dbg(&pdev->dev, "unable to request PWM, trying legacy API\n");
81 beeper->pwm = pwm_request(pwm_id, "pwm beeper");
82 }
79 83
80 if (IS_ERR(beeper->pwm)) { 84 if (IS_ERR(beeper->pwm)) {
81 error = PTR_ERR(beeper->pwm); 85 error = PTR_ERR(beeper->pwm);
@@ -171,6 +175,13 @@ static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops,
171#define PWM_BEEPER_PM_OPS NULL 175#define PWM_BEEPER_PM_OPS NULL
172#endif 176#endif
173 177
178#ifdef CONFIG_OF
179static const struct of_device_id pwm_beeper_match[] = {
180 { .compatible = "pwm-beeper", },
181 { },
182};
183#endif
184
174static struct platform_driver pwm_beeper_driver = { 185static struct platform_driver pwm_beeper_driver = {
175 .probe = pwm_beeper_probe, 186 .probe = pwm_beeper_probe,
176 .remove = __devexit_p(pwm_beeper_remove), 187 .remove = __devexit_p(pwm_beeper_remove),
@@ -178,6 +189,7 @@ static struct platform_driver pwm_beeper_driver = {
178 .name = "pwm-beeper", 189 .name = "pwm-beeper",
179 .owner = THIS_MODULE, 190 .owner = THIS_MODULE,
180 .pm = PWM_BEEPER_PM_OPS, 191 .pm = PWM_BEEPER_PM_OPS,
192 .of_match_table = of_match_ptr(pwm_beeper_match),
181 }, 193 },
182}; 194};
183module_platform_driver(pwm_beeper_driver); 195module_platform_driver(pwm_beeper_driver);