From patchwork Tue Jul 16 12:27:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11046083 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 34DBF912 for ; Tue, 16 Jul 2019 12:27:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25DDC2856B for ; Tue, 16 Jul 2019 12:27:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A27328581; Tue, 16 Jul 2019 12:27:57 +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 79E8D2856B for ; Tue, 16 Jul 2019 12:27:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732614AbfGPM14 (ORCPT ); Tue, 16 Jul 2019 08:27:56 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:46268 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727849AbfGPM1z (ORCPT ); Tue, 16 Jul 2019 08:27:55 -0400 Received: by mail-qt1-f201.google.com with SMTP id k31so17875522qte.13 for ; Tue, 16 Jul 2019 05:27:54 -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=oi3cpxmZZrOhz6s65m8duh1tVfPd+tPPjVC/Tdm+pENEUm/8f+H8g04fNl3FdiakN3 RuYU9E+gKvbTccy4WZZKU62resbh3rx4FrunqjKg5m3WOy4ZUMXJ/tpbPUKyrQxj1twF ZjMF0eP1iYawup/xHV0ieGaF54SXvvVo5L3eo7TVXEkrI970YPMvflwYYSqTooxto/So rZWEWnlwixLD2sc1KDQ+8oC4pRPeoeNGnh5kLOl6qV6g2oTfdiWS+B8hSFmbKBBvzEyH ACn26pqErWbMpwHdeMV3PWf2+2YuQn21zaP+PJLDE7w94E2+rJRwxarGLokpaksA5ns8 mNNQ== 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=mRbfnPtFnj+LkbPw/klN7sAsVqlIsK9/71iffa3fBYAWjg67rzQOslsk0tzNvyvRkG UsOByLuysfJan+f2i293AOSzcJYYSEgAR4QfNhRtnS8yu18NJofVe1+gYzmH5Q3gVbNJ LGKbF7dMw/mwmX0WjcQ6HbwQn8pKscYFac03x5oO9Q8uapvlNnz7rB7Jb4yhYV5qbH2A YWFvOX9Crm+/sdX5C43eJck37Ck/9c74FH87Pcc+vovfx3w39yhxCULYsR9IAOq9iils hehQnRxFPZ83/X0Z6UkrszBmV2NO9j8Y6epyY9aVAa4B+lV8UXNDHJ3sywYTAUDOiZD7 xhFw== X-Gm-Message-State: APjAAAUes5jlp+ERBYj9qWN8emO23/ZkabTelrs1k+c9O5QtlZ2MA9Uk QzBrGzhbzFhA2OQ54fXL5WxaEO5HIeBjvXajlDqbSF3Qd5AvzeVyGR5FChKh4TqZGWRk9+mapeo V+EFHpNuDf13SG5tST21ymV5FvmivlGtlbLO6k6T7fj2aD8z88ly/3E029lJ4+23Bn9/n X-Google-Smtp-Source: APXvYqzdhS5Opve4XX5g4i+/zyRMGIQHgzZlWf2COaHvHnlzLR4BWkO+4IdzPH3TwH8V90Zma5R0XR9Ce9U= X-Received: by 2002:a37:6086:: with SMTP id u128mr21511120qkb.270.1563280074267; Tue, 16 Jul 2019 05:27:54 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:10 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-2-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 1/9] drm_dp_cec: add connector info support. From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@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 12:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11046085 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 17DDB1395 for ; Tue, 16 Jul 2019 12:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A0932856B for ; Tue, 16 Jul 2019 12:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2B1F28581; Tue, 16 Jul 2019 12:27:59 +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 9DC4D2856B for ; Tue, 16 Jul 2019 12:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732752AbfGPM17 (ORCPT ); Tue, 16 Jul 2019 08:27:59 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:53475 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbfGPM17 (ORCPT ); Tue, 16 Jul 2019 08:27:59 -0400 Received: by mail-qt1-f201.google.com with SMTP id h47so17838184qtc.20 for ; Tue, 16 Jul 2019 05:27:58 -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=s1k9j9xY0P+wsWmBSuZUTTtXGFgkeQCPYvTdeJ4vjUDq3JHBu6uLj7d6F8pCwDPQrk n4oTKPuxYu4Lmogv5hWbiK2KREIo+9sDRaXGYhraaP/UdKo+dSLc32lXml3dPoI9ANZS cheJ5NRvx3ybbo/PeD/C1qagpxteXG9SlW+XNgotmwav2plUdy20VCW+m0T5y2a/HZcd SrgofDxLo2Q/bmEIL3HX5IJV6W2VR59FOkFaHPT10qXMA4yS/llq0yeveEmQkqnRF0Jp dqcNP4mgWzLFOfIM+I6nnW9oPwivDlboheXGc/kUebjbd9KHoq/kLuOvCVWcx+3JD2H7 oAZw== 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=edTkq0TX7WtjPX7NduVIJWQpTYOv2nPSbO0o6f5TmSW5bRRLBmPZTSZbzqVAgCrTPr WXm31Xh5BsAkFtwGRlQ8rhY6FoACehBGhpCqjHhRztCqwmyry709CESFVniz1HxsGP/w h1FurTpRicv1QKa3vUv5Wd6GNupVzroTnNg7uyfOeKmvUE4svGUFbPXDF0+qABjU9nz8 iLx/LNBvN+8x4Gj7hpb9UUojQ6+/lfhzDvFsJG+s1mbZsjtR6wjo7RAB1mQY99koM8x6 ewogD89QXaJ9P3mjfEMHbusgs4/ouupwu6Sf56nuqLFHcgAmU5yXoyafbWYqqjPsLuEh f43A== X-Gm-Message-State: APjAAAW3LzfnY4OZitcqZMV/WaTDXCrYYqmHSXWF1AfN4ZMchZu9ODW3 l0GLIBsf38/IU55qpPWCSPNCr0XmRtzcNsEX6lqO+263p62wryPXnt77IlbnwshFcKOQZJj3aKZ V6eLSgBenM9DKrGy05Z/qKbG8qnkHWswvjh/c3Tx9vCxehVKwSj6YAw2rlEyabY2H3uku X-Google-Smtp-Source: APXvYqzl+OPaWf4U299jB/Awuj29sgi51K1KrBzd8Z45Lgrjh59a5V71pMx9ekZAw/J6TSgFLrRzwLKjkmA= X-Received: by 2002:ac8:4a02:: with SMTP id x2mr22016334qtq.329.1563280077978; Tue, 16 Jul 2019 05:27:57 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:11 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-3-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 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 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 12:27: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: 11046087 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 BE4DB1395 for ; Tue, 16 Jul 2019 12:28:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AED422856B for ; Tue, 16 Jul 2019 12:28:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2EB628581; Tue, 16 Jul 2019 12:28:03 +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 4AA072856B for ; Tue, 16 Jul 2019 12:28:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732756AbfGPM2C (ORCPT ); Tue, 16 Jul 2019 08:28:02 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:40534 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbfGPM2C (ORCPT ); Tue, 16 Jul 2019 08:28:02 -0400 Received: by mail-qt1-f201.google.com with SMTP id e32so17820147qtc.7 for ; Tue, 16 Jul 2019 05:28:02 -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=WKnJOrrH+qEjXJlHnLjxekGXT6Nyo0Ar07pMa+L141I=; b=n4f99IIGQ/sBB0GuD4rl+xs8/oXHJkQcX3OM73RGn37RttaiUqoOctoeyT2l1UYGhQ hvyGRwxpt487t/PhhUqTwXfN6bfn2EbnKK7CMc/Xf2KNRPQTm8P/E4n089d+wt5eXP/F lLLervtY4lXhkYq055LWpJwb6B1L6v9+yMoyEvh/fwYWYSe62yUWCQXpl12f/W8PQWE2 C5jK8u9L6fQJ/mLhE2N2Nc7tm7+0L6lR5XgT2INUm/tJfUgUdLUpXAjsOQHdY3RvD08E 1LsJqJ8BF+YnvkBFax7GLDQywFwxYGzzMD/Z1ZyfOfo0LBOIC0XF9BVCGrjYzkp4QIIL 7nLg== 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=WKnJOrrH+qEjXJlHnLjxekGXT6Nyo0Ar07pMa+L141I=; b=KZSSmd6bryly33lPdFV2nt0YI9sMWBy2g7PlRtohPzcJkO7pdir67brv08JvNeGI3I KMPv5fuwNxEccK1ljOkDYaBzJc252Eq36bdklQOj6AOlvc1uRyplgM7aoEnfyn0a/FWo uZxcmBw70XBoThL/EA8Sx9dAzVgndj/6W17l3fwbhixNiB8Yrki33We+wrhKlLpNwUIy Vqv0Vv2U2a/FVEwkqP5fzkB0/ODsyvwlsod3jzOSgfJaqV1f8wIiVsrLMEkfQ2ZrOAyZ PY6KU/tMDDrBLTcjXNpSEgk99nN7ZsaJzap02JTZO7hRHMc8oJI8ntMrj0XOgHuN93G/ Tk4w== X-Gm-Message-State: APjAAAWbNGKtMFtBnT6daMtJ6Qt3YxKjc7VQy62triIIWJ7skW80lPCI e5zbFzWRbmow8VgtLZ7ZGf/OLWAVgnVz17/UYEXzgmF2xmAim6RmOIcKuT8mXm4Vhl+vqlgpFFd w5ERAOMiUpNIGNC0gUH/5QXI0mQUDPBUvYDcBHk5JXJ5D54G03i51ovq0HkmqxaE59cZL X-Google-Smtp-Source: APXvYqyjmJNA0lGswric4KjURdEdHK75avBTBj4LlAdVjqIT/7eivnt6wsktrsiqcLshs648Mnv0vbWrNgE= X-Received: by 2002:a0c:b2da:: with SMTP id d26mr23608767qvf.48.1563280081630; Tue, 16 Jul 2019 05:28:01 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:12 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-4-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 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 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. 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 --- 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 6c323510f1288..361acff2111cf 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c @@ -259,8 +259,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); @@ -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 12:27: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: 11046089 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 71A55912 for ; Tue, 16 Jul 2019 12:28:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6382A28581 for ; Tue, 16 Jul 2019 12:28:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57AFD285A7; Tue, 16 Jul 2019 12:28:09 +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 3509B2856E for ; Tue, 16 Jul 2019 12:28:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733285AbfGPM2G (ORCPT ); Tue, 16 Jul 2019 08:28:06 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:40537 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732475AbfGPM2G (ORCPT ); Tue, 16 Jul 2019 08:28:06 -0400 Received: by mail-qt1-f202.google.com with SMTP id e32so17820289qtc.7 for ; Tue, 16 Jul 2019 05:28:05 -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=ps1Zl7cwg97g6D5+cHOE4PVFmGyOf1YqgdgaKjmJnlYLgi77wz2mipqcq8OYAI+kfR H+xhaHMqTBq9dp5geyGpMvV7cAduVReqWj3EpGA9HxAA4I5f0eF8bP0suHTBfGCT/VLc 4obvJGKjUITT6XaCWwQaXMpFsJ7HJ473baYpiMPl4N8A2N1FVblYML7JEfmvI+U5vu4V HilHRSB3l0KmdeBe4z393a6ED5DGM1R/xF513T6pEh1hjdzTcoPqtHuJaA4c4wshEDL4 0z6yPuFqj5HkDIx7GgfHVv+WS+0Pc5b9hsevELeowY+zy09Dumsk1we3/aAKuZj3/ckR JabA== 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=KvpuA8M/jRyN0SZkwhGn8/tASbAbYimt//HqHpVSUk48qFRhqbKoif0NQHYzTKfBOZ y3wLrGOBY4pYrU/vNXHNnQx0vGkba2bUlEASnV8dDV0PUCm08pPAvF555J7QDCwuAkId 8ZGCjQM0E9YteY2kB8f8IjMcEk8zXvnDwztU2Bb44v0u4AtmcwSwHy8GA1CnbeE7UDK3 Lpw1cmSzl4HROUAwUQeM8cZXV4h1dYTPOtJI25PLkep7O9YKFzVnBES3hCs4Xce2Z/jk pXbXvnA2CzElQmjUbPydd9n/n1p8HiwOWBPxk8B7pnlFe88AZPJESJXh4P2+2t3i+e+0 sTXQ== X-Gm-Message-State: APjAAAUxzHpVRtv5BwBk7LfZwaPbsBfyd1F99mHcgjO5TbJlt2jhZhkw 8z/hm6obajOp0f4X0HVAU0WngTRg6Eup4fCv1huRF69ZaSEtm83TMRkX2Xo6GLhNpEnjkMMqYTw fhgfsbxIpWcjC2+pGA8dsnCgmuAV7YagkGWI738cFEoq1K+flTpcHszWs3yZ5nyyUMKS5 X-Google-Smtp-Source: APXvYqxdneeryHulF9COuffFOjOxMkekk+zmvXpjrHfWvHmAfqW1r+6inDCkFwEU+kaxDX1wZi5A2SHN/W8= X-Received: by 2002:ac8:244f:: with SMTP id d15mr21707292qtd.32.1563280085206; Tue, 16 Jul 2019 05:28:05 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:13 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-5-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 4/9] tda9950: use cec_notifier_cec_adap_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@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 12:27: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: 11046091 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 B3593912 for ; Tue, 16 Jul 2019 12:28:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A49802856B for ; Tue, 16 Jul 2019 12:28:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98A2D28581; Tue, 16 Jul 2019 12:28:11 +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 3F27A2856B for ; Tue, 16 Jul 2019 12:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731015AbfGPM2K (ORCPT ); Tue, 16 Jul 2019 08:28:10 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:53049 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728470AbfGPM2K (ORCPT ); Tue, 16 Jul 2019 08:28:10 -0400 Received: by mail-pf1-f201.google.com with SMTP id a20so12259719pfn.19 for ; Tue, 16 Jul 2019 05:28: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=GwvVXcfKTOvYlFNdrEjQ339Xk5gaHQ5QylqpM0QMSLE=; b=u19izu2n4GJAj0kllXMbetVohajET/y06W6GJ12q/BguX1rclJl4Bh1YGEOjDh2qth 9HiYbqYU+s1/I7NwAR5dqEjsNoK6FIth2xw1BA3ZPvJSlnAGyHFC1mBIknjwZ/qrEj2k KUkiZNbvfdTkb+e/jqcHyDcevdoijz01sePlp30B5Au2E/3kt+qFQTmYeBMrR+mJjjxa onJ33VF5OTZkE/jvEvD0kccLwUsu35vQkbN7guP96DFr+KqiYwSq//zABSIdp0hib7Vg 314ityAzVyWteaRFimO/59kfscRKeY1Al12SiRYTOIXg/t22uh2GvHk95zLj6/q8VAhz WYDA== 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=OV+BFB9Wd32KCp06MK607Qwb4oBEIWQRLSBScTr8UKhSz6SafiDjM/1AJ1aD7fuhUo NSZIMjUh1fAeQhsmLt64OJipslDD5ZVcVhjgaoVQDI6KF/rvYsDt9LvwOXez24fPHEg0 eAKkLDsyVhzlE6p1qzGlN0rAz3HhPFJUPGtEBmxiCnTrMH7gQaD1H6FtNpVPCg3Qr19W BrByyc8jvSJfrQeuYDsDZhBZ3J41cM7eeNMt7+BxIzp4yeNXZwJQ73LPOdaeIBqPrTki GQ5vXMqbSkruJzzpSwZ1U4hACi09RzBA73UiyzRGFHnJER3eKjLmbLUN+cmWItpXobUN TZ3Q== X-Gm-Message-State: APjAAAX5gNIs7eu5MDItmxJJwtO2CR8U4Wn3lZm0sAkDc569RTacf5FD w1MaReoKAzUR3UbRFtSTGCWg034oUSbpJdRsN3WXXVL7thW3IOIXGuDWSz/aGK84oo3nF1KqsH+ yKbW/PJReSHbPH83dye6SviUZiHzuSSfZ3BbqgFfj+t9CXwHahpPr2QDSELGBkENb+wXA X-Google-Smtp-Source: APXvYqzvJwWyZnasuI2XDySmj21QwF25P5xSsjwlFRQ1kE1iwB6CF9nxIesrPOlDatB7vDHdixLjiqnzGEc= X-Received: by 2002:a63:ec03:: with SMTP id j3mr6020220pgh.325.1563280089054; Tue, 16 Jul 2019 05:28:09 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:14 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-6-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 5/9] drm: tda998x: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@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 12:27: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: 11046093 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 18131912 for ; Tue, 16 Jul 2019 12:28:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A092856B for ; Tue, 16 Jul 2019 12:28:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC4F728581; Tue, 16 Jul 2019 12:28:16 +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 104A42856B for ; Tue, 16 Jul 2019 12:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732681AbfGPM2O (ORCPT ); Tue, 16 Jul 2019 08:28:14 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:52286 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728470AbfGPM2O (ORCPT ); Tue, 16 Jul 2019 08:28:14 -0400 Received: by mail-vk1-f202.google.com with SMTP id l186so9782553vke.19 for ; Tue, 16 Jul 2019 05:28:13 -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=KJsbh2orK2LyYfclvK88UN+T6aUxG6wJYt10S1aWn3SMhejuXvW+cXibV9OcPt0kjS kELCplEaZGqTJqLS5Ub20dR0XGLo/t0SQhPr0gVBmtB/7jkPxpV8at+35drC5KblHujY CSBLitwNekM779T/PBIpcDZ5waKRfEO+UkFiFIfukhfm1zWQNqjAj2UInjZq9S1/nw9b vwh07A/Z0YppA33762QpoWjpvj6bvGJgmKAgWwfPFVx23hibSV9B3ZKoV5Q68hfB4dYS Xh1Xceh/FRFdnznClVI8ZeHImcVFi4Tdzob7WfKNrOkOM50A000pdR0ONmaNQNQriroh o+/w== 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=ID1+OQ6WrEB0OZrEwch3aack+kiNQPWBSqO/T0lKHGHNgK74o0R8gK2gS9bIuTMFxn Zh267WP8RC5LdQQd8tmwQjpv4RzJ5B/fyJ0DR6LbL0xKGTM/J5PM9c6cDkf/nz0UAwLq MeYrNNLRTaK120rtF/49J63E21GDNl2DL6hjz6BW4rkIlQEIawN568tC/umfYI2gbHxV KgCZE1K+ainAOC7EbIQexwTw4i/+eu2zEzIk5aqoUl/E5mqZp1xsqA9Z2tgN604vnTF7 q5g4uoG4hANPCRVUBz5ctLtIlW+R8X0BmTe/styFwgaBR4BY5sZHCE1aUpsgpU+7d3ms 6Gng== X-Gm-Message-State: APjAAAUNnNMcaL5cfVc2nvzqRJO87sKpokgpoHPoeo/LySzr5RG41vuc P2rH6024/W3oBi7RpfAzLvJXKukOawsjpbLrev7cdi/L4oQKYc965lAB9tQceJ0h67Eac5v1EFv Ct3sQ/RYiGgelfxp8UTIBFAwc37zm2lDpMPEKtFnQGrp5HBBRPPEA3xFdet0jkOVJAoK8 X-Google-Smtp-Source: APXvYqz6JqCoH2euzJ6VhbYChbVlJpeSQTkC74CH4EJZ63p28zn6y+zQfmwQGZCeMBIkbALCxpSpX9yCjDM= X-Received: by 2002:a1f:3692:: with SMTP id d140mr11969357vka.88.1563280093037; Tue, 16 Jul 2019 05:28:13 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:15 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-7-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 6/9] drm: sti: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@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 12:27: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: 11046095 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 4B5511395 for ; Tue, 16 Jul 2019 12:28:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C96E2856B for ; Tue, 16 Jul 2019 12:28:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30A7B28581; Tue, 16 Jul 2019 12:28:19 +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 CDF922856B for ; Tue, 16 Jul 2019 12:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733300AbfGPM2S (ORCPT ); Tue, 16 Jul 2019 08:28:18 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:37535 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728470AbfGPM2S (ORCPT ); Tue, 16 Jul 2019 08:28:18 -0400 Received: by mail-qk1-f201.google.com with SMTP id k13so16740553qkj.4 for ; Tue, 16 Jul 2019 05:28:17 -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=SJ++/Ti9PPFavM2ItLAtAvvcfstmOio46YDlE3SvqL+/BIX8fcyV0tnIcuHkEQEdQL OQmV6Ijg5Se54V2IJc/xhAr6bg+OadhWRI/LIo3uYBhNK21olpG/SHyNJ7MJmHzK62Lu /A5bmdFlzqbFg4mlwTZAUADBdqdT+CB1vnIWFIW8bp2CzPBwwtG990suE8hHXuEYDeKS IocHuHCDT64VP4lEckJixgVeNNNgsp5PtTkOsYGn7vnBUSFTFnd3/0OKyPeY43mYg3/T ajDT0tIlZtve/we8WWWmz6RzKTmEKYQ4tTqCpixS5VZXE488o3pKnJGzs+ezgdjasKjc aNpg== 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=MvDlgxoyBnRfculPMToCO5+ky13hL8m6tyKnPCbcmM8tBHqCFVl7nyF0PnXMX+55W2 L0fdZBeqwP3wq3di4ebw7DFDsPSngRjJvBRVbY4wksR9MxXgKQ+abR1vKWXrtNwfUBpb KSInYhP6ZIr+e7LWBHwwUDvwGpOpIowetnYkfVZFeEkvoD2WV4OretWHFQo67k4Qi5CS 67dShEKJCxCzY1V5bpwLMJ6sGQLYbKoQrg9tqjy+eNt3Cb+u/ViZavvv3WNCcxWK2oJg BeOcf7tH9lj0WDY2KpnP2EZ1T7tv6db41LIpMtRMarYDeeWkoKns7KNf0GvZLWEjeNCj kxUQ== X-Gm-Message-State: APjAAAXbvOtIJWOpOWjvitJfFG/7CUw9lER/SvQCFTlPezQwb6itjW8v VBlhQhimutOY0gN3c3YWcXVWLnnWOOx5Fl8ZiCuWSfhNTAfc2hWNNGpUeEK9Kk6eAm7lBye0xxr YHnnlD2djPdGRZZPgfY41s/GhDmxzd2qR6kBXJU5Uh6CzrUdjtX1rDnARYEk5YLuUDS8r X-Google-Smtp-Source: APXvYqywKZKS1VDswZjPBXsCxkchpujcdbXfau/GHC2N6ts5XT54aCya3/XtyWNBX4Co6IP5bCr7a7wfr14= X-Received: by 2002:a37:ef18:: with SMTP id j24mr10463517qkk.293.1563280096861; Tue, 16 Jul 2019 05:28:16 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:16 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-8-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 7/9] drm: tegra: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@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 12:27: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: 11046097 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 A382B912 for ; Tue, 16 Jul 2019 12:28:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 941F92856B for ; Tue, 16 Jul 2019 12:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8874028581; Tue, 16 Jul 2019 12:28:24 +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 955252856B for ; Tue, 16 Jul 2019 12:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733192AbfGPM2W (ORCPT ); Tue, 16 Jul 2019 08:28:22 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:44625 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728470AbfGPM2V (ORCPT ); Tue, 16 Jul 2019 08:28:21 -0400 Received: by mail-yw1-f73.google.com with SMTP id l141so15953398ywc.11 for ; Tue, 16 Jul 2019 05:28:21 -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=KpZO6vnxGsix12qC5GYG5ya2j4U2BeieC1jfTivdYeK9V2Pf5TkgSycnmH2fvhXmPJ w5SR4xYA6quFbbuFVifOHHUnBN4rXznbpgde1TN4UOymiYvyViaGvxPMXF1moo8uB1X9 ZGwOJnIAz+ef5P+ruxgib7JBmsw3L2IJ6LR6G/nB5nPF0cqEX8TnQw+WVNnI5upPITP6 9VT8gRE58M+vMFztaewfAGnVOe1BiHTiXRQ6Yp8P90a2HuooR1T50E1vklNGyHk5y9Qb KyKwm9qQfHbj7f30/X9L2CYGqQnceEQRZYTfwqMJmUktrGyp2oQtrt9I3G6qbuEhleG2 XrIw== 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=fr+1hAzujGPDy/OMp0Cor1HimVT8PeT8ZnimyeMuzOeYF8/HFPdTa+oqqum6MLLFCT GY3GCYeUXDM7WYWqWPY02Wu4sI84Nd7gbioRFBl9eK425nMc4wb3atfa2jtesPytOXkW LiX71EdbDkVtigfC4h+rJphEnEePXeRMCK73ImdRfYqHfOxSbq+rUJgxkvZ8+ssI0JIX 4b8uq4sR6kEW9bkWO94an2cx37U627b4sbkd028dy2CTU4jUbV+UpzjiI9LndfsueGsP UzMlTmuS5+vNRWUgFpS2ddTILXnvVfEPt/i/PpPNLj2ewtEWllRCWnqjrX7mmlzr+XwI VIyA== X-Gm-Message-State: APjAAAV0dKdM8KWtIsB8adJWzZ97C9bREzAwPJTyPrfmi+P0hSCfPwDa c/jxZ/soEkhY4zyYSdaA3ZSLK45fTIWWFVmT88Toomzk6gsej77OKDry9DGY14cGPI+WcGXYZOB MewRR9O7y6KFEhtHNx+AVN3DkNTmeSztbmwmt6xRmo8lqhrOWf1wpxTAt9CPYd6iHROqH X-Google-Smtp-Source: APXvYqxKUE2RRCjqJx2Qsq4nX9XfQrlE674+nMl3rlp/olwFA//6Ff6OVECyOuO9RFtEPzgmBwM9TLSm/vE= X-Received: by 2002:a25:5744:: with SMTP id l65mr14608470ybb.467.1563280100734; Tue, 16 Jul 2019 05:28:20 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:17 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-9-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 8/9] drm: dw-hdmi: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: linux-media@vger.kernel.org, hverkuil-cisco@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 12:27: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: 11046099 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 B94A2912 for ; Tue, 16 Jul 2019 12:28:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAEEE2856B for ; Tue, 16 Jul 2019 12:28:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F7C528581; Tue, 16 Jul 2019 12:28:26 +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 3D8C22856B for ; Tue, 16 Jul 2019 12:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733302AbfGPM2Z (ORCPT ); Tue, 16 Jul 2019 08:28:25 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:51804 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728470AbfGPM2Z (ORCPT ); Tue, 16 Jul 2019 08:28:25 -0400 Received: by mail-qt1-f202.google.com with SMTP id m25so17786256qtn.18 for ; Tue, 16 Jul 2019 05:28:25 -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=kIm2tvyac+/+nfEGaoZdJDLH85wtK0/fbcRtZ8b56gPR97iANMn5zSS1ihyogj9AX0 Kx1l3LBg4pNcDOyhhPl5aE8JYaob7nzUPj4FR0O+jUtCq4wrXCJoM0MiKzNfVNKAX/XE J1MqydqecxA9ZbW5Ga3vf5loetymzCbCiitX0OM4QEK9h8h4FrQ8v7fAOCVQTBInZ+08 aMt3Bxfdt+4vVEaGaO67oTa6S3U0Tae/TEa7kxEvRyfuaIcmDyD/tHdnXyU7Ha8Wjs77 2QBcZaIH2wl1dECWZSUrzgU4sublZnW/+Fcon41kziBwfDNViyk9QIlDSw6M8Ibdv/mW INKw== 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=iTLo20oLwRhhA8vKPYOi/0AVyTJB0j3BEsMOqhqvbAkqNJEPm5GfxVspO4dYUq0hz5 NgLwy0DfX4vYkyQdQe9N++AZA3kgI5YEcwtJEVrfWvQvNVJjs7QKLrzUD5bFAs4+rmmd do60LH1PTIOFzrQuzKx7NlvmuoJKifxynrVr8JGMU9gW8Sar1IR7Cc8P5mfFUsT8sIQA TroMvcgLHfkcGoFvU8OTG0WcpRwth/OAtvRWCBleKzB8NMrO2H5oWrbfOGpCE5uR2quE 81eiSV5l+XcAH7zEqFqy0V987jRNIRv3Et1ed71UntnMarx8/phucgDsutv2E3QQzlUn DPcg== X-Gm-Message-State: APjAAAUp0OLc/enE9YrDkb3CSHdtXqUPDpRCpBsn3AnNLRAA/MfU0pXv emFhWasZqh30Gi6In6yI7h5ZS1cuOixCoTHmsNrIZGx4io1ngf0XanUi7Cn8qaIjcEY7Yo5hSJB v5+WMkmWUPjTM2ZN48ZsM0EAuJpgQN/o3DoptkHHSTJWWkMng9sDva8GMKCt0jVhAq17/ X-Google-Smtp-Source: APXvYqwjt1TdUC43jBRhxNtW+XlUFeUr48vYYrtzuNw5HwS65QX9Td90PPprvPYZ9QCX/i/lZZYWFC414+Y= X-Received: by 2002:a05:6214:153:: with SMTP id x19mr2657968qvs.158.1563280104595; Tue, 16 Jul 2019 05:28:24 -0700 (PDT) Date: Tue, 16 Jul 2019 14:27:18 +0200 In-Reply-To: <20190716122718.125993-1-darekm@google.com> Message-Id: <20190716122718.125993-10-darekm@google.com> Mime-Version: 1.0 References: <20190716122718.125993-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.510.g264f2c817a-goog Subject: [PATCH v4 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 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))