Commit 42bff4d0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

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

Pull pwm updates from Thierry Reding:
 "This contains a bunch of cleanups and simplifications across the
  board, as well as a number of small fixes.

  Perhaps the most notable change here is the addition of an API that
  allows PWMs to be used in atomic contexts, which is useful when time-
  critical operations are involved, such as using a PWM to generate IR
  signals.

  Finally, I have decided to step down as PWM subsystem maintainer. Due
  to other responsibilities I have lately not been able to find the time
  that the subsystem deserves and Uwe, who has been helping out a lot
  for the past few years and has many things planned for the future, has
  kindly volunteered to take over. I have no doubt that he will be a
  suitable replacement"

* tag 'pwm/for-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (44 commits)
  MAINTAINERS: pwm: Thierry steps down, Uwe takes over
  pwm: linux/pwm.h: fix Excess kernel-doc description warning
  pwm: Add pwm_apply_state() compatibility stub
  pwm: cros-ec: Drop documentation for dropped struct member
  pwm: Drop two unused API functions
  pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs
  pwm: meson: Simplify using dev_err_probe()
  pwm: stmpe: Silence duplicate error messages
  pwm: Reduce number of pointer dereferences in pwm_device_request()
  pwm: crc: Use consistent variable naming for driver data
  pwm: omap-dmtimer: Drop locking
  dt-bindings: pwm: ti,pwm-omap-dmtimer: Update binding for yaml
  media: pwm-ir-tx: Trigger edges from hrtimer interrupt context
  pwm: bcm2835: Allow PWM driver to be used in atomic context
  pwm: Make it possible to apply PWM changes in atomic context
  pwm: renesas: Remove unused include
  pwm: Replace ENOTSUPP with EOPNOTSUPP
  pwm: Rename pwm_apply_state() to pwm_apply_might_sleep()
  pwm: Stop referencing pwm->chip
  pwm: Update kernel doc for struct pwm_chip
  ...
parents fef018d8 7afc0e7f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ title: MediaTek DISP_PWM Controller

maintainers:
  - Jitao Shi <jitao.shi@mediatek.com>
  - Xinlei Lee <xinlei.lee@mediatek.com>

allOf:
  - $ref: pwm.yaml#
+0 −22
Original line number Diff line number Diff line
* OMAP PWM for dual-mode timers

Required properties:
- compatible: Shall contain "ti,omap-dmtimer-pwm".
- ti,timers: phandle to PWM capable OMAP timer. See timer/ti,timer-dm.yaml for info
  about these timers.
- #pwm-cells: Should be 3. See pwm.yaml in this directory for a description of
  the cells format.

Optional properties:
- ti,prescaler: Should be a value between 0 and 7, see the timers datasheet
- ti,clock-source: Set dmtimer parent clock, values between 0 and 2:
  - 0x00 - high-frequency system clock (timer_sys_ck)
  - 0x01 - 32-kHz always-on clock (timer_32k_ck)
  - 0x02 - external clock (timer_ext_ck, OMAP2 only)

Example:
	pwm9: dmtimer-pwm@9 {
		compatible = "ti,omap-dmtimer-pwm";
		ti,timers = <&timer9>;
		#pwm-cells = <3>;
	};
+59 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/pwm/ti,omap-dmtimer-pwm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: TI dual mode timer PWM controller

maintainers:
  - Tony Lindgren <tony@atomide.com>

description:
  TI dual mode timer instances have an IO pin for PWM capability

allOf:
  - $ref: pwm.yaml#

properties:
  compatible:
    const: ti,omap-dmtimer-pwm

  "#pwm-cells":
    const: 3

  ti,timers:
    description: Timer instance phandle for the PWM
    $ref: /schemas/types.yaml#/definitions/phandle

  ti,prescaler:
    description: |
      Legacy clock prescaler for timer. The timer counter is prescaled
      with 2^n where n is the prescaler.
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
    deprecated: true

  ti,clock-source:
    description: |
      Legacy clock for timer, please use assigned-clocks instead.
      0x00 - high-frequency system clock (timer_sys_ck)
      0x01 - 32-kHz always-on clock (timer_32k_ck)
      0x02 - external clock (timer_ext_ck, OMAP2 only)
    $ref: /schemas/types.yaml#/definitions/uint32
    enum: [ 0, 1, 2 ]
    deprecated: true

required:
  - compatible
  - ti,timers

unevaluatedProperties: false

examples:
  - |
    pwm9: pwm {
      compatible = "ti,omap-dmtimer-pwm";
      ti,timers = <&timer9>;
      #pwm-cells = <3>;
    };
+13 −4
Original line number Diff line number Diff line
@@ -41,11 +41,20 @@ the getter, devm_pwm_get() and devm_fwnode_pwm_get(), also exist.

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_might_sleep(struct pwm_device *pwm, struct pwm_state *state);

This API controls both the PWM period/duty_cycle config and the
enable/disable state.

PWM devices can be used from atomic context, if the PWM does not sleep. You
can check if this the case with::

        bool pwm_might_sleep(struct pwm_device *pwm);

If false, the PWM can also be configured from atomic context with::

	int pwm_apply_atomic(struct pwm_device *pwm, struct pwm_state *state);

As a consumer, don't rely on the output's state for a disabled PWM. If it's
easily possible, drivers are supposed to emit the inactive state, but some
drivers cannot. If you rely on getting the inactive state, use .duty_cycle=0,
@@ -57,13 +66,13 @@ If supported by the driver, the signal can be optimized, for example to improve
EMI by phase shifting the individual channels of a chip.

The pwm_config(), pwm_enable() and pwm_disable() functions are just wrappers
around pwm_apply_state() and should not be used if the user wants to change
around pwm_apply_might_sleep() and should not be used if the user wants to change
several parameter at once. For example, if you see pwm_config() and
pwm_{enable,disable}() calls in the same function, this probably means you
should switch to pwm_apply_state().
should switch to pwm_apply_might_sleep().

The PWM user API also allows one to query the PWM state that was passed to the
last invocation of pwm_apply_state() using pwm_get_state(). Note this is
last invocation of pwm_apply_might_sleep() using pwm_get_state(). Note this is
different to what the driver has actually implemented if the request cannot be
satisfied exactly with the hardware in use. There is currently no way for
consumers to get the actually implemented settings.
+3 −4
Original line number Diff line number Diff line
@@ -17645,12 +17645,11 @@ F: Documentation/devicetree/bindings/leds/irled/pwm-ir-tx.yaml
F:	drivers/media/rc/pwm-ir-tx.c
PWM SUBSYSTEM
M:	Thierry Reding <thierry.reding@gmail.com>
R:	Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
M:	Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
L:	linux-pwm@vger.kernel.org
S:	Maintained
Q:	https://patchwork.ozlabs.org/project/linux-pwm/list/
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git
T:	git https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git
F:	Documentation/devicetree/bindings/gpio/gpio-mvebu.yaml
F:	Documentation/devicetree/bindings/pwm/
F:	Documentation/driver-api/pwm.rst
@@ -17660,7 +17659,7 @@ F: drivers/video/backlight/pwm_bl.c
F:	include/dt-bindings/pwm/
F:	include/linux/pwm.h
F:	include/linux/pwm_backlight.h
K:	pwm_(config|apply_state|ops)
K:	pwm_(config|apply_might_sleep|apply_atomic|ops)
PXA GPIO DRIVER
M:	Robert Jarzmik <robert.jarzmik@free.fr>
Loading