[PATCH v2 2/5] pwm: axi-pwmgen: report the waveform step

From: Nicolae-Daniel Deaconescu

Date: Wed Nov 04 2026 - 08:26:16 EST


The period, duty and offset counters of the AXI PWM generator count
cycles of its external clock, without a divider. Report that clock rate
and one cycle per step.

Signed-off-by: Nicolae-Daniel Deaconescu <Nicolae-daniel.Deaconescu@xxxxxxxxxx>
---
drivers/pwm/pwm-axi-pwmgen.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/pwm/pwm-axi-pwmgen.c b/drivers/pwm/pwm-axi-pwmgen.c
index b40522f01002..5b6a6943d08a 100644
--- a/drivers/pwm/pwm-axi-pwmgen.c
+++ b/drivers/pwm/pwm-axi-pwmgen.c
@@ -136,6 +136,18 @@ static int axi_pwmgen_round_waveform_fromhw(struct pwm_chip *chip, struct pwm_de
return 0;
}

+static int axi_pwmgen_get_waveform_step(struct pwm_chip *chip,
+ struct pwm_device *pwm,
+ struct pwm_waveform_step *step)
+{
+ struct axi_pwmgen_ddata *ddata = axi_pwmgen_ddata_from_chip(chip);
+
+ step->clk_rate_hz = ddata->clk_rate_hz;
+ step->clk_cycles_per_step = 1;
+
+ return 0;
+}
+
static int axi_pwmgen_write_waveform(struct pwm_chip *chip,
struct pwm_device *pwm,
const void *_wfhw)
@@ -201,6 +213,7 @@ static const struct pwm_ops axi_pwmgen_pwm_ops = {
.round_waveform_fromhw = axi_pwmgen_round_waveform_fromhw,
.read_waveform = axi_pwmgen_read_waveform,
.write_waveform = axi_pwmgen_write_waveform,
+ .get_waveform_step = axi_pwmgen_get_waveform_step,
};

static int axi_pwmgen_setup(struct regmap *regmap, struct device *dev)
--
2.34.1