mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
pwm: Changes for v3.11-rc1
A new driver supports driving PWM signals using the TPU unit found on various Renesas SoCs. Furthermore support is added for the NXP PCA9685 LED controller. Another big chunk is the sysfs interface which has been in the works for quite some time. The remaining patches are a random assortment of cleanups and fixes. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAABAgAGBQJR26LnAAoJEN0jrNd/PrOhrAkP/id/DsTvnhCWuwpMffb1jGqW qxfou8mrSuLrbF8QnnAOw0EuIXy3qO40kAts0yDxVm/+pPLmRrtMgeS5zjGJly9n eQrJplSFe35ho3ty4KL84IBA6+JtFiRpwtt2sEYgxEnwMDlkCgH/lyrCQ8jdpgc2 eDOxoHQWzPAGGFWjjVuaNHOoJwy2a4da0YpbMt9eYdqkDBd3sZloVyaBsaiV5MiO HR8e6uTFwNz+o3j9NMIKvQbADz69FeG0AqCqnZso2a8hIiiPSNXwgTCAoVljhmrR m/JOACNS5CcasW8utuk9dXeT5I9rzZ19Z6zJltCFNN/U08KA+c/0FFCBPGzsgkBy fgWyiW7neEwVNl1rpEwcESHzUd5Wk7rynOHGwKJ1f7ZuIwVf44iRhRlXyPe3o4qg iuKVAJeLl/pGoirZNMS+pLlUYpN4GSZC2GxxJ0aLHH/8dWKEk0NDvxXJV6Z7e8ch FjhlkHv7bUKbZnrgJc5lJp9uaiDHMGJpZsyCJZmKOZRPbBrHSdE6lHXnU12xRaPY Hf+bxFsoyjnUYeFpGk1fphrl1Mj2o5PORvOlGliusLIS1V9HJEXZfvlU3S4SOvLt 4Xvu6vhX5SIuGHnMJgLn+IXBqr54mjvxDoEBgn1Lyz+hrCoUcXFODYxk9cXZOVhT R4+MdqgGNOkq8hPMkYeV =5mly -----END PGP SIGNATURE----- Merge tag 'for-3.11-rc1' of git://gitorious.org/linux-pwm/linux-pwm Pull pwm changes from Thierry Reding: "A new driver supports driving PWM signals using the TPU unit found on various Renesas SoCs. Furthermore support is added for the NXP PCA9685 LED controller. Another big chunk is the sysfs interface which has been in the works for quite some time. The remaining patches are a random assortment of cleanups and fixes" * tag 'for-3.11-rc1' of git://gitorious.org/linux-pwm/linux-pwm: pwm: pwm-tiehrpwm: Use clk_enable/disable instead clk_prepare/unprepare. pwm: pca9685: Fix wrong argument to set MODE1_SLEEP bit pwm: renesas-tpu: Add MODULE_ALIAS to make module auto loading work pwm: renesas-tpu: fix return value check in tpu_probe() pwm: Add Renesas TPU PWM driver pwm: Add sysfs interface pwm: Fill in missing .owner fields pwm: add pca9685 driver pwm: atmel-tcb: prepare clk before calling enable pwm: devm: alloc correct pointer size pwm: mxs: Let device core handle pinctrl MAINTAINERS: Update PWM subsystem entry
This commit is contained in:
commit
34ae0a6f05
21 changed files with 1387 additions and 17 deletions
79
Documentation/ABI/testing/sysfs-class-pwm
Normal file
79
Documentation/ABI/testing/sysfs-class-pwm
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
What: /sys/class/pwm/
|
||||
Date: May 2013
|
||||
KernelVersion: 3.11
|
||||
Contact: H Hartley Sweeten <[email protected]>
|
||||
Description:
|
||||
The pwm/ class sub-directory belongs to the Generic PWM
|
||||
Framework and provides a sysfs interface for using PWM
|
||||
channels.
|
||||
|
||||
What: /sys/class/pwm/pwmchipN/
|
||||
Date: May 2013
|
||||
KernelVersion: 3.11
|
||||
Contact: H Hartley Sweeten <[email protected]>
|
||||
Description:
|
||||
A /sys/class/pwm/pwmchipN directory is created for each
|
||||
probed PWM controller/chip where N is the base of the
|
||||
PWM chip.
|
||||
|
||||
What: /sys/class/pwm/pwmchipN/npwm
|
||||
Date: May 2013
|
||||
KernelVersion: 3.11
|
||||
Contact: H Hartley Sweeten <[email protected]>
|
||||
Description:
|
||||
The number of PWM channels supported by the PWM chip.
|
||||
|
||||
What: /sys/class/pwm/pwmchipN/export
|
||||
Date: May 2013
|
||||
KernelVersion: 3.11
|
||||
Contact: H Hartley Sweeten <[email protected]>
|
||||
Description:
|
||||
Exports a PWM channel from the PWM chip for sysfs control.
|
||||
Value is between 0 and /sys/class/pwm/pwmchipN/npwm - 1.
|
||||
|
||||
What: /sys/class/pwm/pwmchipN/unexport
|
||||
Date: May 2013
|
||||
KernelVersion: 3.11
|
||||
Contact: H Hartley Sweeten <[email protected]>
|
||||
Description:
|
||||
Unexports a PWM channel.
|
||||
|
||||
What: /sys/class/pwm/pwmchipN/pwmX
|
||||
Date: May 2013
|
||||
KernelVersion: 3.11
|
||||
Contact: H Hartley Sweeten <[email protected]>
|
||||
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 <[email protected]>
|
||||
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 <[email protected]>
|
||||
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 <[email protected]>
|
||||
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 <[email protected]>
|
||||
Description:
|
||||
Enable/disable the PWM signal.
|
||||
0 is disabled
|
||||
1 is enabled
|
||||
27
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.txt
Normal file
27
Documentation/devicetree/bindings/pwm/nxp,pca9685-pwm.txt
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
NXP PCA9685 16-channel 12-bit PWM LED controller
|
||||
================================================
|
||||
|
||||
Required properties:
|
||||
- compatible: "nxp,pca9685-pwm"
|
||||
- #pwm-cells: should be 2. The first cell specifies the per-chip index
|
||||
of the PWM to use and the second cell is the period in nanoseconds.
|
||||
The index 16 is the ALLCALL channel, that sets all PWM channels at the same
|
||||
time.
|
||||
|
||||
Optional properties:
|
||||
- invert (bool): boolean to enable inverted logic
|
||||
- open-drain (bool): boolean to configure outputs with open-drain structure;
|
||||
if omitted use totem-pole structure
|
||||
|
||||
Example:
|
||||
|
||||
For LEDs that are directly connected to the PCA, the following setting is
|
||||
applicable:
|
||||
|
||||
pca: pca@41 {
|
||||
compatible = "nxp,pca9685-pwm";
|
||||
#pwm-cells = <2>;
|
||||
reg = <0x41>;
|
||||
invert;
|
||||
open-drain;
|
||||
};
|
||||
|
|
@ -45,6 +45,43 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns);
|
|||
|
||||
To start/stop toggling the PWM output use pwm_enable()/pwm_disable().
|
||||
|
||||
Using PWMs with the sysfs interface
|
||||
-----------------------------------
|
||||
|
||||
If CONFIG_SYSFS is enabled in your kernel configuration a simple sysfs
|
||||
interface is provided to use the PWMs from userspace. It is exposed at
|
||||
/sys/class/pwm/. Each probed PWM controller/chip will be exported as
|
||||
pwmchipN, where N is the base of the PWM chip. Inside the directory you
|
||||
will find:
|
||||
|
||||
npwm - The number of PWM channels this chip supports (read-only).
|
||||
|
||||
export - Exports a PWM channel for use with 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.
|
||||
|
||||
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:
|
||||
|
||||
period - The total period of the PWM signal (read/write).
|
||||
Value is in nanoseconds and is the sum of the active and inactive
|
||||
time of the PWM.
|
||||
|
||||
duty_cycle - The active time of the PWM signal (read/write).
|
||||
Value is in nanoseconds and must be less than the period.
|
||||
|
||||
polarity - Changes the polarity of the PWM signal (read/write).
|
||||
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
|
||||
enabled. Value is the string "normal" or "inversed".
|
||||
|
||||
enable - Enable/disable the PWM signal (read/write).
|
||||
0 - disabled
|
||||
1 - enabled
|
||||
|
||||
Implementing a PWM driver
|
||||
-------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue