Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34ae0a6f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 7d3107d2 b388f15f
Loading
Loading
Loading
Loading
+79 −0
Original line number Diff line number Diff line
What:		/sys/class/pwm/
Date:		May 2013
KernelVersion:	3.11
Contact:	H Hartley Sweeten <hsweeten@visionengravers.com>
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 <hsweeten@visionengravers.com>
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 <hsweeten@visionengravers.com>
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 <hsweeten@visionengravers.com>
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 <hsweeten@visionengravers.com>
Description:
		Unexports a PWM channel.

What:		/sys/class/pwm/pwmchipN/pwmX
Date:		May 2013
KernelVersion:	3.11
Contact:	H Hartley Sweeten <hsweeten@visionengravers.com>
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@visionengravers.com>
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@visionengravers.com>
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@visionengravers.com>
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@visionengravers.com>
Description:
		Enable/disable the PWM signal.
		0 is disabled
		1 is enabled
+27 −0
Original line number Diff line number Diff line
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;
};
+37 −0
Original line number Diff line number Diff line
@@ -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
-------------------------

+2 −2
Original line number Diff line number Diff line
@@ -6568,8 +6568,8 @@ S: Maintained
F:	drivers/media/usb/pwc/*

PWM SUBSYSTEM
M:	Thierry Reding <thierry.reding@avionic-design.de>
L:	linux-kernel@vger.kernel.org
M:	Thierry Reding <thierry.reding@gmail.com>
L:	linux-pwm@vger.kernel.org
S:	Maintained
W:	http://gitorious.org/linux-pwm
T:	git git://gitorious.org/linux-pwm/linux-pwm.git
+23 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@ menuconfig PWM

if PWM

config PWM_SYSFS
	bool
	default y if SYSFS

config PWM_AB8500
	tristate "AB8500 PWM support"
	depends on AB8500_CORE && ARCH_U8500
@@ -97,6 +101,15 @@ config PWM_MXS
	  To compile this driver as a module, choose M here: the module
	  will be called pwm-mxs.

config PWM_PCA9685
	tristate "NXP PCA9685 PWM driver"
	depends on OF && REGMAP_I2C
	help
	  Generic PWM framework driver for NXP PCA9685 LED controller.

	  To compile this driver as a module, choose M here: the module
	  will be called pwm-pca9685.

config PWM_PUV3
	tristate "PKUnity NetBook-0916 PWM support"
	depends on ARCH_PUV3
@@ -115,6 +128,16 @@ config PWM_PXA
	  To compile this driver as a module, choose M here: the module
	  will be called pwm-pxa.

config PWM_RENESAS_TPU
	tristate "Renesas TPU PWM support"
	depends on ARCH_SHMOBILE
	help
	  This driver exposes the Timer Pulse Unit (TPU) PWM controller found
	  in Renesas chips through the PWM API.

	  To compile this driver as a module, choose M here: the module
	  will be called pwm-renesas-tpu.

config PWM_SAMSUNG
	tristate "Samsung PWM support"
	depends on PLAT_SAMSUNG
Loading