summaryrefslogtreecommitdiff
path: root/drivers/input/misc/pwm-beeper.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 12:38:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 12:38:20 -0700
commit16a12fa9aed176444fc795b09e796be41902bb08 (patch)
treebd158def3263a8b0d0f0886fd0fcd32728242dc4 /drivers/input/misc/pwm-beeper.c
parentd25e436c4b68db2895185b24ad1f22499c2f87b0 (diff)
parent0337966d121ebebf73a1c346123e8112796e684e (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem updates from Dmitry Torokhov: - a big update from Mauro converting input documentation to ReST format - Synaptics PS/2 is now aware of SMBus companion devices, which means that we can now use native RMI4 protocol to handle touchpads, instead of relying on legacy PS/2 mode. - we removed support from BMA180 accelerometer from input devices as it is now handled properly by IIO - update to TSC2007 to corretcly report pressure - other miscellaneous driver fixes. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (152 commits) Input: ar1021_i2c - use BIT to check for a bit Input: twl4030-pwrbutton - use input_set_capability() helper Input: twl4030-pwrbutton - use correct device for irq request Input: ar1021_i2c - enable touch mode during open Input: add uinput documentation dt-bindings: input: add bindings document for ar1021_i2c driver dt-bindings: input: rotary-encoder: fix typo Input: xen-kbdfront - add module parameter for setting resolution ARM: pxa/raumfeld: fix compile error in rotary controller resources Input: xpad - do not suggest writing to Dominic Input: xpad - don't use literal blocks inside footnotes Input: xpad - note that usb/devices is now at /sys/kernel/debug/ Input: docs - freshen up introduction Input: docs - split input docs into kernel- and user-facing Input: docs - note that MT-A protocol is obsolete Input: docs - update joystick documentation a bit Input: docs - remove disclaimer/GPL notice Input: fix "Game console" heading level in joystick documentation Input: rotary-encoder - remove references to platform data from docs Input: move documentation for Amiga CD32 ...
Diffstat (limited to 'drivers/input/misc/pwm-beeper.c')
-rw-r--r--drivers/input/misc/pwm-beeper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index e53801dbd560..edca0d737750 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -19,6 +19,7 @@
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/property.h>
#include <linux/pwm.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
@@ -29,6 +30,7 @@ struct pwm_beeper {
struct regulator *amplifier;
struct work_struct work;
unsigned long period;
+ unsigned int bell_frequency;
bool suspended;
bool amplifier_on;
};
@@ -94,7 +96,7 @@ static int pwm_beeper_event(struct input_dev *input,
switch (code) {
case SND_BELL:
- value = value ? 1000 : 0;
+ value = value ? beeper->bell_frequency : 0;
break;
case SND_TONE:
break;
@@ -131,6 +133,7 @@ static int pwm_beeper_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct pwm_beeper *beeper;
struct pwm_state state;
+ u32 bell_frequency;
int error;
beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL);
@@ -167,6 +170,16 @@ static int pwm_beeper_probe(struct platform_device *pdev)
INIT_WORK(&beeper->work, pwm_beeper_work);
+ error = device_property_read_u32(dev, "beeper-hz", &bell_frequency);
+ if (error) {
+ bell_frequency = 1000;
+ dev_dbg(dev,
+ "failed to parse 'beeper-hz' property, using default: %uHz\n",
+ bell_frequency);
+ }
+
+ beeper->bell_frequency = bell_frequency;
+
beeper->input = devm_input_allocate_device(dev);
if (!beeper->input) {
dev_err(dev, "Failed to allocate input device\n");