The first byte of UART Rx (/dev/ttyHS4) is always missing

Hello.

When receiving UART data, the first byte of Rx (ttyHS4) is always missing.
It seems to wake up with the first byte after going into sleep mode.
You must disable sleep mode and use the received data as is.
Can this UART sleeping option be disabled?
Please advice.

Usually when a device support runtime PM you can disable sleep mode via sysfs, something like this (not tested):

echo on > /sys/class/tty/ttyHS4/power/control

I tried with the “on” and “auto” options, but I can not.

Modified the following in the kernel source(msm_serial_hs.c)
static int msm_hs_runtime_suspend(struct device *dev)
{
//msm_hs_pm_suspend(dev);
return 0;
}

I confirmed that it is not suspend.
source Is there a better way without modification?

What do you mean ? did you try as root ?

The sysfs way should work, forcing ‘on’ prevents the device to be suspended.

change auto suspend delay time in function and see you are able to achieve expected output
static void msm_serial_hs_rt_init(struct uart_port *uport)

{

  • pm_runtime_set_autosuspend_delay(uport->dev, 100);
  • pm_runtime_set_autosuspend_delay(uport->dev, 500);

}