From: Changqi Hu <changqi.hu@mediatek.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: Changqi Hu <changqi.hu@mediatek.com>,
Peter Shih <pihsun@chromium.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
<linux-serial@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <srv_heupstream@mediatek.com>,
Eddie Huang <eddie.huang@mediatek.com>,
Yingjoe Chen <yingjoe.chen@mediatek.com>
Subject: [PATCH v2] serial: 8250-mtk: modify mtk uart power and clock management
Date: Thu, 18 Jul 2019 20:58:36 +0800 [thread overview]
Message-ID: <1563454716-8355-1-git-send-email-changqi.hu@mediatek.com> (raw)
modify mtk uart runtime interface, enable uart clock before register.
Signed-off-by: Changqi Hu <changqi.hu@mediatek.com>
---
drivers/tty/serial/8250/8250_mtk.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index b0113d1..a07c8ae 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -389,7 +389,7 @@ static int __maybe_unused mtk8250_runtime_suspend(struct device *dev)
struct mtk8250_data *data = dev_get_drvdata(dev);
struct uart_8250_port *up = serial8250_get_port(data->line);
- /*wait until UART in idle status*/
+ /* wait until UART in idle status */
while
(serial_in(up, MTK_UART_DEBUG0));
@@ -426,23 +426,15 @@ static int __maybe_unused mtk8250_runtime_resume(struct device *dev)
static void
mtk8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)
{
- struct uart_8250_port *up = up_to_u8250p(port);
-
- if (!state) {
- if (!(up->capabilities & UART_CAP_RPM))
- mtk8250_runtime_resume(port->dev);
- else
+ if (!state)
+ if (!mtk8250_runtime_resume(port->dev))
pm_runtime_get_sync(port->dev);
- }
serial8250_do_pm(port, state, old);
- if (state) {
- if (!(up->capabilities & UART_CAP_RPM))
+ if (state)
+ if (!pm_runtime_put_sync_suspend(port->dev))
mtk8250_runtime_suspend(port->dev);
- else
- pm_runtime_put_sync_suspend(port->dev);
- }
}
#ifdef CONFIG_SERIAL_8250_DMA
@@ -554,6 +546,9 @@ static int mtk8250_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
pm_runtime_enable(&pdev->dev);
+ err = mtk8250_runtime_resume(&pdev->dev);
+ if (err)
+ return err;
data->line = serial8250_register_8250_port(&uart);
if (data->line < 0)
--
1.8.1.1.dirty
reply other threads:[~2019-07-18 12:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1563454716-8355-1-git-send-email-changqi.hu@mediatek.com \
--to=changqi.hu@mediatek.com \
--cc=eddie.huang@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=jslaby@suse.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=pihsun@chromium.org \
--cc=srv_heupstream@mediatek.com \
--cc=yingjoe.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).