ANDROID: tty: serdev: Fix broken serial console input
Since commit c550a54f2302 ("ANDROID: serdev: add platform device support"), the serial console on the db845c has stopped taking input. Digging in it seems when the tty used for the console is switched to serdev via serdev_tty_port_register(), the client_ops are changed here: https://android.googlesource.com/kernel/common/+/android-mainline/drivers/tty/serdev/serdev-ttyport.c#288 The problem being, the new client_ops->receive_buf function ttyport_receive_buf() starts failing on the SERPORT_ACTIVE test here: https://android.googlesource.com/kernel/common/+/android-mainline/drivers/tty/serdev/serdev-ttyport.c#32 Which seems to be due to the fact that the tty was already opened and being used as the console when it was switched to serdev. Thus ctrl_ops->open function never gets called, which prevents the SERPORT_ACTIVE bit from being set: https://android.googlesource.com/kernel/common/+/android-mainline/drivers/tty/serdev/serdev-ttyport.c#141 Now this was at first confusing as on the HiKey960 we don't see the issue. But in the HiKey960 case it seem the check here: https://android.googlesource.com/kernel/common/+/android-mainline/drivers/tty/serdev/core.c#737 fails preventing the tty from being switched to serdev. Thus this patch tries to avoid switching the tty to serdev if the tty port's console value is true. With this, the serial console continues to function. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Alistair Delva <adelva@google.com> Bug: 147453872 Change-Id: Id2747dc8c4ac633d71afabaf252d2bb69d206123
This commit is contained in:
parent
d32a4878e2
commit
a32426e234
@ -273,6 +273,11 @@ struct device *serdev_tty_port_register(struct tty_port *port,
|
||||
if (!port || !drv || !parent)
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
if (port->console) {
|
||||
/* can't convert tty's that are already in use */
|
||||
return ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
ctrl = serdev_controller_alloc(parent, sizeof(struct serport));
|
||||
if (!ctrl)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
Loading…
Reference in New Issue
Block a user