[PATCH 0/2] pwm: brcmstb: Some cleanups

Florian Fainelli f.fainelli at gmail.com
Mon Feb 14 09:18:49 PST 2022


On 2/14/22 12:23 AM, Uwe Kleine-König wrote:
> Hello,
> 
> here are a few cleanups for the brcmstb PWM driver. There are a few
> issues left with it, that I'm not addressing for now. Just mention it in
> case someone wants to work on this driver:
> 
>  - There is no .get_state() callback
>    (That needs to be implemented by some with hardware and
>    documentation)
> 
>  - There are a few places where an overflow can happen in
>    brcmstb_pwm_config() that are not handled
> 
>  - The loop in brcmstb_pwm_config() to calculate cword is ineffective,
>    cword could be calculated ad hoc.
> 
>  - I don't understand
> 
>                 /*
>                  * We can be called with separate duty and period updates,
>                  * so do not reject dc == 0 right away
>                  */
>                 if (pc == PWM_PERIOD_MIN || (dc < PWM_ON_MIN && duty_ns))
>                         return -EINVAL;
> 
>    The usual policy is "With the selected period, pick the biggest
>    possible duty_cycle that isn't bigger thatn the requested duty_cycle.
>    So should this case be handled using dc = 0 instead?
>    But as I don't understand the real issue here (is this about changing
>    period and duty at the same time?), I don't want to touch that.

IIRC, I was testing using a shell script that would exercise corner
cases by modifying the /sys/class/pwm/*/{period,duty_cycle} separately
was able to run into that. Let me see if I can dig up that script.

Can you give me a day or two to make sure your changes work properly? I
need to locate a board with an exposed PWM header so I can put a scope
on it. Thanks!
-- 
Florian



More information about the linux-arm-kernel mailing list