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);
seq_puts(s, ", usage_power");
seq_puts(s, "\n");
- seq_printf(s, " actual configuration: %3sabled, %llu/%llu ns, %s polarity",
- hwstate.enabled ? "en" : "dis", hwstate.duty_cycle, hwstate.period,
- hwstate.polarity ? "inverse" : "normal");
+ 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");
}