From patchwork Fri Nov 9 05:53:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1718781 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 98351DF264 for ; Fri, 9 Nov 2012 05:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751321Ab2KIFxD (ORCPT ); Fri, 9 Nov 2012 00:53:03 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:32100 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750907Ab2KIFxB (ORCPT ); Fri, 9 Nov 2012 00:53:01 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MD700E92HOCT1C0@mailout1.samsung.com> for linux-fbdev@vger.kernel.org; Fri, 09 Nov 2012 14:53:00 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.49]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 77.77.12699.C3A9C905; Fri, 09 Nov 2012 14:53:00 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-09-509c9a3ca7a6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F6.77.12699.C3A9C905; Fri, 09 Nov 2012 14:53:00 +0900 (KST) Received: from DOJG1HAN02 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MD700AY2HOCSGA0@mmp2.samsung.com> for linux-fbdev@vger.kernel.org; Fri, 09 Nov 2012 14:53:00 +0900 (KST) From: Jingoo Han To: 'Jingoo Han' , 'Florian Tobias Schandinat' Cc: linux-fbdev@vger.kernel.org, 'Sean Paul' References: In-reply-to: Subject: [PATCH v4 7/8] video: exynos_dp: Move hotplug into a workqueue Date: Fri, 09 Nov 2012 14:53:00 +0900 Message-id: <001f01cdbe3e$79aa8300$6cff8900$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac2+Pd0+5OZ6ri/CQOacII/BjUUEfAAAH8hw Content-language: ko x-cr-hashedpuzzle: ACCS CZaK FYUj FzIp IdtR LCUh PX1T Qo+K SDVm U0Vb ZacQ a4ro f4LS hBbv opBL sOgK; 4; ZgBsAG8AcgBpAGEAbgBzAGMAaABhAG4AZABpAG4AYQB0AEAAZwBtAHgALgBkAGUAOwBqAGcAMQAuAGgAYQBuAEAAcwBhAG0AcwB1AG4AZwAuAGMAbwBtADsAbABpAG4AdQB4AC0AZgBiAGQAZQB2AEAAdgBnAGUAcgAuAGsAZQByAG4AZQBsAC4AbwByAGcAOwBzAGUAYQBuAHAAYQB1AGwAQABjAGgAcgBvAG0AaQB1AG0ALgBvAHIAZwA=; Sosha1_v1; 7; {0D2B6389-BAFB-439E-BBFB-4E1224E635FD}; agBnADEALgBoAGEAbgBAAHMAYQBtAHMAdQBuAGcALgBjAG8AbQA=; Fri, 09 Nov 2012 05:52:53 GMT; WwBQAEEAVABDAEgAIAB2ADQAIAA3AC8AOABdACAAdgBpAGQAZQBvADoAIABlAHgAeQBuAG8AcwBfAGQAcAA6ACAATQBvAHYAZQAgAGgAbwB0AHAAbAB1AGcAIABpAG4AdABvACAAYQAgAHcAbwByAGsAcQB1AGUAdQBlAA== x-cr-puzzleid: {0D2B6389-BAFB-439E-BBFB-4E1224E635FD} DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLI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rFh7+xdTA 2KLYxcjJISFgIrFh+UY2CFtM4sK99UA2F4eQwHRGienXz7FAOLOYJI7/fcQKUsUmoCbx5cth 9i5GDg4RgQSJZZdiQMLMAi4ShzfdYwIJCwlwS6xuDgIJcwrwSKz708kMYgsLuEvMPf6bBcRm EVCVmDfpGAtIOa+ArcTbPX4gYV4BQYkfk++xQEzUkli/8zgThC0vsXnNW2aQcgkBdYlHf3VB wiICRhJvPs1mhSgRkdj34h0jyMESAjNYJW7+ns8O8ZapxOrpV1gnMIrMQrJiFpIVs5CsmIVk 1gJGllWMoqkFyQXFSem5RnrFibnFpXnpesn5uZsYwVH+THoH46oGi0OMAhyMSjy8iQ9mBwix JpYVV+YeYpTgYFYS4Z2bOSdAiDclsbIqtSg/vqg0J7X4EKMPMAAmMkuJJucDE1BeSbyhsYmZ kaWRmYWRibk5DmElcd5mj5QAIYH0xJLU7NTUgtQimHFMHJxSDYxr3rDdDthz4vYfsSnXg5Pu nM+rv789uP8D353M8J2SDD67U8vnrVrq9rxS5tI9xTs1qSYyOemar7wWfXTVyjJf2+MXys7H +ZQ9YELyghPH170pKbvbuP/EjAhx+yPMhs4XvugIa9xeUO5TtOIo1/ynd698zmubYjD5oFXF c5ayR/m9rx1UDhgrsRRnJBpqMRcVJwIAWPSvwB8DAAA= X-CFilter-Loop: Reflected Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: Sean Paul Move the hotplug related code from probe and resume into a workqueue. This allows us to initialize the DP driver (and resume it) when there is no monitor connected. Signed-off-by: Sean Paul Reviewed-by: Olof Johansson Signed-off-by: Jingoo Han --- drivers/video/exynos/exynos_dp_core.c | 93 +++++++++++++++++--------------- drivers/video/exynos/exynos_dp_core.h | 1 + 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c index edb3bfe..79ba1ea 100644 --- a/drivers/video/exynos/exynos_dp_core.c +++ b/drivers/video/exynos/exynos_dp_core.c @@ -837,6 +837,45 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg) return IRQ_HANDLED; } +static void exynos_dp_hotplug(struct work_struct *work) +{ + struct exynos_dp_device *dp; + int ret; + + dp = container_of(work, struct exynos_dp_device, hotplug_work); + + ret = exynos_dp_detect_hpd(dp); + if (ret) { + dev_err(dp->dev, "unable to detect hpd\n"); + return; + } + + ret = exynos_dp_handle_edid(dp); + if (ret) { + dev_err(dp->dev, "unable to handle edid\n"); + return; + } + + ret = exynos_dp_set_link_train(dp, dp->video_info->lane_count, + dp->video_info->link_rate); + if (ret) { + dev_err(dp->dev, "unable to do link train\n"); + return; + } + + exynos_dp_enable_scramble(dp, 1); + exynos_dp_enable_rx_to_enhanced_mode(dp, 1); + exynos_dp_enable_enhanced_mode(dp, 1); + + exynos_dp_set_lane_count(dp, dp->video_info->lane_count); + exynos_dp_set_link_bandwidth(dp, dp->video_info->link_rate); + + exynos_dp_init_video(dp); + ret = exynos_dp_config_video(dp, dp->video_info); + if (ret) + dev_err(dp->dev, "unable to config video\n"); +} + static int __devinit exynos_dp_probe(struct platform_device *pdev) { struct resource *res; @@ -882,6 +921,8 @@ static int __devinit exynos_dp_probe(struct platform_device *pdev) return -ENODEV; } + INIT_WORK(&dp->hotplug_work, exynos_dp_hotplug); + ret = devm_request_irq(&pdev->dev, dp->irq, exynos_dp_irq_handler, 0, "exynos-dp", dp); if (ret) { @@ -895,36 +936,8 @@ static int __devinit exynos_dp_probe(struct platform_device *pdev) exynos_dp_init_dp(dp); - ret = exynos_dp_detect_hpd(dp); - if (ret) { - dev_err(&pdev->dev, "unable to detect hpd\n"); - return ret; - } - - exynos_dp_handle_edid(dp); - - ret = exynos_dp_set_link_train(dp, dp->video_info->lane_count, - dp->video_info->link_rate); - if (ret) { - dev_err(&pdev->dev, "unable to do link train\n"); - return ret; - } - - exynos_dp_enable_scramble(dp, 1); - exynos_dp_enable_rx_to_enhanced_mode(dp, 1); - exynos_dp_enable_enhanced_mode(dp, 1); - - exynos_dp_set_lane_count(dp, dp->video_info->lane_count); - exynos_dp_set_link_bandwidth(dp, dp->video_info->link_rate); - - exynos_dp_init_video(dp); - ret = exynos_dp_config_video(dp, dp->video_info); - if (ret) { - dev_err(&pdev->dev, "unable to config video\n"); - return ret; - } - platform_set_drvdata(pdev, dp); + schedule_work(&dp->hotplug_work); return 0; } @@ -934,6 +947,9 @@ static int __devexit exynos_dp_remove(struct platform_device *pdev) struct exynos_dp_platdata *pdata = pdev->dev.platform_data; struct exynos_dp_device *dp = platform_get_drvdata(pdev); + if (work_pending(&dp->hotplug_work)) + flush_work(&dp->hotplug_work); + if (pdata && pdata->phy_exit) pdata->phy_exit(); @@ -949,6 +965,9 @@ static int exynos_dp_suspend(struct device *dev) struct exynos_dp_platdata *pdata = pdev->dev.platform_data; struct exynos_dp_device *dp = platform_get_drvdata(pdev); + if (work_pending(&dp->hotplug_work)) + flush_work(&dp->hotplug_work); + if (pdata && pdata->phy_exit) pdata->phy_exit(); @@ -970,21 +989,7 @@ static int exynos_dp_resume(struct device *dev) exynos_dp_init_dp(dp); - exynos_dp_detect_hpd(dp); - exynos_dp_handle_edid(dp); - - exynos_dp_set_link_train(dp, dp->video_info->lane_count, - dp->video_info->link_rate); - - exynos_dp_enable_scramble(dp, 1); - exynos_dp_enable_rx_to_enhanced_mode(dp, 1); - exynos_dp_enable_enhanced_mode(dp, 1); - - exynos_dp_set_lane_count(dp, dp->video_info->lane_count); - exynos_dp_set_link_bandwidth(dp, dp->video_info->link_rate); - - exynos_dp_init_video(dp); - exynos_dp_config_video(dp, dp->video_info); + schedule_work(&dp->hotplug_work); return 0; } diff --git a/drivers/video/exynos/exynos_dp_core.h b/drivers/video/exynos/exynos_dp_core.h index 57b8a65..66f11f4 100644 --- a/drivers/video/exynos/exynos_dp_core.h +++ b/drivers/video/exynos/exynos_dp_core.h @@ -32,6 +32,7 @@ struct exynos_dp_device { struct video_info *video_info; struct link_train link_train; + struct work_struct hotplug_work; }; /* exynos_dp_reg.c */