On 2021/6/24, 8:44 PM, "Guenter Roeck" <groeck7@xxxxxxxxx on behalf of linux@xxxxxxxxxxxx> wrote:
On Thu, Jun 24, 2021 at 11:58:21AM +0800, Billy Tsai wrote:
>> The tach shouldn't use both edges to measure. When the tach input
>> duty cycle isn't 50% the return value will inaccurate.
>>
> A tachometer doesn't have a duty cycle. A pwm has a duty cycle, but that
> is completely independent of the pwm duty cycle used to set the fan speed.
> So this patch does not really make sense with the above explanation.
The duty cycle means the waveform that reported from the fan tach pin not pwm signal.
> The impact of this patch is likely that the reported fan speed is reduced
> by 50%. It may well be that the driver currently reports twice the real fan
> speed. I have no idea if that is the case, but if it is it should not be
> conditional. The description above states "when the tach input cycle isn't
> 50%", suggesting that this is conditional on some other configuration.
> I don't know what that might be either.
According to the tach mode, our tach controller will sample the time of once conditional meet and translate it to tach value.
When the tach signal duty cycle isn't 50%, using both edges mode will get the tach value with error rate.
In addition, the current report value of both edges will twice the result which will enlarge the error rate.
Actually, the tach signal won't be a complete 50% duty cycle, so both edges mode isn't recommanded for the fan usage.
With rising-to-rising mode the skew time of tach signal will also effect the accuracy.
Thus, using the falling-to-falling mode is the better way for a fan tach monitor.
But for flexibility, I think using dts property to control the tach mode is better the user can change the mode to adapter the monitor device.