Commit 77956cf3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pwm updates from Uwe Kleine-König:
 "In addition to the usual mix of core cleanups, driver changes, minor
  fixes and device tree updates the highlight this cycle is Rust support
  for the core and a first Rust driver both provided by Michal
  Wilczynski.

  Michal wrote about these changes on

    https://mwilczynski.dev/posts/bringing-rust-to-the-pwm-subsystem/

  which is a nice read"

* tag 'pwm/for-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (22 commits)
  pwm: rzg2l-gpt: Allow checking period_tick cache value only if sibling channel is enabled
  pwm: bcm2835: Make sure the channel is enabled after pwm_request()
  pwm: mediatek: Make use of struct_size macro
  pwm: mediatek: Remove unneeded semicolon
  pwm: airoha: Add support for EN7581 SoC
  pwm: mediatek: Convert to waveform API
  pwm: max7360: Clean MAX7360 code
  pwm: Drop unused function pwm_apply_args()
  pwm: Use %u to printf unsigned int pwm_chip::npwm and pwm_chip::id
  pwm: Simplify printf to emit chip->npwm in $debugfs/pwm
  pwm: th1520: Use module_pwm_platform_driver! macro
  pwm: th1520: Fix clippy warning for redundant struct field init
  pwm: Fix Rust formatting
  dt-bindings: pwm: thead: Add T-HEAD TH1520 PWM controller
  pwm: Add Rust driver for T-HEAD TH1520 SoC
  rust: pwm: Fix broken intra-doc link
  rust: pwm: Drop wrapping of PWM polarity and state
  rust: pwm: Add module_pwm_platform_driver! macro
  rust: pwm: Add complete abstraction layer
  rust: pwm: Add Kconfig and basic data structures
  ...
parents 04265849 fae00ea9
Loading
Loading
Loading
Loading
+48 −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/thead,th1520-pwm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: T-HEAD TH1520 PWM controller

maintainers:
  - Michal Wilczynski <m.wilczynski@samsung.com>

allOf:
  - $ref: pwm.yaml#

properties:
  compatible:
    const: thead,th1520-pwm

  reg:
    maxItems: 1

  clocks:
    items:
      - description: SoC PWM clock

  "#pwm-cells":
    const: 3

required:
  - compatible
  - reg
  - clocks

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/thead,th1520-clk-ap.h>
    soc {
      #address-cells = <2>;
      #size-cells = <2>;
      pwm@ffec01c000 {
          compatible = "thead,th1520-pwm";
          reg = <0xff 0xec01c000 0x0 0x4000>;
          clocks = <&clk CLK_PWM>;
          #pwm-cells = <3>;
      };
    };
+10 −0
Original line number Diff line number Diff line
@@ -20871,6 +20871,14 @@ F: include/linux/pwm.h
F:	include/linux/pwm_backlight.h
K:	pwm_(config|apply_might_sleep|apply_atomic|ops)
PWM SUBSYSTEM BINDINGS [RUST]
M:	Michal Wilczynski <m.wilczynski@samsung.com>
L:	linux-pwm@vger.kernel.org
L:	rust-for-linux@vger.kernel.org
S:	Maintained
F:	rust/helpers/pwm.c
F:	rust/kernel/pwm.rs
PXA GPIO DRIVER
M:	Robert Jarzmik <robert.jarzmik@free.fr>
L:	linux-gpio@vger.kernel.org
@@ -22293,6 +22301,7 @@ F: Documentation/devicetree/bindings/firmware/thead,th1520-aon.yaml
F:	Documentation/devicetree/bindings/mailbox/thead,th1520-mbox.yaml
F:	Documentation/devicetree/bindings/net/thead,th1520-gmac.yaml
F:	Documentation/devicetree/bindings/pinctrl/thead,th1520-pinctrl.yaml
F:	Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml
F:	Documentation/devicetree/bindings/reset/thead,th1520-reset.yaml
F:	arch/riscv/boot/dts/thead/
F:	drivers/clk/thead/clk-th1520-ap.c
@@ -22303,6 +22312,7 @@ F: drivers/pinctrl/pinctrl-th1520.c
F:	drivers/pmdomain/thead/
F:	drivers/power/reset/th1520-aon-reboot.c
F:	drivers/power/sequencing/pwrseq-thead-gpu.c
F:	drivers/pwm/pwm_th1520.rs
F:	drivers/reset/reset-th1520.c
F:	include/dt-bindings/clock/thead,th1520-clk-ap.h
F:	include/dt-bindings/power/thead,th1520-power.h
+33 −0
Original line number Diff line number Diff line
@@ -63,6 +63,16 @@ config PWM_ADP5585
	  This option enables support for the PWM function found in the Analog
	  Devices ADP5585.

config PWM_AIROHA
	tristate "Airoha PWM support"
	depends on ARCH_AIROHA || COMPILE_TEST
	select REGMAP_MMIO
	help
	  Generic PWM framework driver for Airoha SoC.

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

config PWM_APPLE
	tristate "Apple SoC PWM support"
	depends on ARCH_APPLE || COMPILE_TEST
@@ -748,6 +758,17 @@ config PWM_TEGRA
	  To compile this driver as a module, choose M here: the module
	  will be called pwm-tegra.

config PWM_TH1520
	tristate "TH1520 PWM support"
	depends on RUST
	select RUST_PWM_ABSTRACTIONS
	help
	  This option enables the driver for the PWM controller found on the
	  T-HEAD TH1520 SoC.

	  To compile this driver as a module, choose M here; the module
	  will be called pwm-th1520. If you are unsure, say N.

config PWM_TIECAP
	tristate "ECAP PWM support"
	depends on ARCH_OMAP2PLUS || ARCH_DAVINCI_DA8XX || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
@@ -819,4 +840,16 @@ config PWM_XILINX
	  To compile this driver as a module, choose M here: the module
	  will be called pwm-xilinx.

 config RUST_PWM_ABSTRACTIONS
	bool
	depends on RUST
	help
	  This option enables the safe Rust abstraction layer for the PWM
	  subsystem. It provides idiomatic wrappers and traits necessary for
	  writing PWM controller drivers in Rust.

	  The abstractions handle resource management (like memory and reference
	  counting) and provide safe interfaces to the underlying C core,
	  allowing driver logic to be written in safe Rust.

endif
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
obj-$(CONFIG_PWM)		+= core.o
obj-$(CONFIG_PWM_AB8500)	+= pwm-ab8500.o
obj-$(CONFIG_PWM_ADP5585)	+= pwm-adp5585.o
obj-$(CONFIG_PWM_AIROHA)	+= pwm-airoha.o
obj-$(CONFIG_PWM_APPLE)		+= pwm-apple.o
obj-$(CONFIG_PWM_ARGON_FAN_HAT)	+= pwm-argon-fan-hat.o
obj-$(CONFIG_PWM_ATMEL)		+= pwm-atmel.o
@@ -68,6 +69,7 @@ obj-$(CONFIG_PWM_STMPE) += pwm-stmpe.o
obj-$(CONFIG_PWM_SUN4I)		+= pwm-sun4i.o
obj-$(CONFIG_PWM_SUNPLUS)	+= pwm-sunplus.o
obj-$(CONFIG_PWM_TEGRA)		+= pwm-tegra.o
obj-$(CONFIG_PWM_TH1520)	+= pwm_th1520.o
obj-$(CONFIG_PWM_TIECAP)	+= pwm-tiecap.o
obj-$(CONFIG_PWM_TIEHRPWM)	+= pwm-tiehrpwm.o
obj-$(CONFIG_PWM_TWL)		+= pwm-twl.o
+4 −4
Original line number Diff line number Diff line
@@ -1608,12 +1608,13 @@ void pwmchip_put(struct pwm_chip *chip)
}
EXPORT_SYMBOL_GPL(pwmchip_put);

static void pwmchip_release(struct device *pwmchip_dev)
void pwmchip_release(struct device *pwmchip_dev)
{
	struct pwm_chip *chip = pwmchip_from_dev(pwmchip_dev);

	kfree(chip);
}
EXPORT_SYMBOL_GPL(pwmchip_release);

struct pwm_chip *pwmchip_alloc(struct device *parent, unsigned int npwm, size_t sizeof_priv)
{
@@ -2696,11 +2697,10 @@ static int pwm_seq_show(struct seq_file *s, void *v)
{
	struct pwm_chip *chip = v;

	seq_printf(s, "%s%d: %s/%s, %d PWM device%s\n",
	seq_printf(s, "%s%u: %s/%s, npwm: %u\n",
		   (char *)s->private, chip->id,
		   pwmchip_parent(chip)->bus ? pwmchip_parent(chip)->bus->name : "no-bus",
		   dev_name(pwmchip_parent(chip)), chip->npwm,
		   (chip->npwm != 1) ? "s" : "");
		   dev_name(pwmchip_parent(chip)), chip->npwm);

	pwm_dbg_show(chip, s);

Loading