From patchwork Mon Nov 18 12:50:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 3196481 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91B82C045B for ; Mon, 18 Nov 2013 12:50:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56E072061C for ; Mon, 18 Nov 2013 12:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03A2020618 for ; Mon, 18 Nov 2013 12:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751561Ab3KRMuV (ORCPT ); Mon, 18 Nov 2013 07:50:21 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:52139 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409Ab3KRMuS (ORCPT ); Mon, 18 Nov 2013 07:50:18 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id rAICoI82020927; Mon, 18 Nov 2013 06:50:18 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAICoI80014831; Mon, 18 Nov 2013 06:50:18 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Mon, 18 Nov 2013 06:50:18 -0600 Received: from deskari.tieu.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAICoCV7002852; Mon, 18 Nov 2013 06:50:17 -0600 From: Tomi Valkeinen To: , CC: Archit Taneja , Tomi Valkeinen Subject: [PATCH 3/6] OMAPDSS: DSS remove ctx stuff Date: Mon, 18 Nov 2013 14:50:06 +0200 Message-ID: <1384779009-10512-4-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1384779009-10512-1-git-send-email-tomi.valkeinen@ti.com> References: <1384779009-10512-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The DSS core driver's suspend/resume can be cleaned up by storing the required registers to a 'dss_context' struct, instead of having a 512 byte block of memory where the registers are directly stored. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/dss.c | 77 ++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index bd01608..a5f674f 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c @@ -39,8 +39,6 @@ #include "dss.h" #include "dss_features.h" -#define DSS_SZ_REGS SZ_512 - struct dss_reg { u16 idx; }; @@ -71,6 +69,13 @@ struct dss_features { int (*dpi_select_source)(enum omap_channel channel); }; +struct dss_context { + bool valid; + u32 control; + u32 sdi_control; + u32 pll_control; +}; + static struct { struct platform_device *pdev; void __iomem *base; @@ -88,8 +93,7 @@ static struct { enum omap_dss_clk_source dispc_clk_source; enum omap_dss_clk_source lcd_clk_source[MAX_DSS_LCD_MANAGERS]; - bool ctx_valid; - u32 ctx[DSS_SZ_REGS / sizeof(u32)]; + struct dss_context ctx; const struct dss_features *feat; } dss; @@ -112,49 +116,6 @@ static inline u32 dss_read_reg(const struct dss_reg idx) return __raw_readl(dss.base + idx.idx); } -#define SR(reg) \ - dss.ctx[(DSS_##reg).idx / sizeof(u32)] = dss_read_reg(DSS_##reg) -#define RR(reg) \ - dss_write_reg(DSS_##reg, dss.ctx[(DSS_##reg).idx / sizeof(u32)]) - -static void dss_save_context(void) -{ - DSSDBG("dss_save_context\n"); - - SR(CONTROL); - - if (dss_feat_get_supported_displays(OMAP_DSS_CHANNEL_LCD) & - OMAP_DISPLAY_TYPE_SDI) { - SR(SDI_CONTROL); - SR(PLL_CONTROL); - } - - dss.ctx_valid = true; - - DSSDBG("context saved\n"); -} - -static void dss_restore_context(void) -{ - DSSDBG("dss_restore_context\n"); - - if (!dss.ctx_valid) - return; - - RR(CONTROL); - - if (dss_feat_get_supported_displays(OMAP_DSS_CHANNEL_LCD) & - OMAP_DISPLAY_TYPE_SDI) { - RR(SDI_CONTROL); - RR(PLL_CONTROL); - } - - DSSDBG("context restored\n"); -} - -#undef SR -#undef RR - int dss_get_ctx_loss_count(void) { struct platform_device *core_pdev = dss_get_core_pdev(); @@ -927,7 +888,16 @@ static int __exit omap_dsshw_remove(struct platform_device *pdev) static int dss_runtime_suspend(struct device *dev) { - dss_save_context(); + dss.ctx.control = dss_read_reg(DSS_CONTROL); + + if (dss_feat_get_supported_displays(OMAP_DSS_CHANNEL_LCD) & + OMAP_DISPLAY_TYPE_SDI) { + dss.ctx.sdi_control = dss_read_reg(DSS_SDI_CONTROL); + dss.ctx.pll_control = dss_read_reg(DSS_PLL_CONTROL); + } + + dss.ctx.valid = true; + dss_set_min_bus_tput(dev, 0); return 0; } @@ -946,7 +916,16 @@ static int dss_runtime_resume(struct device *dev) if (r) return r; - dss_restore_context(); + if (dss.ctx.valid) { + dss_write_reg(DSS_CONTROL, dss.ctx.control); + + if (dss_feat_get_supported_displays(OMAP_DSS_CHANNEL_LCD) & + OMAP_DISPLAY_TYPE_SDI) { + dss_write_reg(DSS_SDI_CONTROL, dss.ctx.sdi_control); + dss_write_reg(DSS_PLL_CONTROL, dss.ctx.pll_control); + } + } + return 0; }