From patchwork Thu Oct 4 15:18:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1545641 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id D87673FD9C for ; Thu, 4 Oct 2012 09:26:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B703DA0D86 for ; Thu, 4 Oct 2012 02:26:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id B3A2FA0C34 for ; Thu, 4 Oct 2012 00:01:41 -0700 (PDT) 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 <0MBC005U0WUSXPP0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 04 Oct 2012 16:01:40 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 88.BE.03783.4543D605; Thu, 04 Oct 2012 16:01:40 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-7d-506d345444c9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D4.BE.03783.4543D605; Thu, 04 Oct 2012 16:01:40 +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 <0MBC0040MWSZQ360@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 04 Oct 2012 16:01:40 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH v1 13/14] drm: exynos: hdmi: add support for exynos5 hdmi Date: Thu, 04 Oct 2012 20:48:55 +0530 Message-id: <1349363936-8531-14-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1349363936-8531-1-git-send-email-rahul.sharma@samsung.com> References: <1349363936-8531-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsWyRsSkRjfEJDfA4O53NYsrX9+zOTB63O8+ zhTAGMVlk5Kak1mWWqRvl8CVsa1rO3vBE7mKidP/MzcwPpboYuTkkBAwkfi9aQYbhC0mceHe eiCbi0NIYCmjxI9nO1m6GDnAip4esoKIT2eUmH79BxOEs5pJonPvdLBuNgFdidkHnzGC2CIC yhJ/J65iBCliFljEJPHvzgd2kISwgKfEtzkbmEFsFgFViTf/ZrGA2LwCHhI35+xngThDQaJ1 2SGwek6g+MJfN8BsIQF3iSfXLjFC9ApIfJt8COo6WYlNB5hBdkkI3GaTeHi+H+odSYmDK26w TGAUXsDIsIpRNLUguaA4KT3XUK84Mbe4NC9dLzk/dxMjMAxP/3smtYNxZYPFIUYBDkYlHl7D 7pwAIdbEsuLK3EOMEhzMSiK8mxVzA4R4UxIrq1KL8uOLSnNSiw8x+gBdMpFZSjQ5HxgjeSXx hsYm5qbGppZGRmampjiElcR5mz1SAoQE0hNLUrNTUwtSi2DGMXFwSjUwLq764uDHdM9+avsc 6Z/c0UYLDYy6NhsXLZDg/7AvVbv415e5Z6T6tb036O+xv6JQvL/ZYbJNw5za5GbLz35+7lfZ V3+vEfNc9nJC3C1/7YI48xcnWFYrxl2Ulk+ZaiwZ41B+MmFz/uHlhQcPMp1NNTkYe33juT+X 1x5rsnfOzC1nkrLiV3+jxFKckWioxVxUnAgAVTXDxnACAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xoG6ISW6Awd5+GYsrX9+zOTB63O8+ zhTAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+TiE6DrlpkD NFZJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmLGtazt7wRO5ionT/zM3 MD6W6GLk4JAQMJF4esiqi5ETyBSTuHBvPVsXIxeHkMB0Ronp138wQTirmSQ6905nA6liE9CV mH3wGSOILSKgLPF34ipGkCJmgUVMEv/ufGAHSQgLeEp8m7OBGcRmEVCVePNvFguIzSvgIXFz zn4WiHUKEq3LDoHVcwLFF/66AWYLCbhLPLl2iXECI+8CRoZVjKKpBckFxUnpuYZ6xYm5xaV5 6XrJ+bmbGMFB/kxqB+PKBotDjAIcjEo8vIbdOQFCrIllxZW5hxglOJiVRHg3K+YGCPGmJFZW pRblxxeV5qQWH2L0AbpqIrOUaHI+MALzSuINjU3MTY1NLU0sTMwscQgrifM2e6QECAmkJ5ak ZqemFqQWwYxj4uCUamBsuWsy/6vPF7fFtr+/PN9U7DTnxJyiPysj9szXUldZpzd9d3VPXF9Q 4f8JK3ednSyxTVQ2gUdA9xqzcmSZ7OXJ4lJvjZK4/Jxub8l6Vmj1+eFWpkqX2VemxpUZvJtW pTCbbbG90sZSL6PM3HXLauNFZ50MVAgo55u8cOPzrXk7y1Mv77hu8r9aiaU4I9FQi7moOBEA xXWkJJ8CAAA= X-CFilter-Loop: Reflected X-Mailman-Approved-At: Thu, 04 Oct 2012 00:52:30 -0700 Cc: t.stanislaws@samsung.com, l.krishna@samsung.com, joshi@samsung.com, kyungmin.park@samsung.com, fahad.k@samsung.com, rahul.sharma@samsung.com, prashanth.g@samsung.com, s.shirish@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.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, }, };