From nobody Mon Feb 9 23:01:53 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F6691FCFDF for ; Mon, 7 Apr 2025 15:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744038682; cv=none; b=ZwgQXRKRIrUEGugqECg97tjbvEJbwOIiot/YDqylS9zbmKERmB+PUD5ei7wZX70UoaZ3LFeb455aj0IqMqzSQQz8fBBIowi9/FTthYf9ynhwKLIgWI/TpUOY/792CjxNzAiIvduUmb32yLIa3gsBcrqazcf8Yatp2Grwcf9s7wE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744038682; c=relaxed/simple; bh=a9M2ccKyY4lBF+8BSsLul3wlaYMo7ScE7hsbV+oCgMQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Lw9lMVvxMoezzLNGU3jkEQZqmLvBo0IQ1Uoe9K6cPjE6l+mVBlRnrxZX0cURoNH4tWnTIGL5i7YEzJpl0J6X9bsH5OLegtwBZLr+3HnYZiA8mo+comKVAfO06XQZI6JYD6L6S9izjdvsF29g2K4Icz+8kIaLZ/DyamLO2raHSVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=KpBbCveA; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="KpBbCveA" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5378e44N028420 for ; Mon, 7 Apr 2025 15:11:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= aSVhAHFwCmKb4di7iY3AClytjvzIBCoWb8Y/fLrSCwk=; b=KpBbCveAIMYucmSn GUbrTB82KoS+GORDkDXSOyojMcBaU2q/O0VB6/JnTHXc3eUeXt3FZZ9aQb/ljmTF 5HH+lX3J4EKgxdGYFzg11rdO2JRQa3xDfcMSNkgzmh88moIOPmoFIXq02bpaCXwk OBK2rSocM8gc36EN+6hNPsYaCPFrJl+T03nhi8K/G7Tj1QDWg3sDsvRfPcsMfoHc Zb28fXxu5xk36unzu9uM7+JR1ot0pFW5CkiPgv+2WyghAaJksSQINtqqNOrSUcLl 9W9hGN/y8oMD3rR8FSm+oe3zxqV7CZjQ7LKIMq1XYIyBIKgaBDIsSf9Z3jjuU31o fj9ZnQ== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45twcyvn73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 07 Apr 2025 15:11:19 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c5e2872e57so854463285a.0 for ; Mon, 07 Apr 2025 08:11:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744038679; x=1744643479; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aSVhAHFwCmKb4di7iY3AClytjvzIBCoWb8Y/fLrSCwk=; b=fbwaePYSVIP6100Z0ZWtfMRRbM3bmRt+Tj6zw68TtkjOxmMkkTVQqQgiiZGgk/MjRb 2LmGSVeke2vpota8v0Vr36xnrQiII66Br8bpqUruZpSGQL+lQq0HNo4llXUOdlpOhSH4 ff6V2O5dImhsY03G46YNM4M5u+w6Ju2zykm2TprQl+TPmLeW9eTGc1c06IqlpY2K0r9u PaTX3Qi0NJ+rHiJME3P5oGyq33c+DTmad0YCpoG+u7N3rv1YV54zK7vI6IcfC6kdjoqH xvq9Jn1KcqlVcb9bsZjZmIVlls6HHvSVkahLEpE7q4OUvXbh4jtekdjIfEBEWmbgBeXh b2sw== X-Forwarded-Encrypted: i=1; AJvYcCUPpRAjogYr5QRwuMaHr73t93d9wmlo4Yaxobnq84x8Dlb9b+84Yf9r1L4PsYrjHFiT6v3o2C5a/Kn/3Dk=@vger.kernel.org X-Gm-Message-State: AOJu0YyudW3oB9+8fJLsXCGzm1KgjkfbgdANvTM+WrRPbzEsilEzRJzF sPRqmxL0ERxJLp8mfKmX+S44QT9BoS6j/53cnmgfhzRMN+JToSzlGKxYKNwFRS2oRqaRBlU3zRY aNKlY8Wj9zg627o8mE3r+xfATHUGx28hzL3Z/uw77rzt2xDbSpGTn5x869hV2h4c= X-Gm-Gg: ASbGnctSUp/B6a3Esw7ue9ExSvnysze8SIwgXOgv0h4XUlRv3paGNL04BOG8I1LzxNB r0Uu3doD9zvpiFqO6m/E6acnUajkYuey5KY+Mv3vDK5fGclO3fLhO7TlX2mkTHNm4q4nkC7PjwO 411WS57pcs09YJqZ2xqWVImB60KhEv6iv22mW+cbAATWJPkvANNPdMqwu/MlYNOemmRCNKd+CWc l9DDNNB9Ir8gwLE1RoMnjycw/R/b8S4B4v2hGToWsazO7XbOtX7vyS5+MCTKoQTJRZSeEZgSd1c PbXNQ7eHqJHuCziyLJi2AOwI4qVJ8tBd181+FjRZn8OGzNw2fAcZCSMKcX/u6ml4mSZQVGdSScF H5J/iT8mcaFNuQ7yE4rcZsErJl1aQ X-Received: by 2002:a05:620a:248e:b0:7c5:3cf6:782b with SMTP id af79cd13be357-7c775b11755mr2439018585a.54.1744038677880; Mon, 07 Apr 2025 08:11:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG00325JjCeNUWzFnxGMoZ5wQxn+cqq9N345OXEerWwQFBqm3ArKxIvh5oGMlCyWXKAO7hfSg== X-Received: by 2002:a05:620a:248e:b0:7c5:3cf6:782b with SMTP id af79cd13be357-7c775b11755mr2439011385a.54.1744038677393; Mon, 07 Apr 2025 08:11:17 -0700 (PDT) Received: from umbar.lan (2001-14ba-a0c3-3a00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54c1e635becsm1312572e87.127.2025.04.07.08.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 08:11:16 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 07 Apr 2025 18:11:05 +0300 Subject: [PATCH v5 08/11] drm/vc4: hdmi: switch to generic CEC helpers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250407-drm-hdmi-connector-cec-v5-8-04809b10d206@oss.qualcomm.com> References: <20250407-drm-hdmi-connector-cec-v5-0-04809b10d206@oss.qualcomm.com> In-Reply-To: <20250407-drm-hdmi-connector-cec-v5-0-04809b10d206@oss.qualcomm.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10704; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=a9M2ccKyY4lBF+8BSsLul3wlaYMo7ScE7hsbV+oCgMQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBn8+sElSqvMbteBjr/5uBLp48ns+u6zUDJQY9/G 7EUDF0jFrKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ/PrBAAKCRCLPIo+Aiko 1TgQB/4h6T/gmqw1lm/i7qnC5wFLztk7/+unzgQuoZHqwTsP4Ynj4oVaX1YbIpaopS/Kf1dZhrW KTpX6ymensCIUI4ZZBrTjZFn0+o8xH9itm65Yk8AIIiOpPzZ7kXrQz7XZII0ccYQIkJyR/8lrFi Ec9nHt7cq3QiglVa1gpMKoTICE6iwsgQUN51Md79rnlc9qL7L/eaecHaCtqat9FtQc+F/McAsfu UgRo0SL2mcr99XxQtSbE1kVI80s/QfxL9mc1tr/AyHLdyNIiABNgI7+DknkRYqDwBVhwwaxHoOr 23W65g9w2BgV6HBrCcOeJ8p45qxqHgLKMExIC/g0zI8CKqkA X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-ORIG-GUID: 8PhHs5e7raALMbHsRSAbJSgxeMj-8OVw X-Authority-Analysis: v=2.4 cv=Q4vS452a c=1 sm=1 tr=0 ts=67f3eb17 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=a9hgYIhf75voWPlnlJQA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: 8PhHs5e7raALMbHsRSAbJSgxeMj-8OVw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-07_04,2025-04-03_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 phishscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2504070106 Switch VC4 driver to using CEC helpers code, simplifying hotplug and registration / cleanup. The existing vc4_hdmi_cec_release() is kept for now. Signed-off-by: Dmitry Baryshkov Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/Kconfig | 1 + drivers/gpu/drm/vc4/vc4_hdmi.c | 138 ++++++++++++++++---------------------= ---- drivers/gpu/drm/vc4/vc4_hdmi.h | 1 - 3 files changed, 56 insertions(+), 84 deletions(-) diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig index 123ab0ce178157c3b39466f87c7ac39c8470f329..bb8c40be325033632d3e94db87a= 16b03554ad3af 100644 --- a/drivers/gpu/drm/vc4/Kconfig +++ b/drivers/gpu/drm/vc4/Kconfig @@ -35,6 +35,7 @@ config DRM_VC4_HDMI_CEC bool "Broadcom VC4 HDMI CEC Support" depends on DRM_VC4 select CEC_CORE + select DRM_DISPLAY_HDMI_CEC_HELPER help Choose this option if you have a Broadcom VC4 GPU and want to use CEC. diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 4797ed1c21f47992fe4d497d904ee31c824cd449..3bc7c4bd496b60ccb0c7dce8b41= e5cd9f01b18ab 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -32,6 +32,7 @@ */ =20 #include +#include #include #include #include @@ -375,14 +376,6 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *v= c4_hdmi, =20 drm_atomic_helper_connector_hdmi_hotplug(connector, status); =20 - if (status =3D=3D connector_status_disconnected) { - cec_phys_addr_invalidate(vc4_hdmi->cec_adap); - return; - } - - cec_s_phys_addr(vc4_hdmi->cec_adap, - connector->display_info.source_physical_address, false); - if (status !=3D connector_status_connected) return; =20 @@ -2378,8 +2371,8 @@ static irqreturn_t vc4_cec_irq_handler_rx_thread(int = irq, void *priv) struct vc4_hdmi *vc4_hdmi =3D priv; =20 if (vc4_hdmi->cec_rx_msg.len) - cec_received_msg(vc4_hdmi->cec_adap, - &vc4_hdmi->cec_rx_msg); + drm_connector_hdmi_cec_received_msg(&vc4_hdmi->connector, + &vc4_hdmi->cec_rx_msg); =20 return IRQ_HANDLED; } @@ -2389,15 +2382,17 @@ static irqreturn_t vc4_cec_irq_handler_tx_thread(in= t irq, void *priv) struct vc4_hdmi *vc4_hdmi =3D priv; =20 if (vc4_hdmi->cec_tx_ok) { - cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_OK, - 0, 0, 0, 0); + drm_connector_hdmi_cec_transmit_done(&vc4_hdmi->connector, + CEC_TX_STATUS_OK, + 0, 0, 0, 0); } else { /* * This CEC implementation makes 1 retry, so if we * get a NACK, then that means it made 2 attempts. */ - cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_NACK, - 0, 2, 0, 0); + drm_connector_hdmi_cec_transmit_done(&vc4_hdmi->connector, + CEC_TX_STATUS_NACK, + 0, 2, 0, 0); } return IRQ_HANDLED; } @@ -2554,9 +2549,9 @@ static irqreturn_t vc4_cec_irq_handler(int irq, void = *priv) return ret; } =20 -static int vc4_hdmi_cec_enable(struct cec_adapter *adap) +static int vc4_hdmi_cec_enable(struct drm_connector *connector) { - struct vc4_hdmi *vc4_hdmi =3D cec_get_drvdata(adap); + struct vc4_hdmi *vc4_hdmi =3D connector_to_vc4_hdmi(connector); struct drm_device *drm =3D vc4_hdmi->connector.dev; /* clock period in microseconds */ const u32 usecs =3D 1000000 / CEC_CLOCK_FREQ; @@ -2621,9 +2616,9 @@ static int vc4_hdmi_cec_enable(struct cec_adapter *ad= ap) return 0; } =20 -static int vc4_hdmi_cec_disable(struct cec_adapter *adap) +static int vc4_hdmi_cec_disable(struct drm_connector *connector) { - struct vc4_hdmi *vc4_hdmi =3D cec_get_drvdata(adap); + struct vc4_hdmi *vc4_hdmi =3D connector_to_vc4_hdmi(connector); struct drm_device *drm =3D vc4_hdmi->connector.dev; unsigned long flags; int idx; @@ -2657,17 +2652,17 @@ static int vc4_hdmi_cec_disable(struct cec_adapter = *adap) return 0; } =20 -static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) +static int vc4_hdmi_cec_adap_enable(struct drm_connector *connector, bool = enable) { if (enable) - return vc4_hdmi_cec_enable(adap); + return vc4_hdmi_cec_enable(connector); else - return vc4_hdmi_cec_disable(adap); + return vc4_hdmi_cec_disable(connector); } =20 -static int vc4_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_add= r) +static int vc4_hdmi_cec_adap_log_addr(struct drm_connector *connector, u8 = log_addr) { - struct vc4_hdmi *vc4_hdmi =3D cec_get_drvdata(adap); + struct vc4_hdmi *vc4_hdmi =3D connector_to_vc4_hdmi(connector); struct drm_device *drm =3D vc4_hdmi->connector.dev; unsigned long flags; int idx; @@ -2693,10 +2688,10 @@ static int vc4_hdmi_cec_adap_log_addr(struct cec_ad= apter *adap, u8 log_addr) return 0; } =20 -static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempt= s, +static int vc4_hdmi_cec_adap_transmit(struct drm_connector *connector, u8 = attempts, u32 signal_free_time, struct cec_msg *msg) { - struct vc4_hdmi *vc4_hdmi =3D cec_get_drvdata(adap); + struct vc4_hdmi *vc4_hdmi =3D connector_to_vc4_hdmi(connector); struct drm_device *dev =3D vc4_hdmi->connector.dev; unsigned long flags; u32 val; @@ -2739,84 +2734,66 @@ static int vc4_hdmi_cec_adap_transmit(struct cec_ad= apter *adap, u8 attempts, return 0; } =20 -static const struct cec_adap_ops vc4_hdmi_cec_adap_ops =3D { - .adap_enable =3D vc4_hdmi_cec_adap_enable, - .adap_log_addr =3D vc4_hdmi_cec_adap_log_addr, - .adap_transmit =3D vc4_hdmi_cec_adap_transmit, -}; - -static void vc4_hdmi_cec_release(void *ptr) -{ - struct vc4_hdmi *vc4_hdmi =3D ptr; - - cec_unregister_adapter(vc4_hdmi->cec_adap); - vc4_hdmi->cec_adap =3D NULL; -} - -static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) +static int vc4_hdmi_cec_init(struct drm_connector *connector) { - struct cec_connector_info conn_info; + struct vc4_hdmi *vc4_hdmi =3D connector_to_vc4_hdmi(connector); struct platform_device *pdev =3D vc4_hdmi->pdev; struct device *dev =3D &pdev->dev; int ret; =20 - if (!of_property_present(dev->of_node, "interrupts")) { - dev_warn(dev, "'interrupts' DT property is missing, no CEC\n"); - return 0; - } - - vc4_hdmi->cec_adap =3D cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, - vc4_hdmi, - vc4_hdmi->variant->card_name, - CEC_CAP_DEFAULTS | - CEC_CAP_CONNECTOR_INFO, 1); - ret =3D PTR_ERR_OR_ZERO(vc4_hdmi->cec_adap); - if (ret < 0) - return ret; - - cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector); - cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info); - if (vc4_hdmi->variant->external_irq_controller) { ret =3D devm_request_threaded_irq(dev, platform_get_irq_byname(pdev, "ce= c-rx"), vc4_cec_irq_handler_rx_bare, vc4_cec_irq_handler_rx_thread, 0, "vc4 hdmi cec rx", vc4_hdmi); if (ret) - goto err_delete_cec_adap; + return ret; =20 ret =3D devm_request_threaded_irq(dev, platform_get_irq_byname(pdev, "ce= c-tx"), vc4_cec_irq_handler_tx_bare, vc4_cec_irq_handler_tx_thread, 0, "vc4 hdmi cec tx", vc4_hdmi); if (ret) - goto err_delete_cec_adap; + return ret; } else { ret =3D devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), vc4_cec_irq_handler, vc4_cec_irq_handler_thread, 0, "vc4 hdmi cec", vc4_hdmi); if (ret) - goto err_delete_cec_adap; + return ret; } =20 - ret =3D cec_register_adapter(vc4_hdmi->cec_adap, &pdev->dev); - if (ret < 0) - goto err_delete_cec_adap; + return 0; +} + +static const struct drm_connector_hdmi_cec_adapter_ops vc4_hdmi_cec_adap_o= ps =3D { + .base.unregister =3D drm_connector_hdmi_cec_unregister, + .init =3D vc4_hdmi_cec_init, + .enable =3D vc4_hdmi_cec_adap_enable, + .log_addr =3D vc4_hdmi_cec_adap_log_addr, + .transmit =3D vc4_hdmi_cec_adap_transmit, +}; + +static int vc4_hdmi_cec_register(struct vc4_hdmi *vc4_hdmi) +{ + struct platform_device *pdev =3D vc4_hdmi->pdev; + struct device *dev =3D &pdev->dev; + + if (!of_property_present(dev->of_node, "interrupts")) { + dev_warn(dev, "'interrupts' DT property is missing, no CEC\n"); + return 0; + } =20 /* - * NOTE: Strictly speaking, we should probably use a DRM-managed - * registration there to avoid removing the CEC adapter by the - * time the DRM driver doesn't have any user anymore. + * NOTE: the CEC adapter will be unregistered from + * drm_connector_cleanup(), which is called from drm_dev_unplug() + * during device unbind. * * However, the CEC framework already cleans up the CEC adapter * only when the last user has closed its file descriptor, so we * don't need to handle it in DRM. * - * By the time the device-managed hook is executed, we will give - * up our reference to the CEC adapter and therefore don't - * really care when it's actually freed. - * * There's still a problematic sequence: if we unregister our * CEC adapter, but the userspace keeps a handle on the CEC * adapter but not the DRM device for some reason. In such a @@ -2827,19 +2804,14 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_h= dmi) * the CEC framework already handles this too, by calling * cec_is_registered() in cec_ioctl() and cec_poll(). */ - ret =3D devm_add_action_or_reset(dev, vc4_hdmi_cec_release, vc4_hdmi); - if (ret) - return ret; - - return 0; - -err_delete_cec_adap: - cec_delete_adapter(vc4_hdmi->cec_adap); - - return ret; + return drm_connector_hdmi_cec_register(&vc4_hdmi->connector, + &vc4_hdmi_cec_adap_ops, + vc4_hdmi->variant->card_name, + 1, + &pdev->dev); } #else -static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) +static int vc4_hdmi_cec_register(struct vc4_hdmi *vc4_hdmi) { return 0; } @@ -3244,7 +3216,7 @@ static int vc4_hdmi_bind(struct device *dev, struct d= evice *master, void *data) if (ret) goto err_put_runtime_pm; =20 - ret =3D vc4_hdmi_cec_init(vc4_hdmi); + ret =3D vc4_hdmi_cec_register(vc4_hdmi); if (ret) goto err_put_runtime_pm; =20 diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index a31157c99bee6b33527c4b558fc72fff65d2a278..8d069718df00d9afc13aadbb126= 48e2bb75a1721 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -147,7 +147,6 @@ struct vc4_hdmi { */ bool disable_wifi_frequencies; =20 - struct cec_adapter *cec_adap; struct cec_msg cec_rx_msg; bool cec_tx_ok; bool cec_irq_was_rx; --=20 2.39.5