linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial/imx: enable the clock when we really use the uart port
  2012-05-02  8:19 [PATCH] serial/imx: enable the clock when we really use the uart port Huang Shijie
@ 2012-05-02  8:19 ` Sascha Hauer
  2012-05-02  8:28   ` Huang Shijie
  2012-06-10 17:31   ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-05-02  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 02, 2012 at 04:19:30PM +0800, Huang Shijie wrote:
> The current code keeps the clock enabled even when we do not really
> use the uart port. But keep the clock enabled will consume some power.
> 
> In order to save more power, disable the clock when we do not use
> the uart, and enable the clock when we really use the uart port.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>

This conflicts with my series converting i.MX to the common clock
framework. Please lets delay this until this has been merged.

Sascha

> ---
>  drivers/tty/serial/imx.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index e7fecee..f5dcdf6 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -694,6 +694,8 @@ static int imx_startup(struct uart_port *port)
>  	int retval;
>  	unsigned long flags, temp;
>  
> +	clk_prepare_enable(sport->clk);
> +
>  	imx_setup_ufcr(sport, 0);
>  
>  	/* disable the DREN bit (Data Ready interrupt enable) before
> @@ -877,6 +879,8 @@ static void imx_shutdown(struct uart_port *port)
>  		temp &= ~(UCR1_IREN);
>  
>  	writel(temp, sport->port.membase + UCR1);
> +
> +	clk_disable_unprepare(sport->clk);
>  }
>  
>  static void
> @@ -1526,6 +1530,7 @@ static int serial_imx_probe(struct platform_device *pdev)
>  		goto deinit;
>  	platform_set_drvdata(pdev, &sport->port);
>  
> +	clk_disable_unprepare(sport->clk);
>  	return 0;
>  deinit:
>  	if (pdata && pdata->exit)
> @@ -1552,7 +1557,6 @@ static int serial_imx_remove(struct platform_device *pdev)
>  
>  	if (sport) {
>  		uart_remove_one_port(&imx_reg, &sport->port);
> -		clk_disable_unprepare(sport->clk);
>  		clk_put(sport->clk);
>  	}
>  
> -- 
> 1.7.3.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] serial/imx: enable the clock when we really use the uart port
@ 2012-05-02  8:19 Huang Shijie
  2012-05-02  8:19 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Huang Shijie @ 2012-05-02  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

The current code keeps the clock enabled even when we do not really
use the uart port. But keep the clock enabled will consume some power.

In order to save more power, disable the clock when we do not use
the uart, and enable the clock when we really use the uart port.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/tty/serial/imx.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index e7fecee..f5dcdf6 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -694,6 +694,8 @@ static int imx_startup(struct uart_port *port)
 	int retval;
 	unsigned long flags, temp;
 
+	clk_prepare_enable(sport->clk);
+
 	imx_setup_ufcr(sport, 0);
 
 	/* disable the DREN bit (Data Ready interrupt enable) before
@@ -877,6 +879,8 @@ static void imx_shutdown(struct uart_port *port)
 		temp &= ~(UCR1_IREN);
 
 	writel(temp, sport->port.membase + UCR1);
+
+	clk_disable_unprepare(sport->clk);
 }
 
 static void
@@ -1526,6 +1530,7 @@ static int serial_imx_probe(struct platform_device *pdev)
 		goto deinit;
 	platform_set_drvdata(pdev, &sport->port);
 
+	clk_disable_unprepare(sport->clk);
 	return 0;
 deinit:
 	if (pdata && pdata->exit)
@@ -1552,7 +1557,6 @@ static int serial_imx_remove(struct platform_device *pdev)
 
 	if (sport) {
 		uart_remove_one_port(&imx_reg, &sport->port);
-		clk_disable_unprepare(sport->clk);
 		clk_put(sport->clk);
 	}
 
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] serial/imx: enable the clock when we really use the uart port
  2012-05-02  8:19 ` Sascha Hauer
@ 2012-05-02  8:28   ` Huang Shijie
  2012-06-10 17:31   ` Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2012-05-02  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

? 2012?05?02? 16:19, Sascha Hauer ??:
> On Wed, May 02, 2012 at 04:19:30PM +0800, Huang Shijie wrote:
>> The current code keeps the clock enabled even when we do not really
>> use the uart port. But keep the clock enabled will consume some power.
>>
>> In order to save more power, disable the clock when we do not use
>> the uart, and enable the clock when we really use the uart port.
>>
>> Signed-off-by: Huang Shijie<b32955@freescale.com>
> This conflicts with my series converting i.MX to the common clock
> framework. Please lets delay this until this has been merged.
OK, thanks

Huang Shijie
> Sascha
>
>> ---
>>   drivers/tty/serial/imx.c |    6 +++++-
>>   1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
>> index e7fecee..f5dcdf6 100644
>> --- a/drivers/tty/serial/imx.c
>> +++ b/drivers/tty/serial/imx.c
>> @@ -694,6 +694,8 @@ static int imx_startup(struct uart_port *port)
>>   	int retval;
>>   	unsigned long flags, temp;
>>
>> +	clk_prepare_enable(sport->clk);
>> +
>>   	imx_setup_ufcr(sport, 0);
>>
>>   	/* disable the DREN bit (Data Ready interrupt enable) before
>> @@ -877,6 +879,8 @@ static void imx_shutdown(struct uart_port *port)
>>   		temp&= ~(UCR1_IREN);
>>
>>   	writel(temp, sport->port.membase + UCR1);
>> +
>> +	clk_disable_unprepare(sport->clk);
>>   }
>>
>>   static void
>> @@ -1526,6 +1530,7 @@ static int serial_imx_probe(struct platform_device *pdev)
>>   		goto deinit;
>>   	platform_set_drvdata(pdev,&sport->port);
>>
>> +	clk_disable_unprepare(sport->clk);
>>   	return 0;
>>   deinit:
>>   	if (pdata&&  pdata->exit)
>> @@ -1552,7 +1557,6 @@ static int serial_imx_remove(struct platform_device *pdev)
>>
>>   	if (sport) {
>>   		uart_remove_one_port(&imx_reg,&sport->port);
>> -		clk_disable_unprepare(sport->clk);
>>   		clk_put(sport->clk);
>>   	}
>>
>> -- 
>> 1.7.3.2
>>
>>
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] serial/imx: enable the clock when we really use the uart port
  2012-05-02  8:19 ` Sascha Hauer
  2012-05-02  8:28   ` Huang Shijie
@ 2012-06-10 17:31   ` Fabio Estevam
  2012-06-11  2:13     ` Huang Shijie
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2012-06-10 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

Huang,

On Wed, May 2, 2012 at 5:19 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Wed, May 02, 2012 at 04:19:30PM +0800, Huang Shijie wrote:
>> The current code keeps the clock enabled even when we do not really
>> use the uart port. But keep the clock enabled will consume some power.
>>
>> In order to save more power, disable the clock when we do not use
>> the uart, and enable the clock when we really use the uart port.
>>
>> Signed-off-by: Huang Shijie <b32955@freescale.com>
>
> This conflicts with my series converting i.MX to the common clock
> framework. Please lets delay this until this has been merged.

I think it is OK to resubmit this patch now.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] serial/imx: enable the clock when we really use the uart port
  2012-06-10 17:31   ` Fabio Estevam
@ 2012-06-11  2:13     ` Huang Shijie
  0 siblings, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2012-06-11  2:13 UTC (permalink / raw)
  To: linux-arm-kernel

? 2012?06?11? 01:31, Fabio Estevam ??:
> Huang,
>
> On Wed, May 2, 2012 at 5:19 AM, Sascha Hauer<s.hauer@pengutronix.de>  wrote:
>> On Wed, May 02, 2012 at 04:19:30PM +0800, Huang Shijie wrote:
>>> The current code keeps the clock enabled even when we do not really
>>> use the uart port. But keep the clock enabled will consume some power.
>>>
>>> In order to save more power, disable the clock when we do not use
>>> the uart, and enable the clock when we really use the uart port.
>>>
>>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> This conflicts with my series converting i.MX to the common clock
>> framework. Please lets delay this until this has been merged.
> I think it is OK to resubmit this patch now.
>
ok, thanks.

Huang Shijie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-11  2:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-02  8:19 [PATCH] serial/imx: enable the clock when we really use the uart port Huang Shijie
2012-05-02  8:19 ` Sascha Hauer
2012-05-02  8:28   ` Huang Shijie
2012-06-10 17:31   ` Fabio Estevam
2012-06-11  2:13     ` Huang Shijie

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).