mirror of
https://gitee.com/openharmony/kernel_linux
synced 2025-01-10 18:04:14 +00:00
pwm: Standardize document format
Each text file under Documentation follows a different format. Some don't even have titles! Change its representation to follow the adopted standard, using ReST markup for it to be parseable by Sphinx: - mark document title; - mark literal blocks; - better format the parameters. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
2ea659a9ef
commit
c571123c8a
@ -1,4 +1,6 @@
|
|||||||
|
======================================
|
||||||
Pulse Width Modulation (PWM) interface
|
Pulse Width Modulation (PWM) interface
|
||||||
|
======================================
|
||||||
|
|
||||||
This provides an overview about the Linux PWM interface
|
This provides an overview about the Linux PWM interface
|
||||||
|
|
||||||
@ -16,7 +18,7 @@ Users of the legacy PWM API use unique IDs to refer to PWM devices.
|
|||||||
|
|
||||||
Instead of referring to a PWM device via its unique ID, board setup code
|
Instead of referring to a PWM device via its unique ID, board setup code
|
||||||
should instead register a static mapping that can be used to match PWM
|
should instead register a static mapping that can be used to match PWM
|
||||||
consumers to providers, as given in the following example:
|
consumers to providers, as given in the following example::
|
||||||
|
|
||||||
static struct pwm_lookup board_pwm_lookup[] = {
|
static struct pwm_lookup board_pwm_lookup[] = {
|
||||||
PWM_LOOKUP("tegra-pwm", 0, "pwm-backlight", NULL,
|
PWM_LOOKUP("tegra-pwm", 0, "pwm-backlight", NULL,
|
||||||
@ -40,7 +42,7 @@ New users should use the pwm_get() function and pass to it the consumer
|
|||||||
device or a consumer name. pwm_put() is used to free the PWM device. Managed
|
device or a consumer name. pwm_put() is used to free the PWM device. Managed
|
||||||
variants of these functions, devm_pwm_get() and devm_pwm_put(), also exist.
|
variants of these functions, devm_pwm_get() and devm_pwm_put(), also exist.
|
||||||
|
|
||||||
After being requested, a PWM has to be configured using:
|
After being requested, a PWM has to be configured using::
|
||||||
|
|
||||||
int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state);
|
int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state);
|
||||||
|
|
||||||
@ -72,11 +74,14 @@ interface is provided to use the PWMs from userspace. It is exposed at
|
|||||||
pwmchipN, where N is the base of the PWM chip. Inside the directory you
|
pwmchipN, where N is the base of the PWM chip. Inside the directory you
|
||||||
will find:
|
will find:
|
||||||
|
|
||||||
npwm - The number of PWM channels this chip supports (read-only).
|
npwm
|
||||||
|
The number of PWM channels this chip supports (read-only).
|
||||||
|
|
||||||
export - Exports a PWM channel for use with sysfs (write-only).
|
export
|
||||||
|
Exports a PWM channel for use with sysfs (write-only).
|
||||||
|
|
||||||
unexport - Unexports a PWM channel from sysfs (write-only).
|
unexport
|
||||||
|
Unexports a PWM channel from sysfs (write-only).
|
||||||
|
|
||||||
The PWM channels are numbered using a per-chip index from 0 to npwm-1.
|
The PWM channels are numbered using a per-chip index from 0 to npwm-1.
|
||||||
|
|
||||||
@ -84,21 +89,26 @@ 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
|
pwmchipN directory it is associated with, where X is the number of the
|
||||||
channel that was exported. The following properties will then be available:
|
channel that was exported. The following properties will then be available:
|
||||||
|
|
||||||
period - The total period of the PWM signal (read/write).
|
period
|
||||||
|
The total period of the PWM signal (read/write).
|
||||||
Value is in nanoseconds and is the sum of the active and inactive
|
Value is in nanoseconds and is the sum of the active and inactive
|
||||||
time of the PWM.
|
time of the PWM.
|
||||||
|
|
||||||
duty_cycle - The active time of the PWM signal (read/write).
|
duty_cycle
|
||||||
|
The active time of the PWM signal (read/write).
|
||||||
Value is in nanoseconds and must be less than the period.
|
Value is in nanoseconds and must be less than the period.
|
||||||
|
|
||||||
polarity - Changes the polarity of the PWM signal (read/write).
|
polarity
|
||||||
|
Changes the polarity of the PWM signal (read/write).
|
||||||
Writes to this property only work if the PWM chip supports changing
|
Writes to this property only work if the PWM chip supports changing
|
||||||
the polarity. The polarity can only be changed if the PWM is not
|
the polarity. The polarity can only be changed if the PWM is not
|
||||||
enabled. Value is the string "normal" or "inversed".
|
enabled. Value is the string "normal" or "inversed".
|
||||||
|
|
||||||
enable - Enable/disable the PWM signal (read/write).
|
enable
|
||||||
0 - disabled
|
Enable/disable the PWM signal (read/write).
|
||||||
1 - enabled
|
|
||||||
|
- 0 - disabled
|
||||||
|
- 1 - enabled
|
||||||
|
|
||||||
Implementing a PWM driver
|
Implementing a PWM driver
|
||||||
-------------------------
|
-------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user