From patchwork Wed Dec 22 09:52:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 426521 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBM9qNup009153 for ; Wed, 22 Dec 2010 09:52:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751992Ab0LVJwU (ORCPT ); Wed, 22 Dec 2010 04:52:20 -0500 Received: from moutng.kundenserver.de ([212.227.17.9]:60198 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751826Ab0LVJwU (ORCPT ); Wed, 22 Dec 2010 04:52:20 -0500 Received: from axis700.grange (pD9EB9018.dip0.t-ipconnect.de [217.235.144.24]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LaJV0-1QH5802RcU-00lzFd; Wed, 22 Dec 2010 10:52:18 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 38FC4E6A7A; Wed, 22 Dec 2010 10:52:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 2190D1067BC; Wed, 22 Dec 2010 10:52:18 +0100 (CET) Date: Wed, 22 Dec 2010 10:52:18 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-fbdev@vger.kernel.org cc: linux-sh@vger.kernel.org Subject: [PATCH 1/2] fbdev: sh-mobile: implement MIPI DSI runtime PM support Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:eZjE9peQLew1siMkQomGW+a1LLDIBUV89kSsKTUiliG KKq4oZTU9tNP4kNtiDyE+KWwytCgOu44H3f3WOHAY5miVS/z/H 2dKeFyOw/Z+sSun2KmX0RyEFTY0MnD8dzfEBiN6k1wQFlYY8+q m/YcpJe6LAaRdRoOf9nJ+5ZzrCEaxUT92XJeM2pT+HE3oBmvvB ee5K2Uiwkhx/Lk8YCZIZUvF6fHFYF17FMrS/CChDDo= 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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 22 Dec 2010 09:52:23 +0000 (UTC) diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 3f3d431..ef19cac 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ struct sh_mipi { void __iomem *base; struct clk *dsit_clk; struct clk *dsip_clk; + struct device *dev; }; static struct sh_mipi *mipi_dsi[MAX_SH_MIPI_DSI]; @@ -104,6 +106,7 @@ static void mipi_display_on(void *arg, struct fb_info *info) { struct sh_mipi *mipi = arg; + pm_runtime_get_sync(mipi->dev); sh_mipi_dsi_enable(mipi, true); } @@ -112,6 +115,7 @@ static void mipi_display_off(void *arg) struct sh_mipi *mipi = arg; sh_mipi_dsi_enable(mipi, false); + pm_runtime_put(mipi->dev); } static int __init sh_mipi_setup(struct sh_mipi *mipi, @@ -356,7 +360,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev) goto emap; } - mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk"); + mipi->dev = &pdev->dev; + + mipi->dsit_clk = clk_get(NULL, "dsit_clk"); if (IS_ERR(mipi->dsit_clk)) { ret = PTR_ERR(mipi->dsit_clk); goto eclktget; @@ -405,6 +411,9 @@ static int __init sh_mipi_probe(struct platform_device *pdev) mipi_dsi[idx] = mipi; + pm_runtime_enable(&pdev->dev); + pm_runtime_resume(&pdev->dev); + ret = sh_mipi_setup(mipi, pdata); if (ret < 0) goto emipisetup; @@ -416,11 +425,13 @@ static int __init sh_mipi_probe(struct platform_device *pdev) pdata->lcd_chan->board_cfg.board_data = mipi; pdata->lcd_chan->board_cfg.display_on = mipi_display_on; pdata->lcd_chan->board_cfg.display_off = mipi_display_off; + pdata->lcd_chan->board_cfg.owner = THIS_MODULE; return 0; emipisetup: mipi_dsi[idx] = NULL; + pm_runtime_disable(&pdev->dev); clk_disable(mipi->dsip_clk); eclkpon: clk_disable(mipi->dsit_clk); @@ -467,10 +478,12 @@ static int __exit sh_mipi_remove(struct platform_device *pdev) if (ret < 0) return ret; + pdata->lcd_chan->board_cfg.owner = NULL; pdata->lcd_chan->board_cfg.display_on = NULL; pdata->lcd_chan->board_cfg.display_off = NULL; pdata->lcd_chan->board_cfg.board_data = NULL; + pm_runtime_disable(&pdev->dev); clk_disable(mipi->dsip_clk); clk_disable(mipi->dsit_clk); clk_put(mipi->dsit_clk);