Commit 7b9df264 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

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

Pull pwm updates from Thierry Reding:
 "This adds support for the PWM controller found on Toshiba Visconti
  SoCs and converts a couple of drivers to the atomic API.

  There's also a bunch of cleanups and minor fixes across the board"

* tag 'pwm/for-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (35 commits)
  pwm: Reword docs about pwm_apply_state()
  pwm: atmel: Improve duty cycle calculation in .apply()
  pwm: atmel: Fix duty cycle calculation in .get_state()
  pwm: visconti: Add Toshiba Visconti SoC PWM support
  dt-bindings: pwm: Add bindings for Toshiba Visconti PWM Controller
  arm64: dts: rockchip: Remove clock-names from PWM nodes
  ARM: dts: rockchip: Remove clock-names from PWM nodes
  dt-bindings: pwm: rockchip: Add more compatible strings
  dt-bindings: pwm: Convert pwm-rockchip.txt to YAML
  pwm: mediatek: Remove unused function
  pwm: pca9685: Improve runtime PM behavior
  pwm: pca9685: Support hardware readout
  pwm: pca9685: Switch to atomic API
  pwm: lpss: Don't modify HW state in .remove callback
  pwm: sti: Free resources only after pwmchip_remove()
  pwm: sti: Don't modify HW state in .remove callback
  pwm: lpc3200: Don't modify HW state in .remove callback
  pwm: lpc18xx-sct: Free resources only after pwmchip_remove()
  pwm: bcm-kona: Don't modify HW state in .remove callback
  pwm: bcm2835: Free resources only after pwmchip_remove()
  ...
parents 583f2bcf a6efb350
Loading
Loading
Loading
Loading
+0 −27
Original line number Diff line number Diff line
Rockchip PWM controller

Required properties:
 - compatible: should be "rockchip,<name>-pwm"
   "rockchip,rk2928-pwm": found on RK29XX,RK3066 and RK3188 SoCs
   "rockchip,rk3288-pwm": found on RK3288 SOC
   "rockchip,rv1108-pwm", "rockchip,rk3288-pwm": found on RV1108 SoC
   "rockchip,vop-pwm": found integrated in VOP on RK3288 SoC
 - reg: physical base address and length of the controller's registers
 - clocks: See ../clock/clock-bindings.txt
   - For older hardware (rk2928, rk3066, rk3188, rk3228, rk3288, rk3399):
     - There is one clock that's used both to derive the functional clock
       for the device and as the bus clock.
   - For newer hardware (rk3328 and future socs): specified by name
     - "pwm": This is used to derive the functional clock.
     - "pclk": This is the APB bus clock.
 - #pwm-cells: must be 2 (rk2928) or 3 (rk3288). See pwm.yaml in this directory
   for a description of the cell format.

Example:

	pwm0: pwm@20030000 {
		compatible = "rockchip,rk2928-pwm";
		reg = <0x20030000 0x10>;
		clocks = <&cru PCLK_PWM01>;
		#pwm-cells = <2>;
	};
+100 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/pwm/pwm-rockchip.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Rockchip PWM controller

maintainers:
  - Heiko Stuebner <heiko@sntech.de>

properties:
  compatible:
    oneOf:
      - const: rockchip,rk2928-pwm
      - const: rockchip,rk3288-pwm
      - const: rockchip,rk3328-pwm
      - const: rockchip,vop-pwm
      - items:
          - const: rockchip,rk3036-pwm
          - const: rockchip,rk2928-pwm
      - items:
          - enum:
              - rockchip,rk3368-pwm
              - rockchip,rk3399-pwm
              - rockchip,rv1108-pwm
          - const: rockchip,rk3288-pwm
      - items:
          - enum:
              - rockchip,px30-pwm
              - rockchip,rk3308-pwm
          - const: rockchip,rk3328-pwm

  reg:
    maxItems: 1

  clocks:
    minItems: 1
    maxItems: 2

  clock-names:
    maxItems: 2

  "#pwm-cells":
    enum: [2, 3]
    description:
      Must be 2 (rk2928) or 3 (rk3288 and later).
      See pwm.yaml for a description of the cell format.

required:
  - compatible
  - reg
  - "#pwm-cells"

if:
  properties:
    compatible:
      contains:
        enum:
          - rockchip,rk3328-pwm
          - rockchip,rv1108-pwm

then:
  properties:
    clocks:
      items:
        - description: Used to derive the functional clock for the device.
        - description: Used as the APB bus clock.

    clock-names:
      items:
        - const: pwm
        - const: pclk

  required:
    - clocks
    - clock-names

else:
  properties:
    clocks:
      maxItems: 1
      description:
        Used both to derive the functional clock
        for the device and as the bus clock.

  required:
    - clocks

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/rk3188-cru-common.h>
    pwm0: pwm@20030000 {
      compatible = "rockchip,rk2928-pwm";
      reg = <0x20030000 0x10>;
      clocks = <&cru PCLK_PWM01>;
      #pwm-cells = <2>;
    };
+43 −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/toshiba,pwm-visconti.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Toshiba Visconti PWM Controller

maintainers:
  - Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

properties:
  compatible:
    items:
      - const: toshiba,visconti-pwm

  reg:
    maxItems: 1

  '#pwm-cells':
    const: 2

required:
  - compatible
  - reg
  - '#pwm-cells'

additionalProperties: false

examples:
  - |
    soc {
        #address-cells = <2>;
        #size-cells = <2>;

        pwm: pwm@241c0000 {
            compatible = "toshiba,visconti-pwm";
            reg = <0 0x241c0000 0 0x1000>;
            pinctrl-names = "default";
            pinctrl-0 = <&pwm_mux>;
            #pwm-cells = <2>;
        };
    };
+5 −1
Original line number Diff line number Diff line
@@ -55,7 +55,11 @@ 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().

The PWM user API also allows one to query the PWM state with pwm_get_state().
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
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.

In addition to the PWM state, the PWM API also exposes PWM arguments, which
are the reference PWM config one should use on this PWM.
+0 −4
Original line number Diff line number Diff line
@@ -355,7 +355,6 @@
		reg = <0x20050000 0x10>;
		#pwm-cells = <3>;
		clocks = <&cru PCLK_PWM>;
		clock-names = "pwm";
		pinctrl-names = "default";
		pinctrl-0 = <&pwm0_pin>;
		status = "disabled";
@@ -366,7 +365,6 @@
		reg = <0x20050010 0x10>;
		#pwm-cells = <3>;
		clocks = <&cru PCLK_PWM>;
		clock-names = "pwm";
		pinctrl-names = "default";
		pinctrl-0 = <&pwm1_pin>;
		status = "disabled";
@@ -377,7 +375,6 @@
		reg = <0x20050020 0x10>;
		#pwm-cells = <3>;
		clocks = <&cru PCLK_PWM>;
		clock-names = "pwm";
		pinctrl-names = "default";
		pinctrl-0 = <&pwm2_pin>;
		status = "disabled";
@@ -388,7 +385,6 @@
		reg = <0x20050030 0x10>;
		#pwm-cells = <2>;
		clocks = <&cru PCLK_PWM>;
		clock-names = "pwm";
		pinctrl-names = "default";
		pinctrl-0 = <&pwm3_pin>;
		status = "disabled";
Loading