Re: [PATCH v2 1/1] pwm: tiehrpwm: ensures that state.enabled is synchronized in .probe()
From: Uwe Kleine-König
Date: Fri Feb 07 2025 - 03:49:16 EST
Hello Rafael,
On Thu, Feb 06, 2025 at 12:18:52AM -0300, Rafael V. Volkmer wrote:
> If the hardware is already active during probe, it's not asserted
> that the clock is enabled. To address this, added ehrpwm_get_state()
> to verify the enable bit and update the pwm_state struct with the
> correct hardware parameters.
>
> In ehrpwm_pwm_probe(), the function checks if the enable bit is set
> and calls clk_enable() and pm_runtime_get_sync() if needed.
>
> Additionally, ehrpwm_get_state() was integrated as .get_state in
> the ehrpwm_pwm_ops struct, incorporating it into the driver's pwm_ops
> for consistent state management.
No in depth review here. One thing I just noticed when skimming your
patch: There are still whitespace style issues (that checkpatch might
not notice), please only use only a single space after =. Also please
split the patch in two: One to introduce .get_state() and the other to
fix clock enable accounting.
I would also consider inlining ehrpwm_read_period(),
ehrpwm_read_duty_cycle() and ehrpwm_read_polarity() into
ehrpwm_get_state() to not have to jump around to understand the register
usage.
For a more detailed review I have to ask for your patience. There are
still some more driver reviews in my list, but I come to your driver
eventually.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature