From patchwork Fri Nov 22 14:18:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akash Asthana X-Patchwork-Id: 11258045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D51F930 for ; Fri, 22 Nov 2019 14:18:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDCCB20706 for ; Fri, 22 Nov 2019 14:18:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="crmR2cyz"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="KiX1SXYi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726912AbfKVOSG (ORCPT ); Fri, 22 Nov 2019 09:18:06 -0500 Received: from a27-21.smtp-out.us-west-2.amazonses.com ([54.240.27.21]:41034 "EHLO a27-21.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKVOSG (ORCPT ); Fri, 22 Nov 2019 09:18:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574432285; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=60m7qadNAvfOutaquUIdmy4f8rhoSqd0rh/FZoSSQNw=; b=crmR2cyzdaM2HyeXI2rMqYEDvepHWfLO599cmTOHXChBWyX4B3g7W8Ow+AESPPIL BUS5lnEhX8GnjlXwYfdnE5efsMK41QvJjQ+noqo+cr0C5cg/A0q4olsr10CboyYJKqn ZwYnsDRoQo2OT5RyqLY9Ag+ISzb7Tyk+RAVyA7LM= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574432285; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=60m7qadNAvfOutaquUIdmy4f8rhoSqd0rh/FZoSSQNw=; b=KiX1SXYincp337wHwnTxDM6cFfX0lYL8VCxTSTCWZazdhs0VjaP9NmwIneiq1Fgp qgS2RXZFufzg+4DJHyIKGia1SoxB9rxiASfl3OQr/BL/1GjpLwbvKDKK8+nAcCmexee 1f0tQc282gwQF9LA+jMaEXXEeNrVJ/MZS5J76hn0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9F0A0C447A6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org From: Akash Asthana To: gregkh@linuxfoundation.org Cc: swboyd@chromium.org, mgautam@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Akash Asthana Subject: [PATCH v6 1/5] Revert "tty: serial: qcom_geni_serial: Wakeup over UART RX" Date: Fri, 22 Nov 2019 14:18:05 +0000 Message-ID: <0101016e937a2126-089ac422-902f-418a-b8c3-b022122c847a-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> References: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> X-SES-Outgoing: 2019.11.22-54.240.27.21 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This reverts commit 8b7103f31950443fd5727d7d80d3c65416b5a390. To apply v6 patches cleanly on tty-next, revert v2 patches. Signed-off-by: Akash Asthana --- drivers/tty/serial/qcom_geni_serial.c | 44 +---------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index ff63728..5180cd8 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -117,7 +116,6 @@ struct qcom_geni_serial_port { bool brk; unsigned int tx_remaining; - int wakeup_irq; }; static const struct uart_ops qcom_geni_console_pops; @@ -757,15 +755,6 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, uart_write_wakeup(uport); } -static irqreturn_t qcom_geni_serial_wakeup_isr(int isr, void *dev) -{ - struct uart_port *uport = dev; - - pm_wakeup_event(uport->dev, 2000); - - return IRQ_HANDLED; -} - static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) { u32 m_irq_en; @@ -1317,29 +1306,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return ret; } - if (!console) { - port->wakeup_irq = platform_get_irq(pdev, 1); - if (port->wakeup_irq < 0) { - dev_err(&pdev->dev, "Failed to get wakeup IRQ %d\n", - port->wakeup_irq); - } else { - irq_set_status_flags(port->wakeup_irq, IRQ_NOAUTOEN); - ret = devm_request_irq(uport->dev, port->wakeup_irq, - qcom_geni_serial_wakeup_isr, - IRQF_TRIGGER_FALLING, "uart_wakeup", uport); - if (ret) { - dev_err(uport->dev, "Failed to register wakeup IRQ ret %d\n", - ret); - return ret; - } - - device_init_wakeup(&pdev->dev, true); - ret = dev_pm_set_wake_irq(&pdev->dev, port->wakeup_irq); - if (unlikely(ret)) - dev_err(uport->dev, "%s:Failed to set IRQ wake:%d\n", - __func__, ret); - } - } uport->private_data = drv; platform_set_drvdata(pdev, port); port->handle_rx = console ? handle_rx_console : handle_rx_uart; @@ -1362,12 +1328,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev) struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct uart_port *uport = &port->uport; - uart_suspend_port(uport->private_data, uport); - - if (port->wakeup_irq > 0) - enable_irq(port->wakeup_irq); - - return 0; + return uart_suspend_port(uport->private_data, uport); } static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) @@ -1375,9 +1336,6 @@ static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct uart_port *uport = &port->uport; - if (port->wakeup_irq > 0) - disable_irq(port->wakeup_irq); - return uart_resume_port(uport->private_data, uport); } From patchwork Fri Nov 22 14:18:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akash Asthana X-Patchwork-Id: 11258047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A801B930 for ; Fri, 22 Nov 2019 14:18:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 876E920721 for ; Fri, 22 Nov 2019 14:18:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="Mp3S4Os6"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="fo1raQ4/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbfKVOSK (ORCPT ); Fri, 22 Nov 2019 09:18:10 -0500 Received: from a27-186.smtp-out.us-west-2.amazonses.com ([54.240.27.186]:52540 "EHLO a27-186.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKVOSK (ORCPT ); Fri, 22 Nov 2019 09:18:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574432289; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=I/atPG93tK42zBPgLSecpSBKlCIfLw7bC526e3EtDmo=; b=Mp3S4Os6omTigo5tp2c03JKIvaqI2PQrZHGSoW5IZ9TIjxkIE8HgV0DFcsjvxxIA h/IUFyCLKOys1omOXxiaKZuw3KQ+m8xhngiQrVaZdZHU2V5F5/d6/3ChVTicJrJVZl2 KXnPFYd3UXMwgijgiB84nRr8/2Rtv1QSAqyGcqWY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574432289; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=I/atPG93tK42zBPgLSecpSBKlCIfLw7bC526e3EtDmo=; b=fo1raQ4/zXkIn7TSGZj9Pm72QIu1r8XdGIhOOdvpT3FzNli3RLaDTVyDirT7CxOV ++edrlhkFc81lg07T7c9+eFIZ3VZoKaXCxQiLg8JgzalbOK908S79n7VxCSHfs+h3yU 6lJ3zHFvTsL2sxa6O0n+4wZzDENFs48TB8UWX+C8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A5ADCC447B9 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org From: Akash Asthana To: gregkh@linuxfoundation.org Cc: swboyd@chromium.org, mgautam@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Akash Asthana Subject: [PATCH v6 2/5] Revert "tty: serial: qcom_geni_serial: IRQ cleanup" Date: Fri, 22 Nov 2019 14:18:08 +0000 Message-ID: <0101016e937a3077-0e4686f8-fad9-4592-b428-17be97b39fed-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> References: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> X-SES-Outgoing: 2019.11.22-54.240.27.186 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This reverts commit 3e4aaea7a0391d47f6ffff1f10594c658a67c881. To apply v6 patches cleanly on tty-next branch, revert v2 patches. Signed-off-by: Akash Asthana --- drivers/tty/serial/qcom_geni_serial.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 5180cd8..14c6306 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -831,7 +830,7 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport) if (uart_console(uport)) console_stop(uport->cons); - disable_irq(uport->irq); + free_irq(uport->irq, uport); spin_lock_irqsave(&uport->lock, flags); qcom_geni_serial_stop_tx(uport); qcom_geni_serial_stop_rx(uport); @@ -891,14 +890,21 @@ static int qcom_geni_serial_startup(struct uart_port *uport) int ret; struct qcom_geni_serial_port *port = to_dev_port(uport, uport); + scnprintf(port->name, sizeof(port->name), + "qcom_serial_%s%d", + (uart_console(uport) ? "console" : "uart"), uport->line); + if (!port->setup) { ret = qcom_geni_serial_port_setup(uport); if (ret) return ret; } - enable_irq(uport->irq); - return 0; + ret = request_irq(uport->irq, qcom_geni_serial_isr, IRQF_TRIGGER_HIGH, + port->name, uport); + if (ret) + dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); + return ret; } static unsigned long get_clk_cfg(unsigned long clk_freq) @@ -1291,21 +1297,11 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; - scnprintf(port->name, sizeof(port->name), "qcom_geni_serial_%s%d", - (uart_console(uport) ? "console" : "uart"), uport->line); irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; uport->irq = irq; - irq_set_status_flags(uport->irq, IRQ_NOAUTOEN); - ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr, - IRQF_TRIGGER_HIGH, port->name, uport); - if (ret) { - dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); - return ret; - } - uport->private_data = drv; platform_set_drvdata(pdev, port); port->handle_rx = console ? handle_rx_console : handle_rx_uart; From patchwork Fri Nov 22 14:18:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akash Asthana X-Patchwork-Id: 11258049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A02F109A for ; Fri, 22 Nov 2019 14:18:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A8A52072D for ; Fri, 22 Nov 2019 14:18:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="FRIHJBbA"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="BcqVrbO+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbfKVOSN (ORCPT ); Fri, 22 Nov 2019 09:18:13 -0500 Received: from a27-56.smtp-out.us-west-2.amazonses.com ([54.240.27.56]:54320 "EHLO a27-56.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKVOSN (ORCPT ); Fri, 22 Nov 2019 09:18:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574432292; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=uOuubZHBpGnPO3AHLT4+1988UXqM0gfUql5XfHl/kuk=; b=FRIHJBbA2uTBwCUjelahxVYwFxCQvqWadKrr5wjIdpMX1n/G5BhMFz+dmnc41k1c qvPlnuEzE403tq+jCbVE0ESCTCwCn6ppt64zswTZV1Bo9Ncu/02fF1iVVmrqIIbXpk+ B/TROHRTRRz1MSYLmp86H2qsBVcgyAv9+9s2EstU= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574432292; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=uOuubZHBpGnPO3AHLT4+1988UXqM0gfUql5XfHl/kuk=; b=BcqVrbO+0mAgF3aE/+Tkb3iIT8EGgMXba5Fo/ZC6oaADMuyZ2hToeALyHu2Nh4id dDqb0ImL8B/X+XtHRz6gYM3zNdLVknw3W/RWYspDkf9QqpnaYUJQUczCuBIa7gnPqb8 GO+zHZ2gPCICbK0DZjaaSX0u8QbXZQD/SdP1tRHU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A47BEC76F43 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org From: Akash Asthana To: gregkh@linuxfoundation.org Cc: swboyd@chromium.org, mgautam@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Akash Asthana Subject: [PATCH v6 3/5] tty: serial: qcom_geni_serial: IRQ cleanup Date: Fri, 22 Nov 2019 14:18:12 +0000 Message-ID: <0101016e937a3e05-f74c5c73-a964-45f2-ae71-6daed292e8ee-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> References: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> X-SES-Outgoing: 2019.11.22-54.240.27.56 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Move ISR registration from startup to probe function to avoid registering it everytime when the port open is called for driver. Signed-off-by: Akash Asthana Reviewed-by: Matthias Kaehlcke --- Changes in v6: - Rebased on tty-next branch Changes in v5: - No change. Changes in v4: - As per Stephen's comment, move ISR registration(later in probe) after registering uart port with serial core. - As per Greg's comment, corrected returning of PTR value from integer type function(probe). Changes in v3: - As per Stephen's comment, using devm_kasprintf instead of scnprintf API. drivers/tty/serial/qcom_geni_serial.c | 38 ++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 14c6306..634054a 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -101,7 +102,7 @@ struct qcom_geni_serial_port { struct uart_port uport; struct geni_se se; - char name[20]; + const char *name; u32 tx_fifo_depth; u32 tx_fifo_width; u32 rx_fifo_depth; @@ -830,7 +831,7 @@ static void qcom_geni_serial_shutdown(struct uart_port *uport) if (uart_console(uport)) console_stop(uport->cons); - free_irq(uport->irq, uport); + disable_irq(uport->irq); spin_lock_irqsave(&uport->lock, flags); qcom_geni_serial_stop_tx(uport); qcom_geni_serial_stop_rx(uport); @@ -890,21 +891,14 @@ static int qcom_geni_serial_startup(struct uart_port *uport) int ret; struct qcom_geni_serial_port *port = to_dev_port(uport, uport); - scnprintf(port->name, sizeof(port->name), - "qcom_serial_%s%d", - (uart_console(uport) ? "console" : "uart"), uport->line); - if (!port->setup) { ret = qcom_geni_serial_port_setup(uport); if (ret) return ret; } + enable_irq(uport->irq); - ret = request_irq(uport->irq, qcom_geni_serial_isr, IRQF_TRIGGER_HIGH, - port->name, uport); - if (ret) - dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); - return ret; + return 0; } static unsigned long get_clk_cfg(unsigned long clk_freq) @@ -1297,6 +1291,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; + port->name = devm_kasprintf(uport->dev, GFP_KERNEL, + "qcom_geni_serial_%s%d", + uart_console(uport) ? "console" : "uart", uport->line); + if (!port->name) + return -ENOMEM; + irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; @@ -1307,7 +1307,21 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->handle_rx = console ? handle_rx_console : handle_rx_uart; if (!console) device_create_file(uport->dev, &dev_attr_loopback); - return uart_add_one_port(drv, uport); + + ret = uart_add_one_port(drv, uport); + if (ret) + return ret; + + irq_set_status_flags(uport->irq, IRQ_NOAUTOEN); + ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr, + IRQF_TRIGGER_HIGH, port->name, uport); + if (ret) { + dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); + uart_remove_one_port(drv, uport); + return ret; + } + + return ret; } static int qcom_geni_serial_remove(struct platform_device *pdev) From patchwork Fri Nov 22 14:18:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akash Asthana X-Patchwork-Id: 11258051 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C44EC930 for ; Fri, 22 Nov 2019 14:18:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3FD720721 for ; Fri, 22 Nov 2019 14:18:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="de6jGz3E"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="dL79sIpI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbfKVOSV (ORCPT ); Fri, 22 Nov 2019 09:18:21 -0500 Received: from a27-11.smtp-out.us-west-2.amazonses.com ([54.240.27.11]:57628 "EHLO a27-11.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKVOSV (ORCPT ); Fri, 22 Nov 2019 09:18:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574432300; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=pWTY+R2E1B8uT/YaPAO8GuUikDXWu2WulDf7gUdEVkY=; b=de6jGz3EGhw4fC0gfngoxwrTKIuMITENAiJekDuLGZuocB08mj0DwiUcQWE7m867 LkX/lr/79OK1nDZrgzUPCldH2FKo49Hp/TSEkactgD8n8MIMmlsjKusnISSenFPr/xJ fy2Yx4ZfOJaBFLh38D6JvdFlO3XA/hbtqrd1bKU0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574432300; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=pWTY+R2E1B8uT/YaPAO8GuUikDXWu2WulDf7gUdEVkY=; b=dL79sIpIgvGwHpkWTp8c3XjCMJCnJ6MDFFVThAHcPkM+PVWjFiBtN7baANtjEaps XYe4bcrkun/mBAZuPjQ4HLIhYYEEwIganZcge27TBYhZsqITSF5MrD50AedZgbZrXfW mXl7pzICCqalzgU82fm3J5fPAGJDoaSuCXZ0Q4Qc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7ECFEC447A2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org From: Akash Asthana To: gregkh@linuxfoundation.org Cc: swboyd@chromium.org, mgautam@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Akash Asthana Subject: [PATCH v6 4/5] tty: serial: qcom_geni_serial: Wakeup over UART RX Date: Fri, 22 Nov 2019 14:18:19 +0000 Message-ID: <0101016e937a5b83-1c5c4e0e-ae63-447a-8724-52477b11dff4-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> References: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> X-SES-Outgoing: 2019.11.22-54.240.27.11 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add system wakeup capability over UART RX line for wakeup capable UART. When system is suspended, RX line act as an interrupt to wakeup system for any communication requests from peer. Signed-off-by: Akash Asthana Reviewed-by: Stephen Boyd Reviewed-by: Matthias Kaehlcke --- Changes in V6: - Rebased on top of tty-next branch. - As per stephen's comment mark devices runtime status as active irrespective of wakeup feature. Changes in V5: - No change. Changes in V4: - As per Greg's comment, removed extra dev_err logging. - As per Stephen's comment, using common code that manage wakeirq irqs for devices. Using dev_pm_set_dedicated_wake_irq API that will take care of requesting and attaching wakeup irqs for devices. Also, it sets wakeirq status to WAKE_IRQ_DEDICATED_ALLOCATED as a result enabling/disabling of wake irq will be managed by suspend/resume framework so, removed the code for enabling and disabling of wake irq from the driver. Changes in V3: - As per Stephen's comment, using platform_get_irq_optional API to get wakeup IRQ for device. Changes in V2: - As per Stephen's comment, splitted V1 patch into 2 seperate patch. a) Clean up of core IRQ registration b) Add wakeup feature. drivers/tty/serial/qcom_geni_serial.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 634054a..b952509 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -116,6 +118,7 @@ struct qcom_geni_serial_port { bool brk; unsigned int tx_remaining; + int wakeup_irq; }; static const struct uart_ops qcom_geni_console_pops; @@ -1302,6 +1305,9 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return irq; uport->irq = irq; + if (!console) + port->wakeup_irq = platform_get_irq_optional(pdev, 1); + uport->private_data = drv; platform_set_drvdata(pdev, port); port->handle_rx = console ? handle_rx_console : handle_rx_uart; @@ -1321,6 +1327,24 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) return ret; } + /* + * Set pm_runtime status as ACTIVE so that wakeup_irq gets + * enabled/disabled from dev_pm_arm_wake_irq during system + * suspend/resume respectively. + */ + pm_runtime_set_active(&pdev->dev); + + if (port->wakeup_irq > 0) { + device_init_wakeup(&pdev->dev, true); + ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, + port->wakeup_irq); + if (ret) { + device_init_wakeup(&pdev->dev, false); + uart_remove_one_port(drv, uport); + return ret; + } + } + return ret; } @@ -1330,6 +1354,10 @@ static int qcom_geni_serial_remove(struct platform_device *pdev) struct uart_driver *drv = port->uport.private_data; uart_remove_one_port(drv, &port->uport); + + device_init_wakeup(&pdev->dev, false); + dev_pm_clear_wake_irq(&pdev->dev); + return 0; } From patchwork Fri Nov 22 14:18:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akash Asthana X-Patchwork-Id: 11258053 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C073930 for ; Fri, 22 Nov 2019 14:18:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B8A420721 for ; Fri, 22 Nov 2019 14:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="mI7ttV16"; dkim=pass (1024-bit key) header.d=amazonses.com header.i=@amazonses.com header.b="IUbQLO1e" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726568AbfKVOSZ (ORCPT ); Fri, 22 Nov 2019 09:18:25 -0500 Received: from a27-10.smtp-out.us-west-2.amazonses.com ([54.240.27.10]:36514 "EHLO a27-10.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKVOSY (ORCPT ); Fri, 22 Nov 2019 09:18:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574432304; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=qJH+yx4Hn/VtzKH5j0VbwhaJKVdEHt0pS4CwQiE53d4=; b=mI7ttV16qTlS2OyQ5IEebaD2H5Ifl1zgg9yvFQjF+ClB98jRCjBBcIoc6ewu+Hd0 f2ak2EMQ/v8dstkUcIzFnTSOx8LJbAyvoDDyKVyhrGpb7oABFA0FwOaZajHTXpObL0S hkX93wNuws0JXARQaT3aEiJHbWEY2CNBUtEdEPsk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574432304; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=qJH+yx4Hn/VtzKH5j0VbwhaJKVdEHt0pS4CwQiE53d4=; b=IUbQLO1eI1f/Etq+4ALFYBTUJyRT9C60FosPZ8TUPVSlN+S73R5A9MIXlzEQO9ur BousNefHrtONZVCLYD2QUGC/DVmoFDQ0SwnG5FUCvfckgoTcBIMy5zKBlXmnKLY1QzK 8PfY6udnJMaF0wFUeL+/GR+8RpnO6KRW3PSUpLcE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BA80AC76F54 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=akashast@codeaurora.org From: Akash Asthana To: gregkh@linuxfoundation.org Cc: swboyd@chromium.org, mgautam@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, Akash Asthana Subject: [PATCH v6 5/5] tty: serial: qcom_geni_serial: Move loopback support to TIOCM_LOOP Date: Fri, 22 Nov 2019 14:18:24 +0000 Message-ID: <0101016e937a6c00-b8cf45e5-aedf-4e03-bf23-47d7810a0b23-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> References: <1574432266-20732-1-git-send-email-akashast@codeaurora.org> X-SES-Outgoing: 2019.11.22-54.240.27.10 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Remove code from the driver that create and maintain loopback sysfs node. Instead use the ioctl TIOCMSET with TIOCM_LOOP argument to set HW to loopback mode. Signed-off-by: Akash Asthana Reviewed-by: Stephen Boyd --- Change in V6: - As per stephen's comment corrected commit subject. - As per stephen's comment defined new macros for different loopback mode. drivers/tty/serial/qcom_geni_serial.c | 36 +++++++++-------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index b952509..3e84192 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -93,7 +93,11 @@ #define DEF_TX_WM 2 #define DEF_FIFO_WIDTH_BITS 32 #define UART_RX_WM 2 -#define MAX_LOOPBACK_CFG 3 + +/* SE_UART_LOOPBACK_CFG */ +#define RX_TX_SORTED BIT(0) +#define CTS_RTS_SORTED BIT(1) +#define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED) #ifdef CONFIG_CONSOLE_POLL #define CONSOLE_RX_BYTES_PW 1 @@ -165,30 +169,6 @@ static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = { }, }; -static ssize_t loopback_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); - - return snprintf(buf, sizeof(u32), "%d\n", port->loopback); -} - -static ssize_t loopback_store(struct device *dev, - struct device_attribute *attr, const char *buf, - size_t size) -{ - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); - u32 loopback; - - if (kstrtoint(buf, 0, &loopback) || loopback > MAX_LOOPBACK_CFG) { - dev_err(dev, "Invalid input\n"); - return -EINVAL; - } - port->loopback = loopback; - return size; -} -static DEVICE_ATTR_RW(loopback); - static struct qcom_geni_serial_port qcom_geni_console_port = { .uport = { .iotype = UPIO_MEM, @@ -238,10 +218,14 @@ static void qcom_geni_serial_set_mctrl(struct uart_port *uport, unsigned int mctrl) { u32 uart_manual_rfr = 0; + struct qcom_geni_serial_port *port = to_dev_port(uport, uport); if (uart_console(uport)) return; + if (mctrl & TIOCM_LOOP) + port->loopback = RX_TX_CTS_RTS_SORTED; + if (!(mctrl & TIOCM_RTS)) uart_manual_rfr = UART_MANUAL_RFR_EN | UART_RFR_NOT_READY; writel(uart_manual_rfr, uport->membase + SE_UART_MANUAL_RFR); @@ -1311,8 +1295,6 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) uport->private_data = drv; platform_set_drvdata(pdev, port); port->handle_rx = console ? handle_rx_console : handle_rx_uart; - if (!console) - device_create_file(uport->dev, &dev_attr_loopback); ret = uart_add_one_port(drv, uport); if (ret)