From patchwork Fri Mar 31 12:20:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 9656199 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 12583601D2 for ; Fri, 31 Mar 2017 12:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02DED2867F for ; Fri, 31 Mar 2017 12:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBC3B28693; Fri, 31 Mar 2017 12:21:25 +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=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 86CA22867F for ; Fri, 31 Mar 2017 12:21:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC3A36EAC3; Fri, 31 Mar 2017 12:20:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb3-smtp-cloud2.xs4all.net (lb3-smtp-cloud2.xs4all.net [194.109.24.29]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0CD286EAAF for ; Fri, 31 Mar 2017 12:20:49 +0000 (UTC) Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:ef31:4dcf:822e:7392]) by smtp-cloud2.xs4all.net with ESMTP id 2cLc1v00d3YS7uB01cLn46; Fri, 31 Mar 2017 14:20:48 +0200 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCHv6 03/10] exynos_hdmi: add CEC notifier support Date: Fri, 31 Mar 2017 14:20:29 +0200 Message-Id: <20170331122036.55706-4-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170331122036.55706-1-hverkuil@xs4all.nl> References: <20170331122036.55706-1-hverkuil@xs4all.nl> Cc: linux-samsung-soc@vger.kernel.org, Russell King , Krzysztof Kozlowski , Patrice.chotard@st.com, Javier Martinez Canillas , Hans Verkuil , dri-devel@lists.freedesktop.org, Daniel Vetter , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Implement the CEC notifier support to allow CEC drivers to be informed when there is a new physical address. Signed-off-by: Hans Verkuil Tested-by: Marek Szyprowski Acked-by: Daniel Vetter Acked-by: Krzysztof Kozlowski Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_hdmi.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 88ccc0469316..bc4c8d0a66f4 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -43,6 +43,8 @@ #include +#include + #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" @@ -119,6 +121,7 @@ struct hdmi_context { bool dvi_mode; struct delayed_work hotplug_work; struct drm_display_mode current_mode; + struct cec_notifier *notifier; const struct hdmi_driver_data *drv_data; void __iomem *regs; @@ -822,6 +825,7 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, if (gpiod_get_value(hdata->hpd_gpio)) return connector_status_connected; + cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); return connector_status_disconnected; } @@ -860,6 +864,7 @@ static int hdmi_get_modes(struct drm_connector *connector) edid->width_cm, edid->height_cm); drm_mode_connector_update_edid_property(connector, edid); + cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid); ret = drm_add_edid_modes(connector, edid); @@ -1503,6 +1508,7 @@ static void hdmi_disable(struct drm_encoder *encoder) if (funcs && funcs->disable) (*funcs->disable)(crtc); + cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); cancel_delayed_work(&hdata->hotplug_work); hdmiphy_disable(hdata); @@ -1878,15 +1884,22 @@ static int hdmi_probe(struct platform_device *pdev) } } + hdata->notifier = cec_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: + cec_notifier_put(hdata->notifier); pm_runtime_disable(dev); err_hdmiphy: @@ -1905,9 +1918,11 @@ static int hdmi_remove(struct platform_device *pdev) struct hdmi_context *hdata = platform_get_drvdata(pdev); cancel_delayed_work_sync(&hdata->hotplug_work); + cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); component_del(&pdev->dev, &hdmi_component_ops); + cec_notifier_put(hdata->notifier); pm_runtime_disable(&pdev->dev); if (!IS_ERR(hdata->reg_hdmi_en))