Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346928
b: refs/heads/master
c: d56a289
h: refs/heads/master
v: v3
  • Loading branch information
Sascha Hauer authored and Dmitry Torokhov committed Nov 3, 2012
1 parent 687b20e commit c25d2e2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 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: 8ed2757edd0c6bacf20c1c55bd53a0acba565be8
refs/heads/master: d56a289be2ce01d1aa426a6cf45dede14a8db41e
7 changes: 7 additions & 0 deletions trunk/Documentation/devicetree/bindings/input/pwm-beeper.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* 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
2 changes: 1 addition & 1 deletion trunk/drivers/input/misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ config INPUT_PCF8574

config INPUT_PWM_BEEPER
tristate "PWM beeper support"
depends on HAVE_PWM
depends on HAVE_PWM || PWM
help
Say Y here to get support for PWM based beeper devices.

Expand Down
14 changes: 13 additions & 1 deletion trunk/drivers/input/misc/pwm-beeper.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ static int __devinit pwm_beeper_probe(struct platform_device *pdev)
if (!beeper)
return -ENOMEM;

beeper->pwm = pwm_request(pwm_id, "pwm beeper");
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");
}

if (IS_ERR(beeper->pwm)) {
error = PTR_ERR(beeper->pwm);
Expand Down Expand Up @@ -171,13 +175,21 @@ static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops,
#define PWM_BEEPER_PM_OPS NULL
#endif

#ifdef CONFIG_OF
static const struct of_device_id pwm_beeper_match[] = {
{ .compatible = "pwm-beeper", },
{ },
};
#endif

static struct platform_driver pwm_beeper_driver = {
.probe = pwm_beeper_probe,
.remove = __devexit_p(pwm_beeper_remove),
.driver = {
.name = "pwm-beeper",
.owner = THIS_MODULE,
.pm = PWM_BEEPER_PM_OPS,
.of_match_table = of_match_ptr(pwm_beeper_match),
},
};
module_platform_driver(pwm_beeper_driver);
Expand Down

0 comments on commit c25d2e2

Please sign in to comment.