From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA400C433FF for ; Tue, 13 Aug 2019 11:04:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 902D3206C2 for ; Tue, 13 Aug 2019 11:04:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VQ6s0ar2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728789AbfHMLE3 (ORCPT ); Tue, 13 Aug 2019 07:04:29 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:34522 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728704AbfHMLEQ (ORCPT ); Tue, 13 Aug 2019 07:04:16 -0400 Received: by mail-pg1-f202.google.com with SMTP id x19so66299116pgx.1 for ; Tue, 13 Aug 2019 04:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=4SGVKzSfOWWb5eHKsBAlwwo8FxZigEPwWxwM+lh0QRU=; b=VQ6s0ar2ecZ6e29UcdEWnWepSXsnto9WgOE1FdvUzcq+RdE5V3sYETzhQZFkLDUqkR MLZfKg1XU+bf9DSNRZwTPA/DDel6Afaar2cE4RVKXq2p0h22/swftMVF48e9St9uSL+7 SqB9pux7zMSYkD7TNanWHihvgtihGXz1yhvdYow6oFOfZR/pFoUJLLf1xaHAHK9/4XEr Oq5jTyvmANZvLSnp7EsMiBBFqQ9j5+e4evkC7ciY+lWE62ZFN0fE/4oi7KuCSlV49SYc 4ECf/h5Dk6b0oGoSjbI9a/mXO7Qn9Ty3D7Zf0lh3GtcidCAPu+zJjYr2ejM8+KDqkhAA r74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=4SGVKzSfOWWb5eHKsBAlwwo8FxZigEPwWxwM+lh0QRU=; b=oIU7AoRmflyOo9kk19jXdnQIeETGLVp3+RYgrBG5Na7TJTo1W5is3z9QsqZcKyL67k g4VR9VTb2Kh++ikwcNaL9Reby1bibVWiWjQjHRtO6QPbahTWPnN+GF84wGG7qoCVXWhr VV3YSTnb7lkMgRxwItiRPxTxvsdLTX08G1JoOjXc9cdo+vSys4F583BKOfvHAHHF2mGH Lceu0sZBw/ZXIYgN+LYWqil22Gw3VfsyUaxvW14JmSc78QARL2d0Uz4IWUwQQSuZiocq +avwVOaAapEEyRlPjtgcatVRy+3Pau+sYadAg+ddDcFBzQXsKmjJZfJc1ez6pWSSMNZi WZcg== X-Gm-Message-State: APjAAAUtQuJAUCUwoENkqzW4Gm8zuEeVsOnQaUrWQkCXK8oUhEetbBf6 QP+bUVkkFWEa16Bv9oTPGNMVzOOzZWA= X-Google-Smtp-Source: APXvYqyLozO0LYZOjgblXZL3P6XyhM7ZT4Ot91CeRL5qS1Y03DN/d8auJUcK3azljzKPyS03UvKbuMqD9Ws= X-Received: by 2002:a63:6d6:: with SMTP id 205mr34857175pgg.262.1565694256013; Tue, 13 Aug 2019 04:04:16 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:40 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-9-darekm@google.com> Mime-Version: 1.0 References: <20190813110300.83025-1-darekm@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH v6 8/8] drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl Cc: Dariusz Marcinkiewicz , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Daniel Vetter , Kukjin Kim , Krzysztof Kozlowski , "moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES" , "moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use the new cec_notifier_conn_(un)register() functions to (un)register the notifier for the HDMI connector, and fill in the cec_connector_info. Changes since v2: - removed unnecessary call to invalidate phys address before deregistering the notifier, - use cec_notifier_phys_addr_invalidate instead of setting invalid address on a notifier. Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/exynos/exynos_hdmi.c | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bc1565f1822ab..d532b468d9af5 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -852,6 +852,10 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, static void hdmi_connector_destroy(struct drm_connector *connector) { + struct hdmi_context *hdata = connector_to_hdmi(connector); + + cec_notifier_conn_unregister(hdata->notifier); + drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -935,6 +939,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder) { struct hdmi_context *hdata = encoder_to_hdmi(encoder); struct drm_connector *connector = &hdata->connector; + struct cec_connector_info conn_info; int ret; connector->interlace_allowed = true; @@ -957,6 +962,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder) DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n"); } + cec_fill_conn_info_from_drm(&conn_info, connector); + + hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL, + &conn_info); + if (hdata->notifier == NULL) { + ret = -ENOMEM; + DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n"); + } + return ret; } @@ -1528,8 +1542,8 @@ static void hdmi_disable(struct drm_encoder *encoder) */ mutex_unlock(&hdata->mutex); cancel_delayed_work(&hdata->hotplug_work); - cec_notifier_set_phys_addr(hdata->notifier, - CEC_PHYS_ADDR_INVALID); + if (hdata->notifier) + cec_notifier_phys_addr_invalidate(hdata->notifier); return; } @@ -2006,12 +2020,6 @@ 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); audio_infoframe = &hdata->audio.infoframe; @@ -2023,7 +2031,7 @@ static int hdmi_probe(struct platform_device *pdev) ret = hdmi_register_audio_device(hdata); if (ret) - goto err_notifier_put; + goto err_runtime_disable; ret = component_add(&pdev->dev, &hdmi_component_ops); if (ret) @@ -2034,8 +2042,7 @@ static int hdmi_probe(struct platform_device *pdev) err_unregister_audio: platform_device_unregister(hdata->audio.pdev); -err_notifier_put: - cec_notifier_put(hdata->notifier); +err_runtime_disable: pm_runtime_disable(dev); err_hdmiphy: @@ -2054,12 +2061,10 @@ 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); platform_device_unregister(hdata->audio.pdev); - cec_notifier_put(hdata->notifier); pm_runtime_disable(&pdev->dev); if (!IS_ERR(hdata->reg_hdmi_en)) -- 2.23.0.rc1.153.gdeed80330f-goog