From patchwork Tue Aug 13 11:02:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3025D1398 for ; Thu, 15 Aug 2019 08:37:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 223932811A for ; Thu, 15 Aug 2019 08:37:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16EFF2884A; Thu, 15 Aug 2019 08:37: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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 C5DAF2811A for ; Thu, 15 Aug 2019 08:37:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE2606E946; Thu, 15 Aug 2019 08:35:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by gabe.freedesktop.org (Postfix) with ESMTPS id B863E6E0EF for ; Tue, 13 Aug 2019 11:03:43 +0000 (UTC) Received: by mail-qk1-x74a.google.com with SMTP id x28so19364970qki.21 for ; Tue, 13 Aug 2019 04:03:43 -0700 (PDT) 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=suzgW5VW6Ng90prgpz/ghvx/fVcho6Pl4urYZ0d0Q0c=; b=fLsrGDNmxxkou+/lqzAkdGse01GQ75mWbDNm6118FGFJVNJieyQEIymdVnByV63U2Y eNh3d2l0FK63/rMnf6PgWBOZGT079wCqnlB+2Sl/vEhuR9fcadcR+CTXnlYO/0rKKhW/ u8ykGwcGJRF4J9nlrPITq9dsURV15xHAsvZoFwDdSwCq3JXH63vUgvK6MtOU8KfqYTcT sJBFzLydh8KXCFAJegz5V863rgbSAZJiSydPVHyJlihD0piThyauofC/NxDdgk65IKL+ YWIiGDeDQg7L5zpT/89nGqm76fSf3IF5YmctQke39NvLNZ9HdG+s4lBsQ2YHmjqxcjGT H7hQ== X-Gm-Message-State: APjAAAVQcHyyfFHvbBbpFYpo88Hm9paZC4NSTmaanFHMFaViV+dF8oCY KQTzEyKMEGATfSljlEF4/i5voZubBAQ8Kgoo0/IzK3rf68aLFfTd3cE1NUrDfKkYEMwGgE04LxR fgOSZb4K2HltsJwY9DBhLhy/Q+V+Xh460DV52FvimZYcNtLRepP9BOjQ6hI45Z8L/sS9Uy+iugg == X-Google-Smtp-Source: APXvYqxH0s5mm6hwQ1otgCG0chGHch91z1fgqZDyPSZRLZ3zhyi2y9k5EKBX3ssntH2nkvkmJsnKCHjxCiI= X-Received: by 2002:a37:aec7:: with SMTP id x190mr7822514qke.420.1565694222662; Tue, 13 Aug 2019 04:03:42 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:33 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-2-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 1/8] drm/i915/intel_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 X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=suzgW5VW6Ng90prgpz/ghvx/fVcho6Pl4urYZ0d0Q0c=; b=mAwTBif5SbxpYaq2IikX38jkOeszeUCovNEYab4cHeVN+v697Wp2h3UHSPoj6PQEsx gWErNctQhzZZtEathfy//4/gyuApE+oiS/w6iVDZKnkz+CoezIRW4AxGxBuSUH2Vy5mF 7xblnVtiwRzWYhRluLub87aOD2EYsxBrPidHFfxkOz9l5amojS0yJpWbP6Su1HrpxNc3 kWT5XLunbopN/uGkEZe7JDJXXDr5wqe1v5U+JvF6UW36PXO+ZA9c2Z8M6mzWjWMmijH4 c5f6NIh0A1W1Og+SU2pIQAHDrxScIO/Ezb2xFf/KG9z2fMUfhfmORLA9Q0ahhKKDrTGY PzdQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , open list , Rodrigo Vivi , Dariusz Marcinkiewicz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Dariusz Marcinkiewicz Signed-off-by: Hans Verkuil Tested-by: Hans Verkuil --- drivers/gpu/drm/i915/display/intel_hdmi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index b1ca8e5bdb56d..9fcf2c58c29c5 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -2752,8 +2752,9 @@ intel_hdmi_connector_register(struct drm_connector *connector) static void intel_hdmi_destroy(struct drm_connector *connector) { - if (intel_attached_hdmi(connector)->cec_notifier) - cec_notifier_put(intel_attached_hdmi(connector)->cec_notifier); + struct cec_notifier *n = intel_attached_hdmi(connector)->cec_notifier; + + cec_notifier_conn_unregister(n); intel_connector_destroy(connector); } @@ -3068,6 +3069,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, struct drm_device *dev = intel_encoder->base.dev; struct drm_i915_private *dev_priv = to_i915(dev); enum port port = intel_encoder->port; + struct cec_connector_info conn_info; DRM_DEBUG_KMS("Adding HDMI connector on port %c\n", port_name(port)); @@ -3120,8 +3122,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd); } - intel_hdmi->cec_notifier = cec_notifier_get_conn(dev->dev, - port_identifier(port)); + cec_fill_conn_info_from_drm(&conn_info, connector); + + intel_hdmi->cec_notifier = + cec_notifier_conn_register(dev->dev, port_identifier(port), + &conn_info); if (!intel_hdmi->cec_notifier) DRM_DEBUG_KMS("CEC notifier get failed\n"); } From patchwork Tue Aug 13 11:02:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CF00F1398 for ; Thu, 15 Aug 2019 08:36:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C198F2811A for ; Thu, 15 Aug 2019 08:36:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B50D32876B; Thu, 15 Aug 2019 08:36:44 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 66D582876B for ; Thu, 15 Aug 2019 08:36:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 40C026E8F6; Thu, 15 Aug 2019 08:35:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by gabe.freedesktop.org (Postfix) with ESMTPS id A77906E0EF for ; Tue, 13 Aug 2019 11:03:49 +0000 (UTC) Received: by mail-qt1-x84a.google.com with SMTP id 41so93679536qtm.4 for ; Tue, 13 Aug 2019 04:03:49 -0700 (PDT) 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=8XQAtQU5Jlu+LsGTeIXfkeaCQsZPIsgrkBYJbMGoesk=; b=JFe3WsyopcIZtTBiQtYHBao+Udp1c/OlBUm6fPMqutlTj4kOpePDizoAUvefzabg9q UfnO0F4FMd4uscV57szy4/TL5yxUJCT6KIA/CzBcz/jGrfzuSI/g5VkdamNkW7GhfMBr 8j3YTefAWs7NogSnIkSyPRj04tL4SWp5CHJNpVd7q7aU/IK0WPLNSDKpKvRDT2nhIRSY UgZYpDgwlr6SbMs/hTKSIqRiaLz5btCx/Fd5ylYWOoFmjb791T14xjqMOQWpOH11AW1j ZLh1VVqsEtuMMHcOPtL/4qBwPzVKh3AtrgsYuPSGNbh5Hg886rl0fva3N/1nrDK2wTT1 oFpQ== X-Gm-Message-State: APjAAAWkDmPYB+qVjkdLrH/e3cbzWpG9clGmmFK7E7KCGhq9r8lQ5RuR epVPc0Vn2AbdCfAsRUqAuox6syutSa73a81LL3yat6Wo6E4GZ+9qmcK4M/yg6CWegr6M52nQc35 61dIxDyg9EsZEXNu9NVJYnLPbGaYp2mFjeK6+T5vPmyVsXNfdgK982GJ+1VL8HvVc/03ftnbLAA == X-Google-Smtp-Source: APXvYqyDDzweTJoOpSrCJBhYFA2bPdcntFbwhRbcFvhSWKkyE6mKScSn8KJ6qn2GtAZSopDoFcKlju1Uov8= X-Received: by 2002:ae9:f812:: with SMTP id x18mr26524005qkh.290.1565694228612; Tue, 13 Aug 2019 04:03:48 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:34 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-3-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 2/8] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=8XQAtQU5Jlu+LsGTeIXfkeaCQsZPIsgrkBYJbMGoesk=; b=WONVccTIDftVGDULY91dHjvEzbQk3VhS9tlpsFUt/enibyOhbHo3b0DFcLewogMBDc xloAzgsKjOvC4JHqImA6XZqZ9jRNJ5EK4ZOiClT3bWa5BIHWdOsUPHw3sAG+6mNN+Wfu U8Abd4dxv6ucp2qlfEgK5xSyVYx2UF+yjDweJ+zWobe6kv0lykLYshfNTbDfIMe1Hfxn b+h7b0wcWnyH7KRBwS/M5bb+p26QB/Lh2KK1QgTroLTD2RlwxcRwJaSIJglkwTT8ESJp jRZAETsPoZjKR9LScyy1NPY89PdS90jvaEbg1HjVQGGD98Z3zzDrfnyPal6oeYj+jqDh +eyw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Jernej Skrabec , Jonas Karlman , David Airlie , Neil Armstrong , open list , Laurent Pinchart , Thomas Gleixner , Dariusz Marcinkiewicz , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use the new cec_notifier_cec_adap_(un)register() functions to (un)register the notifier for the CEC adapter. Also adds CEC_CAP_CONNECTOR_INFO capability to the adapter. Changes since v3: - add CEC_CAP_CONNECTOR_INFO to cec_allocate_adapter, - replace CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | CEC_CAP_RC | CEC_CAP_PASSTHROUGH with CEC_CAP_DEFAULTS. Signed-off-by: Dariusz Marcinkiewicz Signed-off-by: Hans Verkuil Tested-by: Hans Verkuil --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c index 0f949978d3fcd..ac1e001d08829 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c @@ -256,8 +256,8 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev) dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); cec->adap = cec_allocate_adapter(&dw_hdmi_cec_ops, cec, "dw_hdmi", - CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | - CEC_CAP_RC | CEC_CAP_PASSTHROUGH, + CEC_CAP_DEFAULTS | + CEC_CAP_CONNECTOR_INFO, CEC_MAX_LOG_ADDRS); if (IS_ERR(cec->adap)) return PTR_ERR(cec->adap); @@ -278,13 +278,14 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev) if (ret < 0) return ret; - cec->notify = cec_notifier_get(pdev->dev.parent); + cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent, + NULL, cec->adap); if (!cec->notify) return -ENOMEM; ret = cec_register_adapter(cec->adap, pdev->dev.parent); if (ret < 0) { - cec_notifier_put(cec->notify); + cec_notifier_cec_adap_unregister(cec->notify); return ret; } @@ -294,8 +295,6 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev) */ devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec); - cec_register_cec_notifier(cec->adap, cec->notify); - return 0; } @@ -303,8 +302,8 @@ static int dw_hdmi_cec_remove(struct platform_device *pdev) { struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); + cec_notifier_cec_adap_unregister(cec->notify); cec_unregister_adapter(cec->adap); - cec_notifier_put(cec->notify); return 0; } From patchwork Tue Aug 13 11:02:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B62171399 for ; Thu, 15 Aug 2019 08:37:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6CE12811A for ; Thu, 15 Aug 2019 08:37:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B5382884A; Thu, 15 Aug 2019 08:37:52 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 573852811A for ; Thu, 15 Aug 2019 08:37:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 054766E947; Thu, 15 Aug 2019 08:35:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc49.google.com (mail-yw1-xc49.google.com [IPv6:2607:f8b0:4864:20::c49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74E7F89CD5 for ; Tue, 13 Aug 2019 11:03:55 +0000 (UTC) Received: by mail-yw1-xc49.google.com with SMTP id b195so79030306ywa.16 for ; Tue, 13 Aug 2019 04:03:55 -0700 (PDT) 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=rNr4ZPVQiRY9460rK+p/RjWfP2XiBB6EuRKjHiRo/qQ=; b=Ydo4nyZdAN5hfEVDl+uvb2BD4mBXyQ/ZLiC0SA4r7SgT9eMeXyHHGuyyOkyLWnFyxr P7kJmL7ZVgUG3BCpr7irwpEYrsu0CR7CFVCU7lZP1GOI0mT0fmDQKutSbLvdpRpRPVGI 4rJVHLcS2jGAQXEhFEDMBhjJA215imuvDnlwc9tbn/fV8Z3I0S6T6/jnZ/awUGvluPX2 Lug46BC+PnzqHV6zyUITTDL2XgmvbAP8MN698rCc4a1Mmg699ZgSI6/28EqZcfAiGBfW dduWa4M50sMhmVSahuBjjtoJ2fHfDoGzkTI/ry+FK47XFZXOLzM31L8k6rCO69XSiawG m/iQ== X-Gm-Message-State: APjAAAX0uUh2LkMj7DKuf31zMdPfKvOg9+nbCCqn9/ExWwI5f2LUxL7S zuj38hVjUYg4IZ5Yxqxq7CWKhPaFeYzmOxfDGv4KouUuV59AhNsgo0/LMIBEd4O+CQBvaIOuvDH ooDkODyGxr/1rO2XNpjjigzAqgZW2OIrU4aDcT6MJw/fkYv2aKcojWeEcsI+9fd8TMQSXV+Iuiw == X-Google-Smtp-Source: APXvYqzy3zyQSUtSJVRsXoVnBQExctrAHwWmKhG2weYA8xtqjiHkmA3bvc5GEwy/WQBRR+/id9TXLsPcW2M= X-Received: by 2002:a81:9a93:: with SMTP id r141mr23669458ywg.469.1565694234480; Tue, 13 Aug 2019 04:03:54 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:35 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-4-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 3/8] tda9950: use cec_notifier_cec_adap_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=rNr4ZPVQiRY9460rK+p/RjWfP2XiBB6EuRKjHiRo/qQ=; b=NB+nNxe2i9JPeP5p/K3KwWw72d/gd1uAP87BwA5SC2DlTXUqmewM1VyxSaR/9zpTfX 7252HzgBSDCjnVqh52se43BMYdzuatZhL6hR56buIzY9Jz8wwkNXPWsdY/AoFp5c/BYo VfR7yjbue1o7BScHyYP/bEXF14+ByQOpyog/7bcoebzAU9mb66yCwNTn1me8pPEHrtOT f9suboV6sUrFWc3rm1bUAmvUNDJ4A4u60KC5LeWvHRCfYH8XrUpH4LeN4tvLbSu0qLw1 bj3x4VBU070oy/BglfWGr4XnP43adYy7D+bKnt2eu9kc7X2ZCvwouORwwAN5eqIsGDl2 LNOA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Kees Cook , David Airlie , open list , Hans Verkuil , Russell King , Colin Ian King , Thomas Gleixner , Dariusz Marcinkiewicz , Allison Randal Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use the new cec_notifier_cec_adap_(un)register() functions to (un)register the notifier for the CEC adapter. Signed-off-by: Dariusz Marcinkiewicz Signed-off-by: Hans Verkuil Tested-by: Hans Verkuil --- drivers/gpu/drm/i2c/tda9950.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c index 8039fc0d83db4..a5a75bdeb7a5f 100644 --- a/drivers/gpu/drm/i2c/tda9950.c +++ b/drivers/gpu/drm/i2c/tda9950.c @@ -420,7 +420,8 @@ static int tda9950_probe(struct i2c_client *client, priv->hdmi = glue->parent; priv->adap = cec_allocate_adapter(&tda9950_cec_ops, priv, "tda9950", - CEC_CAP_DEFAULTS, + CEC_CAP_DEFAULTS | + CEC_CAP_CONNECTOR_INFO, CEC_MAX_LOG_ADDRS); if (IS_ERR(priv->adap)) return PTR_ERR(priv->adap); @@ -457,13 +458,14 @@ static int tda9950_probe(struct i2c_client *client, if (ret < 0) return ret; - priv->notify = cec_notifier_get(priv->hdmi); + priv->notify = cec_notifier_cec_adap_register(priv->hdmi, NULL, + priv->adap); if (!priv->notify) return -ENOMEM; ret = cec_register_adapter(priv->adap, priv->hdmi); if (ret < 0) { - cec_notifier_put(priv->notify); + cec_notifier_cec_adap_unregister(priv->notify); return ret; } @@ -473,8 +475,6 @@ static int tda9950_probe(struct i2c_client *client, */ devm_remove_action(dev, tda9950_cec_del, priv); - cec_register_cec_notifier(priv->adap, priv->notify); - return 0; } @@ -482,8 +482,8 @@ static int tda9950_remove(struct i2c_client *client) { struct tda9950_priv *priv = i2c_get_clientdata(client); + cec_notifier_cec_adap_unregister(priv->notify); cec_unregister_adapter(priv->adap); - cec_notifier_put(priv->notify); return 0; } From patchwork Tue Aug 13 11:02:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE5751398 for ; Thu, 15 Aug 2019 08:35:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E005271FD for ; Thu, 15 Aug 2019 08:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92A3A2884A; Thu, 15 Aug 2019 08:35:29 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 42B8C271FD for ; Thu, 15 Aug 2019 08:35:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35DF16E8DA; Thu, 15 Aug 2019 08:34:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x74a.google.com (mail-qk1-x74a.google.com [IPv6:2607:f8b0:4864:20::74a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F82389CD5 for ; Tue, 13 Aug 2019 11:03:59 +0000 (UTC) Received: by mail-qk1-x74a.google.com with SMTP id g125so8572049qkd.7 for ; Tue, 13 Aug 2019 04:03:59 -0700 (PDT) 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=6ulPqZWHu3buhcEJ9W+gaYDffj1X2raN/hmc1DXKRc0=; b=C1mTTMcGjeRK6RutAIm/fsU015AW3mhBCNOa82Dr0tgxBxF5pB0oTzLdR+lOu3HDAH XPQoi91J/6wix49W/E+ZxAKdT1XzwigbvKl50QpKPIEsiFFpcBz2xsGaQM/Oq5SkirD1 FDdA55P3yqMlKt12pUjk4jhiQ2FibypOvC6XWCwnQxXlqHqGiEONNgnypL2q3FjFPlii lzESRQHPt6ElsQp5zC6JBSD4DwKJ+Q7B0NbB7uS0EHIEsQQyccJALcyQnfp+bRt9vfAB /juNe6OEZbtbITJ2Dlfb6Tf78gyu4xyGQ+QMzQlJT/qEP5dkyzSQbABO11UgQu5hkQKw wniA== X-Gm-Message-State: APjAAAXLrgETprFrvP3raGkQ8TYsYxfjBHHeHuRIiq8rUhd6f2VvWBA/ C8/FgipHXQGyNwnNunIcmoSt0LkhYTImRp/kcr2tkzvQ7qv3lpEbEsNyMHbN7oBxXK5Utv43fEk kbSXvuT0C0uNOGsgBR7YG+k589mxg0RcL1bMsh8LaV4zHPwiBG7XNZBNuJnpdu0P25xwDjlvySg == X-Google-Smtp-Source: APXvYqzOEdfJlhU1SPtyfEAHwdXZr+UgnOS/BqJFVj/N8D9Hp9/fP0qqBoTZWcRHPQw91l6QDOyw/B0nzXU= X-Received: by 2002:ae9:df84:: with SMTP id t126mr30585905qkf.328.1565694238500; Tue, 13 Aug 2019 04:03:58 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:36 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-5-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 4/8] drm: tda998x: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=6ulPqZWHu3buhcEJ9W+gaYDffj1X2raN/hmc1DXKRc0=; b=Ttc66cpbZ8f6IDLo5P+0wVxpvOL4SKVLSiOw7YHwSn/XuZU+OLaUtGoHRCorWkaat1 wHSH5LO9HUkbMelvZJAXTbIIKxlRuRGofTbc+1J1foxEeRj2qI4qwLsJ+rvqQnKOUhlh esxHHm3r1yTSn5NKYWJdmluPi4/GbmoggxvsZJ7FmgW3kcTO4WzXH1zjYAljxfoSQqWJ 0dwdWp+SksTGppNbhvwfEOHUPhbusR4sTcuYUCqyACzHhfGvzundOvP5iG7h3CHvfoWe C19TChEbFAxO0/uUA6NZOpJaJi5Dv54wbOd7YlTIWGPp/pAG/vYiwfnT1a1T5Oq173Mk v5pQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Dariusz Marcinkiewicz , Russell King , open list Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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: - cec_notifier_phys_addr_invalidate where appropriate, - don't check for NULL notifier before calling cec_notifier_conn_unregister. Changes since v1: Add memory barrier to make sure that the notifier becomes visible to the irq thread once it is fully constructed. Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/i2c/tda998x_drv.c | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 61e042918a7fc..19a63ee1b3f53 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -804,9 +804,14 @@ static irqreturn_t tda998x_irq_thread(int irq, void *data) if (lvl & CEC_RXSHPDLEV_HPD) { tda998x_edid_delay_start(priv); } else { + struct cec_notifier *notify; + schedule_work(&priv->detect_work); - cec_notifier_set_phys_addr(priv->cec_notify, - CEC_PHYS_ADDR_INVALID); + + notify = READ_ONCE(priv->cec_notify); + if (notify) + cec_notifier_phys_addr_invalidate( + notify); } handled = true; @@ -1331,6 +1336,8 @@ static int tda998x_connector_init(struct tda998x_priv *priv, struct drm_device *drm) { struct drm_connector *connector = &priv->connector; + struct cec_connector_info conn_info; + struct cec_notifier *notifier; int ret; connector->interlace_allowed = 1; @@ -1347,6 +1354,19 @@ static int tda998x_connector_init(struct tda998x_priv *priv, if (ret) return ret; + cec_fill_conn_info_from_drm(&conn_info, connector); + + notifier = cec_notifier_conn_register(priv->cec_glue.parent, + NULL, &conn_info); + if (!notifier) + return -ENOMEM; + /* + * Make sure that tda998x_irq_thread does see the notifier + * when it fully constructed. + */ + smp_wmb(); + priv->cec_notify = notifier; + drm_connector_attach_encoder(&priv->connector, priv->bridge.encoder); @@ -1790,8 +1810,7 @@ static void tda998x_destroy(struct device *dev) i2c_unregister_device(priv->cec); - if (priv->cec_notify) - cec_notifier_put(priv->cec_notify); + cec_notifier_conn_unregister(priv->cec_notify); } static int tda998x_create(struct device *dev) @@ -1916,12 +1935,6 @@ static int tda998x_create(struct device *dev) cec_write(priv, REG_CEC_RXSHPDINTENA, CEC_RXSHPDLEV_HPD); } - priv->cec_notify = cec_notifier_get(dev); - if (!priv->cec_notify) { - ret = -ENOMEM; - goto fail; - } - priv->cec_glue.parent = dev; priv->cec_glue.data = priv; priv->cec_glue.init = tda998x_cec_hook_init; From patchwork Tue Aug 13 11:02:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 042941398 for ; Thu, 15 Aug 2019 08:37:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA6CA2811A for ; Thu, 15 Aug 2019 08:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBE512884A; Thu, 15 Aug 2019 08:37:07 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 940DC2811A for ; Thu, 15 Aug 2019 08:37:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B85CA6E90D; Thu, 15 Aug 2019 08:35:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by gabe.freedesktop.org (Postfix) with ESMTPS id 45BDA6E0EF for ; Tue, 13 Aug 2019 11:04:03 +0000 (UTC) Received: by mail-qt1-x849.google.com with SMTP id j10so17266164qtl.23 for ; Tue, 13 Aug 2019 04:04:03 -0700 (PDT) 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=ip9lF/U/ATkDBCN52xa8MDYElKkFg+n6UubAPvcwdoQ=; b=PoJI795HY0e7Y/7ZcND+gayOjzC9ZZ0UJ/ScILWe5RAQOLyiDNtITRjXcn+ROk2yJ2 mmh/WmV6CxrVSgmiruRkVt01nfyEhUgQ1uMnFhkgMAZ94actj9QiEPCa64XGHX72rmbs FOSA12C6IS4jOe5XW6FgiDYxyiRBbkT5JN0tTen58+fDfwrJyu9ISl78QbEAQGOxmH7T G28wy1PsdPwhiNXezlG7+ER+q6vCS7k0D6vYwH8NOqpH0YuzIfU/4JKpTkrhFGLmYoMi aRaGvG8ElInSfsErZVKLuBU0sjO8kegCfXsXyRtL4OhkFmYCvCL/hoXwBIq51wniFTSW XvMA== X-Gm-Message-State: APjAAAU880diCghohhqfzhymm/jHADiLoUalZ/oiAYFFT9hlrM9SIB1D nKlcyjpzL6VXCBrCgPmFBv6Ubm8+kNPcbl3eBwZgi5BDdl/JfITDbrVXb9MyC52cOAiPV1TJWuk NzLziI0txh8DQKHudvT0UPhijtF3grb0m4wJlXqqRGMP1+K+oWRavzv8jfdNU2wP5eitNeTG5CQ == X-Google-Smtp-Source: APXvYqysSUrmxH++r5MmUXV4gWwiLxUMWPgS8nugFZzvIugrQ9MfQDgywxdIlcVe+Xz2GFVznywfU+Ysfvs= X-Received: by 2002:ac8:6105:: with SMTP id a5mr15179523qtm.285.1565694242255; Tue, 13 Aug 2019 04:04:02 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:37 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-6-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 5/8] drm: sti: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=ip9lF/U/ATkDBCN52xa8MDYElKkFg+n6UubAPvcwdoQ=; b=L8MnBJ66KutyhXM1pVJve1tTkI9eCP1J5jPB3Zz1KokSDUH6mh59HIERL2XGmcVUPr 3WrIC6I9g5N127W9P+9Rp5VuHoeaKnvsC+8o341cSsS2xtEvgkrarWZA8QbeVAOjMGe1 liVA/FbdyxZivqYi7Yr+irg6HA4OxJeMf/IF0alLg66zc6sUjvufCQCkDO3FCvv2e4Zv 3SHnX+IE4HMfr4asT3FCECTYCwZKb0b2SKzJ3if+MCbZXG6GvmwgU3l8ogIEl6tkipYu e7wOP85XCH2b5SpFdqb7dERv+2Zz6z1h5BRtL99ey4tkpST978h96jVyK5Chw7JsPAFd Yfpw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , open list , Dariusz Marcinkiewicz , Vincent Abriou Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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: Don't invalidate physical address before unregistering the notifier. Signed-off-by: Dariusz Marcinkiewicz --- drivers/gpu/drm/sti/sti_hdmi.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 9862c322f0c4a..bd15902b825ad 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1256,6 +1256,7 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; struct drm_encoder *encoder; struct sti_hdmi_connector *connector; + struct cec_connector_info conn_info; struct drm_connector *drm_connector; struct drm_bridge *bridge; int err; @@ -1318,6 +1319,14 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) goto err_sysfs; } + cec_fill_conn_info_from_drm(&conn_info, drm_connector); + hdmi->notifier = cec_notifier_conn_register(&hdmi->dev, NULL, + &conn_info); + if (!hdmi->notifier) { + hdmi->drm_connector = NULL; + return -ENOMEM; + } + /* Enable default interrupts */ hdmi_write(hdmi, HDMI_DEFAULT_INT, HDMI_INT_EN); @@ -1331,6 +1340,9 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) static void sti_hdmi_unbind(struct device *dev, struct device *master, void *data) { + struct sti_hdmi *hdmi = dev_get_drvdata(dev); + + cec_notifier_conn_unregister(hdmi->notifier); } static const struct component_ops sti_hdmi_ops = { @@ -1436,10 +1448,6 @@ static int sti_hdmi_probe(struct platform_device *pdev) goto release_adapter; } - hdmi->notifier = cec_notifier_get(&pdev->dev); - if (!hdmi->notifier) - goto release_adapter; - hdmi->reset = devm_reset_control_get(dev, "hdmi"); /* Take hdmi out of reset */ if (!IS_ERR(hdmi->reset)) @@ -1459,14 +1467,11 @@ static int sti_hdmi_remove(struct platform_device *pdev) { struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); - cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID); - i2c_put_adapter(hdmi->ddc_adapt); if (hdmi->audio_pdev) platform_device_unregister(hdmi->audio_pdev); component_del(&pdev->dev, &sti_hdmi_ops); - cec_notifier_put(hdmi->notifier); return 0; } From patchwork Tue Aug 13 11:02:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D95C01399 for ; Thu, 15 Aug 2019 08:36:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9AE92811A for ; Thu, 15 Aug 2019 08:36:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE2FA28842; Thu, 15 Aug 2019 08:36:37 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 68BF52811A for ; Thu, 15 Aug 2019 08:36:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF3276E93C; Thu, 15 Aug 2019 08:35:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk1-xa4a.google.com (mail-vk1-xa4a.google.com [IPv6:2607:f8b0:4864:20::a4a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DD336E0F2 for ; Tue, 13 Aug 2019 11:04:07 +0000 (UTC) Received: by mail-vk1-xa4a.google.com with SMTP id l186so45501323vke.19 for ; Tue, 13 Aug 2019 04:04:07 -0700 (PDT) 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=saq5XDceOIgoGr9TXKhDgKirX3SqKoE0qoHBi968/xk=; b=cLLJxmExIbWn+lYfaYcmOwgJSpomUDRiEIeJ1YKzEcCN93ESc7Fpg0DIyPVkXr+V8x 1NoU/Pc6N/2zOZSZvNKpfJ4+wlVJwZYjrBaR6xGCS7qyQFYKxY6dNjeBIj6RyqNNOthp mxKBPhXFsAFUCwPPtBNJbCbd6ue2SmLxdP+jHT0vggkPqgggYDFm17dXkS0cH6S5EmX6 luz1LX3Eo1sTraXQ3lH7/MkGkSoOKnEvkgpupAMCBC9NGofCZPhPr0vtjbqJHVqDrkws qJAdMxWpEwHFeHUb0U04rEOHIOxyOHOzZXs8bXJ4aqfB2NnJIWTr1aV133M69TptqEOM Cqyg== X-Gm-Message-State: APjAAAUJG21lQrpwf1x5NE/+xOYEKLSlygwpx3ZPIr3r35OlcHVI8tPq 7uQPv+rGe7vNQCylvEqqr7l4wjS/UN15aCUbxbfphJAqioVdI410kyZacKtkRMJUAZsWx66JUci o24EBa8jG+lkJSt94IkcNf9V4Ob/qzzjbxfpFhc6s5wIivJF+izCl8c/aV1oFqwUW8xtrwzOEJw == X-Google-Smtp-Source: APXvYqyRU0LZVcPWtHHZrERKAl27mwogAt6+FnB4yxVhw/aK7Ob1F1wrsG/rm4k4QQRTeI1EszqJIbqVp0I= X-Received: by 2002:a67:fa44:: with SMTP id j4mr10655278vsq.138.1565694246217; Tue, 13 Aug 2019 04:04:06 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:38 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-7-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 6/8] drm: tegra: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=saq5XDceOIgoGr9TXKhDgKirX3SqKoE0qoHBi968/xk=; b=gDO1KkDTJUciiu/w2pWa46oNOHB2NW+diPTrQSe6UjOmk/n2EoRpy+rDWdBYJuiKzY 6x6LgDF5KDKyv9VXmseeyAu3LhFkBOtjkbVjLcCMTQsulzf1fQZYMwK97ErqMxCmCX3D S7EApgu5kjDAFza//vwbwwa1Gk59twIlmD1KY7DRHQFJrGUzS5zFJe0CbCc0GIqHF4io VFLPmmZnVQfYKNtjAbG8Evu6bf3DyEGgeEqB45NKR7BoQ3ILZ+L7a3sdX45sWfvGO1sY XSFc2NiIuWZftfLGRjyOg7nh1+UFJBut3iAOv4jzfoc8SYbt4t+/WIT5Jms6mAK+9E0I NTQA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , open list , Jonathan Hunter , Thierry Reding , "open list:DRM DRIVERS FOR NVIDIA TEGRA" , Dariusz Marcinkiewicz Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 v4: - only create a CEC notifier for HDMI connectors Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index bdcaa4c7168cf..34373734ff689 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -70,6 +70,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) void tegra_output_connector_destroy(struct drm_connector *connector) { + struct tegra_output *output = connector_to_output(connector); + + if (output->cec) + cec_notifier_conn_unregister(output->cec); + drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -163,18 +168,11 @@ int tegra_output_probe(struct tegra_output *output) disable_irq(output->hpd_irq); } - output->cec = cec_notifier_get(output->dev); - if (!output->cec) - return -ENOMEM; - return 0; } void tegra_output_remove(struct tegra_output *output) { - if (output->cec) - cec_notifier_put(output->cec); - if (output->hpd_gpio) free_irq(output->hpd_irq, output); @@ -184,6 +182,7 @@ void tegra_output_remove(struct tegra_output *output) int tegra_output_init(struct drm_device *drm, struct tegra_output *output) { + int connector_type; int err; if (output->panel) { @@ -199,6 +198,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) if (output->hpd_gpio) enable_irq(output->hpd_irq); + connector_type = output->connector.connector_type; + /* + * Create a CEC notifier for HDMI connector. + */ + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || + connector_type == DRM_MODE_CONNECTOR_HDMIB) { + struct cec_connector_info conn_info; + + cec_fill_conn_info_from_drm(&conn_info, &output->connector); + output->cec = cec_notifier_conn_register(output->dev, NULL, + &conn_info); + if (!output->cec) + return -ENOMEM; + } + return 0; } From patchwork Tue Aug 13 11:02:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 906871399 for ; Thu, 15 Aug 2019 08:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 822AA2811A for ; Thu, 15 Aug 2019 08:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 766442864B; Thu, 15 Aug 2019 08:35:48 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 1C4C32811A for ; Thu, 15 Aug 2019 08:35:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 942676E8E5; Thu, 15 Aug 2019 08:34:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vk1-xa4a.google.com (mail-vk1-xa4a.google.com [IPv6:2607:f8b0:4864:20::a4a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 225CC6E0EF for ; Tue, 13 Aug 2019 11:04:13 +0000 (UTC) Received: by mail-vk1-xa4a.google.com with SMTP id w185so27600vka.20 for ; Tue, 13 Aug 2019 04:04:13 -0700 (PDT) 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=7PGacRYXVFsNBUaK9AFFTq+0n3dK1YSXmAGYlruF6gc=; b=aYDRcepPB1DlXrbZQ0PYXIJQm0WjMp3HIuBisAYaZpXET8cocwNNi/lrBMVFkhyShA ukCVUNJu2Qg9nX7/zHtWuELHW6cZPVlpS5WpzyutWUVljYqafMZFg5utnBChJ0zRKTMn 3OzKuNdekjGFMFE98t6i0zFhwdrMlOCK6wiAwm0nVgSZVNDvUZ25wuk4Kt2AZElgPVBj 7AX0t4/bpNL7g2jVW7YjJ4JAr+b1o71jmxU+AVBXr56My4vYvZz9VWlUmVPyGac3f6Hz 6/ZD04fM7J7mQZAXaJQkh2yz4ypwcpYf1fxL0pOcxnFhxz+Bv64X1AXmQcv0z81IVwfr yguA== X-Gm-Message-State: APjAAAVA1E5UNAuRiMR+xvP13E1ydiyCnzLFscC2XxsX6kOowNLVO67x yE+0JNx9r0Lnh9ICJqjPIquusmke69zJopex+lmSVNkQmcfeMcnRaprFIn68suPL2J6haj6b+bg B3pcBwX09mj8BfuN0w0H1EYJCO5VmYkTc8rLzsYwftIBbwuKgIZb3pZN3peN3ekSmNXqRFBzH9A == X-Google-Smtp-Source: APXvYqyeQaoLuHS4lwvUuncTOZ0+P8t2+0nXHV4RbzHYhLOmVe7Ku4FbTLBE7VGYoUn20Yyj7SW3SjzIXg0= X-Received: by 2002:a9f:326e:: with SMTP id y43mr1637980uad.4.1565694251963; Tue, 13 Aug 2019 04:04:11 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:39 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-8-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 7/8] drm: dw-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 X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=7PGacRYXVFsNBUaK9AFFTq+0n3dK1YSXmAGYlruF6gc=; b=kmTjua/WpkiMq8nHLEd+LjG0YWASE8dJy8v8DnjnQqJTFv/ip1x0XgtkDMWpTTy6Vu JmjhuBtQZS0wboasCWyAFpMs/HYXk/5ypvK2xWr699mfV4KLxHyTTFpc5NLRaAUy9ZVb 09xFUN1d6+7JVLTL3TNM61eV33vnagLykDXXqMYp5hZ9kAOIchcfYZrpWsOdlXhDuEQf c4h6mkc1dUIB5OGoj6KQwqsRvSIXlTHimed7bvYENAz0v8az7SbA0Cf6TN9dh+X6+99l BzUQPyJV3qYFSbIPsuKMoq2LWYrn0SlY+qhBTtKxpUmnPjjPdUEWi6cu5zm7ql1p9oEX AwPg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Jonas Karlman , David Airlie , Neil Armstrong , Douglas Anderson , open list , Laurent Pinchart , Dariusz Marcinkiewicz , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 v4: - typo fix Changes since v2: - removed unnecessary NULL check before a call to cec_notifier_conn_unregister, - use cec_notifier_phys_addr_invalidate to invalidate physical address. Changes since v1: Add memory barrier to make sure that the notifier becomes visible to the irq thread once it is fully constructed. Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 36 ++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 83b94b66e464e..c00184700bb9d 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2194,6 +2194,8 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) struct dw_hdmi *hdmi = bridge->driver_private; struct drm_encoder *encoder = bridge->encoder; struct drm_connector *connector = &hdmi->connector; + struct cec_connector_info conn_info; + struct cec_notifier *notifier; connector->interlace_allowed = 1; connector->polled = DRM_CONNECTOR_POLL_HPD; @@ -2207,6 +2209,18 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) drm_connector_attach_encoder(connector, encoder); + cec_fill_conn_info_from_drm(&conn_info, connector); + + notifier = cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); + if (!notifier) + return -ENOMEM; + /* + * Make sure that dw_hdmi_irq thread does see the notifier + * when it fully constructed. + */ + smp_wmb(); + hdmi->cec_notifier = notifier; + return 0; } @@ -2373,9 +2387,13 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) phy_stat & HDMI_PHY_HPD, phy_stat & HDMI_PHY_RX_SENSE); - if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) - cec_notifier_set_phys_addr(hdmi->cec_notifier, - CEC_PHYS_ADDR_INVALID); + if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) { + struct cec_notifier *notifier; + + notifier = READ_ONCE(hdmi->cec_notifier); + if (notifier) + cec_notifier_phys_addr_invalidate(notifier); + } } if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { @@ -2693,12 +2711,6 @@ __dw_hdmi_probe(struct platform_device *pdev, if (ret) goto err_iahb; - hdmi->cec_notifier = cec_notifier_get(dev); - if (!hdmi->cec_notifier) { - ret = -ENOMEM; - goto err_iahb; - } - /* * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator * N and cts values before enabling phy @@ -2796,9 +2808,6 @@ __dw_hdmi_probe(struct platform_device *pdev, hdmi->ddc = NULL; } - if (hdmi->cec_notifier) - cec_notifier_put(hdmi->cec_notifier); - clk_disable_unprepare(hdmi->iahb_clk); if (hdmi->cec_clk) clk_disable_unprepare(hdmi->cec_clk); @@ -2820,8 +2829,7 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) /* Disable all interrupts */ hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); - if (hdmi->cec_notifier) - cec_notifier_put(hdmi->cec_notifier); + cec_notifier_conn_unregister(hdmi->cec_notifier); clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->isfr_clk); From patchwork Tue Aug 13 11:02:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52F3E1399 for ; Thu, 15 Aug 2019 08:37:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 436512811A for ; Thu, 15 Aug 2019 08:37:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37F3B2884A; Thu, 15 Aug 2019 08:37:13 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,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 D543E2811A for ; Thu, 15 Aug 2019 08:37:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51EA76E91F; Thu, 15 Aug 2019 08:35:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by gabe.freedesktop.org (Postfix) with ESMTPS id E16986E0F2 for ; Tue, 13 Aug 2019 11:04:16 +0000 (UTC) Received: by mail-pg1-x549.google.com with SMTP id l12so19605943pgt.9 for ; Tue, 13 Aug 2019 04:04:16 -0700 (PDT) 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=DW+e16hliXTCzR8MZaVzRj5LLvYJMMc9NFN23d1+21cJtVqoP3Q2qKT67VNT2/rYP1 XUz6fUY3q/Ksdb+Z7PkrySw8ejb21TidC70f6BaChKmNgJYRFzsidcsN9SmLSm/d/gW0 m1QLWaeX1IpgaIwG5K06yniUJ60k4Rgn6Nh519bT46kOkOiVJYL7HyHnflewdcaL1JSb M8yIxbDjidqsKyEf/GJTfjLNBk692YTgW/u2ChIpvpSfCm+QVWblnppTs1Sfrq9p2h6O 2P+Ew0+IpZaCXisByX7a3zhPfgMKZ6/a3HzrtPFNfOlNpqiYpl7a6ZPDRpSQY54kOz9l JMgQ== X-Gm-Message-State: APjAAAXGFtDutaaNa8Sf/d2v685ZPuj4QB1CpObznjWSkGJf1+6/dM5Y u+2kbdUUxrvaJiug8gAOcmUdoJPgGShKpFwhrmdCzFnLrgct075l3bcs96E9HO77C758esbqPeX MZ+avEFuStq1TKmJmAjmwVmhdyYpVKI3hcklHtoND0qD+en0yGExAARpq6DCxEDFB+l0MCRLhyA == 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 X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES" , David Airlie , Seung-Woo Kim , open list , Krzysztof Kozlowski , Kyungmin Park , Kukjin Kim , Dariusz Marcinkiewicz , "moderated list:ARM/SAMSUNG EXYNOS ARM ARCHITECTURES" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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))