From patchwork Wed Aug 7 08:52:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081731 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 4E751912 for ; Wed, 7 Aug 2019 08:54:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D49C289C0 for ; Wed, 7 Aug 2019 08:54:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31DCF289C4; Wed, 7 Aug 2019 08:54:41 +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 441F7289C0 for ; Wed, 7 Aug 2019 08:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726902AbfHGIyi (ORCPT ); Wed, 7 Aug 2019 04:54:38 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:45111 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIyi (ORCPT ); Wed, 7 Aug 2019 04:54:38 -0400 Received: by mail-qt1-f201.google.com with SMTP id l9so81345087qtu.12 for ; Wed, 07 Aug 2019 01:54:37 -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=bpoBrPVBTZJE9yVo9K3tdUXrLCzODmTgxBIGcxm52AY=; b=JLB8Bevx5gs0fRPGOueftiX+yf/mU9VJFH4TOrSYaV4rFNMNKnK1LfOrbU7xl2W5sP gq7PjbW/2Twf3TKuoDyMJbJRIER7TtjL6OkTsae9P4byjfY+ViUx8cDCm9QZWf9d1yAf 8dVFmV+/fpoZBiH5QiWyyJ+XaS10dWD2VOMYs/tWurCdZLYLNx4nLts+qkMLOlRCjXF5 Pb6LHuaJ0vjQrHGSzdnabSncNPZ43LLmSJjy0yKJ7KQ6NQg+mBKo5MKY1XfvnNyTzsO5 SAATWUHLgD6D16KzXDI/q+a67tCsncp98F6PovshKqW56R/qEwB3/O8PMj+SdD/0R1vY Slkg== 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=bpoBrPVBTZJE9yVo9K3tdUXrLCzODmTgxBIGcxm52AY=; b=NUAoovvqY2OonMzq8GUTlojLip27GMaUK+2gYjDejZNXNnwQgm4rZgvXBTZKBtUVVu DasofqSQFudrxNvEJLUazRKQ8uEuKKC6KzP2IuLfWskfgflfYquwjWaH6NNqBlhfespc QjFCUmeb0uMxS6BC2rsqH7Wgw4HH1z7d9kBXdCcs1XivoBAeUrZ4uqdQFS0maeVltD1F W1O5uGfVi3QQlop6qhE5A3Vp9mGpcgCsAbKdVacBBWWmowz024ptWAmMaO6E+qhUqFJM QZnYDxBkZQgcD8gDrBfy9N6dwHpgdcEjaxkwH6MBXbbwARl1/stVIxmDKHmjKKH6LOB9 XkYQ== X-Gm-Message-State: APjAAAVJlq0MZC3ZEXQZ0DvplxI4886nCDi0niGAJJNP58gfkbhUj+ZZ PcOR0AL6MTQNdjUwOIRZ8Oxl61WlgdKTbednCHPgGWg03uPtnDtiyLRQ4ltfUvBc588v34dLzxg d1NdGhVlkeGDjJXOOqX5eJJX19E2fo4hmuxjm66bhQvVyTw5g4cFo1z7e9nqNPKrAOf+5 X-Google-Smtp-Source: APXvYqxwLBHh6RGlWO35BTMEPKjpjhKOVUH8zMWsCE8QruUDXhPZIpoNgledyLYyh+JiwND8pu1MI7EJg20= X-Received: by 2002:ac8:2c8c:: with SMTP id 12mr6960244qtw.137.1565168077407; Wed, 07 Aug 2019 01:54:37 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:24 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-2-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Tested-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 Wed Aug 7 08:52:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081733 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 9E7FF1395 for ; Wed, 7 Aug 2019 08:54:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D94B289C0 for ; Wed, 7 Aug 2019 08:54:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8219B289C4; Wed, 7 Aug 2019 08:54: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 2DE65289C0 for ; Wed, 7 Aug 2019 08:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727171AbfHGIym (ORCPT ); Wed, 7 Aug 2019 04:54:42 -0400 Received: from mail-vs1-f73.google.com ([209.85.217.73]:39959 "EHLO mail-vs1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIym (ORCPT ); Wed, 7 Aug 2019 04:54:42 -0400 Received: by mail-vs1-f73.google.com with SMTP id v9so22825379vsq.7 for ; Wed, 07 Aug 2019 01:54: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=SB3F8TZYhXPlmL6l2l4pVDGNIiypiEu1RaEyzVgjWH4=; b=HqwAlDP4zZ5Wkiapdq9PLDACOU2zVk91pmEx2kkMo7fMu1s3oFV8wvnCPvNA2mEyll gEpu49b+ZgIVxaspKOv9gtlhFkyxDWtpU2KYqlhi8209tlibnNIywSW5h0NdveMhiXRJ l7Afl5iFRRxwG46+ARPEBk0qk4eLYp/HavJcbG2XvJT88/73D/TSV/3XFjSulULmjdfe Uc/u8YAa5dGzjmPvBIkPI4tapJuEsCscpjMZxu9xbFIv/QXvJKA7Xnixf0euzLqA/53o QUzAkmX3mlCxeTnjpGdKQichzZCaj1aW+dN8lAHMVVdfFaeoAdHZ79XJ6T9dcvCmaNFm GK2Q== 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=SB3F8TZYhXPlmL6l2l4pVDGNIiypiEu1RaEyzVgjWH4=; b=Qqv2i4L/pAHGGfdyDoTNa7urb1lGKpVI7ZxsMFTyhC3ui5VBVSAna9MpYMYxgQu6yA KZv+DsaPobpnSz4EWjqZBaXxUycUzumZo7GN6p3zMLwqiVxjxkXCrpTb6C5WuZUOh5CN Y1MDpbG4DJO1DWKqC0F+1dj7p12m/o4NoNS3mGAqcnWKBxCxLxTVbfp6mMcfIx3qEo5/ 6wOU5TDgp28KJXrfyeVpqJoMDKAmdSV/9raSN1dZ3S+WD6/YTRb6hmH1G3VkvZ4LRQgu Qa6Xd+pMfBW43aDHGjEH2ycjvul6dGNR5Jis0yDOd6iia+u/sqSE00+VcKa1O1cqJd8x pZTA== X-Gm-Message-State: APjAAAWkAqcYzzKUnEKDnuMzHky/VLhJbMn8gOrPJ10BfFsj1xBGwKwh yzjplQWuP0VdgkKDX/lH1kLMDnO+quU6RhhLeWBbREOuO7YUnKeG9cnJk2s/fLODHoAEE7AVRDE t9o4Z5LpzGo/R+Z9y7Xbh6aBVNsGhXMNJbNGEiCRl+BScvTwinlSbZotl7ElNP5mV5EIn X-Google-Smtp-Source: APXvYqyP2o76MbfNxMdFUXTI1TuwFxd+js9nuLhn0YTyHXliuwQoEuxqzeuXDwPx6U1qBjTKji8DJiQBpE0= X-Received: by 2002:a1f:2909:: with SMTP id p9mr2932712vkp.23.1565168081028; Wed, 07 Aug 2019 01:54:41 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:25 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-3-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Tested-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 Wed Aug 7 08:52:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081735 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 39B801395 for ; Wed, 7 Aug 2019 08:54:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27D3F289C4 for ; Wed, 7 Aug 2019 08:54:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C9A0289C9; Wed, 7 Aug 2019 08:54:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 34123289C4 for ; Wed, 7 Aug 2019 08:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727453AbfHGIyp (ORCPT ); Wed, 7 Aug 2019 04:54:45 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:49092 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIyp (ORCPT ); Wed, 7 Aug 2019 04:54:45 -0400 Received: by mail-qt1-f202.google.com with SMTP id x7so81595306qtp.15 for ; Wed, 07 Aug 2019 01:54:45 -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=tYzitGZaVbEZqsWCVoM4nGJXWDHkLAxcBvoGyaZfPDw=; b=YC8QKxzgIX1jfg1zNl8Yv+YrpOUt+X52YrCWyr4QEFu3zNq9aCfuN5Opwmn3Y90gpk Xs00rs1SVl84v4bmJWvYlCn/ZFY5XpUVvkJ9rmLArf8XEJXxc2YlSH9ldA74gpGe/RJE ZhAR5TcN0D1tjrtkVASaAEMxWPVigJnUPMpOpKKUqS3HkdC9V3vwHg0lG8G7uub5o5nE YjWTdpVXsPRPt5W01HawEMncJclyjg5IGI4DlEJA3CT5g0ngF6FapDYqxzqsOrQgT9Tl xIR2YPSzsZM69c7eavCQ2RJyALkHL5MqEihAfYDbhmN9nGqDWB2kFkQA46AzMQJ53u6K FDtQ== 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=tYzitGZaVbEZqsWCVoM4nGJXWDHkLAxcBvoGyaZfPDw=; b=pbqLD7Z5Zey2HRgCiilvszVpllx4CzNwzpBLn6e7QQ3USUt38DdTs/oSG2QanzbL6J aQpmwOyUZtsVFUjVsU5Kc58Ffw5GcU23Hbs9RrSu8AXyTJIu9vhpHFHgwVBx0f9w3XkS hZGePSM0fU0BU6yqhj/ek1lX4FGvfNm9pHz4igZ+23Taqa/IeoNQAWWWJ7EGNNfBSsb8 5s0GCsUcjVVniI45fIS/7UO7ypqa/6GBpeE43HRksIWsA62lu8iiiohh2dMSkDkvXuyx vn8+uwhjaRljlbY+m5JBEYB9/YnsXQn5FPqhfVunmC031aL46cDfgCYcDkaefxtya6uz TxoQ== X-Gm-Message-State: APjAAAWbcihoGohl+nS0edRuxLEGSbYW7WbIHz9k/Tu030WOPM3V5dpL NYPIn2m+4zlBWBjn620NMiEzJkjFmFD4Q+sEsXXCHqRZx97Z0vtzfnVDUCwzaeNNd4F1ln51kaI bXHtC5f1wKysDQhnnOLL/Xhf6AAxicesemkqzDD2TS+RSi3mkBljig3nZHzkRrmw2dHqp X-Google-Smtp-Source: APXvYqwxckXYeuLUg6V16q1PEJ8QXThl7Pgl4CPiQMQA299wv/5nSvVFOqCLQ7xLFJonpuPaSN73bj7ZRR8= X-Received: by 2002:a37:90c1:: with SMTP id s184mr7228671qkd.217.1565168084723; Wed, 07 Aug 2019 01:54:44 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:26 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-4-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Tested-by: Hans Verkuil --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c index 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 Wed Aug 7 08:52:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081737 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 7061B912 for ; Wed, 7 Aug 2019 08:54:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CD60289C0 for ; Wed, 7 Aug 2019 08:54:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FF30289C5; Wed, 7 Aug 2019 08:54:50 +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 EECE5289C0 for ; Wed, 7 Aug 2019 08:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727501AbfHGIyt (ORCPT ); Wed, 7 Aug 2019 04:54:49 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:39381 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIyt (ORCPT ); Wed, 7 Aug 2019 04:54:49 -0400 Received: by mail-qt1-f201.google.com with SMTP id r15so3050948qtt.6 for ; Wed, 07 Aug 2019 01:54: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=7yz5TvIjUhkFsaJEChG/sQWYugSPGGNdhiYIO8s9O9w=; b=htE6JyTY9SdYOmLfnf523OF9kj2NB6t7ODA70xsKxzOvmqmd26SkZ59p28A52cm5wB IXxIpFQwMKZr5yg+jSAoo3GjRNjKTXDsyjX9t1/srW4A8J0ueIxBqBYVtATaBdNWd8Oa +auQIWZWtsUw8PnOKw/0nJTX5DGOG5aJjZP6h0Hjg4tuE2jFXixE8yOxBaG0N1BIirO5 ZjoFnxr15dOogmaZNxGbCiZDRHkzWSc82vy2jBzv7jG6TayYbWa26VAjrvowswbLo+zR ICJ68Omb6vNQbzp0iuAL+b3eL3HTfZUZjv9Yj7vh9Ojzna1krVZ3z39ozHSGvCvfwIHL q/Bg== 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=7yz5TvIjUhkFsaJEChG/sQWYugSPGGNdhiYIO8s9O9w=; b=uCl57fv5jObAnRHYTmJShomrUDFqh3sYttof78irNXxMBNEhi/LjqcpQBwIPacM5vJ wbhK5vx9mXYcAH3eLiFlJDYQLHjZYOsEJxEhP9758eRIp4LgKkJYjHBoeO160lAngirN DPMV0YcWI2lNgIiWyUKw0F04nx2/sunlhHzcGfJiUHTfxeyJfYEQdbY3ldwj48mj8eFw 8nsEYd+EO06A126J4uOgZ3hLR+tdEMf79UwkFxEQ6JmAzZp5/RVrSxIoQbjya9UemXOK iPqu4HD1mfG1a+rg8n1SF1I9zLRaqu8jfnfnwD4C+2o1Lkhz6L7Zbpw8CIyl2e/mqV86 ZnXA== X-Gm-Message-State: APjAAAXUCS1lizf0qSIg/cHrybVOKKTqg6iP9xgjDqIkarb65Rj6jfWP KHayke8g6KkN4CXcgw8dqEyzDeVSdvHpZUygoSnxp8HB+aLNDNrWwiyNoxMeTUsT08mmX79QTGL cTu4C1stKCBoph2FjW37HF3ovDguxBaWqg+S/WotW36v6dohUbf9mJhTZa/oOd0ZGd7Yp X-Google-Smtp-Source: APXvYqwsyN9JX7aBj7yupHptnoL42fWrUg/lVg1SBYHWSVo6VIvUXYf5K8I7eFOXS7CnQeDAYXUQ165evhI= X-Received: by 2002:a37:aa88:: with SMTP id t130mr7379750qke.12.1565168088423; Wed, 07 Aug 2019 01:54:48 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:27 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-5-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Tested-by: Hans Verkuil --- drivers/gpu/drm/i2c/tda9950.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c index 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 Wed Aug 7 08:52:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081739 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 58093912 for ; Wed, 7 Aug 2019 08:54:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4753D289C5 for ; Wed, 7 Aug 2019 08:54:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BA2A289CA; Wed, 7 Aug 2019 08:54:54 +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 D4E44289C5 for ; Wed, 7 Aug 2019 08:54:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727522AbfHGIyx (ORCPT ); Wed, 7 Aug 2019 04:54:53 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:34667 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIyx (ORCPT ); Wed, 7 Aug 2019 04:54:53 -0400 Received: by mail-vk1-f202.google.com with SMTP id g68so35695070vkb.1 for ; Wed, 07 Aug 2019 01:54:52 -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=WKoE5Si3IbQGZAiEkMWSeCHd8THwHQPY0EBsGX+tSRY=; b=ZbQYfTisi+DVLG5aBLx0lCfIDtJNRFGMqQRJbWFPEgoOzUjS1GV8YvgfP91QWYo0I4 ILfmw+2WNWRmZgLLN+7OyR9mnMyheYng0jvvu/0sjlmAIrpqk+5ebRGhwSQhrzoytw3I CgUZ//rsKD0ALmgpQlVzeSEXJ5GxlYQWXGzw0na000NVOboxocscggcXVZDSzvIW6Pkc BCvei55p9qHO09mJl49ZF6ubo4EHjj3nu+Nr/kdTrWJ2GIFlZoJcrNj0e62slF1baexH vjPoh5HpBoPgb4PZvjpLqe6YPTvBi0jkXgOhXzFgaoU8zite5asaYYU6tQm7bFYZeRo0 pjRQ== 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=WKoE5Si3IbQGZAiEkMWSeCHd8THwHQPY0EBsGX+tSRY=; b=ZJTgqtYhkvzx9GIW8pNyl8c3L2NzpXgq3KA/pNB5G7Cvkp837qfs4ht+SO8nKZlmiT JJ+VidILCKdk3rr9/a8FD8k1BJAnXJJhPDO9wIkQu0bcgNVxTGWKQsL3V6QSNwx0AXh/ 0UgVHU66iQf9hjv03kePDhOC+7splBuVK/99rf1838P8gVblvjBaMtLpaSKTYeEfiM87 yESGXEPbmhO6kjWdWsKP3Rra3Xd0w155+PKF5Kox6DMWqg3YmutHEmtw0ItS75fjQPqC 6SFVu4aKn0uQg6rSvGaBEOPNIeMBHsxhgWwLZtJ4VJ3H6S2pUpr4NAxy0XE1EPQ//lDF Mxhw== X-Gm-Message-State: APjAAAXO68Y5G5r1KiDGBclHk9C1Vk0O9CrRQq/zOfab5nuXr3ox7Hen eNgmG7Q8KT2DxReFG/12tggifLwB0jA1HGRdn49afc+auV6gFmNgehe5+hws6OEhKWzx3am5Jxw q5eBht0Nc6qQD4nv2ISm2lm8t+wGf0Iww7AFdJ0Tnwt2lV6uR7Zq9+CGG4L+P5BUsdVQd X-Google-Smtp-Source: APXvYqx7A9OoyolLBYHv9lxwrnZw6OVvjBR+UWxqxP729c/3SFjSRojJOQnRq+EL+/Sj7t55uUfgs9JDTFE= X-Received: by 2002:a1f:5945:: with SMTP id n66mr2941678vkb.58.1565168092095; Wed, 07 Aug 2019 01:54:52 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:28 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-6-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Tested-by: Hans Verkuil --- drivers/gpu/drm/i2c/tda998x_drv.c | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 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 Wed Aug 7 08:52:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081741 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 27B5C1395 for ; Wed, 7 Aug 2019 08:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1779A289C2 for ; Wed, 7 Aug 2019 08:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BFAB289C5; Wed, 7 Aug 2019 08:54:58 +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 A8DBB289C2 for ; Wed, 7 Aug 2019 08:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727642AbfHGIy5 (ORCPT ); Wed, 7 Aug 2019 04:54:57 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:52287 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIy5 (ORCPT ); Wed, 7 Aug 2019 04:54:57 -0400 Received: by mail-qt1-f201.google.com with SMTP id d26so81695425qte.19 for ; Wed, 07 Aug 2019 01:54:56 -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=vs1a12otLFeV2MsjfkbwfxhNwOmJxVaDVrzJ3ex9GN0=; b=g6Jwa6gHxXTCrhx5mS6zWncGX1kP7YS0XEx/yW+U+9BahAt2ud9xQVxED8DgDE9Ohh MLh18AL3kQavBe3z+1eZekCF+7+5KPmf1c+EAmufagg5HThKb3k9bZt2CdQQJ6oxwL0A agGrlYFjTOqXXIHFyf7p+0i5J2THuYuXhQZ5GGar4DEpq7MFlaYBx17fNDUjAwAogmuk sXf+EZxRjkbfWeYZkVm2OxOJuJlmJAtVRpq6UpFW2MLzPii3CrApMQhdYoGEjSdaf8aD N7qDYW0celAc2s/s+7VnLjkv2S3qsmQwt9J4j4ttnDyIpwfNQT2T+YKAozIj6oqUpvZA gEsg== 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=vs1a12otLFeV2MsjfkbwfxhNwOmJxVaDVrzJ3ex9GN0=; b=puqHbbba7R2vB9ggrGeEqPLgadHcGCynPP4n43iPb6rcEe8+KW0S5cIm0r2Fh98p2W AAYkjwMfkuHZeUIb67cSJPAro652dwDFCc2AotZuG9iVoFHdv0VBFJMR9T4sLDJhV+pW L0aRTxL+GJxwjjoGFoQ+d0tL4SDqXX7AaN3fIBpGfYW8H+MwY4Y+V5vULw8JIikajbfH rcFlzWPR5sbrdMC4mrPPixBU0Hk6tp8oP9EGaY9heqZpH4eoebAz3xbiPxyMnx5kPzMo I1Wv1E3RrkcyF1S3HCn8f17/m4ZMJUNws0Xbyua3bKYwGeyJlUguIclRVdrhpSkMDFtz +BoQ== X-Gm-Message-State: APjAAAUJUPxrzodirREKAUaxYPuyKe0mUbDVCh9gWQI21lmeceoy9QRY 8ZuRKerKG+g+WYr4A/LXH3cKNxTpKGpH1KmXDyVuyTtKib1i+2+KHiMSh1K05+EBpj4zyfoFr4p ltlnOx61EbZhPw0sNFQhu1JTRDSVV7cAqtETUhPDTX8J4x2RTiGT/MWl9ZGfRtRLkYaof X-Google-Smtp-Source: APXvYqwblvd9hqb20nELJN9NFJxuBq3p2Cf/2BRhMH1j1/EL/smobQJS0J7yADNJ52S3Un9PhhTaE113zOI= X-Received: by 2002:a37:474b:: with SMTP id u72mr7378611qka.470.1565168095947; Wed, 07 Aug 2019 01:54:55 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:29 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-7-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Wed Aug 7 08:52:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081743 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 D58D21395 for ; Wed, 7 Aug 2019 08:55:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C51DC289C2 for ; Wed, 7 Aug 2019 08:55:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6978289C5; Wed, 7 Aug 2019 08:55:01 +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 60222289C2 for ; Wed, 7 Aug 2019 08:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbfHGIzB (ORCPT ); Wed, 7 Aug 2019 04:55:01 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:35237 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIzA (ORCPT ); Wed, 7 Aug 2019 04:55:00 -0400 Received: by mail-vk1-f201.google.com with SMTP id g2so38986997vkl.2 for ; Wed, 07 Aug 2019 01:55:00 -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=r8K6LICfmoR0+5wTOuaiOzjtq+oGKszmcNUI42hpcms=; b=SLyqef9Q3HeDC0I6b77tXI/tMPRaoZY6/+vVU8rHuNnquqX1qvcqt+O9h0riXRmEYf Ym/yJrocjgp4DVP5EAlLfajZZG5r/vP+YtVWUOoRczRYXw6zHBl/5ujFsVk7nSvfIqch 5vx9SDKc9D5Gd79LHWH6iW3T7Dp/TfxgPUiF5+k3dIMiKvFl/kNgpNk0iS0J4pCiAzky zuimAMrTrVe2JQFriccx2Kmi+R5YtsSeb+jrNpoLXmm+RvOUgA+Ne818ENqTGwuFQvPR VE06BfMvDWbxg7LvbEE3Z0n8aqj04tYdNkVWE4Ow1ieDUpq7YlFFnh5ivtkz68E8+xJc +Mfg== 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=r8K6LICfmoR0+5wTOuaiOzjtq+oGKszmcNUI42hpcms=; b=berMpRshwFHOa6sPPiT6xBL4PZucqqdFMokxSaFnZtKiW9YWXtTRGnjaaH0ttLosBh TUuSdJOct1OEn70RZ7snaLE/RYNDQqKetMel6G6Ynce5JYDw0ldk1XTeACyBPimHuQUF pbL9Wp2H85cl3/ZRj9RhLQBHxBg1wO2DEL91m0PSddO8NjNscQF4FqyEdKm4GtDQ8LzA to4ebcV6MD9PSkqFAY4PA4BxHEhfKB24tfKpCTjqhg4R7JYHc4RauXl49+9IdAKGYxwO fcxlCpyKiKKJ5mwJbfSdwBZXbCXBN/4m2btF5VwNnMse011bHVp7naOpHjWzYN4OWPv6 2CCw== X-Gm-Message-State: APjAAAUMcR41qaD/7LvqywdfmX37rknqggaaFicUT1T1lV/mef04cOKJ ccWQDG/YBdkxYaltf9C8GGzJPC4Z9aSDRh9FV+EIpuTeKebic3rtDbUUgPqkC1osMFNvC+CF33n w7St1Fmns8SLIOlrFyXtPydK+87EZdvmdyGyXqcp+LBRtZJOqZpazjSKS9zncaI+2tId4 X-Google-Smtp-Source: APXvYqxlP0IUMjoX9jiPFMZh5NPu/yL62dH2jCIAouMNN2gM1HehFX84DS2w0i9udD+jxxvurNWrAJM1AOo= X-Received: by 2002:a1f:8513:: with SMTP id h19mr2931500vkd.92.1565168099538; Wed, 07 Aug 2019 01:54:59 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:30 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-8-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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. Changes since v4: - only create a CEC notifier for HDMI connectors Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/tegra/output.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 9c2b9dad55c30..13153b93626fd 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -80,6 +80,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) void tegra_output_connector_destroy(struct drm_connector *connector) { + struct tegra_output *output = connector_to_output(connector); + + if (output->cec) + cec_notifier_conn_unregister(output->cec); + drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -174,18 +179,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 +195,7 @@ void tegra_output_remove(struct tegra_output *output) int tegra_output_init(struct drm_device *drm, struct tegra_output *output) { + int connector_type; int err; if (output->panel) { @@ -212,6 +211,21 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output) if (gpio_is_valid(output->hpd_gpio)) enable_irq(output->hpd_irq); + connector_type = output->connector.connector_type; + /* + * Create a CEC notifier for HDMI connector. + */ + if (connector_type == DRM_MODE_CONNECTOR_HDMIA || + connector_type == DRM_MODE_CONNECTOR_HDMIB) { + struct cec_connector_info conn_info; + + cec_fill_conn_info_from_drm(&conn_info, &output->connector); + output->cec = cec_notifier_conn_register(output->dev, NULL, + &conn_info); + if (!output->cec) + return -ENOMEM; + } + return 0; } From patchwork Wed Aug 7 08:52:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081745 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 989E3912 for ; Wed, 7 Aug 2019 08:55:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C23289C2 for ; Wed, 7 Aug 2019 08:55:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79D00289C5; Wed, 7 Aug 2019 08:55:05 +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 16EDC289C2 for ; Wed, 7 Aug 2019 08:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbfHGIzE (ORCPT ); Wed, 7 Aug 2019 04:55:04 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:37483 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIzE (ORCPT ); Wed, 7 Aug 2019 04:55:04 -0400 Received: by mail-qk1-f201.google.com with SMTP id d203so213737qke.4 for ; Wed, 07 Aug 2019 01:55: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=rSoN9hjSxRIhqadFC45zbU01lHdfo22WQmk7pgd6Hws=; b=IObPTHV1GMvAaA7pSRb8i2dsFoveilicBcUFokI3xCuQbAYVPmJ0vhmCC3aXQHgWmb ZBsevIDh78sKNRXv0mioBFR9611/rs8+QNaqrjwx/zcdHc2BIckojSK5hy9XcEgKKSle //wdkD/B76/HyyW2i5GUJ7dYdkGGCFSg+u00842o2YIxyL6JbxzWGA+zS/E2iKuj26UH Yi4jxXYblqw//DVvc0rlp7Q6cinmI1kQyvk43cVgQmiyvp07U09t/gXzbkSmeKNWTu+c CRWKlZ78qHMGXe4J8zzEGZMM56dqBaIwQwbBrJccw61MQXCTsJQgNYlZ2ZhOiNxAS61F DqDw== 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=rSoN9hjSxRIhqadFC45zbU01lHdfo22WQmk7pgd6Hws=; b=l4Q9YNC+S49HgZ1wWtFsXHMjxUZPaQf22+qSHjk+yOOnjeH8SprF6U1Og8XEGFW/ET DWcNSOfFTZn3rKFQz7JXPG73M0RLRskLxFkuLJSNIbDelppte5g4KR3aJL5/WwTwK+Y+ mNpC6e1kxrx6yw1hUEohFVmYaAVWIsXCpx/51RkKILHybDBwLQX03CUmwf+okEkrkgnv yZbxk0HCbz3MUSzy3JWSWkWSt23zICMuegUsnw2yDnC5yJO96PI/rCuJQ+g4S2EBG7WB nXr1jbVPYeUH8A1C7eZWteoheZ/JdgVtiR33K+lIrJzMWDChvNVoAliXDkOwwheU35x3 AW7g== X-Gm-Message-State: APjAAAXTfSJYUCciTca2zjO849PaTT9LEY8GINlPvsdKz1BEObSrbpUI B2CsJsW680WrWqpPmvpNPXepTmJVB4heJb2pXgAzMJXg6qHmJ+eYqQd5EsAx7AwIu9NfZZDPN/q ggDqix2tuz60WET6kW6plt8jrFMBxh86J5L+fLl92F2D5aDprS+kYdD+gZYsNZrDnKWU1 X-Google-Smtp-Source: APXvYqxk4KFT1/urykdUwXAUUrIOrOJ90FOZxCw0eG0M2t35QVYKP4uYumZj8QJToJlNkFrHMkA4MQ2byL8= X-Received: by 2002:ae9:de87:: with SMTP id s129mr6887829qkf.485.1565168103384; Wed, 07 Aug 2019 01:55:03 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:31 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-9-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 v4: - typo fix Changes since v2: - removed unnecessary NULL check before a call to cec_notifier_conn_unregister, - use cec_notifier_phys_addr_invalidate to invalidate physical address. Changes since v1: Add memory barrier to make sure that the notifier becomes visible to the irq thread once it is fully constructed. Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 36 ++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index ab7968c8f6a29..b7d0d9ad5f2f7 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 *notifier; + + notifier = READ_ONCE(hdmi->cec_notifier); + if (notifier) + cec_notifier_phys_addr_invalidate(notifier); + } } 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 Wed Aug 7 08:52:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11081747 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 8A9F21395 for ; Wed, 7 Aug 2019 08:55:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7928E289C2 for ; Wed, 7 Aug 2019 08:55:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DD86289C5; Wed, 7 Aug 2019 08:55: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 0A1AD289C2 for ; Wed, 7 Aug 2019 08:55:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727727AbfHGIzI (ORCPT ); Wed, 7 Aug 2019 04:55:08 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:45345 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfHGIzI (ORCPT ); Wed, 7 Aug 2019 04:55:08 -0400 Received: by mail-vk1-f201.google.com with SMTP id x83so38718173vkx.12 for ; Wed, 07 Aug 2019 01:55:07 -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=sT+6pc8yUdcgTGiP+s2HOeG1S7Q+0p5kuGHMT4qkvoY=; b=WKBf8ELbpGN9QA2Ux13ffiBX2ScZzfVlOxMq7xICtXIVMXzVs+cQ9U0JmIjqnUoktv ilRqBWv9exXEJrlE1ssJ5B5rxLkT1t3ynSxlIl0a2WsMMeJv88h8di+yH79Np83NUjir 6NUDc0+kn0XVU7nemrmSXnlQq4OyYR0YoLhyPjUsEDEqiy9Ym2quU/1ztQLdqW8OcyOj aO4A/D0esSxEZjCFIr0/b9DGIvHVrOWiLq3W3QfIfbKL7/SwS2l/DyaHzBJENLbZ5MlG 5hqeM3OeAIr/1400eXjSAS97DG/XzTl/4eKjzvfAF66SOYJGr4d5QTArh9NH4Kd00w8p BLQw== 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=sT+6pc8yUdcgTGiP+s2HOeG1S7Q+0p5kuGHMT4qkvoY=; b=AqlggOHpHivNnefJMU4MUFM4ARgpoO4p0KHyXbT7FXnOIp7XZP5d/WYjJF1vlyMKQf C8BQRZ8i6S8FW9F1z6pzdZnWZxjcKSCGYxLkWTOhOPiI13fpGnmN88XUwqdL2l2x3BRM tJmrAcEhxnogUCoCamGx9ee0uOqNjEoAwBSGSZHfOM3SNORNai+Lrp2UZSgyFjLmZ69A c8o202fGPSeJrHo60cJCdJnFyAo1zipImUv3NGUafoHRjU5C1MHhmsGGcioHaF6G9HPw HvAwRUAPgYlrNOmq9F9crmOSfz4Bl2nJoVplumoVFctaJ6CcgX43p4DBzS8WLCmoZI2i GBVw== X-Gm-Message-State: APjAAAXSPME28kx+hVfsxxxVOUFPaiabgznloZ3vs1Kn2x8QzRKtqMzO 79jDhR7raCtLWodZ+hG+iPyfW3+0gy9WLzMrbnox0tMho9j8lHkCoPYDbMLZafufh5xsX4WBFTF f9pknA5Rsmcg7KFbI25oCVmOpy90EneqPUr/sYr4sbl/iiBbXZQst+EqF7nJDKUp+zaxp X-Google-Smtp-Source: APXvYqx9bmqCZ205X2vBtH8OCRXXfDuYkDDVaGrk8UwvZI16qhNyJ636Giur/4hr/yWJBNSDe3Xtn5BLdPM= X-Received: by 2002:a1f:9f06:: with SMTP id i6mr794223vke.52.1565168107003; Wed, 07 Aug 2019 01:55:07 -0700 (PDT) Date: Wed, 7 Aug 2019 10:52:32 +0200 In-Reply-To: <20190807085232.151260-1-darekm@google.com> Message-Id: <20190807085232.151260-10-darekm@google.com> Mime-Version: 1.0 References: <20190807085232.151260-1-darekm@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH v5 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 Tested-by: Hans Verkuil --- drivers/gpu/drm/exynos/exynos_hdmi.c | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 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))