[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e4a124a8-0905-4504-62e0-a809163775fe@gmx.de>
Date: Sat, 5 Dec 2020 00:16:01 +0100
From: Lino Sanfilippo <LinoSanfilippo@....de>
To: Sean Young <sean@...s.org>
Cc: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
thierry.reding@...il.com, lee.jones@...aro.org,
nsaenzjulienne@...e.de, f.fainelli@...il.com, rjui@...adcom.com,
sbranden@...adcom.com, bcm-kernel-feedback-list@...adcom.com,
linux-pwm@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] pwm: bcm2835: Support apply function for atomic
configuration
Hi Sean,
On 04.12.20 at 09:44, Sean Young wrote:
>> What about an extra check then to make sure that the period has not been truncated,
>> e.g:
>>
>> value = DIV_ROUND_CLOSEST_ULL(state->period, scaler);
>>
>> /* dont accept a period that is too small or has been truncated */
>> if ((value < PERIOD_MIN) ||
>> (value != DIV_ROUND_CLOSEST_ULL(state->period, scaler)))
>> return -EINVAL;
>
> Rather than doing another 64 bit division which is expensive (esp on 32 bit
> kernels), you could assign to u64 and check:
>
> if (value < PERIOD || value > U32_MAX)
> return -EINVAL;
>
Sound reasonable, I will adjust this.
>
> There was a problem where the carrier is incorrect for some IR hardware
> which uses a carrier of 455kHz. With periods that small, rounding errors
> do really matter and rounding down might cause problems.
>
> A policy of rounding down the carrier is not the right thing to do
> for pwm-ir-tx, and such a change will probably break pwm-ir-tx in some
> edge cases.
>
Thanks for this background information.
Regards,
Lino
Powered by blists - more mailing lists