summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkuanyuhuang <kuanyuhuang@google.com>2023-10-05 14:00:21 +0000
committerTom Huang <kuanyuhuang@google.com>2023-10-13 02:18:28 +0000
commit3765eb7bf1ab09592d98a37c42a0d0f179224d14 (patch)
tree3970f0481dc8deddb1bda28257b610a23877d925
parent0bb9b16f8417b51cba4387356131bf8e875440ba (diff)
downloadgs-3765eb7bf1ab09592d98a37c42a0d0f179224d14.tar.gz
fix exynos serial suspend taking long time
When BT CHRE enabled, BT uses AOC UART to tx/rx packets with BT chip. Add skip suspend to avoid BT exynos serial hold suspend unexpectly. Test: suspend/resume testing Bug: 294747612 Change-Id: Ic39a4a3060815b6076cb12ba989ab1d448f29eaf Signed-off-by: kuanyuhuang <kuanyuhuang@google.com>
-rw-r--r--arch/arm64/boot/dts/google/zuma-usi.dtsi1
-rw-r--r--drivers/tty/serial/exynos_tty.c34
2 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm64/boot/dts/google/zuma-usi.dtsi b/arch/arm64/boot/dts/google/zuma-usi.dtsi
index d7ff832dc..7de70bfe6 100644
--- a/arch/arm64/boot/dts/google/zuma-usi.dtsi
+++ b/arch/arm64/boot/dts/google/zuma-usi.dtsi
@@ -987,6 +987,7 @@
samsung,usi-serial-v2;
samsung,rts-alive-control;
samsung,uart-logging;
+ goog,ioctl-suspend;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
clocks = <&clock MUX_APM_FUNC>, <&clock DOUT_CLK_APM_USI1_UART>;
diff --git a/drivers/tty/serial/exynos_tty.c b/drivers/tty/serial/exynos_tty.c
index 92cfcba8f..18e18641c 100644
--- a/drivers/tty/serial/exynos_tty.c
+++ b/drivers/tty/serial/exynos_tty.c
@@ -186,6 +186,8 @@ struct exynos_uart_port {
unsigned int uart_logging;
struct uart_local_buf uart_local_buf;
struct logbuffer *log;
+ unsigned int ioctl_support;
+ unsigned int skip_suspend;
};
/* conversion functions */
@@ -521,6 +523,18 @@ uart_dbg_store(struct device *dev, struct device_attribute *attr,
ourport->port.line);
ourport->dbg_mode = 0;
break;
+ case 8:
+ if (ourport->ioctl_support) {
+ dev_err(dev, "skip exynos_serial suspend/resume\n");
+ ourport->skip_suspend = 1;
+ }
+ break;
+ case 9:
+ if (ourport->ioctl_support) {
+ dev_err(dev, "disable skip exynos_serial suspend/resume\n");
+ ourport->skip_suspend = 0;
+ }
+ break;
default:
dev_err(dev, "Wrong Command!(0/1/2)\n");
}
@@ -2753,6 +2767,11 @@ static int exynos_serial_probe(struct platform_device *pdev)
else
ourport->uart_logging = 0;
+ if (of_get_property(pdev->dev.of_node, "goog,ioctl-suspend", NULL))
+ ourport->ioctl_support = 1;
+ else
+ ourport->ioctl_support = 0;
+
if (of_find_property(pdev->dev.of_node,
"samsung,use-default-irq", NULL))
ourport->use_default_irq = 1;
@@ -2846,6 +2865,9 @@ static int exynos_serial_suspend(struct device *dev)
unsigned int ucon;
if (port) {
+ if (ourport->skip_suspend) {
+ return 0;
+ }
/*
* If rts line must be protected while suspending
* we change the gpio pad as output high
@@ -2892,6 +2914,12 @@ static int exynos_serial_suspend_noirq(struct device *dev)
struct exynos_uart_port *ourport = to_ourport(port);
unsigned int ucon;
+ if (port) {
+ if (ourport->skip_suspend) {
+ return 0;
+ }
+ }
+
if (ourport->dbg_uart_ch && !console_suspend_enabled) {
uart_clock_enable(ourport);
/* disable Tx, Rx mode bit for suspend in case of HWACG */
@@ -2913,6 +2941,9 @@ static int exynos_serial_resume(struct device *dev)
struct exynos_uart_port *ourport = to_ourport(port);
if (port) {
+ if (ourport->skip_suspend) {
+ return 0;
+ }
if (!IS_ERR(ourport->usi_reg))
regmap_update_bits(ourport->usi_reg,
ourport->usi_offset,
@@ -2954,6 +2985,9 @@ static int exynos_serial_resume_noirq(struct device *dev)
struct exynos_uart_port *ourport = to_ourport(port);
if (port) {
+ if (ourport->skip_suspend) {
+ return 0;
+ }
/* restore IRQ mask */
if (exynos_serial_has_interrupt_mask(port)) {
unsigned int uintm = 0xf;