Re: [PATCH 1/3] pwm: cros-ec: Don't care about consumers in .get_state()

From: Tzung-Bi Shih
Date: Tue Jun 11 2024 - 04:50:51 EST


On Fri, Jun 07, 2024 at 10:44:15AM +0200, Uwe Kleine-König wrote:
> The get_state() callback is never called (in a visible way) after there
> is a consumer for a pwm device. The core handles loosing the information
> about duty_cycle just fine.

ChromeOS EC has no separated "enabled" state, it sees `duty == 0` as
"disabled"[1]. 1db37f9561b2 ("pwm: cros-ec: Cache duty cycle value")
caches the value in kernel side so that it can retrieve the original duty
value even if (struct pwm_state *)->enabled is false.

To make sure I understand, did you mean the original duty value could be less
important because:
- We are less caring as it is in a debug context at [2]?
- At [3], the PWM device is still initializing.

[1]: https://crrev.com/0e16954460a08133b2557150e0897014ea2b9672/common/pwm.c#66
[2]: https://elixir.bootlin.com/linux/v6.10-rc3/source/drivers/pwm/core.c#L52
[3]: https://elixir.bootlin.com/linux/v6.10-rc3/source/drivers/pwm/core.c#L371