From patchwork Tue Dec 13 15:08:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 9472559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 007BC6021C for ; Tue, 13 Dec 2016 15:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7630284F7 for ; Tue, 13 Dec 2016 15:11:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAB8E285DC; Tue, 13 Dec 2016 15:11:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 698EF284F7 for ; Tue, 13 Dec 2016 15:11:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGoiO-0005Jh-8s; Tue, 13 Dec 2016 15:10:00 +0000 Received: from lb2-smtp-cloud3.xs4all.net ([194.109.24.26]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cGoh9-0004Xi-F9 for linux-arm-kernel@lists.infradead.org; Tue, 13 Dec 2016 15:08:50 +0000 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:ef31:4dcf:822e:7392]) by smtp-cloud3.xs4all.net with ESMTP id KT8D1u00W3YS7uB01T8Ldz; Tue, 13 Dec 2016 16:08:20 +0100 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCH 2/4] exynos_hdmi: add HDMI notifier support Date: Tue, 13 Dec 2016 16:08:11 +0100 Message-Id: <20161213150813.37966-3-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161213150813.37966-1-hverkuil@xs4all.nl> References: <20161213150813.37966-1-hverkuil@xs4all.nl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161213_070843_952042_F7644226 X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Russell King , dri-devel@lists.freedesktop.org, Javier Martinez Canillas , Hans Verkuil , Benjamin Gaignard , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Implement the HDMI notifier support to allow CEC drivers to be informed when there is a new EDID and when a connect or disconnect happens. Signed-off-by: Hans Verkuil --- drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_hdmi.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 465d344f..34f3b6f 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -77,6 +77,7 @@ config DRM_EXYNOS_DP config DRM_EXYNOS_HDMI bool "HDMI" depends on DRM_EXYNOS_MIXER || DRM_EXYNOS5433_DECON + select HDMI_NOTIFIERS help Choose this option if you want to use Exynos HDMI for DRM. diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index e8fb6ef..2bfc411 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -132,6 +133,7 @@ struct hdmi_context { struct delayed_work hotplug_work; struct drm_display_mode current_mode; u8 cea_video_id; + struct hdmi_notifier *notifier; const struct hdmi_driver_data *drv_data; void __iomem *regs; @@ -857,9 +859,12 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, { struct hdmi_context *hdata = connector_to_hdmi(connector); - if (gpiod_get_value(hdata->hpd_gpio)) + if (gpiod_get_value(hdata->hpd_gpio)) { + hdmi_event_connect(hdata->notifier); return connector_status_connected; + } + hdmi_event_disconnect(hdata->notifier); return connector_status_disconnected; } @@ -898,6 +903,9 @@ static int hdmi_get_modes(struct drm_connector *connector) edid->width_cm, edid->height_cm); drm_mode_connector_update_edid_property(connector, edid); + hdmi_event_connect(hdata->notifier); + hdmi_event_new_edid(hdata->notifier, edid, + EDID_LENGTH * (1 + edid->extensions)); ret = drm_add_edid_modes(connector, edid); @@ -1544,6 +1552,7 @@ static void hdmi_disable(struct drm_encoder *encoder) if (funcs && funcs->disable) (*funcs->disable)(crtc); + hdmi_event_disconnect(hdata->notifier); cancel_delayed_work(&hdata->hotplug_work); hdmiphy_disable(hdata); @@ -1893,15 +1902,22 @@ static int hdmi_probe(struct platform_device *pdev) } } + hdata->notifier = hdmi_notifier_get(&pdev->dev); + if (hdata->notifier == NULL) { + ret = -ENOMEM; + goto err_hdmiphy; + } + pm_runtime_enable(dev); ret = component_add(&pdev->dev, &hdmi_component_ops); if (ret) - goto err_disable_pm_runtime; + goto err_notifier_put; return ret; -err_disable_pm_runtime: +err_notifier_put: + hdmi_notifier_put(hdata->notifier); pm_runtime_disable(dev); err_hdmiphy: @@ -1918,9 +1934,11 @@ static int hdmi_remove(struct platform_device *pdev) struct hdmi_context *hdata = platform_get_drvdata(pdev); cancel_delayed_work_sync(&hdata->hotplug_work); + hdmi_event_disconnect(hdata->notifier); component_del(&pdev->dev, &hdmi_component_ops); + hdmi_notifier_put(hdata->notifier); pm_runtime_disable(&pdev->dev); if (!IS_ERR(hdata->reg_hdmi_en))