leds/pwm: don't call pwm_disable when setting brightness
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest0 of 2 patches 0 repliesNew
Patches in v1 No applies recorded yet
None of the 2 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] leds/pwm: don't call pwm_disable when setting brightness
Quoted 8 lines · Thierry Reding
Quoted 6 lines · Uwe Kleine-K?nig
Quoted 2 lines
Why do you think it is the worst? If we define the behaviour as b) what does that gain us? Why would users want to call these functions if their
The gain is that the three (or more?) pwm drivers don't need to special case an artificial requirement of the framework. OK, users have to adapt, but it's as simple as substituting all questionable calls to
pwm_disableby a call topwm_config(duty=0).
Quoted 5 lines
There is no gain. If users suddenly have to care about hardware specifics I call that a loss. Equivalently if the PWM core framework needs to know about these specifics that's also a loss because it puts complexity in the core where device-specific properties clearly shouldn't be handled.
The easy way out for PWM users, the core and the driver is:
Declare the output status of a disabled PWM as undefined.
The core is not affected by this change. The users are even simplified by this change, because at the moment they all have to special case in some way if (duty == 0) pwm_disable(pwm);, this code could be removed. The PWM drivers could be simplified aswell since they no longer have to care about getting the PWM in a well defined state and don't have to take care about the correct disabled state of inverted PWMs. If a PWM driver wishes it can do some special casing for 0 and 100% duty cycle in order to save some power, but that would only be a bonus. As an additional bonus inverted PWMs could be completely software emulated in the core, then this code could also be removed from the drivers. PWM Users generally don't want to disable or enable the PWMs, instead they want a duty cycle of 0 or 100%. If they really don't care about the output status then they can call pwm_disable().
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |