From patchwork Thu Oct 4 15:42:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1545051 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D22293FD9C for ; Thu, 4 Oct 2012 07:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753020Ab2JDHZX (ORCPT ); Thu, 4 Oct 2012 03:25:23 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:45511 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752952Ab2JDHZL (ORCPT ); Thu, 4 Oct 2012 03:25:11 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBC00LFOXWSZVQ0@mailout2.samsung.com> for linux-media@vger.kernel.org; Thu, 04 Oct 2012 16:24:58 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 1F.B5.03783.AC93D605; Thu, 04 Oct 2012 16:24:58 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-38-506d39ca51d9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6D.B5.03783.9C93D605; Thu, 04 Oct 2012 16:24:57 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBC006I9XWMLU10@mmp2.samsung.com> for linux-media@vger.kernel.org; Thu, 04 Oct 2012 16:24:57 +0900 (KST) From: Rahul Sharma To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Cc: t.stanislaws@samsung.com, inki.dae@samsung.com, kyungmin.park@samsung.com, joshi@samsung.com Subject: [PATCH v1 13/14] drm: exynos: hdmi: add support for exynos5 hdmi Date: Thu, 04 Oct 2012 21:12:51 +0530 Message-id: <1349365372-21417-14-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1349365372-21417-1-git-send-email-rahul.sharma@samsung.com> References: <1349365372-21417-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsWyRsSkTveUZW6AwexnbBY9G7ayOjB6fN4k F8AYxWWTkpqTWZZapG+XwJWxrWs7e8ETuYqJ0/8zNzA+luhi5OSQEDCReL/hFhuELSZx4d56 IJuLQ0hgKaPEpP3NzDBFVybtZIFITGeU2HXqNVTVciaJfU19jCBVbAK6ErMPPgOzRQRcJbZu uQlmMwskSXz/OYkJxBYW8JT4NmcD2FQWAVWJ5Y/nAk3l4OAFijfPt4NYpiDRuuwQO0iYEyh8 5GciSFhIwENi0ocOVohOAYlvkw+BdUoIyEpsOsAMco2EwBk2ifv3lkI9IylxcMUNlgmMwgsY GVYxiqYWJBcUJ6XnGuoVJ+YWl+al6yXn525iBAbg6X/PpHYwrmywOMQowMGoxMNr2J0TIMSa WFZcmXuIUYKDWUmEd7NiboAQb0piZVVqUX58UWlOavEhRh+gSyYyS4km5wOjI68k3tDYxNzU 2NTSyMjM1BSHsJI4b7NHSoCQQHpiSWp2ampBahHMOCYOTqkGxjybbOWongDBB9+3z9t1yFMg vkXq/wrz1v8MRyZuZr1vauFUcSXgz4Ow7wlXHjVw7/lf0NV9kV2mfN/V3+/2H/Msurd4aebq LxbuzixyFhuefllw4c3lC+v0L9xILU5Y8fwJb8LedbxHGm77lGR9+NmduVhypdzueUaKN+5M 2yD7m/fJta9Ze04rsRRnJBpqMRcVJwIAcNIqh20CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkkeLIzCtJLcpLzFFi42I5/e+xoO5Jy9wAg7sXTSx6NmxldWD0+LxJ LoAxqoHRJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VWycUnQNctMwdo qpJCWWJOKVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsIYxY1vXdvaCJ3IVE6f/Z25g fCzRxcjJISFgInFl0k4WCFtM4sK99WxdjFwcQgLTGSV2nXoN5SxnktjX1McIUsUmoCsx++Az MFtEwFVi65abYDazQJLE95+TmEBsYQFPiW9zNjCD2CwCqhLLH88F2sDBwQsUb55vB7FMQaJ1 2SF2kDAnUPjIz0SQsJCAh8SkDx2sExh5FzAyrGIUTS1ILihOSs811CtOzC0uzUvXS87P3cQI Du9nUjsYVzZYHGIU4GBU4uE17M4JEGJNLCuuzD3EKMHBrCTCu1kxN0CINyWxsiq1KD++qDQn tfgQow/QTROZpUST84Gxl1cSb2hsYm5qbGppYmFiZolDWEmct9kjJUBIID2xJDU7NbUgtQhm HBMHp1QDYya3UlBrCYunzGe+4IPXwxytXa5KXuQyfGtgZ+r4PtH18e2ITl/Wd0LNd7hOrnyx 9tcUVgkHjSeTFaZff/NgXvr7qqnNyiqZot+WG7HuUXadvsPuVKGob1r8WYEPj9tWyO9KmXb+ 6u7UM3JyYjt2P7jq3fZTZYnfDOm/O1QOV5VJPs+/PPmEnhJLcUaioRZzUXEiAPoxFYqcAgAA X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch adds support for exynos5 hdmi with device tree enabled. Signed-off-by: Rahul Sharma --- drivers/gpu/drm/exynos/exynos_hdmi.c | 83 ++++++++++++++++++++++++++++++++-- 1 files changed, 79 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 89e798b..5caf49f 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include @@ -2250,6 +2253,41 @@ void hdmi_attach_hdmiphy_client(struct i2c_client *hdmiphy) hdmi_hdmiphy = hdmiphy; } +#ifdef CONFIG_OF +static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata + (struct device *dev) +{ + struct device_node *np = dev->of_node; + struct s5p_hdmi_platform_data *pd; + enum of_gpio_flags flags; + u32 value; + + pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + if (!pd) { + DRM_ERROR("memory allocation for pdata failed\n"); + goto err_data; + } + + if (!of_find_property(np, "hpd-gpio", &value)) { + DRM_ERROR("no hpd gpio property found\n"); + goto err_data; + } + + pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0, &flags); + + return pd; + +err_data: + return NULL; +} +#else +static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata + (struct device *dev) +{ + return NULL; +} +#endif + static struct platform_device_id hdmi_driver_types[] = { { .name = "s5pv210-hdmi", @@ -2259,7 +2297,19 @@ static struct platform_device_id hdmi_driver_types[] = { .driver_data = HDMI_TYPE13, }, { .name = "exynos4-hdmi14", - .driver_data = HDMI_TYPE14, + .driver_data = HDMI_TYPE14, + }, { + .name = "exynos5-hdmi", + .driver_data = HDMI_TYPE14, + }, { + /* end node */ + } +}; + +static struct of_device_id hdmi_match_types[] = { + { + .compatible = "samsung,exynos5-hdmi", + .data = (void *)HDMI_TYPE14, }, { /* end node */ } @@ -2276,7 +2326,16 @@ static int __devinit hdmi_probe(struct platform_device *pdev) DRM_DEBUG_KMS("[%d]\n", __LINE__); - pdata = pdev->dev.platform_data; + if (pdev->dev.of_node) { + pdata = drm_hdmi_dt_parse_pdata(dev); + if (IS_ERR(pdata)) { + DRM_ERROR("failed to parse dt\n"); + return PTR_ERR(pdata); + } + } else { + pdata = pdev->dev.platform_data; + } + if (!pdata) { DRM_ERROR("no platform data specified\n"); return -EINVAL; @@ -2303,18 +2362,33 @@ static int __devinit hdmi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, drm_hdmi_ctx); - hdata->type = (enum hdmi_type)platform_get_device_id + if (dev->of_node) { + const struct of_device_id *match; + match = of_match_node(of_match_ptr(hdmi_match_types), + pdev->dev.of_node); + hdata->type = (enum hdmi_type)match->data; + } else { + hdata->type = (enum hdmi_type)platform_get_device_id (pdev)->driver_data; + } + hdata->hpd_gpio = pdata->hpd_gpio; hdata->dev = dev; ret = hdmi_resources_init(hdata); + if (ret) { ret = -EINVAL; + DRM_ERROR("hdmi_resources_init failed\n"); goto err_data; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + DRM_ERROR("failed to find registers\n"); + ret = -ENOENT; + goto err_resource; + } hdata->regs = devm_request_and_ioremap(&pdev->dev, res); if (!hdata->regs) { @@ -2462,8 +2536,9 @@ struct platform_driver hdmi_driver = { .remove = __devexit_p(hdmi_remove), .id_table = hdmi_driver_types, .driver = { - .name = "exynos4-hdmi", + .name = "exynos-hdmi", .owner = THIS_MODULE, .pm = &hdmi_pm_ops, + .of_match_table = hdmi_match_types, }, };