[PATCH 2/2] Documentation: Reflect the changes to pwm sysfs

From: poeschel
Date: Fri Oct 02 2020 - 08:33:02 EST


From: Lars Poeschel <poeschel@xxxxxxxxxxx>

This is an update to the documentation to reflect the change to pwm
sysfs.

/sys/class/pwm/pwmchipN/pwmX style exports are marked as deprecated.
They are still available as symlinks to the new interface.
New exports are available as /sys/class/pwm/pwm-N-X

Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Lars Poeschel <poeschel@xxxxxxxxxxx>
---
Documentation/ABI/obsolete/sysfs-class-pwm | 52 +++++++++++++++++++
Documentation/ABI/testing/sysfs-class-pwm | 60 ++++++++++++----------
Documentation/driver-api/pwm.rst | 7 +--
3 files changed, 90 insertions(+), 29 deletions(-)
create mode 100644 Documentation/ABI/obsolete/sysfs-class-pwm

diff --git a/Documentation/ABI/obsolete/sysfs-class-pwm b/Documentation/ABI/obsolete/sysfs-class-pwm
new file mode 100644
index 000000000000..92ba4f3586e9
--- /dev/null
+++ b/Documentation/ABI/obsolete/sysfs-class-pwm
@@ -0,0 +1,52 @@
+What: /sys/class/pwm/pwmchipN/pwmX
+Date: May 2013
+KernelVersion: 3.11
+Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+Description:
+ A /sys/class/pwm/pwmchipN/pwmX directory is created for
+ each exported PWM channel where X is the exported PWM
+ channel number.
+
+What: /sys/class/pwm/pwmchipN/pwmX/period
+Date: May 2013
+KernelVersion: 3.11
+Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+Description:
+ Sets the PWM signal period in nanoseconds.
+
+What: /sys/class/pwm/pwmchipN/pwmX/duty_cycle
+Date: May 2013
+KernelVersion: 3.11
+Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+Description:
+ Sets the PWM signal duty cycle in nanoseconds.
+
+What: /sys/class/pwm/pwmchipN/pwmX/polarity
+Date: May 2013
+KernelVersion: 3.11
+Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+Description:
+ Sets the output polarity of the PWM signal to "normal" or
+ "inversed".
+
+What: /sys/class/pwm/pwmchipN/pwmX/enable
+Date: May 2013
+KernelVersion: 3.11
+Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+Description:
+ Enable/disable the PWM signal.
+ 0 is disabled
+ 1 is enabled
+
+What: /sys/class/pwm/pwmchipN/pwmX/capture
+Date: June 2016
+KernelVersion: 4.8
+Contact: Lee Jones <lee.jones@xxxxxxxxxx>
+Description:
+ Capture information about a PWM signal. The output format is a
+ pair unsigned integers (period and duty cycle), separated by a
+ single space.
+
+ This ABI is deprecated and will be removed after 2025. It is replaced by
+ another sysfs ABI documented in Documentation/ABI/testing/sysfs-class-pwm
+
diff --git a/Documentation/ABI/testing/sysfs-class-pwm b/Documentation/ABI/testing/sysfs-class-pwm
index c20e61354561..87582dea1027 100644
--- a/Documentation/ABI/testing/sysfs-class-pwm
+++ b/Documentation/ABI/testing/sysfs-class-pwm
@@ -38,50 +38,58 @@ Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Description:
Unexports a PWM channel.

-What: /sys/class/pwm/pwmchipN/pwmX
-Date: May 2013
-KernelVersion: 3.11
-Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+What: /sys/class/pwm/pwm-N-X
+ /sys/class/pwm/pwmchipN/pwm-N-X
+Date: October 2020
+KernelVersion: 5.9
+Contact: Lars Poeschel <poeschel@xxxxxxxxxxx>
Description:
- A /sys/class/pwm/pwmchipN/pwmX directory is created for
+ A /sys/class/pwm/pwm-N-X directory is created for
each exported PWM channel where X is the exported PWM
- channel number.
+ channel number and N is the number of the pwmchip
+ that this pwm belongs to.
+ /sys/class/pwm/pwmchipN/pwm-N-X is the same

-What: /sys/class/pwm/pwmchipN/pwmX/period
-Date: May 2013
-KernelVersion: 3.11
-Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+What: /sys/class/pwm/pwm-N-X/period
+ /sys/class/pwm/pwmchipN/pwm-N-X/period
+Date: October 2020
+KernelVersion: 5.9
+Contact: Lars Poeschel <poeschel@xxxxxxxxxxx>
Description:
Sets the PWM signal period in nanoseconds.

-What: /sys/class/pwm/pwmchipN/pwmX/duty_cycle
-Date: May 2013
-KernelVersion: 3.11
-Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+What: /sys/class/pwm/pwm-N-X/duty_cycle
+ /sys/class/pwm/pwmchipN/pwm-N-X/duty_cycle
+Date: October 2020
+KernelVersion: 5.9
+Contact: Lars Poeschel <poeschel@xxxxxxxxxxx>
Description:
Sets the PWM signal duty cycle in nanoseconds.

-What: /sys/class/pwm/pwmchipN/pwmX/polarity
-Date: May 2013
-KernelVersion: 3.11
-Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+What: /sys/class/pwm/pwm-N-X/polarity
+ /sys/class/pwm/pwmchipN/pwm-N-X/polarity
+Date: October 2020
+KernelVersion: 5.9
+Contact: Lars Poeschel <poeschel@xxxxxxxxxxx>
Description:
Sets the output polarity of the PWM signal to "normal" or
"inversed".

-What: /sys/class/pwm/pwmchipN/pwmX/enable
-Date: May 2013
-KernelVersion: 3.11
-Contact: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
+What: /sys/class/pwm/pwm-N-X/enable
+ /sys/class/pwm/pwmchipN/pwm-N-X/enable
+Date: October 2020
+KernelVersion: 5.9
+Contact: Lars Poeschel <poeschel@xxxxxxxxxxx>
Description:
Enable/disable the PWM signal.
0 is disabled
1 is enabled

-What: /sys/class/pwm/pwmchipN/pwmX/capture
-Date: June 2016
-KernelVersion: 4.8
-Contact: Lee Jones <lee.jones@xxxxxxxxxx>
+What: /sys/class/pwm/pwm-N-X/capture
+ /sys/class/pwm/pwmchipN/pwm-N-X/capture
+Date: October 2020
+KernelVersion: 5.9
+Contact: Lars Poeschel <poeschel@xxxxxxxxxxx>
Description:
Capture information about a PWM signal. The output format is a
pair unsigned integers (period and duty cycle), separated by a
diff --git a/Documentation/driver-api/pwm.rst b/Documentation/driver-api/pwm.rst
index ab62f1bb0366..9361cd9b136c 100644
--- a/Documentation/driver-api/pwm.rst
+++ b/Documentation/driver-api/pwm.rst
@@ -89,9 +89,10 @@ will find:

The PWM channels are numbered using a per-chip index from 0 to npwm-1.

-When a PWM channel is exported a pwmX directory will be created in the
-pwmchipN directory it is associated with, where X is the number of the
-channel that was exported. The following properties will then be available:
+When a PWM channel is exported a pwm-N-X directory will be created in the
+/sys/class/pwm/ directory. N is number of the PWM chip this pwm is associated
+with and X is the number of the channel that was exported. The following
+properties will then be available:

period
The total period of the PWM signal (read/write).
--
2.28.0