serial: imx: enable the clocks only when the uart is used
Subsystems (2)
PATCH 1/1 serial: imx: enable the clocks only when the uart is used
Current code opens the clocks when the uart driver is probed. This will wastes some power if several uarts are enabled, but not really used.
So close these clocks for uart, and enable the clocks only when the uart is used.
--- drivers/tty/serial/imx.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/tty/serial/imx.c +9 -3
@@ -699,6 +699,9 @@ static int imx_startup(struct uart_port *port)int retval;unsigned long flags, temp; +clk_prepare_enable (sport->clk_per); +clk_prepare_enable (sport->clk_ipg); +imx_setup_ufcr (sport,0 );/* disable the DREN bit (Data Ready interrupt enable) before
@@ -884,6 +887,9 @@ static void imx_shutdown(struct uart_port *port)writel (temp, sport->port.membase +UCR1 );spin_unlock_irqrestore (&sport->port.lock, flags); + +clk_disable_unprepare (sport->clk_per); +clk_disable_unprepare (sport->clk_ipg); } static void
@@ -1557,6 +1563,9 @@ static int serial_imx_probe(struct platform_device *pdev) goto deinit;platform_set_drvdata (pdev, sport); +clk_disable_unprepare (sport->clk_per); +clk_disable_unprepare (sport->clk_ipg); +return 0 ; deinit:if (pdata && pdata->exit)
@@ -1578,9 +1587,6 @@ static int serial_imx_remove(struct platform_device *pdev)uart_remove_one_port (&imx_reg, &sport->port); -clk_disable_unprepare (sport->clk_per); -clk_disable_unprepare (sport->clk_ipg); -if (pdata && pdata->exit) pdata->exit (pdev);
Signature · 1 line
1.7.1
PATCH 1/1 serial: imx: enable the clocks only when the uart is used
Quoted 17 lines · Huang Shijie
Current code opens the clocks when the uart driver is probed. This will wastes some power if several uarts are enabled, but not really used.
So close these clocks for uart, and enable the clocks only when the uart is used.
Signed-off-by Huang Shijie <[email protected]>--- drivers/tty/serial/imx.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)drivers/tty/serial/imx.c +0
-0
drivers/tty/serial/imx.c static int imx_startup(struct uart_port *port) · line 703
Quoted 5 lines
drivers/tty/serial/imx.c +2
-0@@ -699,6 +699,9 @@ static int imx_startup(struct uart_port *port)int retval;unsigned long flags, temp; +clk_prepare_enable (sport->clk_per); +clk_prepare_enable (sport->clk_ipg);
You should check the return value. I've a good mind to mark these functions with __must_check...
PATCH 1/1 serial: imx: enable the clocks only when the uart is used
Quoted 2 lines · Russell King - ARM Linux
You should check the return value. I've a good mind to mark these functions with
__must_check...
yes, that's a good idea to add the __must_check.
thanks
Huang Shijie
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html