From patchwork Tue Jun 25 14:21:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2777011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8FAE29F755 for ; Tue, 25 Jun 2013 14:25:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F9532026C for ; Tue, 25 Jun 2013 14:25:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6841920247 for ; Tue, 25 Jun 2013 14:25:27 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrU9u-0000Ry-HV; Tue, 25 Jun 2013 14:23:51 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrU9X-0001a7-0e; Tue, 25 Jun 2013 14:23:27 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrU93-0001Ue-6M for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2013 14:22:58 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOY009EZD9KVV80@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2013 23:22:40 +0900 (KST) X-AuditID: cbfee61a-b7f3b6d000006edd-f6-51c9a7b0c43c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 29.20.28381.0B7A9C15; Tue, 25 Jun 2013 23:22:40 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOY00ISLD8IH350@mmp1.samsung.com>; Tue, 25 Jun 2013 23:22:40 +0900 (KST) From: Sylwester Nawrocki To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 3/5] video: exynos_mipi_dsim: Use generic PHY driver Date: Tue, 25 Jun 2013 16:21:48 +0200 Message-id: <1372170110-12993-3-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1372170110-12993-1-git-send-email-s.nawrocki@samsung.com> References: <1372170110-12993-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLLMWRmVeSWpSXmKPExsVy+t9jAd0Ny08GGix5oWtx8H69xYHZD1kt rp+3s5h0fwKLxeWFl1gtehdcZbO48LSHzeJs0xt2i02Pr7FanOj7wGrRs2Erq8WM8/uYLNY9 fMFkcfhNO6vF+hmvWRz4PV5duMPisXlJvcf5GQsZPfq2rGL0OH5jO5PH501yAWxRXDYpqTmZ ZalF+nYJXBlTPn1kLWiXqViyaBNbA+NE8S5GTg4JAROJp8ceM0HYYhIX7q1n62Lk4hASWMQo cXTLYxYIp4NJomX9RjaQKjYBQ4neo32MXYwcHCIC3hLLrymC1DALXGSSOL33HViNsIC7xKfJ 11lAbBYBVYmVbcfZQWxeATeJ1RtusoH0SggoSMyZZAMS5gQqX390KVi5EFDJlRnzWCYw8i5g ZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERyoz6R2MK5ssDjEKMDBqMTDG7nrRKAQa2JZ cWXuIUYJDmYlEd5DWScDhXhTEiurUovy44tKc1KLDzFKc7AoifMeaLUOFBJITyxJzU5NLUgt gskycXBKNTDu8/sUl+fA9yLX9tRD/nlNKrabYwL7KqpXsVV90L7Z/y7PzonBlpv94qS5FUt8 HqkcXeg0R6rwuNrbypqrPm2Gt5dEmp4NmLYhMEZvnzkTS/f89E7FzWd/6+1wdNmkyhyy/WVB h6LL/n8K36uDt6qu5GNrFZFnvRCw0//zj8SF52LM6jxtXJRYijMSDbWYi4oTAQGNWilQAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130625_102257_506278_A417A445 X-CRM114-Status: GOOD ( 12.40 ) X-Spam-Score: -8.2 (--------) Cc: linux-fbdev@vger.kernel.org, kgene.kim@samsung.com, devicetree-discuss@lists.ozlabs.org, jg1.han@samsung.com, dh09.lee@samsung.com, balbi@ti.com, kishon@ti.com, inki.dae@samsung.com, kyungmin.park@samsung.com, Sylwester Nawrocki , plagnioj@jcrosoft.com, t.figa@samsung.com, linux-media@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Use the generic PHY API instead of the platform callback to control the MIPI DSIM DPHY. The 'phy_label' field is added to the platform data structure to allow PHY lookup on non-dt platforms. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park Acked-by: Felipe Balbi --- drivers/video/exynos/exynos_mipi_dsi.c | 18 +++++++++--------- include/video/exynos_mipi_dsim.h | 6 ++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index 32e5406..1f96004 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c @@ -156,8 +156,7 @@ static int exynos_mipi_dsi_blank_mode(struct mipi_dsim_device *dsim, int power) exynos_mipi_regulator_enable(dsim); /* enable MIPI-DSI PHY. */ - if (dsim->pd->phy_enable) - dsim->pd->phy_enable(pdev, true); + phy_power_on(dsim->phy); clk_enable(dsim->clock); @@ -373,6 +372,10 @@ static int exynos_mipi_dsi_probe(struct platform_device *pdev) return ret; } + dsim->phy = devm_phy_get(&pdev->dev, dsim_pd->phy_label); + if (IS_ERR(dsim->phy)) + return PTR_ERR(dsim->phy); + dsim->clock = devm_clk_get(&pdev->dev, "dsim0"); if (IS_ERR(dsim->clock)) { dev_err(&pdev->dev, "failed to get dsim clock source\n"); @@ -439,8 +442,7 @@ static int exynos_mipi_dsi_probe(struct platform_device *pdev) exynos_mipi_regulator_enable(dsim); /* enable MIPI-DSI PHY. */ - if (dsim->pd->phy_enable) - dsim->pd->phy_enable(pdev, true); + phy_power_on(dsim->phy); exynos_mipi_update_cfg(dsim); @@ -504,9 +506,8 @@ static int exynos_mipi_dsi_suspend(struct device *dev) if (client_drv && client_drv->suspend) client_drv->suspend(client_dev); - /* enable MIPI-DSI PHY. */ - if (dsim->pd->phy_enable) - dsim->pd->phy_enable(pdev, false); + /* disable MIPI-DSI PHY. */ + phy_power_off(dsim->phy); clk_disable(dsim->clock); @@ -536,8 +537,7 @@ static int exynos_mipi_dsi_resume(struct device *dev) exynos_mipi_regulator_enable(dsim); /* enable MIPI-DSI PHY. */ - if (dsim->pd->phy_enable) - dsim->pd->phy_enable(pdev, true); + phy_power_on(dsim->phy); clk_enable(dsim->clock); diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h index 89dc88a..fd69beb 100644 --- a/include/video/exynos_mipi_dsim.h +++ b/include/video/exynos_mipi_dsim.h @@ -216,6 +216,7 @@ struct mipi_dsim_config { * automatically. * @e_clk_src: select byte clock source. * @pd: pointer to MIPI-DSI driver platform data. + * @phy: pointer to the generic PHY */ struct mipi_dsim_device { struct device *dev; @@ -236,6 +237,7 @@ struct mipi_dsim_device { bool suspended; struct mipi_dsim_platform_data *pd; + struct phy *phy; }; /* @@ -248,7 +250,7 @@ struct mipi_dsim_device { * @enabled: indicate whether mipi controller got enabled or not. * @lcd_panel_info: pointer for lcd panel specific structure. * this structure specifies width, height, timing and polarity and so on. - * @phy_enable: pointer to a callback controlling D-PHY enable/reset + * @phy_label: the generic PHY label */ struct mipi_dsim_platform_data { char lcd_panel_name[PANEL_NAME_SIZE]; @@ -257,7 +259,7 @@ struct mipi_dsim_platform_data { unsigned int enabled; void *lcd_panel_info; - int (*phy_enable)(struct platform_device *pdev, bool on); + const char *phy_label; }; /*