Re: [PATCH v15 0/7] Rust Abstractions for PWM subsystem with TH1520 PWM driver

Michal Wilczynski
2025-10-15T18:07:31Z

On 10/15/25 19:52, Michal Wilczynski wrote:
>
>
> On 10/13/25 18:48, Uwe Kleine-König wrote:
>>
>> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
>> index c9fd1d8d17bc..a5666052b7ce 100644
>> --- a/drivers/pwm/pwm_th1520.rs
>> +++ b/drivers/pwm/pwm_th1520.rs
>> @@ -121,6 +121,7 @@ fn round_waveform_tohw(
>> wf: &pwm::Waveform,
>> ) -> Result<pwm::RoundedWaveform<Self::WfHw>> {
>> let data = chip.drvdata();
>> + let status = 0;
>>
>> if wf.period_length_ns == 0 {
>> dev_dbg!(chip.device(), "Requested period is 0, disabling PWM.\n");
>> @@ -141,18 +142,13 @@ fn round_waveform_tohw(
>> if period_cycles == 0 {
>> dev_dbg!(
>> chip.device(),
>> - "Requested period {} ns is too small for clock rate {} Hz, disabling PWM.\n",
>> + "Requested period {} ns is too small for clock rate {} Hz, rounding up.\n",
>> wf.period_length_ns,
>> rate_hz
>> );
>>
>> - return Ok(pwm::RoundedWaveform {
>> - status: 0,
>> - hardware_waveform: Th1520WfHw {
>> - enabled: false,
>> - ..Default::default()
>> - },
>> - });
>> + period_cycles = 1;
>> + status = 1;

Well status and period_cycles need to be mutable obviously, will change
that.

Best regards,
--
Michal Wilczynski <m.wilczynski@samsung.com>