From patchwork Wed Jun 22 07:49:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damian Hobson-Garcia X-Patchwork-Id: 903762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5M7n5nP012642 for ; Wed, 22 Jun 2011 07:49:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751599Ab1FVHtF (ORCPT ); Wed, 22 Jun 2011 03:49:05 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:38880 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724Ab1FVHtE (ORCPT ); Wed, 22 Jun 2011 03:49:04 -0400 Received: by pwj7 with SMTP id 7so436401pwj.19 for ; Wed, 22 Jun 2011 00:49:03 -0700 (PDT) Received: by 10.68.41.40 with SMTP id c8mr130878pbl.406.1308728943776; Wed, 22 Jun 2011 00:49:03 -0700 (PDT) Received: from localhost.localdomain (mailhost.igel.co.jp [219.106.231.130]) by mx.google.com with ESMTPS id g8sm266171pba.21.2011.06.22.00.49.02 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Jun 2011 00:49:03 -0700 (PDT) From: Damian Hobson-Garcia To: Magnus Damm , lethal@linux-sh.org, linux-sh@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: taki@igel.co.jp, matsu@igel.co.jp, Damian Hobson-Garcia Subject: [PATCH 1/5 v3] fbdev: sh_mobile_meram: Add enable/disble hooks for LCDC Date: Wed, 22 Jun 2011 16:49:48 +0900 Message-Id: <1308728992-9660-2-git-send-email-dhobsong@igel.co.jp> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308728992-9660-1-git-send-email-dhobsong@igel.co.jp> References: <1308728992-9660-1-git-send-email-dhobsong@igel.co.jp> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 22 Jun 2011 07:49:09 +0000 (UTC) Add hooks to allow the LCDC to increase/decrease the MERAM PM reference counts Signed-off-by: Damian Hobson-Garcia --- Changes from V2 =============== * Change the names of the clk_on/clk_off callbacks to pm_get_sync/pm_put_sync to better reflect their actual functionality * Make these callback functions static drivers/video/sh_mobile_meram.c | 27 +++++++++++++++++++++++++++ include/video/sh_mobile_meram.h | 6 ++++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c index 9170c82..371f129 100644 --- a/drivers/video/sh_mobile_meram.c +++ b/drivers/video/sh_mobile_meram.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -460,11 +461,33 @@ static int sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, return 0; } +static int sh_mobile_meram_pm_get_sync(struct sh_mobile_meram_info *pdata) +{ + if (!pdata || !pdata->pdev) + return -EINVAL; + + dev_dbg(&pdata->pdev->dev, "Enabling sh_mobile_meram clock."); + pm_runtime_get_sync(&pdata->pdev->dev); + return 0; +} + +static int sh_mobile_meram_pm_put_sync(struct sh_mobile_meram_info *pdata) +{ + if (!pdata || !pdata->pdev) + return -EINVAL; + + dev_dbg(&pdata->pdev->dev, "Disabling sh_mobile_meram clock."); + pm_runtime_put_sync(&pdata->pdev->dev); + return 0; +} + static struct sh_mobile_meram_ops sh_mobile_meram_ops = { .module = THIS_MODULE, .meram_register = sh_mobile_meram_register, .meram_unregister = sh_mobile_meram_unregister, .meram_update = sh_mobile_meram_update, + .meram_pm_put_sync = sh_mobile_meram_pm_put_sync, + .meram_pm_get_sync = sh_mobile_meram_pm_get_sync, }; /* @@ -515,6 +538,8 @@ static int __devinit sh_mobile_meram_probe(struct platform_device *pdev) if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1) meram_write_reg(priv->base, MEVCR1, 1 << 29); + pm_runtime_enable(&pdev->dev); + dev_info(&pdev->dev, "sh_mobile_meram initialized."); return 0; @@ -530,6 +555,8 @@ static int sh_mobile_meram_remove(struct platform_device *pdev) { struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); + pm_runtime_disable(&pdev->dev); + if (priv->base) iounmap(priv->base); diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h index af602d6..f213b6d 100644 --- a/include/video/sh_mobile_meram.h +++ b/include/video/sh_mobile_meram.h @@ -63,6 +63,12 @@ struct sh_mobile_meram_ops { unsigned long base_addr_c, unsigned long *icb_addr_y, unsigned long *icb_addr_c); + + /* enable meram clock */ + int (*meram_pm_get_sync)(struct sh_mobile_meram_info *meram_dev); + + /* disable meram clock */ + int (*meram_pm_put_sync)(struct sh_mobile_meram_info *meram_dev); }; #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */