Commit c371f62d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull pwm updates from Uwe Kleine-König:
 "There are a few patches adapting to changes in Rust land which seems
  to be the norm since there is a pwm driver written in Rust. Other than
  that just a few cleanups and a single fix for the tiehrpwm driver that
  came in too late for making it into v6.19.

  Thanks to Andy Shevchenko, Bartosz Golaszewski, Daniel Almeida and
  Michal Wilczynski for reviews in this cycle, and to Alice Ryhl, Ben
  Zong-You Xie, Gokul Praveen, Kari Argillander, Markus Probst, Raag
  Jadav, Shankari Anand, Tamir Duberstein and Vladimir Zapolskiy for
  code contributions"

* tag 'pwm/for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux:
  pwm: Remove redundant check in pwm_ops_check()
  pwm: tiehrpwm: Enable pwmchip's parent device before setting configuration
  pwm: Update MAINTAINER entry
  rust: pwm: Add __rust_helper to helpers
  rust: pwm: Simplify to_result call sites and unsafe blocks
  rust: pwm: Fix potential memory leak on init error
  dt-bindings: pwm: nxp,lpc32xx-pwm: Specify clocks property as mandatory
  pwm: th1520: Replace `kernel::c_str!` with C-Strings
  pwm: dwc: Use size macro
  pwm: Emit native configuration in /sys/kernel/debug/pwm
  rust: pwm: Add UnregisteredChip wrapper around Chip
  rust: pwm: Update ARef and AlwaysRefCounted imports to use sync::aref
parents e86dda7b 9321f9d2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ properties:
required:
  - compatible
  - reg
  - clocks
  - '#pwm-cells'

allOf:
@@ -36,9 +37,12 @@ unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/lpc32xx-clock.h>

    pwm@4005c000 {
        compatible = "nxp,lpc3220-pwm";
        reg = <0x4005c000 0x4>;
        clocks = <&clk LPC32XX_CLK_PWM1>;
        #pwm-cells = <3>;
    };
+2 −4
Original line number Diff line number Diff line
@@ -21151,16 +21151,14 @@ L: linux-pwm@vger.kernel.org
S:	Maintained
Q:	https://patchwork.ozlabs.org/project/linux-pwm/list/
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
F:	drivers/gpio/gpio-mvebu.c
F:	drivers/pwm/
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_might_sleep|apply_atomic|ops)
K:	(devm_)?pwmchip_(add|alloc|remove)
K:	pwm_(round|get|set)_waveform
PWM SUBSYSTEM BINDINGS [RUST]
M:	Michal Wilczynski <m.wilczynski@samsung.com>
+23 −7
Original line number Diff line number Diff line
@@ -1699,8 +1699,7 @@ static bool pwm_ops_check(const struct pwm_chip *chip)

	if (ops->write_waveform) {
		if (!ops->round_waveform_tohw ||
		    !ops->round_waveform_fromhw ||
		    !ops->write_waveform)
		    !ops->round_waveform_fromhw)
			return false;

		if (PWM_WFHWSIZE < ops->sizeof_wfhw) {
@@ -2638,10 +2637,10 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)

	for (i = 0; i < chip->npwm; i++) {
		struct pwm_device *pwm = &chip->pwms[i];
		struct pwm_state state, hwstate;
		struct pwm_state state;
		int err;

		pwm_get_state(pwm, &state);
		pwm_get_state_hw(pwm, &hwstate);

		seq_printf(s, " pwm-%-3d (%-20.20s):", i, pwm->label);

@@ -2657,9 +2656,26 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
			seq_puts(s, ", usage_power");
		seq_puts(s, "\n");

		if (pwmchip_supports_waveform(chip)) {
			struct pwm_waveform wf;

			err = pwm_get_waveform_might_sleep(pwm, &wf);
			if (!err)
				seq_printf(s, "  actual configuration: %lld/%lld [+%lld]",
					   wf.duty_length_ns, wf.period_length_ns, wf.duty_offset_ns);
			else
				seq_printf(s, "  actual configuration: read out error: %pe\n", ERR_PTR(err));
		} else {
			struct pwm_state hwstate;

			err = pwm_get_state_hw(pwm, &hwstate);
			if (!err)
				seq_printf(s, "  actual configuration:    %3sabled, %llu/%llu ns, %s polarity",
					   hwstate.enabled ? "en" : "dis", hwstate.duty_cycle, hwstate.period,
					   hwstate.polarity ? "inverse" : "normal");
			else
				seq_printf(s, "  actual configuration: read out error: %pe", ERR_PTR(err));
		}

		seq_puts(s, "\n");
	}
+2 −1
Original line number Diff line number Diff line
@@ -22,13 +22,14 @@
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/pwm.h>
#include <linux/sizes.h>

#include "pwm-dwc.h"

/* Elkhart Lake */
static const struct dwc_pwm_info ehl_pwm_info = {
	.nr = 2,
	.size = 0x1000,
	.size = SZ_4K,
};

static int dwc_pwm_init_one(struct device *dev, struct dwc_pwm_drvdata *ddata, unsigned int idx)
+2 −4
Original line number Diff line number Diff line
@@ -237,8 +237,6 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
	if (period_cycles < 1)
		period_cycles = 1;

	pm_runtime_get_sync(pwmchip_parent(chip));

	/* Update clock prescaler values */
	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_CLKDIV_MASK, tb_divval);

@@ -290,8 +288,6 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
	if (!(duty_cycles > period_cycles))
		ehrpwm_write(pc->mmio_base, cmp_reg, duty_cycles);

	pm_runtime_put_sync(pwmchip_parent(chip));

	return 0;
}

@@ -378,6 +374,8 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
	int err;
	bool enabled = pwm->state.enabled;

	guard(pm_runtime_active)(pwmchip_parent(chip));

	if (state->polarity != pwm->state.polarity) {
		if (enabled) {
			ehrpwm_pwm_disable(chip, pwm);
Loading