#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>
struct regulator *amplifier;
struct work_struct work;
unsigned long period;
+ unsigned int bell_frequency;
bool suspended;
bool amplifier_on;
};
switch (code) {
case SND_BELL:
- value = value ? 1000 : 0;
+ value = value ? beeper->bell_frequency : 0;
break;
case SND_TONE:
break;
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);
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");