From patchwork Thu Sep 17 23:36:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Chan X-Patchwork-Id: 48425 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8HNabvk005453 for ; Thu, 17 Sep 2009 23:36:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809AbZIQXgd (ORCPT ); Thu, 17 Sep 2009 19:36:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753847AbZIQXgd (ORCPT ); Thu, 17 Sep 2009 19:36:33 -0400 Received: from smtp-out.google.com ([216.239.33.17]:8855 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753662AbZIQXgc (ORCPT ); Thu, 17 Sep 2009 19:36:32 -0400 Received: from spaceape14.eur.corp.google.com (spaceape14.eur.corp.google.com [172.28.16.148]) by smtp-out.google.com with ESMTP id n8HNaTV2001313; Fri, 18 Sep 2009 00:36:29 +0100 Received: from localhost (cheetara.mtv.corp.google.com [172.18.103.81]) by spaceape14.eur.corp.google.com with ESMTP id n8HNaQZb008247; Thu, 17 Sep 2009 16:36:27 -0700 Received: by localhost (Postfix, from userid 18922) id 39B46504E9E; Thu, 17 Sep 2009 16:36:26 -0700 (PDT) From: Mike Chan To: linux-omap@vger.kernel.org Cc: tomi.valkeinen@nokia.com, Mike Chan Subject: [PATCH] video: omap2: dss: RET on idle, enable/disable dss clocks only when needed. Date: Thu, 17 Sep 2009 16:36:26 -0700 Message-Id: <1253230586-931-1-git-send-email-mike@android.com> X-Mailer: git-send-email 1.5.4.5 X-System-Of-Record: true Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Signed-off-by: Mike Chan --- drivers/video/omap2/dss/dispc.c | 6 ++++- drivers/video/omap2/dss/dsi.c | 50 +++++++++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index d061d75..4216466 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -484,13 +484,17 @@ static inline void enable_clocks(bool enable) bool dispc_go_busy(enum omap_channel channel) { int bit; + bool ret; if (channel == OMAP_DSS_CHANNEL_LCD) bit = 5; /* GOLCD */ else bit = 6; /* GODIGIT */ - return REG_GET(DISPC_CONTROL, bit, bit) == 1; + enable_clocks(1); + ret = REG_GET(DISPC_CONTROL, bit, bit) == 1; + enable_clocks(0); + return ret; } void dispc_go(enum omap_channel channel) diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 5e3d653..e9d8a5f 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -1186,6 +1186,9 @@ int dsi_pll_init(bool enable_hsclk, bool enable_hsdiv) if (r) goto err1; + enable_clocks(0); + dsi_enable_pll_clock(0); + DSSDBG("PLL init done\n"); return 0; @@ -1199,11 +1202,9 @@ err0: void dsi_pll_uninit(void) { - enable_clocks(0); - dsi_enable_pll_clock(0); - dsi.pll_locked = 0; dsi_pll_power(DSI_PLL_POWER_OFF); + regulator_disable(dsi.vdds_dsi_reg); DSSDBG("PLL uninit done\n"); } @@ -1848,6 +1849,9 @@ static int dsi_vc_send_bta_sync(int channel) INIT_COMPLETION(dsi.bta_completion); + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_vc_enable_bta_irq(channel); r = dsi_vc_send_bta(channel); @@ -1870,6 +1874,9 @@ static int dsi_vc_send_bta_sync(int channel) err: dsi_vc_disable_bta_irq(channel); + enable_clocks(0); + dsi_enable_pll_clock(0); + return r; } @@ -1921,6 +1928,9 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, return -EINVAL; } + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_vc_write_long_header(channel, data_type, len, ecc); /*dsi_vc_print_status(0); */ @@ -1964,6 +1974,9 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, dsi_vc_write_long_payload(channel, b1, b2, b3, 0); } + enable_clocks(0); + dsi_enable_pll_clock(0); + return r; } @@ -1979,6 +1992,9 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) channel, data_type, data & 0xff, (data >> 8) & 0xff); + enable_clocks(1); + dsi_enable_pll_clock(1); + if (FLD_GET(dsi_read_reg(DSI_VC_CTRL(channel)), 16, 16)) { DSSERR("ERROR FIFO FULL, aborting transfer\n"); return -EINVAL; @@ -1990,6 +2006,9 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) dsi_write_reg(DSI_VC_SHORT_PACKET_HEADER(channel), r); + enable_clocks(0); + dsi_enable_pll_clock(0); + return 0; } @@ -2775,13 +2794,15 @@ static int dsi_update_thread(void *data) break; dsi_bus_lock(); - if (dsi.update_mode == OMAP_DSS_UPDATE_DISABLED || kthread_should_stop()) { dsi_bus_unlock(); break; } + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_perf_mark_setup(); if (dsi.update_region.dirty) { @@ -2872,6 +2893,9 @@ static int dsi_update_thread(void *data) complete_all(&dsi.update_completion); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); /* XXX We need to give others chance to get the bus lock. Is @@ -3068,6 +3092,9 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO) dsi_start_auto_update(dssdev); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); mutex_unlock(&dsi.lock); @@ -3101,6 +3128,9 @@ static void dsi_display_disable(struct omap_dss_device *dssdev) dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; dssdev->state = OMAP_DSS_DISPLAY_DISABLED; + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_display_uninit_dispc(dssdev); dsi_display_uninit_dsi(dssdev); @@ -3128,6 +3158,9 @@ static int dsi_display_suspend(struct omap_dss_device *dssdev) dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi_display_uninit_dispc(dssdev); dsi_display_uninit_dsi(dssdev); @@ -3181,6 +3214,9 @@ static int dsi_display_resume(struct omap_dss_device *dssdev) if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO) dsi_start_auto_update(dssdev); + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); mutex_unlock(&dsi.lock); @@ -3325,6 +3361,9 @@ static int dsi_display_enable_te(struct omap_dss_device *dssdev, bool enable) dsi_bus_lock(); + enable_clocks(1); + dsi_enable_pll_clock(1); + dsi.te_enabled = enable; if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) @@ -3332,6 +3371,9 @@ static int dsi_display_enable_te(struct omap_dss_device *dssdev, bool enable) dsi_set_te(dssdev, enable); end: + enable_clocks(0); + dsi_enable_pll_clock(0); + dsi_bus_unlock(); return 0;