Commit d56a289b authored by Sascha Hauer's avatar Sascha Hauer Committed by Dmitry Torokhov

Input: pwm-beeper - add devicetree probing support

A very simple binding, the only property is the phandle to the PWM.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: default avatarThierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 8ed2757e
* PWM beeper device tree bindings
Registers a PWM device as beeper.
Required properties:
- compatible: should be "pwm-beeper"
- pwms: phandle to the physical PWM device
...@@ -441,7 +441,7 @@ config INPUT_PCF8574 ...@@ -441,7 +441,7 @@ config INPUT_PCF8574
config INPUT_PWM_BEEPER config INPUT_PWM_BEEPER
tristate "PWM beeper support" tristate "PWM beeper support"
depends on HAVE_PWM depends on HAVE_PWM || PWM
help help
Say Y here to get support for PWM based beeper devices. Say Y here to get support for PWM based beeper devices.
......
...@@ -75,7 +75,11 @@ static int __devinit pwm_beeper_probe(struct platform_device *pdev) ...@@ -75,7 +75,11 @@ static int __devinit pwm_beeper_probe(struct platform_device *pdev)
if (!beeper) if (!beeper)
return -ENOMEM; return -ENOMEM;
beeper->pwm = pwm_get(&pdev->dev, NULL);
if (IS_ERR(beeper->pwm)) {
dev_dbg(&pdev->dev, "unable to request PWM, trying legacy API\n");
beeper->pwm = pwm_request(pwm_id, "pwm beeper"); beeper->pwm = pwm_request(pwm_id, "pwm beeper");
}
if (IS_ERR(beeper->pwm)) { if (IS_ERR(beeper->pwm)) {
error = PTR_ERR(beeper->pwm); error = PTR_ERR(beeper->pwm);
...@@ -171,6 +175,13 @@ static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops, ...@@ -171,6 +175,13 @@ static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops,
#define PWM_BEEPER_PM_OPS NULL #define PWM_BEEPER_PM_OPS NULL
#endif #endif
#ifdef CONFIG_OF
static const struct of_device_id pwm_beeper_match[] = {
{ .compatible = "pwm-beeper", },
{ },
};
#endif
static struct platform_driver pwm_beeper_driver = { static struct platform_driver pwm_beeper_driver = {
.probe = pwm_beeper_probe, .probe = pwm_beeper_probe,
.remove = __devexit_p(pwm_beeper_remove), .remove = __devexit_p(pwm_beeper_remove),
...@@ -178,6 +189,7 @@ static struct platform_driver pwm_beeper_driver = { ...@@ -178,6 +189,7 @@ static struct platform_driver pwm_beeper_driver = {
.name = "pwm-beeper", .name = "pwm-beeper",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = PWM_BEEPER_PM_OPS, .pm = PWM_BEEPER_PM_OPS,
.of_match_table = of_match_ptr(pwm_beeper_match),
}, },
}; };
module_platform_driver(pwm_beeper_driver); module_platform_driver(pwm_beeper_driver);
......
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