[Fix]
After applying this patch, it appears that the read() command sometimes fails to receive a response, even when increasing the retry times. This could be due to our use of a spin lock to lock the UART port in the read() function, preventing us from calling read() immediately after a write() function.
fbf84fb368923 ("UBUNTU: SAUCE: platform/x86: dell-uart-backlight: replace chars_in_buffer() with flush_chars()")
To fix this we only need a small delay after the write() function to make it has time to clear its buffer.
[Test case]
1. Add dell_uart_backlight.dyndbg="+pt" to the kernel cmdline
2. Boots up the system and check dmesg
3. Make sure there is no dell_uart_backlight rx NULL message in dmesg
4. Try to unload/reload dell_uart_backlight couple times and check dmesg again
[Where problems could occur]
sleep for 1ms is pretty short that it's not possible to lead to messages loss.
[Impact]
Boots up the system and sometimes we can see below messages and that leads to backlight driver doesn't get loaded.
[ 86.424880] dell_uart_ backlight: dell_uart_ get_display_ mode:tx: 6a 10 85 backlight: dell_uart_ get_display_ mode:rx: NULL backlight: dell_uart_ get_display_ mode:tx: 6a 10 85 backlight: dell_uart_ get_display_ mode:rx: NULL
[ 86.603936] [7439] dell_uart_
[ 87.596047] dell_uart_
[ 87.775209] [7439] dell_uart_
[Fix]
After applying this patch, it appears that the read() command sometimes fails to receive a response, even when increasing the retry times. This could be due to our use of a spin lock to lock the UART port in the read() function, preventing us from calling read() immediately after a write() function.
fbf84fb368923 ("UBUNTU: SAUCE: platform/x86: dell-uart- backlight: replace chars_in_buffer() with flush_chars()")
To fix this we only need a small delay after the write() function to make it has time to clear its buffer.
[Test case] backlight. dyndbg= "+pt" to the kernel cmdline
1. Add dell_uart_
2. Boots up the system and check dmesg
3. Make sure there is no dell_uart_backlight rx NULL message in dmesg
4. Try to unload/reload dell_uart_backlight couple times and check dmesg again
[Where problems could occur]
sleep for 1ms is pretty short that it's not possible to lead to messages loss.