input: pwm-beeper: add feature to set volume via sysfs
PATCH v7 2/5 input: pwm-beeper: add feature to set volume via sysfs
Make the driver accept switching volume levels via sysfs. This can be helpful if the beep/bell sound intensity needs to be adapted to the environment of the device.
The volume adjustment is done by changing the duty cycle of the pwm signal.
This patch adds the sysfs interface with 5 default volume levels (0 - mute, 4 - max. volume).
Signed-off-by Frieder Schrempf <[email protected]>
Signed-off-by Manuel Traut <[email protected]>
Tested-by Manuel Traut <[email protected]>
--- .../ABI/testing/sysfs-devices-pwm-beeper | 17 ++++ drivers/input/misc/pwm-beeper.c | 84 ++++++++++++++++++- 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-pwm-beeper
Documentation/ABI/testing/sysfs-devices-pwm-beeper new file +17 -0
@@ -0,0 +1,17 @@ +What: /sys/devices/.../pwm-beeper/volume +Date: February 2017 +KernelVersion: +Contact: Frieder Schrempf <[email protected]> +Description: + Control the volume of this pwm-beeper. Values + are between 0 and max_volume. This file will also + show the current volume level stored in the driver. + +What: /sys/devices/.../pwm-beeper/max_volume +Date: February 2017 +KernelVersion: +Contact: Frieder Schrempf <[email protected]> +Description: + This file shows the maximum volume level that can be + assigned to volume. +
drivers/input/misc/pwm-beeper.c +83 -1
127 lines not on this page · raw message
Signature · 1 line
2.39.0