From patchwork Fri Jun 14 17:45:49 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: 2722751 Return-Path: X-Original-To: patchwork-linux-media@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 CB2D7C0AB1 for ; Fri, 14 Jun 2013 17:48:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0A6720366 for ; Fri, 14 Jun 2013 17:48:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B110620359 for ; Fri, 14 Jun 2013 17:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753521Ab3FNRsp (ORCPT ); Fri, 14 Jun 2013 13:48:45 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:40969 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753236Ab3FNRsn (ORCPT ); Fri, 14 Jun 2013 13:48:43 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOE002S49H67N10@mailout1.samsung.com>; Sat, 15 Jun 2013 02:48:42 +0900 (KST) X-AuditID: cbfee61a-b7f3b6d000006edd-1f-51bb57794551 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0F.EC.28381.9775BB15; Sat, 15 Jun 2013 02:48:42 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MOE00L589D10O50@mmp2.samsung.com>; Sat, 15 Jun 2013 02:48:41 +0900 (KST) From: Sylwester Nawrocki To: kishon@ti.com Cc: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org, kyungmin.park@samsung.com, sw0312.kim@samsung.com, devicetree-discuss@lists.ozlabs.org, kgene.kim@samsung.com, dh09.lee@samsung.com, jg1.han@samsung.com, linux-fbdev@vger.kernel.org, Sylwester Nawrocki Subject: [RFC PATCH 3/5] video: exynos_dsi: Use generic PHY driver Date: Fri, 14 Jun 2013 19:45:49 +0200 Message-id: <1371231951-1969-4-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1371231951-1969-1-git-send-email-s.nawrocki@samsung.com> References: <1371231951-1969-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJLMWRmVeSWpSXmKPExsVy+t9jQd2q8N2BBguXsVscmP2Q1eL6eTuL ywsvsVr0LrjKZnHhaQ+bxdmmN+wWmx5fY7U40feB1aJnw1ZWixnn9zFZHH7TDmRNfsnmwOOx eUm9x/kZCxk9+rasYvQ4fmM7k8fnTXIBrFFcNimpOZllqUX6dglcGVuevmMr+KZUsfLHEvYG xjbZLkYODgkBE4lDU6S7GDmBTDGJC/fWs3UxcnEICUxnlLj4rZMJwulgkrjz6S87SBWbgKFE 79E+RpBmEQFBiU+fGEFqmAWuMEl03drADFIjLOAkMfX8bDCbRUBVouPrSRYQm1fAVWL6gp3s EIsVJOZMsgEJcwq4SaxvOgE2XgiopHHjUuYJjLwLGBlWMYqmFiQXFCel5xrqFSfmFpfmpesl 5+duYgQH4DOpHYwrGywOMQpwMCrx8E5Q2x0oxJpYVlyZe4hRgoNZSYT3ripQiDclsbIqtSg/ vqg0J7X4EKM0B4uSOO+BVutAIYH0xJLU7NTUgtQimCwTB6dUA6O18otN5swzfva/PhxZsDGQ M+e+gyhDjuPGkp08K/Jeanee7H+/1VhB4+6HvO9ruObPvnV/jaeqfFTq1gTvHyck/0j3KPIt ETwQ8fILx5Yv0irnZuzbwbroXMUb/h9qAdqWFrZNz3jO/AnxXLl97ULR2aKssvP6r0uWr3mi mvk3fMHs4wnfjCcrsRRnJBpqMRcVJwIAamcONDwCAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.2 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 Use the generic PHY API instead of the platform callback to control the MIPI DSIM DPHY. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/video/display/source-exynos_dsi.c | 36 +++++++++-------------------- include/video/exynos_dsi.h | 5 ---- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/video/display/source-exynos_dsi.c b/drivers/video/display/source-exynos_dsi.c index 145d57b..dfab790 100644 --- a/drivers/video/display/source-exynos_dsi.c +++ b/drivers/video/display/source-exynos_dsi.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -219,6 +220,7 @@ struct exynos_dsi { bool enabled; struct platform_device *pdev; + struct phy *phy; struct device *dev; struct resource *res; struct clk *pll_clk; @@ -816,6 +818,7 @@ again: static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) { + static unsigned long j; struct exynos_dsi_transfer *xfer; unsigned long flags; bool start = true; @@ -824,7 +827,8 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) if (list_empty(&dsi->transfer_list)) { spin_unlock_irqrestore(&dsi->transfer_lock, flags); - dev_warn(dsi->dev, "unexpected TX/RX interrupt\n"); + if (printk_timed_ratelimit(&j, 500)) + dev_warn(dsi->dev, "unexpected TX/RX interrupt\n"); return false; } @@ -994,8 +998,7 @@ static int exynos_dsi_enable(struct video_source *src) clk_prepare_enable(dsi->bus_clk); clk_prepare_enable(dsi->pll_clk); - if (dsi->pd->phy_enable) - dsi->pd->phy_enable(dsi->pdev, true); + phy_power_on(dsi->phy); exynos_dsi_reset(dsi); exynos_dsi_init_link(dsi); @@ -1019,8 +1022,7 @@ static int exynos_dsi_disable(struct video_source *src) exynos_dsi_disable_clock(dsi); - if (dsi->pd->phy_enable) - dsi->pd->phy_enable(dsi->pdev, false); + phy_power_off(dsi->phy); clk_disable_unprepare(dsi->pll_clk); clk_disable_unprepare(dsi->bus_clk); @@ -1099,12 +1101,6 @@ static const struct dsi_video_source_ops exynos_dsi_ops = { * Device Tree */ -static int (* const of_phy_enables[])(struct platform_device *, bool) = { -#ifdef CONFIG_S5P_SETUP_MIPIPHY - [0] = s5p_dsim_phy_enable, -#endif -}; - static struct exynos_dsi_platform_data *exynos_dsi_parse_dt( struct platform_device *pdev) { @@ -1112,7 +1108,6 @@ static struct exynos_dsi_platform_data *exynos_dsi_parse_dt( struct exynos_dsi_platform_data *dsi_pd; struct device *dev = &pdev->dev; const __be32 *prop_data; - u32 val; dsi_pd = kzalloc(sizeof(*dsi_pd), GFP_KERNEL); if (!dsi_pd) { @@ -1120,19 +1115,6 @@ static struct exynos_dsi_platform_data *exynos_dsi_parse_dt( return NULL; } - prop_data = of_get_property(node, "samsung,phy-type", NULL); - if (!prop_data) { - dev_err(dev, "failed to get phy-type property\n"); - goto err_free_pd; - } - - val = be32_to_cpu(*prop_data); - if (val >= ARRAY_SIZE(of_phy_enables) || !of_phy_enables[val]) { - dev_err(dev, "Invalid phy-type %u\n", val); - goto err_free_pd; - } - dsi_pd->phy_enable = of_phy_enables[val]; - prop_data = of_get_property(node, "samsung,pll-stable-time", NULL); if (!prop_data) { dev_err(dev, "failed to get pll-stable-time property\n"); @@ -1254,6 +1236,10 @@ static int exynos_dsi_probe(struct platform_device *pdev) return -ENOMEM; } + dsi->phy = devm_phy_get(&pdev->dev, "dsim"); + if (IS_ERR(dsi->phy)) + return PTR_ERR(dsi->phy); + platform_set_drvdata(pdev, dsi); dsi->irq = platform_get_irq(pdev, 0); diff --git a/include/video/exynos_dsi.h b/include/video/exynos_dsi.h index 95e1568..5c062c7 100644 --- a/include/video/exynos_dsi.h +++ b/include/video/exynos_dsi.h @@ -25,9 +25,6 @@ */ struct exynos_dsi_platform_data { unsigned int enabled; - - int (*phy_enable)(struct platform_device *pdev, bool on); - unsigned int pll_stable_time; unsigned long pll_clk_rate; unsigned long esc_clk_rate; @@ -36,6 +33,4 @@ struct exynos_dsi_platform_data { unsigned short rx_timeout; }; -int s5p_dsim_phy_enable(struct platform_device *pdev, bool on); - #endif /* _EXYNOS_MIPI_DSIM_H */