Skip to contentSkip to conversation

serial/imx: enable the clock when we really use the uart port

PATCH New Huang Shijie 3 participants 5 messages May 2, 2012 – Jun 11, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial/imx: enable the clock when we really use the uart port

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.

---
 drivers/tty/serial/imx.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/tty/serial/imx.c +5 -1
index e7fecee..f5dcdf6 100644
@@ -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);
 	}
 
Signature · 1 line
1.7.3.2
maintainer
#1 lore raw

PATCH 1/1 serial/imx: enable the clock when we really use the uart port

Quoted 7 lines · Huang Shijie

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.

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

Sascha

Quoted 47 lines
---
 drivers/tty/serial/imx.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/tty/serial/imx.c +5 -1
index e7fecee..f5dcdf6 100644
@@ -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);
 	}
 
Signature · 1 line
1.7.3.2
Signature · 4 lines
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 |
#2 lore raw

PATCH 1/1 serial/imx: enable the clock when we really use the uart port

Quoted 10 lines · Sascha Hauer
Quoted 7 lines · Huang Shijie

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.

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

Quoted 44 lines

Sascha

Quoted 42 lines
---
  drivers/tty/serial/imx.c |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
drivers/tty/serial/imx.c +5 -1
index e7fecee..f5dcdf6 100644
@@ -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);
  	}
 
Quoted 5 lines
Quoted 5 lines
Signature · 1 line
1.7.3.2

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

reviewer
#3 lore raw

PATCH 1/1 serial/imx: enable the clock when we really use the uart port

In reply to Sascha Hauer

Huang,

Quoted 11 lines · Sascha Hauer
Quoted 7 lines · Huang Shijie

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.

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.

#4 lore raw

PATCH 1/1 serial/imx: enable the clock when we really use the uart port

Quoted 7 lines · Fabio Estevam

Huang,

Quoted 4 lines · Sascha Hauer
Quoted 3 lines · Huang Shijie

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.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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.

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

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