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

Commit 38f7d2da authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'pwm/for-4.13-rc1' of...

Merge tag 'pwm/for-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm

Pull pwm updates from Thierry Reding:
 "This release cycle's changes include mostly updates and cleanups to
  existing drivers along with a few cleanups to the core, documentation
  and device tree bindings"

* tag 'pwm/for-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
  pwm: cros-ec: Fix transposed param settings
  pwm: meson: Improve PWM calculation precision
  dt-bindings: pwm: meson: Add compatible for gxbb ao PWMs
  pwm: meson: Add compatible for the gxbb ao PWMs
  pwm: sun4i: Drop legacy callbacks
  pwm: sun4i: Switch to atomic PWM
  pwm: sun4i: Improve hardware read out
  pwm: hibvt: Constify hibvt_pwm_ops
  pwm: Silently error out on EPROBE_DEFER
  pwm: Standardize document format
  pwm: bfin: Remove unneeded error message
  dt-bindings: pwm: Update STM32 timers clock names
  dt-bindings: pwm: Add R-Car M3-W device tree bindings
  pwm: tegra: Set maximum pwm clock source per SoC tapeout
parents dc087d1e 5ec8c48a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2,7 +2,9 @@ Amlogic Meson PWM Controller
============================

Required properties:
- compatible: Shall contain "amlogic,meson8b-pwm" or "amlogic,meson-gxbb-pwm".
- compatible: Shall contain "amlogic,meson8b-pwm"
                         or "amlogic,meson-gxbb-pwm"
                         or "amlogic,meson-gxbb-ao-pwm"
- #pwm-cells: Should be 3. See pwm.txt in this directory for a description of
  the cells format.

+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ Example:
		compatible = "st,stm32-timers";
		reg = <0x40010000 0x400>;
		clocks = <&rcc 0 160>;
		clock-names = "clk_int";
		clock-names = "int";

		pwm {
			compatible = "st,stm32-pwm";
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ Required Properties:
 - "renesas,pwm-r8a7791": for R-Car M2-W
 - "renesas,pwm-r8a7794": for R-Car E2
 - "renesas,pwm-r8a7795": for R-Car H3
 - "renesas,pwm-r8a7796": for R-Car M3-W
- reg: base address and length of the registers block for the PWM.
- #pwm-cells: should be 2. See pwm.txt in this directory for a description of
  the cells format.
+28 −18
Original line number Diff line number Diff line
======================================
Pulse Width Modulation (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
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[] = {
		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
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);

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

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

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
    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
  enable
    Enable/disable the PWM signal (read/write).

	- 0 - disabled
	- 1 - enabled

Implementing a PWM driver
-------------------------
+3 −1
Original line number Diff line number Diff line
@@ -678,7 +678,9 @@ struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id)

	pc = of_node_to_pwmchip(args.np);
	if (IS_ERR(pc)) {
		if (PTR_ERR(pc) != -EPROBE_DEFER)
			pr_err("%s(): PWM chip not found\n", __func__);

		pwm = ERR_CAST(pc);
		goto put;
	}
Loading