From patchwork Fri Jun 28 13:43:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 19117 X-Patchwork-Delegate: sylvester.nawrocki@gmail.com Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UsYyp-0008DG-W3; Fri, 28 Jun 2013 15:44:51 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-6) with esmtp id 1UsYyn-0001cL-69; Fri, 28 Jun 2013 15:44:51 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754595Ab3F1Nor (ORCPT + 1 other); Fri, 28 Jun 2013 09:44:47 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:61788 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262Ab3F1Noq (ORCPT ); Fri, 28 Jun 2013 09:44:46 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MP300E9SVIGYOI0@mailout4.samsung.com>; Fri, 28 Jun 2013 22:44:45 +0900 (KST) X-AuditID: cbfee61b-b7f8e6d00000524c-5e-51cd934c3b12 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7E.36.21068.C439DC15; Fri, 28 Jun 2013 22:44:44 +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 <0MP300GFHVG1GY60@mmp1.samsung.com>; Fri, 28 Jun 2013 22:44:44 +0900 (KST) From: Sylwester Nawrocki To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: kishon@ti.com, linux-media@vger.kernel.org, kyungmin.park@samsung.com, balbi@ti.com, t.figa@samsung.com, devicetree-discuss@lists.ozlabs.org, kgene.kim@samsung.com, dh09.lee@samsung.com, jg1.han@samsung.com, inki.dae@samsung.com, tomi.valkeinen@ti.com, plagnioj@jcrosoft.com, jason77.wang@gmail.com, linux-fbdev@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH v4 3/5] video: exynos_mipi_dsim: Use the generic PHY driver Date: Fri, 28 Jun 2013 15:43:09 +0200 Message-id: <1372426991-2482-4-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1372426991-2482-1-git-send-email-s.nawrocki@samsung.com> References: <1372426991-2482-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jAV2fyWcDDdadtrI4eL/e4sDsh6wW 18/bWUy6P4HFYsbSR6wWlxdeYrXoXXCVzeLC0x42i7NNb9gtNj2+xmpxou8Dq0XPhq2sFjPO 72OyWPfwBZPF4TftrBbrZ7xmsVg//xabg6DHzll32T1eXbjD4rF5Sb3H+RkLGT36tqxi9Dh+ YzuTx+dNcgHsUVw2Kak5mWWpRfp2CVwZPy/PYSk4IVdxpb+FtYFxhWQXIyeHhICJxLuz9xkh bDGJC/fWs3UxcnEICSxilPi74iwrhNPBJLF85SsWkCo2AUOJ3qN9QB0cHCIC3hLLrymC1DAL NDFLtM5exgpSIwwUv755KjtIDYuAqsSG244gYV4BV4lbt6+xgIQlBBQk5kyyAQlzCrhJvHrQ yw5iCwGVLH7yhGkCI+8CRoZVjKKpBckFxUnpuUZ6xYm5xaV56XrJ+bmbGMFB/Ex6B+OqBotD jAIcjEo8vA2JZwKFWBPLiitzDzFKcDArifAennA2UIg3JbGyKrUoP76oNCe1+BCjNAeLkjjv wVbrQCGB9MSS1OzU1ILUIpgsEwenVANjAnvLDoHZaqt7HSdkX5zD92eVdc6ujTf+/dLxSv1V tCD759Qvv3e59R2+Iqk0/e7y/nZdtRlN/0o0LqqFmfxesaZs7YTdCzLus02f4lOmeOkHxxP3 kEk/d364pd6gEDORZ//F5Ou/D/yV+HaQmyOB12CaemN8tqn1tb3zX1kte3L/6s6q77Ou6iix FGckGmoxFxUnAgCQpzgUXgIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.6.28.133619 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_NOT_1 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 Acked-by: Donghwa Lee --- drivers/video/exynos/exynos_mipi_dsi.c | 19 ++++++++++--------- include/video/exynos_mipi_dsim.h | 6 ++++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index 32e5406..248e444 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -156,8 +157,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 +373,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 +443,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 +507,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 +538,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; }; /*