From patchwork Tue Jul 16 07:58:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045435 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 3356A746 for ; Tue, 16 Jul 2019 07:58:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24933285A9 for ; Tue, 16 Jul 2019 07:58:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17561285AA; Tue, 16 Jul 2019 07:58:43 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A83827D0E for ; Tue, 16 Jul 2019 07:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbfGPH6l (ORCPT ); Tue, 16 Jul 2019 03:58:41 -0400 Received: from mail-yb1-f201.google.com ([209.85.219.201]:50416 "EHLO mail-yb1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfGPH6l (ORCPT ); Tue, 16 Jul 2019 03:58:41 -0400 Received: by mail-yb1-f201.google.com with SMTP id p20so15758912yba.17 for ; Tue, 16 Jul 2019 00:58:41 -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=/ga3Schijqq2Ba7rsbCfWfT7iT+jVVIxe06gLHk3exg=; b=hiqhUe6RBFTteTDvgKQLGnbDGOjJjtkbWoKQc+cqG9CU8103xW+ME61fdiUcUfMCt0 B3yOxK0MidhmiUkzrJEAdrMOirRBoxHKsHIA++e+pTJ4FI6KhV8m7hQat9EE1V/YH9uy YaP7bieZV+tw31YmDsTK20JWg83f1wNPTJ5/BDoRaeNyA/u9zfEzSX10UeyJKgbaHQ4R UCuxxKYf5r1wzN6JH2aQHnDLUW6Re42cEDpGxyB42rVa2ZpwnZA14qDwXUxNHgwJ46Ub 56csbDKQCnGdF3Zr9Nl0PDK89uCgu6n22VletKGSCnRnFErePo0uxCauCWYnJpg2Y+6q wT5Q== 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=/ga3Schijqq2Ba7rsbCfWfT7iT+jVVIxe06gLHk3exg=; b=s0LrkBVu/QwBfNbLL+DyO/FujXw0IUsIMAUZhrc+uZmAZi/ozFrZLZWBSPjDgioH03 w6aukolgiv5p+3Z0/L1fpeQqVDUREAXB8dmUF2Z7Ur6c4k9/LtxDxrAs9eWW/34ea7Si t9oq628VcFpWtm9TmwKk7Rloe5O204FEPlbCz812ZdYwNisXmneWtgExsz9KQ4jMzOTY 4sbj7Z7WGZ3f8VjnWa/dY7ivqfZZsMsUsLQcG8tEvb9CbYeTydod4I9Zuj9rQmKdc0P1 hpryfbTRArD6aYannxvVHvFDjvL7pofy5q0Q/BIaZNXw6WusBQgQ+OGvQJ937olMXKkz dTtQ== X-Gm-Message-State: APjAAAXwZTrLNdLDQ/lAYhiASxtuIn8y52MvmsI5gtAO2H+Dhs67NbR2 6GQ52zaxG2T3H4qsXHY+mSnKvTPTK49li/LpRFghznoFaOG2qvGPZXg+Es+jZKkRyKIDdBYyC4D nFLBPEU1EkZbt8flNYMkM3galKc+2vkT6UrqNqlMluven5L6KAWp3cjXBgu8CwYgGuX7m X-Google-Smtp-Source: APXvYqxdC4f59+re/DOpRdnaas8T5VUeCqkpH/LvcAxi25C3CAk7J4GNY37SWoIFU+hmdtvaRwWcukdl7Nw= X-Received: by 2002:a81:37c7:: with SMTP id e190mr18099595ywa.144.1563263920475; Tue, 16 Jul 2019 00:58:40 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:12 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-2-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 1/9] drm_dp_cec: add connector info support. From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pass the connector info to the CEC adapter. This makes it possible to associate the CEC adapter with the corresponding drm connector. Signed-off-by: Dariusz Marcinkiewicz Signed-off-by: Hans Verkuil --- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- drivers/gpu/drm/drm_dp_cec.c | 25 ++++++++++++------- drivers/gpu/drm/i915/intel_dp.c | 4 +-- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +-- include/drm/drm_dp_helper.h | 14 +++++------ 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 6e205ee36ac3b..7f2eb4eb1035b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -394,7 +394,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm, drm_dp_aux_register(&aconnector->dm_dp_aux.aux); drm_dp_cec_register_connector(&aconnector->dm_dp_aux.aux, - aconnector->base.name, dm->adev->dev); + &aconnector->base); aconnector->mst_mgr.cbs = &dm_mst_cbs; drm_dp_mst_topology_mgr_init( &aconnector->mst_mgr, diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c index b15cee85b702b..b457c16c3a8bb 100644 --- a/drivers/gpu/drm/drm_dp_cec.c +++ b/drivers/gpu/drm/drm_dp_cec.c @@ -8,7 +8,9 @@ #include #include #include +#include #include +#include #include /* @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct work_struct *work) */ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) { - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD; + struct drm_connector *connector = aux->cec.connector; + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD | + CEC_CAP_CONNECTOR_INFO; + struct cec_connector_info conn_info; unsigned int num_las = 1; u8 cap; @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) /* Create a new adapter */ aux->cec.adap = cec_allocate_adapter(&drm_dp_cec_adap_ops, - aux, aux->cec.name, cec_caps, + aux, connector->name, cec_caps, num_las); if (IS_ERR(aux->cec.adap)) { aux->cec.adap = NULL; goto unlock; } - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) { + + cec_fill_conn_info_from_drm(&conn_info, connector); + cec_s_conn_info(aux->cec.adap, &conn_info); + + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { cec_delete_adapter(aux->cec.adap); aux->cec.adap = NULL; } else { @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid); /** * drm_dp_cec_register_connector() - register a new connector * @aux: DisplayPort AUX channel - * @name: name of the CEC device - * @parent: parent device + * @connector: drm connector * * A new connector was registered with associated CEC adapter name and * CEC adapter parent device. After registering the name and parent * drm_dp_cec_set_edid() is called to check if the connector supports * CEC and to register a CEC adapter if that is the case. */ -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, - struct device *parent) +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, + struct drm_connector *connector) { WARN_ON(aux->cec.adap); if (WARN_ON(!aux->transfer)) return; - aux->cec.name = name; - aux->cec.parent = parent; + aux->cec.connector = connector; INIT_DELAYED_WORK(&aux->cec.unregister_work, drm_dp_cec_unregister_work); } diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4336df46fe782..79c8afdbc4869 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -5693,7 +5693,6 @@ static int intel_dp_connector_register(struct drm_connector *connector) { struct intel_dp *intel_dp = intel_attached_dp(connector); - struct drm_device *dev = connector->dev; int ret; ret = intel_connector_register(connector); @@ -5708,8 +5707,7 @@ intel_dp_connector_register(struct drm_connector *connector) intel_dp->aux.dev = connector->kdev; ret = drm_dp_aux_register(&intel_dp->aux); if (!ret) - drm_dp_cec_register_connector(&intel_dp->aux, - connector->name, dev->dev); + drm_dp_cec_register_connector(&intel_dp->aux, connector); return ret; } diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 4116ee62adafe..4438824ca88b0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1413,8 +1413,7 @@ nouveau_connector_create(struct drm_device *dev, switch (type) { case DRM_MODE_CONNECTOR_DisplayPort: case DRM_MODE_CONNECTOR_eDP: - drm_dp_cec_register_connector(&nv_connector->aux, - connector->name, dev->dev); + drm_dp_cec_register_connector(&nv_connector->aux, connector); break; } diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 3fc534ee81746..729af0b812909 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h @@ -1221,6 +1221,7 @@ struct drm_dp_aux_msg { struct cec_adapter; struct edid; +struct drm_connector; /** * struct drm_dp_aux_cec - DisplayPort CEC-Tunneling-over-AUX @@ -1233,8 +1234,7 @@ struct edid; struct drm_dp_aux_cec { struct mutex lock; struct cec_adapter *adap; - const char *name; - struct device *parent; + struct drm_connector *connector; struct delayed_work unregister_work; }; @@ -1431,8 +1431,8 @@ drm_dp_has_quirk(const struct drm_dp_desc *desc, enum drm_dp_quirk quirk) #ifdef CONFIG_DRM_DP_CEC void drm_dp_cec_irq(struct drm_dp_aux *aux); -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char *name, - struct device *parent); +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, + struct drm_connector *connector); void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux); void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid); void drm_dp_cec_unset_edid(struct drm_dp_aux *aux); @@ -1441,9 +1441,9 @@ static inline void drm_dp_cec_irq(struct drm_dp_aux *aux) { } -static inline void drm_dp_cec_register_connector(struct drm_dp_aux *aux, - const char *name, - struct device *parent) +static inline void +drm_dp_cec_register_connector(struct drm_dp_aux *aux, + struct drm_connector *connector) { } From patchwork Tue Jul 16 07:58:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045437 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 59EE3112C for ; Tue, 16 Jul 2019 07:58:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BB7F26E96 for ; Tue, 16 Jul 2019 07:58:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 403B6285AA; Tue, 16 Jul 2019 07:58:46 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEE7026E96 for ; Tue, 16 Jul 2019 07:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729302AbfGPH6p (ORCPT ); Tue, 16 Jul 2019 03:58:45 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:39512 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfGPH6p (ORCPT ); Tue, 16 Jul 2019 03:58:45 -0400 Received: by mail-qk1-f202.google.com with SMTP id x1so16133226qkn.6 for ; Tue, 16 Jul 2019 00:58:44 -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=/bOkXYUTo+ONsBE31JFge3XwJortkoB3vocu6FHYM2A=; b=pWOkLw3pLWVdNKTcexFuJNwO1Rs6vMwtGdzk7YOnhDuLZc2JazmcTvDk92hL6RLkso XZM1+xgPX+uxyd8iV2EUBQ2SwGZvsB/T5cDo6ebLmvMCDM1fauYCnkjSVzdEfgphhTcW PgOYhpNL+GiSO89u/p0gR63U+t6XT6uLz5BOWuQsY49aLznqqY3k77odsEN60rYFBI4i 80nlJwW1TtFqgmdw10jJeXLvBaTr9XQdgfnIs4TQlcqsfzBd/df98Ttly5ppDcahP3Ws +FbkiyVWGMLmAPamvUXf0nYbyHIp7/MajEIbRld5x1N8r1uETaVbejUW6oBRKai4OSt8 dTOw== 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=/bOkXYUTo+ONsBE31JFge3XwJortkoB3vocu6FHYM2A=; b=aKc34YYbpL/fxggGQkqWSIq6DIxMtGVqrp7deDEpjNiY0vt7gpX54FH5PcC1n+ioic iO6f4CMfd9Xq4Tft2B0K/NqWlkYH1MGKBQBGfGdje0V3MUJ0w44fq9E735HJjDXRhU1s riDGaBFd78mRnVFkIwA6j66wfHarMNGgYqrNE1iJu6Hhp9mQpL4PIaxwdPrAaE2EM7Yq cMXrTVN9UxkAn7fRQwEaso0XYXRxwkhKyfFjfywtCAERr7sGoZ3k3HshhIAS91JPvaqd WbZ5zoDq1fMT74RrzQT0Ds5taIhcjpo32ennv97GfO6rFM46pJBiiYle5A2cHNptBnWh 13kg== X-Gm-Message-State: APjAAAVj6lLGophi1HYwExa7KBRg5O+cftMJdODA/IzjYy2Yz+HnAf85 q1Oy23/7ggfFifyP6oBKYoGPCEOyQS/t+RlWaUUmN5ny89y/dprTmEgNa8bIIAc5RHBEVG3i0MO KV9aUWNJOXEBQDSsPommyMgc08XRBplQ/TR6OjRH/9ssKGlYehSgS+LIzXw53AlpzRXsU X-Google-Smtp-Source: APXvYqwI/zGOTFbOLF6aPcaL4GYSjFXsi7OP6C1Dbq7ncIg62uYB0TNyatzhmdLofwbGYukVP5D5gkZgDzU= X-Received: by 2002:a0c:ae50:: with SMTP id z16mr22121524qvc.60.1563263924052; Tue, 16 Jul 2019 00:58:44 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:13 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-3-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 2/9] drm/i915/intel_hdmi: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 187a2b828b975..db7953ce49c8e 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/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); } @@ -3061,6 +3062,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)); @@ -3113,8 +3115,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 Jul 16 07:58:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045439 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 C2DDD112C for ; Tue, 16 Jul 2019 07:58:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B53D526E96 for ; Tue, 16 Jul 2019 07:58:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A965F285A9; Tue, 16 Jul 2019 07:58:49 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58E3426E96 for ; Tue, 16 Jul 2019 07:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730750AbfGPH6t (ORCPT ); Tue, 16 Jul 2019 03:58:49 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:48228 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfGPH6s (ORCPT ); Tue, 16 Jul 2019 03:58:48 -0400 Received: by mail-vk1-f201.google.com with SMTP id x71so652090vkd.15 for ; Tue, 16 Jul 2019 00:58:48 -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=Y0eJ4pSh22lZlPekVxJNJZYe8l8R+Qjf/bJaf0Pgidw=; b=PNkJ+YkiNvIQD2mvldrWYlCL7lNP6694Ggzk5e3oE6YDCL1N2JjEfV5VIa0Tw2fP0M ZG7Knm2w7R7DkAbG7khbXIRMV41L5zYO1HqIBPTu08+KHY0phDKkXtOE0pDUx/g3VhVj 9rC6ewSWZiGK0d4LlSTyJcAhRfHwO7XaNJAAmZYnoR5Qvb9KcveR0muxwofBNGB870kA S7HAFwcKjhZbbMYUOEPUbb6uDZMbXyR3ccdWnNHpVdeRCTYHtUpnCxDr63B9P4rF8B2F 8zul72whS7N2ZhwURaUuBgpZ9zsFQRuHdCUy5rSpyvSglYa6fwJUHmQQqOEkcYdhFHss Cjqw== 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=Y0eJ4pSh22lZlPekVxJNJZYe8l8R+Qjf/bJaf0Pgidw=; b=oW4OO7d3sPgYBGloP2rE4RFMOS6UPcN5eIbw10zTqUo2Zg7Q0CsnJG6D4caH4io+qV an/XzdSYjkKbYANuNU95bCGnsZPrVKKBw27JuSdN7Eq31WDXYqaJfYWrpEmNOe3KGT/a 9h5yjab2L7DVhjB9WHWNm5IoG8bFoI+VPOI8ILAE1GgSFqaZvuDfAv+nYa5CYEi+wPnO mCuCfGJwxc53UG47QPeSQD8Pe4023P96j+lZj/6i/PAaG3F3h6Q2M/XXwmQxtoFRhmlm OxkAEUP98YGSaZAe3ZzHG+lBYQKvDqeLp4HH8HcyvPkyV/mqLYiAM/hRvPaazW8x31pC gWlg== X-Gm-Message-State: APjAAAUEhj9HNaPKpnirXbowrtd1F2P9dztfWDjJkq/mruPfQKCXLqtj zXGfAwdfZt5ZzxjHtk9U8tgeECp5GVgF26v+RNshAPhaRWHq/nf92xoQKolMomJuprfsJGwpExM FNAe1PvRkfdOxYNPRBUwC8p14y2RrO5jqjJlV9O54auzNFwWE68K7Qo3J830T40b+oYb7 X-Google-Smtp-Source: APXvYqx6AKau+vn76nt+tDEomvC0J8yQHoYI6Azbuv9I7RS+SsZ6iEIlD6Z9IfJjOrOPRh5Mctx7/fliBHw= X-Received: by 2002:a1f:3244:: with SMTP id y65mr11465917vky.77.1563263927514; Tue, 16 Jul 2019 00:58:47 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:14 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-4-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 3/9] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c index 6c323510f1288..6f7ecacb7d1fb 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c @@ -281,13 +281,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; } @@ -297,8 +298,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; } @@ -306,8 +305,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 Jul 16 07:58:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045441 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 79338746 for ; Tue, 16 Jul 2019 07:58:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BB5D26E96 for ; Tue, 16 Jul 2019 07:58:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60230285A9; Tue, 16 Jul 2019 07:58:53 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07F8026E96 for ; Tue, 16 Jul 2019 07:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730981AbfGPH6w (ORCPT ); Tue, 16 Jul 2019 03:58:52 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:33645 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfGPH6w (ORCPT ); Tue, 16 Jul 2019 03:58:52 -0400 Received: by mail-qt1-f201.google.com with SMTP id y19so17314498qtm.0 for ; Tue, 16 Jul 2019 00:58:51 -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=m7n3rFhmx+idK8s3ajEqgLAszpk7xnK8xQBqwfMuZS0=; b=JUPkX7edG6+p/s9IQSNg9SGTpFLoIqZCOU0TiuVJtVwnTlZbQJZD5vR6nbcT1EdFOW ddGIPdndrC8nwb6+77ajD/9duW4odBRvlIBfmW8jVoHYtItReKR7epjKC7sMyQMQ/ETe EQSWpZESasuzpowjYFHBXqkXQDXxz6stbOXzOXWUI5Xqi8fOkR9dl+tFh2POvKieQ2vd NUhjpm79Gvd52Uh8plNxwdwKn1hzMzRmD5encfIeeNW5Yuw8cogjFp21a9uIVj6K1E3o qL2rE6F9RijKN2h3Gr7P+HIYPggEKHdZhYZVZM1IzQJ1BLJkERx8h+lOx69fa721QX0N b/Ig== 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=m7n3rFhmx+idK8s3ajEqgLAszpk7xnK8xQBqwfMuZS0=; b=TQeQ/cB6edu/p7zfr7ly+unSe1Fek3iqEyMTkPPGWHdAmuAEKTj26rUICGeubVfwVa UoY2A+UdfSVbbB9Py7ZBl7G42ESGe+JxHUUohkMycZ+4fzxo0MxRvSIziwgqRRZgNGTl MXGLdTPvEj2vURVvN6z9UTQYjTXjpwFstAtxuVGSu0ao4YhfX3Yi8hzKxnuvaeez2SV0 PDc7I2HF00/loWTeGRXps5PDlMGI8rPmKBROKX/IPZLf6s/ps2Qh97PFXIYIEKHQRUj1 OR31qYI65KIxNMv8Mb8ZpzUl1BnjfsG84osJyDR80jLlAQ+soa16ciJ6SdJaZcRyyzVQ VOqQ== X-Gm-Message-State: APjAAAUFFvFOsBsiOUy3Be35wCu/i7TjVF7FESwft3qvotGgoSIOwX25 dD647mO7y844msoetwWD97q2r/1nXPdjaM39UHebOHI9TOT3XFW8iV78n4qaacQryGRkYFmf5xZ wsIKT2NN1fggXR3URik7mKOmMyxxoUi2GsJSfg6uoOQCyfu5lNry5KAqL8Dj4ZgVlqgAD X-Google-Smtp-Source: APXvYqwnM++ODBWgq6EIIxe/BhJrIB6UhcG4c6OaOINg0Qfpf9IPpQbXL6qeAIOlwm6ZiqE9HmF2TMc5GbY= X-Received: by 2002:aed:3f10:: with SMTP id p16mr21590946qtf.110.1563263931255; Tue, 16 Jul 2019 00:58:51 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:15 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-5-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 4/9] tda9950: use cec_notifier_cec_adap_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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 250b5e02a314a..e9f6171c47792 100644 --- a/drivers/gpu/drm/i2c/tda9950.c +++ b/drivers/gpu/drm/i2c/tda9950.c @@ -423,7 +423,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); @@ -460,13 +461,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; } @@ -476,8 +478,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; } @@ -485,8 +485,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 Jul 16 07:58:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045443 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 107A1746 for ; Tue, 16 Jul 2019 07:58:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3B1126E96 for ; Tue, 16 Jul 2019 07:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5626285A9; Tue, 16 Jul 2019 07:58:56 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8847326E96 for ; Tue, 16 Jul 2019 07:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730984AbfGPH64 (ORCPT ); Tue, 16 Jul 2019 03:58:56 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:33648 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfGPH6z (ORCPT ); Tue, 16 Jul 2019 03:58:55 -0400 Received: by mail-qt1-f201.google.com with SMTP id y19so17314589qtm.0 for ; Tue, 16 Jul 2019 00:58:55 -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=GwvVXcfKTOvYlFNdrEjQ339Xk5gaHQ5QylqpM0QMSLE=; b=NnfIyEiDxbCbFLJUyFns1MQ9/TtSKDvaZbjQ6WjtPo7TIFugMPq3H7KviiflJSGj7Y n6KSYrpOFn6dD5Buz9fSx+IOQLS5pGzdAA07xcCB+wAMG3X2vWXdkeEA4YYnUxZA/KgN pYKUQ86vsyfqedFrHeKcMkjBZklLnkfLo75TmB9oUd03PS1wlVeR2K+3UT6q0p7ulAKa Wn8dsnHV0TozBTsm0AS/gM4+H7+02W1avZP6zd9HnKOPeZc6sCjW04Fwc6DIM6AHVHfV oSMEafphzaiM0mhGfKZLLkvSIUnC113ytAphCW4A/9kE4dr++V5GwvZMzpEVrwoCrGLf wlhw== 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=GwvVXcfKTOvYlFNdrEjQ339Xk5gaHQ5QylqpM0QMSLE=; b=Gk78ipBZTuC8XxMhhJxkhjatfRuRzTW2cDGunDiqJVhN2y6O7wVdPbSOONT/xST4SQ ZGSQJrAjUDN0bJ+rlkS8Ct8/ipdFyOmN+nYEAc7MgWx7Pdyr8rKlQjh8GjaMmoV2OF/w FgS3QsMaq+dFkaE0f0E9dkz1lkouxwJ2ENlkhGMrgKKSzhLrY63Sl19XQVkP7u0S0QEx +oWSeHHxYxxuypg4AcFkM62U/WriCkkXV7iSIA3c1kcs6qfek8uBCgrUvIUsSKLadWQE plVlUvxI66K6Br7J4XCsn26y4SsmSRqcV+D2YVfskduOYX3KKQ/JLKIZWz+Jtb2ERh2L Tyrg== X-Gm-Message-State: APjAAAW04S9TTVpx999IPBwf6B3kgfya1bbHR4Sm0dNxQnyaaTATbDyU yee2MRcFMJA3IWciUS/CyWUg9VhwjMSpj+MueRbv6wm1k6eqN8hjnlIYeT8FfIqOe1LXwSWNdrp 8FWdZBzO2CaQQpAW1aKbpnfvzLD87vUPechW2k9IYYqvSRj3u8hfgMnYsB0gJgqtSfSDC X-Google-Smtp-Source: APXvYqwZ65B/dh+nOfIGihTfbVKvHXJ65MNNFA3VCkqxftworN0kG9abk562GupeG+EvIE64WLPSz6RLsU4= X-Received: by 2002:ac8:290c:: with SMTP id y12mr20960166qty.141.1563263934829; Tue, 16 Jul 2019 00:58:54 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:16 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-6-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 5/9] drm: tda998x: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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 7f34601bb5155..31214663d6fdd 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -794,9 +794,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; @@ -1253,6 +1258,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; @@ -1269,6 +1276,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); @@ -1650,8 +1670,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) @@ -1776,12 +1795,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 Jul 16 07:58:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045445 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 83CBC112C for ; Tue, 16 Jul 2019 07:59:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75E33285B5 for ; Tue, 16 Jul 2019 07:59:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68965285B9; Tue, 16 Jul 2019 07:59:00 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFCB26E96 for ; Tue, 16 Jul 2019 07:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731014AbfGPH67 (ORCPT ); Tue, 16 Jul 2019 03:58:59 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:50016 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfGPH67 (ORCPT ); Tue, 16 Jul 2019 03:58:59 -0400 Received: by mail-qk1-f202.google.com with SMTP id l14so16099916qke.16 for ; Tue, 16 Jul 2019 00:58:59 -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=zLnKA9KgudLK8KUe2S3pT9CbPlyxYTLlfzuTx+kcCmI=; b=NkwKYQmX1X+EopVFbUS55AdzPtX+5yG2sH4L9Y9DnaOT0QMkejdR6qtLozWfB9EV++ CIqgBr/JvnK4WsZc3SzVNXdvucZ+PSuJz4oY0D1Lc1LE4sLfl8Qe5pkxiacEE5FiSreq fLtcnOoliy4BbEUdIH6ceBJ1SHtbqyIUNoKwNXg2txVF9v7JBQ5NVJNZCeZKjFV2spyi eWcJyq0ZLTmYvj78alKvAHYPdkTz52E1LL8rBo1XViSPD2CgyHIKvJaEV4iA7kMkT+uY E9W17XLqhbbTMQ1RpF6iNdkgiGACW/ZMOEQdqV3LDSTvniUgQ3aW1pNEwECMlLobbylF mDuw== 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=zLnKA9KgudLK8KUe2S3pT9CbPlyxYTLlfzuTx+kcCmI=; b=sbkVWfr7gMbeqzhI0IwUeqR66gRNAKNIcYdX/NopbshJ08u7JpFUUQBAY6xiyreeuF +ExiJCzb8yIfLP0OFQgjsyfYMLthPAqcQOxyB2aJIRLkFGzsPFNrb/UTt36sy+jWJJnt +Mn+KS9hIX8NetombBfF6TTfzpB6UgsjeiYN69S046xmRMjkf+lxQZ2rhWL2dYBnEf7b xk6//0AZ6OgOio8qhfGJKdNVtYDsQMdC6ryi/xfzL50JMYBe4Ck4jIJ+75vZZX17PGvc SIYxdRedq+0MSFPgjFBVxQcYnYfM0Ay7JM4YRenlcjzybZXgRgG3vE7dJqMBn23eDa/8 Mg1Q== X-Gm-Message-State: APjAAAVsv00wut/AmbpyXwOvYADncIfjc2j7jTz2ZOIR6YGG8Wx7VO38 HyyZGjmwGo98eiVnjVvZn4sySiZ4ASZl83FZGDW4nt+CqiBaUHAOkYrLQsay498MiyXu7DXKo8T h69pM/6UgwioL6bDKRILznnxfIuCQHaO+LbB/tQsmIxQoErPhmTtIbyOW7xAlFiiZKOCp X-Google-Smtp-Source: APXvYqzwa7CqZQxo831nIATBLLVP9T7qh3/h1f2pyHuxQTcFnxEkp2uyaIsN3UMzNVBhjyfXEZ6isE0rU+Y= X-Received: by 2002:a37:4d06:: with SMTP id a6mr20684878qkb.298.1563263938545; Tue, 16 Jul 2019 00:58:58 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:17 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-7-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 6/9] drm: sti: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 6000df6249807..6de30c0eee9e1 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1250,6 +1250,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; @@ -1310,6 +1311,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); @@ -1323,6 +1332,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 = { @@ -1428,10 +1440,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)) @@ -1451,14 +1459,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 Jul 16 07:58:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045447 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 B897A112C for ; Tue, 16 Jul 2019 07:59:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA71E26E96 for ; Tue, 16 Jul 2019 07:59:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EEAB285A9; Tue, 16 Jul 2019 07:59:04 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44E8726E96 for ; Tue, 16 Jul 2019 07:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731015AbfGPH7D (ORCPT ); Tue, 16 Jul 2019 03:59:03 -0400 Received: from mail-pg1-f202.google.com ([209.85.215.202]:38848 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbfGPH7D (ORCPT ); Tue, 16 Jul 2019 03:59:03 -0400 Received: by mail-pg1-f202.google.com with SMTP id w5so12146714pgs.5 for ; Tue, 16 Jul 2019 00:59:03 -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=2DumyVCzzaB3MQwtkeoHKm9gyaJLAkkzi+6ishqFPeg=; b=jI4HizKkZApNt1a1QrTk8EYDhTm4SE6CjAmLk1TxlUMaBVu4zrtgptF6HIrnK6AyKI m+g7qv256lwJLNijaGXJfe0dtW/E0NPmHHLjVgCnQ9WNhZCMeZR/+Khig/gnm8ywzUls mGN55SWM+Vf9mG38cjwXXiBddDxWqEg5Pjy5BxI+ROlmM0e9Ux4w1NSypQi/f+kQjUsZ F5JmfPR/2tuOqTdtC3g2J5qIm0M8810mWTaQrHjbr1epwXm8rubxfFe0yqGEe8/Tj8AJ Jc4DP2wvdJEAckdndrebXUn+6R3MUjcwGis1ho29vLDqaNUX2AWDIk9c7wSaTIvZYmef PSfg== 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=2DumyVCzzaB3MQwtkeoHKm9gyaJLAkkzi+6ishqFPeg=; b=WKi30//TDs+o4oOa0O32cPA8wq+N/nisjzQwnsPhe0UDZR8Avty560lV8DN6hK6zru wgdhx+cAWSodu+a5VqakRZLsRgm3O7YcB3c69PDgeX74YqhQUFhZw2nQR+IJPSnyNNdo GpAR8coRjLrNupg/mFuMUO0oxqNCJZeqevGwvdgN6xssk4W70Drx+X6duEbjbouqrBU9 UIQVlMZ19eDaYY8uy9yANibas2Xq+30sz8k2gnsTuCE65ajzJtsT8OJVI6WxWlQvbZ5A U/8oQXytVptdYX3HHRZpXKjnKD6yhEGAOPU7KA3ZjlJvqSegRT4Kwqh1+TlPPmC7UB09 nGmA== X-Gm-Message-State: APjAAAXsMYy8vDduHKmck9f/gNW9AykucLTrA8ZxGDuzCeBU78Z8VLZ2 8sJVRTGX+ziEopDI3+SB9togZKo70l0bktMsobY6OcF3lOgtOMV9XQmBRVx7j+c9ceMCsPP2ewT Bj+sym4gHRvbZtf0joaP8hJMY9Ljts/wzIgsMsvNY74Ln7g32hIAnl6KUkF1yevfkG/01 X-Google-Smtp-Source: APXvYqwCFgeyixuS84GW1P9B1yOuSmUklCviq8TMo9Qo3o+bRXoghai4bpiSv0iA5NCF2BHzW0ARJRtR4Bw= X-Received: by 2002:a63:a1a:: with SMTP id 26mr31449662pgk.265.1563263942350; Tue, 16 Jul 2019 00:59:02 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:18 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-8-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 7/9] drm: tegra: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/gpu/drm/tegra/output.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 9c2b9dad55c30..ea92e72280868 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -80,6 +80,9 @@ 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); + + cec_notifier_conn_unregister(output->cec); drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -174,18 +177,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 (gpio_is_valid(output->hpd_gpio)) { free_irq(output->hpd_irq, output); gpio_free(output->hpd_gpio); @@ -197,6 +193,7 @@ void tegra_output_remove(struct tegra_output *output) int tegra_output_init(struct drm_device *drm, struct tegra_output *output) { + struct cec_connector_info conn_info; int err; if (output->panel) { @@ -212,6 +209,13 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) if (gpio_is_valid(output->hpd_gpio)) enable_irq(output->hpd_irq); + 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 Jul 16 07:58:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045449 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 750A5746 for ; Tue, 16 Jul 2019 07:59:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 674FB26E96 for ; Tue, 16 Jul 2019 07:59:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BA9D285A9; Tue, 16 Jul 2019 07:59:08 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE05E26E96 for ; Tue, 16 Jul 2019 07:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731042AbfGPH7H (ORCPT ); Tue, 16 Jul 2019 03:59:07 -0400 Received: from mail-yw1-f74.google.com ([209.85.161.74]:43688 "EHLO mail-yw1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbfGPH7H (ORCPT ); Tue, 16 Jul 2019 03:59:07 -0400 Received: by mail-yw1-f74.google.com with SMTP id b188so15480947ywb.10 for ; Tue, 16 Jul 2019 00:59:06 -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=T8TalvmLrtZ0fzDRhYayjujQxy4L4gy0LZKADKi+6tE=; b=GGytpziiJqb6dHQuAs1KJaAXycwvDOr87Z/yhd8DewdUAdfC50RsVsXf56sB5de0zK OBx359g7oU3CkWKe0DouhO4bKjagDjVdFk93YPrdvxx8nVdO894dsGQiD34gZrx7iDaC o9p57plXDC4xc8kb4owlBvDc0CkV6qX5AHuLM/6G22jp6/lHGDs/bkFisSNju6Av7Cv6 sXaY1wjJ8UF0FLGvTOBOWzNboiXHl7KxwZNz03t5y5Vv9LmYm2laqTdWzafZQW84jwmU 2QgytGqtAWyK3SbRwbkcEKkV49/bBBvai/7OuEq5v/pviA+RCa4/fpMO1c1quxAmJ2Az 8x/g== 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=T8TalvmLrtZ0fzDRhYayjujQxy4L4gy0LZKADKi+6tE=; b=W0uJGUJ2xOgIKxkIRPoDCdYMUwvoiYyLmS8bLXOu3I9RCj57J4Z6hvpxO6NHb9ePX7 Sz9BBZ+GIMaVTAdpGnmf6iXLKGTK28CeJ3M+Hfgt3qVT4C8WB/P30v3fNyMK2U+VKiqQ vwseYNyq8cZ07oFyuoC2WfP2M3gFOTw2nam7nsrug1dUTXlGAn9i0FGMkQzs6x9KUX/v WLfQde+8qKJjEIRXmzQnuqh5UzlYwk/0shy36x49YMMv/cVDKTTc4H1NTeHSd6px3SGV /xCBTfm1WGL5SM1BC+Busatro21xSf7DEU6+VJx5qVjBJoF+w1615DrxwfdjbjSv3aIk KRXQ== X-Gm-Message-State: APjAAAVntFiQbo9vNAP60kekLHR79PKCK1nFIaQag/n42L6Qo6XnmnfM 4Zu9CTiQNw2t5OO+hlxxhWxkBZ6CdtTMCfE+JtIXdQGhxWwgKqHUgpOCgX1wplwP2PHljnPgeOp kIpBZrK3yBdFlMfSUdN1gFDblA9u1/R4o+q36DNedJmg3zgbKhFkXUYKLHtunuxDkYy2J X-Google-Smtp-Source: APXvYqwK8aZhMf7FpkawYxaahFLBvjLt2oGwF/sHPu3k8FRm4aFxHel7UuSupek3WykwFkywcnrSvLMS0Co= X-Received: by 2002:a0d:d410:: with SMTP id w16mr18242925ywd.125.1563263946379; Tue, 16 Jul 2019 00:59:06 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:19 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-9-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 8/9] drm: dw-hdmi: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 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 --- 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 ab7968c8f6a29..1e183af0e1ab1 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2118,6 +2118,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; @@ -2129,6 +2131,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; } @@ -2295,9 +2309,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 *notifer; + + notifer = READ_ONCE(hdmi->cec_notifier); + if (notifer) + cec_notifier_phys_addr_invalidate(notifer); + } } if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { @@ -2600,12 +2618,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 @@ -2693,9 +2705,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); @@ -2717,8 +2726,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 Jul 16 07:58:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11045451 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 6B73D112C for ; Tue, 16 Jul 2019 07:59:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D51526E96 for ; Tue, 16 Jul 2019 07:59:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51181285A9; Tue, 16 Jul 2019 07:59:12 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E434126E96 for ; Tue, 16 Jul 2019 07:59:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbfGPH7L (ORCPT ); Tue, 16 Jul 2019 03:59:11 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:56375 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727862AbfGPH7L (ORCPT ); Tue, 16 Jul 2019 03:59:11 -0400 Received: by mail-qt1-f202.google.com with SMTP id x11so12909524qto.23 for ; Tue, 16 Jul 2019 00:59:10 -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=LcyxD0jadNcdSb7X2PuAiJWDefUY+UWHf/7pqMNmvYo=; b=U77iCosxrsg3OgIkMic+Uau0MQaXSCb+1ncJPy1T/AX7fvlYvJnKs9xyuu+etzhOtJ KCcGE3XqEWllx7UX3tm/aV09a9YXPOIygZIPnUq5JtTRTcQ3qxLcBt0bT1PAqoHF+4t8 ALC6lIrVe/TthFXDpW265auBuSPaP2ytNCplhcsjyEP6g76GOEsWogtMvepYo7+S85s9 r6LHwBzukjOFXxAw2AV6gxfSJyxAN6MWkWfA95VHe3OXl+9u0UM9YVUNqnpza7q7NyKA pGFIfvM5g/4byANLaUioTN6jSuXYLDoc2JlRxSEeUKleWooEy/ASLH4jM6HU74TfC1R2 vRJA== 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=LcyxD0jadNcdSb7X2PuAiJWDefUY+UWHf/7pqMNmvYo=; b=UsrUvF5ttE1/4+SJIF4o7BUdEau0hr4bRCn55sk0GcEYlMJdxL/HUkYu62Toawzz6+ leWhnvS2XItdNl8bMtGCxkMFp4p4TyS5a5Hit3gGOCCvTCaUbcW0usUuveTB6w71MzEM jTmY9Wte59sVVqke6wmUOdZJ8sSt4e7PL3XQqw9OuyMiin7KpMw64en+/d/40rohNyZy /V4mpXU1keVUWAUiYb9JwXWFZbsqGHs8/MBySTfsFYQzvQtjFdNWYCjVFCS/XUagerLn WujX0twm1QnN/uEX/gMurXqiHnrkdEUFkMneEX39YsY8Y3hd/eL7CZjJFuj4qYYdwGWo MULA== X-Gm-Message-State: APjAAAU5IpRZSFTVYaYOMiFdKV1KAjPjEzCIQWY1MHJOIGXtcJQ8ST/i xEPeSSkQy5gkEGyN4rlIWhsgES3Agqi95LrYgDWsfIhPtceRElj1Ijz0nEyKy+N6gx/hK/ZNuav +4lse15y9sO8Umycb6HMDNq92M0NKoS2NjY2EZCvlOmF4lLRpDD7QaekaCTNhz+FSUsar X-Google-Smtp-Source: APXvYqywgok42NUsewsRN+aIkY28P0KnyOf1vx4L3J7Jbx4kJXo6QY8bwUWKPeJnIuh2dy1zHvJ9qLxH2Cc= X-Received: by 2002:a37:9944:: with SMTP id b65mr20950749qke.105.1563263949957; Tue, 16 Jul 2019 00:59:09 -0700 (PDT) Date: Tue, 16 Jul 2019 09:58:20 +0200 In-Reply-To: <20190716075820.260202-1-darekm@google.com> Message-Id: <20190716075820.260202-10-darekm@google.com> Mime-Version: 1.0 References: <20190716075820.260202-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v3 9/9] drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl, hverkuil@xs4all.nl Cc: Dariusz Marcinkiewicz Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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 19c252f659dd0..5fd2551a93567 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -858,6 +858,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); } @@ -941,6 +945,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; @@ -963,6 +968,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; } @@ -1534,8 +1548,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; } @@ -2012,12 +2026,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; @@ -2029,7 +2037,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) @@ -2040,8 +2048,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: @@ -2060,12 +2067,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))