Re: rk_gpio: high latency switching between input / output

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Fri, 24 Sep 2021 16:19:41 UTC
On 23/09/2021 10:18, Emmanuel Vadot wrote:
> 
>   I've made some tests on my rock64 board.
>   The program I used [1] is, I think, the worst possible scenario that
> can happen as it :
>   - Set the pin to output
>   - Toggle the pin
>   - Set the pin to input
>   - Read the pin
>   - Set the pin to output
> 
>   With it I get a ~30khz signal produced on the pin.
> 
>   I did some change to rk_gpio [2], those changes are :
> 
>   - Cache the pin info (gpio or not) and flags (pullup/pulldown)
>   - Remove useless reads for the pin direction and value when we're
> setting or toggling the pin (so output mode only).
> 
>   With this and the same program I manage to have a ~50khz signal output
> on the pin.
>   I'm not sure I can get higher result for now.
> 
>   All test where done on main (c96da199458) with GENERIC kernel.
>   Obviously you will have better result for kernel operation but I
> choose to do userland to have the worst case possible.
> 
>   Let me know if this helps you in your case, otherwise I'll hookup some
> 1wire temp sensors and try to make them work while the scope is still
> plugged on the board.
 >
>   1: https://people.freebsd.org/~manu/rk_gpio/gpio_test.c
>   2: https://people.freebsd.org/~manu/rk_gpio/0001-arm64-rockchip-rk_gpio-Improve-mode-switching.patch
> 

Thank you very much!
1-wire works reliably for me with your patch.
Hope to see it committed soon.


-- 
Andriy Gapon