Skip to contentSkip to conversation

input: pwm-beeper: add feature to set volume via sysfs

PATCH Superseded Manuel Traut 1 participant 1 message Jan 24, 2023 Input drivers

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

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).

---
 .../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
new file mode 100644
index 000000000000..8424b6776ca9
@@ -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