[PATCH 1/1][SRU][M] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add small delay after write command

AceLan Kao acelan.kao at canonical.com
Thu Sep 14 10:13:41 UTC 2023


From: "Chia-Lin Kao (AceLan)" <acelan.kao at canonical.com>

BugLink: https://bugs.launchpad.net/bug/2035299

After applying fbf84fb368923 ("UBUNTU: SAUCE: platform/x86:
dell-uart-backlight: replace chars_in_buffer() with flush_chars()"), it
seems that the read() command may fail to receive a response, even when
increasing the retry times. It never gets a response when it fails.

To fix this, try adding a small delay after the write() function as a workaround.

Fixes: fbf84fb368923 ("UBUNTU: SAUCE: platform/x86: dell-uart-backlight: replace chars_in_buffer() with flush_chars()")
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao at canonical.com>
---
 drivers/platform/x86/dell/dell-uart-backlight.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/platform/x86/dell/dell-uart-backlight.c b/drivers/platform/x86/dell/dell-uart-backlight.c
index 120701e5b8b13..c489f7997767f 100644
--- a/drivers/platform/x86/dell/dell-uart-backlight.c
+++ b/drivers/platform/x86/dell/dell-uart-backlight.c
@@ -248,6 +248,7 @@ static int dell_uart_set_bl_power(struct backlight_device *bd, int power)
 	}
 
 	dell_uart_write(uart, bl_cmd->cmd, bl_cmd->tx_len);
+	msleep(1);
 	rx_len = dell_uart_read(uart, bl_cmd->ret, bl_cmd->rx_len);
 
 	mutex_unlock(&dell_pdata->brightness_mutex);
@@ -275,6 +276,7 @@ static int dell_uart_get_brightness(struct backlight_device *bd)
 	}
 
 	dell_uart_write(uart, bl_cmd->cmd, bl_cmd->tx_len);
+	msleep(1);
 	rx_len = dell_uart_read(uart, bl_cmd->ret, bl_cmd->rx_len);
 
 	mutex_unlock(&dell_pdata->brightness_mutex);
@@ -304,6 +306,7 @@ static int dell_uart_update_status(struct backlight_device *bd)
 	}
 
 	dell_uart_write(uart, bl_cmd->cmd, bl_cmd->tx_len);
+	msleep(1);
 	rx_len = dell_uart_read(uart, bl_cmd->ret, bl_cmd->rx_len);
 
 	mutex_unlock(&dell_pdata->brightness_mutex);
@@ -330,6 +333,7 @@ static int dell_uart_show_firmware_ver(struct dell_uart_backlight *dell_pdata)
 	}
 
 	dell_uart_write(uart, bl_cmd->cmd, bl_cmd->tx_len);
+	msleep(1);
 	while (retry-- > 0) {
 		/* first byte is data length */
 		dell_uart_read(uart, bl_cmd->ret, 1);
@@ -371,6 +375,7 @@ static int dell_uart_get_display_mode(struct dell_uart_backlight *dell_pdata)
 		}
 
 		dell_uart_write(uart, bl_cmd->cmd, bl_cmd->tx_len);
+		msleep(1);
 		rx_len = dell_uart_read(uart, bl_cmd->ret, bl_cmd->rx_len);
 
 		mutex_unlock(&dell_pdata->brightness_mutex);
-- 
2.34.1




More information about the kernel-team mailing list