From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 506D438837C for ; Sat, 25 Jul 2026 02:58:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948294; cv=none; b=g52m8GtKSxNoGIGKGn+2ls5vfmlKuAhedfD8/GHf3uchK96+m7kSklykj78bpIz06yqvlT8OujG/L5vpsxN0cRhdfMBkI5ZcKeMuxEnfIhJfLzrmWah7eOrpPY8ZzwYymp9VL109tuR9fCGqoL2QIRWKscEnXSFc0G0PT2OBAY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948294; c=relaxed/simple; bh=jrTgka+ct8+dK3aVK/RgKLDCanFYhnlIsVkTvRq12aU=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mzoDrVk8ASxfZPJuQ0jkzFKsa4zaq9R0eVfavnBN6l6DZqwtzt5SSa9hMUuuhVQlbSjekkrvhQrGnrHFyelX4CNdeal2nVSe29fzGrXj/m7GKJsE1fGxf5vYfHuazJKWFOaovtpxApipK964DdApnFsYVL12nwLLjaCIVccb3Ow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSaT-000000002xV-2XOj; Sat, 25 Jul 2026 02:58:05 +0000 Date: Sat, 25 Jul 2026 03:58:02 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 01/13] drm/bridge: it6505: quiesce event sources and work on remove() Message-ID: <248a9b6a19da93d75b59e9fcad0e03fe94ea67d8.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" struct it6505 is freed by devres right after remove() returns, but remove() cancels none of the driver's work items, so link_works, hdcp_wait_ksv_list, hdcp_work and extcon_wq can still run afterwards and dereference freed memory. Cancelling alone would not be enough: the threaded IRQ and the extcon notifier stay live until devres teardown and can requeue the works. Unregister the extcon notifier and disable the IRQ first, then cancel all work. Make it6505_remove_notifier_module() idempotent, tracking the registration in a flag under extcon_lock, as both .detach() and remove() call it now. The notifier_call pointer is left intact: extcon traverses its raw notifier chain without holding a lock, so a traversal racing with the unregistration may still invoke the callback. Also initialise extcon_wq in probe: cancel_work_sync() on a never-initialised work item trips WARN_ON(!work->func). Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: track registration in a flag instead of clearing notifier_call, which an unlocked chain traversal racing the unregistration could have called as NULL v5: serialise notifier registration state with extcon_lock v4: * quiesce event sources before cancelling work; retitled * initialise extcon_wq in probe to avoid WARN_ON(!work->func) v3: new patch drivers/gpu/drm/bridge/ite-it6505.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 8ecb43611dba..a7ba6a0befda 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -443,6 +443,7 @@ struct it6505 { struct drm_display_mode source_output_mode; struct drm_display_mode video_info; struct notifier_block event_nb; + bool extcon_registered; struct extcon_dev *extcon; struct work_struct extcon_wq; int extcon_state; @@ -2934,11 +2935,15 @@ static int it6505_use_notifier_module(struct it6505= *it6505) int ret; struct device *dev =3D it6505->dev; =20 + mutex_lock(&it6505->extcon_lock); it6505->event_nb.notifier_call =3D it6505_extcon_notifier; - INIT_WORK(&it6505->extcon_wq, it6505_extcon_work); ret =3D devm_extcon_register_notifier(it6505->dev, it6505->extcon, EXTCON_DISP_DP, &it6505->event_nb); + if (!ret) + it6505->extcon_registered =3D true; + mutex_unlock(&it6505->extcon_lock); + if (ret) { dev_err(dev, "failed to register notifier for DP"); return ret; @@ -2951,13 +2956,16 @@ static int it6505_use_notifier_module(struct it6505= *it6505) =20 static void it6505_remove_notifier_module(struct it6505 *it6505) { - if (it6505->extcon) { - devm_extcon_unregister_notifier(it6505->dev, - it6505->extcon, EXTCON_DISP_DP, + mutex_lock(&it6505->extcon_lock); + if (it6505->extcon && it6505->extcon_registered) { + devm_extcon_unregister_notifier(it6505->dev, it6505->extcon, + EXTCON_DISP_DP, &it6505->event_nb); - - flush_work(&it6505->extcon_wq); + it6505->extcon_registered =3D false; } + mutex_unlock(&it6505->extcon_lock); + + flush_work(&it6505->extcon_wq); } =20 static void __maybe_unused it6505_delayed_audio(struct work_struct *work) @@ -3615,6 +3623,7 @@ static int it6505_i2c_probe(struct i2c_client *client) INIT_WORK(&it6505->link_works, it6505_link_training_work); INIT_WORK(&it6505->hdcp_wait_ksv_list, it6505_hdcp_wait_ksv_list); INIT_DELAYED_WORK(&it6505->hdcp_work, it6505_hdcp_work); + INIT_WORK(&it6505->extcon_wq, it6505_extcon_work); init_completion(&it6505->extcon_completion); memset(it6505->dpcd, 0, sizeof(it6505->dpcd)); it6505->powered =3D false; @@ -3647,6 +3656,12 @@ static void it6505_i2c_remove(struct i2c_client *cli= ent) drm_bridge_remove(&it6505->bridge); drm_dp_aux_unregister(&it6505->aux); it6505_debugfs_remove(it6505); + it6505_remove_notifier_module(it6505); + disable_irq(it6505->irq); + cancel_work_sync(&it6505->link_works); + cancel_work_sync(&it6505->hdcp_wait_ksv_list); + cancel_delayed_work_sync(&it6505->hdcp_work); + cancel_work_sync(&it6505->extcon_wq); it6505_poweroff(it6505); it6505_remove_edid(it6505); } --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 1BBB035A384 for ; Sat, 25 Jul 2026 02:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948307; cv=none; b=d4vddEbdAOfOWfRmxTBvdkttbVvmaod6TAZrE4RZQkDgxWBk9VRgFRH0l8RNQY9VL768pnMYnbnAIQuZhBnn27pqXcaPZUh2ajyGTW0n9D8TuxfAAMgyI/E5wpnquQhWsDDGkKzWN1/eRmSZ0gRH+63zWJmRbUUnSDDlv3vJD6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948307; c=relaxed/simple; bh=LvRVJael3yyzubcF0NvrZoK1YmZzqAe5+mjRNeoEVAc=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LqEQu1hjSc1aKwx7aHJSDHPExc1MC2uss2dwWDUJxXMIWRXeOk+5DMeB4OlFkqRLOBuqZK8mC+d05XmWNuMDFA4T/QdOFo8IyINRKCpNrus+n5npXUbN86H6z475eMwJN4oDwLsPG5XhP93MxzUqXMygUIffYnQld2rPwpOQuvw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSah-000000002y4-2k8c; Sat, 25 Jul 2026 02:58:19 +0000 Date: Sat, 25 Jul 2026 03:58:16 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 02/13] drm/bridge: it6505: balance and disable runtime PM on remove Message-ID: <9ea942316bc9a08474f6171866a432bd4eb93410.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Runtime PM is enabled in probe but never disabled on remove, so rebinding the driver warns "Unbalanced pm_runtime_enable!". The extcon work also holds a usage reference while a display is connected, which unbinding leaks; the count survives in struct device, so after a rebind the device never runtime-suspends again. Drop the usage reference held for a connected display and disable runtime PM in remove(). Fixes: 10517777d302 ("drm/bridge: it6505: Adapt runtime power management fr= amework") Signed-off-by: Daniel Golle --- v6: no changes. v5: also drop the usage ref held for a connected display; retitled v4: new patch drivers/gpu/drm/bridge/ite-it6505.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index a7ba6a0befda..7c61b02cc7e6 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -3662,6 +3662,9 @@ static void it6505_i2c_remove(struct i2c_client *clie= nt) cancel_work_sync(&it6505->hdcp_wait_ksv_list); cancel_delayed_work_sync(&it6505->hdcp_work); cancel_work_sync(&it6505->extcon_wq); + if (it6505->extcon_state) + pm_runtime_put_sync(&client->dev); + pm_runtime_disable(&client->dev); it6505_poweroff(it6505); it6505_remove_edid(it6505); } --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 4A743340298 for ; Sat, 25 Jul 2026 02:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948318; cv=none; b=I6oGVTn+awsqzqHeHdEL2X542+KxeplPNY/w6dzRrcND3bYUtT8Qj9IXBkEsRatADFXEyR7bIx1WKaXdq5Jzyl/iypjxoSr7RmwV8JdCDDJnP3nOIPEnmEvuYq6HzHSLrMgmRV49jqGl9cNJLua/1QuFkWQkV2SKoAm6O8DW//M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948318; c=relaxed/simple; bh=wCfhbLyWom6anCeu4al33aDrM55RZRPstVDfFxgADUM=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mOlUh35yZjaQwE/hQt0noxTGrNN5n7WYL59fptgtpBn/vBf6kNGaXS99mombD7ffR8NyId3zRtukNUezQQury5PEk/hOG84Ue9G7JIqAWf5ALzr9TP2Dyli9zBYyPdeF1AjeGAQpoUpDqR63bwIFUqzjkVyxhTxspHWJvaJWiA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSas-000000002zF-3TCe; Sat, 25 Jul 2026 02:58:30 +0000 Date: Sat, 25 Jul 2026 03:58:27 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 03/13] drm/bridge: it6505: unregister DP AUX adapter on bridge detach Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The DP AUX adapter is registered in .attach() but only unregistered in i2c remove(). Unbinding and rebinding the DRM device while the i2c driver stays bound registers the adapter a second time, which fails. Unregister it in .detach() instead, and also on the .attach() error path, which so far leaked the registration. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: no changes. v5: new patch drivers/gpu/drm/bridge/ite-it6505.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 7c61b02cc7e6..c10cc6a786b5 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -3093,6 +3093,7 @@ static int it6505_bridge_attach(struct drm_bridge *br= idge, ret =3D it6505_use_notifier_module(it6505); if (ret < 0) { dev_err(dev, "use notifier module failed"); + drm_dp_aux_unregister(&it6505->aux); return ret; } } @@ -3106,6 +3107,7 @@ static void it6505_bridge_detach(struct drm_bridge *b= ridge) =20 flush_work(&it6505->link_works); it6505_remove_notifier_module(it6505); + drm_dp_aux_unregister(&it6505->aux); } =20 static enum drm_mode_status @@ -3654,7 +3656,6 @@ static void it6505_i2c_remove(struct i2c_client *clie= nt) struct it6505 *it6505 =3D i2c_get_clientdata(client); =20 drm_bridge_remove(&it6505->bridge); - drm_dp_aux_unregister(&it6505->aux); it6505_debugfs_remove(it6505); it6505_remove_notifier_module(it6505); disable_irq(it6505->irq); --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 C3BAF367B73 for ; Sat, 25 Jul 2026 02:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948334; cv=none; b=MO2MtfM3gEPTTpLkwBDEQhMjqy7KC3kVtj0sMT05S7uXd+IFn67nM6GtwrLmxDRU+WnJuv1YZ9oOEd1f3j5SgEixlizbeEHcBOCcovDCWbefPNt3MjbzJJ38eCZSUYysZ8Hr/OQaUUVBjVcZShcZ5+NoGrc2zHjsKujPFDQ/aiA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948334; c=relaxed/simple; bh=IyJOaFKHP5Z6JsgoSrdbBHiqOS2kFveNeppXWV+Qwkg=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=isDJWK7v2//WmMoS8bVjd1dvq4XmVzLs95ghhiq6csrFnu4wxGbj58VjMqjYzEDOWmjpkBey3qaqeczHYBmanI3s+e9my+QQGBa6eSCQg2qxK7SPW7L31vwjWcL0hvAR4UxkB5Unxv+5mwE1dixSF0yL7dLjdvANlfh/CqWpI+A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSb7-0000000030c-32Ro; Sat, 25 Jul 2026 02:58:45 +0000 Date: Sat, 25 Jul 2026 03:58:42 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 04/13] drm/bridge: it6505: complete poweroff even if disabling regulators fails Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505_poweroff() returns early when regulator_disable() fails, leaving it6505->powered set with the IRQ already disabled. The next it6505_poweron() then takes its early return and never re-enables the IRQ, leaving the bridge deaf to hotplug and link training interrupts. The regulator core keeps the consumer's enable count on a failed disable either way, so bailing out only adds a wedged bridge on top of the leaked reference. Log the error and complete the power-off state transition instead. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: note that the regulator reference is leaked either way v5: new patch drivers/gpu/drm/bridge/ite-it6505.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index c10cc6a786b5..fb6030a2c18c 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2811,13 +2811,15 @@ static int it6505_poweroff(struct it6505 *it6505) if (pdata->pwr18) { err =3D regulator_disable(pdata->pwr18); if (err) - return err; + dev_err(dev, "cannot disable pwr18 regulator: %d", + err); } =20 if (pdata->ovdd) { err =3D regulator_disable(pdata->ovdd); if (err) - return err; + dev_err(dev, "cannot disable ovdd regulator: %d", + err); } =20 it6505->powered =3D false; --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 1419030D3FA for ; Sat, 25 Jul 2026 02:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948348; cv=none; b=IW4MxHe3t84rgZNv6dWHnn9epAOJsYPz3FyJaMRvf+L1adYU1vrqp1Fl8wx2rAl+o1s+Qu4mDJWSqvmigSXk08//Ke/hD9IILl3Yn4jtopIeW4wn6qOhl8WltVvTy2rvRSNWW3RXHNhTxsCkrVR1eauWSuofj3QH/6EPDxPkQMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948348; c=relaxed/simple; bh=ZaMsSclhVUybEeeh3jskIeEfctp/jCzRBSaHQyp8sLM=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UDs2qARdqvKXTGblv6PHetkTW70ncfxzbH7bbkAYxivhDdVpwaYWTYcwt8VSp4Om2AaR0944SYrdxGzE4mB0PsCN/tCL2bfzU8H3m0jCEiCB9+13d9aPOttnwIg/+XF32paJouq9D7jUbB5XK5sdBGfAHx+6ZszuRbiC0rt4a8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSbM-0000000031c-2iI1; Sat, 25 Jul 2026 02:59:00 +0000 Date: Sat, 25 Jul 2026 03:58:57 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 05/13] drm/bridge: it6505: bail out of the IRQ handler when status reads fail Message-ID: <9f33511464953754eee9a5df141a38936f26bd26.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When reading the interrupt status registers fails, the negative error codes end up in int_status[], where it6505_test_bit() sees almost all bits set: every interrupt sub-handler runs on garbage and the error values are even written back to the status registers. Return IRQ_NONE instead. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: no changes v5: new patch drivers/gpu/drm/bridge/ite-it6505.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index fb6030a2c18c..3806b0b96637 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2714,6 +2714,11 @@ static irqreturn_t it6505_int_threaded_handler(int u= nused, void *data) int_status[1] =3D it6505_read(it6505, INT_STATUS_02); int_status[2] =3D it6505_read(it6505, INT_STATUS_03); =20 + if (int_status[0] < 0 || int_status[1] < 0 || int_status[2] < 0) { + pm_runtime_put_sync(dev); + return IRQ_NONE; + } + it6505_write(it6505, INT_STATUS_01, int_status[0]); it6505_write(it6505, INT_STATUS_02, int_status[1]); it6505_write(it6505, INT_STATUS_03, int_status[2]); --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 634D935A384 for ; Sat, 25 Jul 2026 02:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948377; cv=none; b=VAKaeUibJQYbsHGN4ZsMLOoKTIVCvOdGzxuDlzq4WG5DrAE0bcMb6SOxeGAAlsOefI7n74ewCews2qS/rp7sE/TDtr8mBw06p0Q2TGliFWb4lksDIZrcliS5XyOyDBgmXrOzEg55y7JOiuitkMTu4gF+QZeRdNIJDylT5rby4sA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948377; c=relaxed/simple; bh=yaFXhpBnBAIgzpCNFMP9nZFJIf27fX86MplXilh5Kyo=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ml5ma+21rbxdN7Mo3KbkxA5iWrFznKN5x2qBpmG65e7rqDavUKLC+dVaqad7FVlG1Ajcf+rKMTlS/Bl+zY7aW80Hucj+YFwux3DfpZF29wXdlVLqwKe+c1eIZd72ycb4tQXP6C4yd7c0WAoDif0wx/1SDpgOe9EFDKVcZ/rEqKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSbp-0000000032V-3ApD; Sat, 25 Jul 2026 02:59:29 +0000 Date: Sat, 25 Jul 2026 03:59:26 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 06/13] drm/bridge: it6505: avoid division by zero in pixel clock calculation Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505_calc_video_info() checks the sum of the three pixel clock counter samples for zero before dividing it by 3, so sums of 1 or 2 truncate to 0 and the following pixel clock calculation divides by zero. Divide first and check the result. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: no changes v5: new patch drivers/gpu/drm/bridge/ite-it6505.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 3806b0b96637..b7eb746c8f8e 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -751,12 +751,13 @@ static void it6505_calc_video_info(struct it6505 *it6= 505) sum +=3D rddata; } =20 + sum /=3D 3; + if (sum =3D=3D 0) { DRM_DEV_DEBUG_DRIVER(dev, "calc video timing error"); return; } =20 - sum /=3D 3; pclk =3D 13500 * 2048 / sum; it6505->video_info.clock =3D pclk; it6505->video_info.hdisplay =3D hdew; --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 6BECC38A729 for ; Sat, 25 Jul 2026 02:59:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948395; cv=none; b=buYR1N5knAkc9cudWFhHOJtT/B+DO45sX4GI+XMCmmdDcrfrDYvBQ7uunMTGrhNMTIZtjjOnYKre+/jXStbjCE6dxXKcEEt8DwVgn6YEvxgk61qV7rUHeb4AmFyc4PXaWqc/fCKJgYIhUUH+IXB+Sn+o9PYEQV2uZHnj2lqM0kQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948395; c=relaxed/simple; bh=hEsK2tNEylz1vgj+WoiMqDLj79c6eTNNwB11xqzWmC8=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qaxUWbfk0A8g7xAzcoGKqMrh9DQ9Gdc1NOgrdYPR4AehXjhvq+JRWt7iIuDPis+uC1BpqqFsdBnX6C5MAfwBHdyFzjzaO6Kk5YlCmBVn40p0f6YvjAE/jzy8BhcE6kft61zfSUVOvTl7pxoItQe7WSyI2n0MxDJrFUa9Uoxv3Ug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSc0-0000000032p-0cCd; Sat, 25 Jul 2026 02:59:40 +0000 Date: Sat, 25 Jul 2026 03:59:36 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 07/13] drm/bridge: it6505: avoid division by zero in audio FS debug print Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" REG_AUDIO_INPUT_FREQ reads back 0 when no audio clock has been latched, and it6505_read() returns a negative errno on i2c failure. The debug print divides by the readback, and its arguments are evaluated even with debug output disabled. Only print when the value is usable as a divisor. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: no changes v5: new patch drivers/gpu/drm/bridge/ite-it6505.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index b7eb746c8f8e..04711c8f4a04 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -1623,8 +1623,11 @@ static void it6505_enable_audio(struct it6505 *it650= 5) it6505_set_bits(it6505, REG_AUDIO_SRC_CTRL, AUDIO_FIFO_RESET, 0x00); it6505_set_bits(it6505, REG_RESET_CTRL, AUDIO_RESET, 0x00); regbe =3D it6505_read(it6505, REG_AUDIO_INPUT_FREQ); - DRM_DEV_DEBUG_DRIVER(dev, "regbe:0x%02x audio input fs: %d.%d kHz", - regbe, 6750 / regbe, (6750 % regbe) * 10 / regbe); + if (regbe > 0) + DRM_DEV_DEBUG_DRIVER(dev, + "regbe:0x%02x audio input fs: %d.%d kHz", + regbe, 6750 / regbe, + (6750 % regbe) * 10 / regbe); it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_AUD_MUTE, 0x00); } =20 --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 2281C367B73 for ; Sat, 25 Jul 2026 03:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948408; cv=none; b=iWpXTW0GfEtpFzjsFEzQly6/qxw3aj2hX2hLxV4H8B4QrjxRSaGv2x1zhBPChTxI1u8MzH2DQeNyOdVjlLQ0MCJDBjjLndPvTsDTAZQbtwGg1gyyrNTZ4Igr8v4/nkRMg4H2nYHQ70rRF7SrofXJ/hafl429GYHHXH5TsJOdYgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948408; c=relaxed/simple; bh=oL9ZpyRIvsLyi7Nzsd1zFM/wQu1u0M3u6JEt6p4vbgs=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EqA/9uzpeDRzytQHOZo7+j+PZO1diUYlnoSyvjirPMvQh6GIdqYf/jYKZR8mYWWN5DBc2mSpdkiNS8RhDBFtDsT8Magp0UA5xa/t1uIGi9cyuFMer6jP3SM9BJPSUkvlRdn+oC1edVZRujSEHnTWZyi4SH4Cl0/rPv3sy/8/D24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnScH-00000000341-0gpg; Sat, 25 Jul 2026 02:59:57 +0000 Date: Sat, 25 Jul 2026 03:59:53 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 08/13] drm/bridge: it6505: guard against zero channel count in audio infoframe Message-ID: <1348050dfe1904851fa69d89c79f6160765542c4.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505->audio.channel_count stays 0 until link training or a valid hw_params call has run, but it6505_enable_audio() can be reached before that from the audio-FIFO-error IRQ, making it6505_enable_audio_infoframe() index the 8-entry audio_info_ca[] table with -1. Bail out while the channel count is not yet known. Also fix the debug print on the invalid-channel-count path, which logged the previously cached count instead of the rejected one. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle Reviewed-by: Chen-Yu Tsai --- v6: no changes v5: no changes v4: no changes, collected Chen-Yu Tsai's Reviewed-by v3: new patch drivers/gpu/drm/bridge/ite-it6505.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 04711c8f4a04..f4ee5c81d3b8 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -1577,6 +1577,9 @@ static void it6505_enable_audio_infoframe(struct it65= 05 *it6505) struct device *dev =3D it6505->dev; u8 audio_info_ca[] =3D { 0x00, 0x00, 0x01, 0x03, 0x07, 0x0B, 0x0F, 0x1F }; =20 + if (!it6505->audio.channel_count) + return; + DRM_DEV_DEBUG_DRIVER(dev, "infoframe channel_allocation:0x%02x", audio_info_ca[it6505->audio.channel_count - 1]); =20 @@ -3009,7 +3012,7 @@ static int __maybe_unused it6505_audio_setup_hw_param= s(struct it6505 *it6505, =20 if (params->cea.channels <=3D 1 || params->cea.channels > 8) { DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support", - it6505->audio.channel_count); + params->cea.channels); return -EINVAL; } =20 --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 C473438AC8B for ; Sat, 25 Jul 2026 03:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948427; cv=none; b=F4FACM9lJgbCy7E5B2fOCzpaaP+A/3qpQxzlXPQcwLx0JXsMPNAqlHO1AfK64dzjbnlF9gaKiDLdrsFEzxHL9OCJgG2qfA2Iurqp1do/zcYrjSpbL1D+TW5DxSFlK6JJJneM7yRTrFyKXoUZJNTbnj4ShjNxi06nMn/8fx+QMEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948427; c=relaxed/simple; bh=7hMJBRtAjovT9ZhgiSKafDOw0X3W+SNad5gaZYQhE0o=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VgtBUHZceFdIxpuWgIkWZu8xqQPnFVnEhiLgi/+L2rj38A6pMyBr2nRCXWTQqMeQt9Ar39WkHtVmEHJaZWipbiXfAjJawK3Tj2qdj01cpMFce1Il2MbvO26066CDi0UlqE+pGUxmJ6KYfBvxOXWC7G+y6ekqeS8Ic8QuZwV+CkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnScS-0000000034X-1DyX; Sat, 25 Jul 2026 03:00:08 +0000 Date: Sat, 25 Jul 2026 04:00:05 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 09/13] drm/bridge: it6505: hold endpoint OF node reference while parsing it Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505_parse_dt() drops the reference to each endpoint node right after looking it up and then keeps reading its properties, racing with the node being freed under CONFIG_OF_DYNAMIC. Put the node only once parsing is done. Fixes: 380d920b582d ("drm/bridge: add it6505 driver to read data-lanes and = link-frequencies from dt") Signed-off-by: Daniel Golle --- v6: no changes v5: new patch drivers/gpu/drm/bridge/ite-it6505.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index f4ee5c81d3b8..0da8b40dd88a 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -3366,7 +3366,6 @@ static void it6505_parse_dt(struct it6505 *it6505) } =20 ep =3D of_graph_get_endpoint_by_regs(np, 1, 0); - of_node_put(ep); =20 if (ep) { len =3D it6505_get_data_lanes_count(ep, 1, 4); @@ -3379,13 +3378,13 @@ static void it6505_parse_dt(struct it6505 *it6505) *max_lane_count =3D MAX_LANE_COUNT; dev_err(dev, "error data-lanes, use default"); } + of_node_put(ep); } else { *max_lane_count =3D MAX_LANE_COUNT; dev_err(dev, "error endpoint, use default"); } =20 ep =3D of_graph_get_endpoint_by_regs(np, 0, 0); - of_node_put(ep); =20 if (ep) { len =3D of_property_read_variable_u64_array(ep, @@ -3405,6 +3404,7 @@ static void it6505_parse_dt(struct it6505 *it6505) dev_err(dev, "error link frequencies, use default"); *max_dpi_pixel_clock =3D DPI_PIXEL_CLK_MAX; } + of_node_put(ep); } else { dev_err(dev, "error endpoint, use default"); *max_dpi_pixel_clock =3D DPI_PIXEL_CLK_MAX; --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 3A0602D3A93 for ; Sat, 25 Jul 2026 03:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948437; cv=none; b=dxHWHcn0y4HYtrQVhw4ZYnlDhbGJ7EjcFWoYOz3ZC/bgxFEYmb1F9wn0BQJWAArV1Hr0takr2JdEgoFqbm+zMCV89EP32UZs2yEUP656Jn1DgPCVdIs2PMmS1+AZDAoI5NSuWKqyf1ZemzfQwJhYeixgcO77EP926qrZRbOOCLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948437; c=relaxed/simple; bh=AtxbK/oOcFyIBNfCGt6Yz6rk6ui4WmRWgEz/dyOOGcw=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iP5pE2dIw5hvmwjaU8OlWFlItnf0LE6dC+kjXdThR5vc6Sxgwm5dUoLdEne0oVmL4DOPpqeE8Nl1y5D3TW600bQt9cuOQehmu2vUCdFVEkg44JtluarZvS806n1XNwqeTwWU0xwEz3oLlayRtPl054LL1FYLOQL6pMTJg5zzzRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSch-0000000035X-3Gla; Sat, 25 Jul 2026 03:00:23 +0000 Date: Sat, 25 Jul 2026 04:00:20 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 10/13] drm/bridge: it6505: reject a too short link-frequencies property Message-ID: <44684d199a5a6e6b30d84aed463c1c4ec4e9b014.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" of_property_read_variable_u64_array() is asked for a minimum array size of zero, so a link-frequencies property shorter than one u64 -- a 32-bit value written by mistake, say -- returns 0 without storing anything. it6505_parse_dt() reads that as success and derives max_dpi_pixel_clock from an uninitialised stack variable. Ask for one element so a short property lands in the existing error path. Fixes: 380d920b582d ("drm/bridge: add it6505 driver to read data-lanes and = link-frequencies from dt") Signed-off-by: Daniel Golle --- v6: new patch drivers/gpu/drm/bridge/ite-it6505.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 0da8b40dd88a..1678ec5b3ba7 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -3389,7 +3389,7 @@ static void it6505_parse_dt(struct it6505 *it6505) if (ep) { len =3D of_property_read_variable_u64_array(ep, "link-frequencies", - &link_frequencies, 0, + &link_frequencies, 1, 1); if (len >=3D 0) { do_div(link_frequencies, 1000); --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 5387F388869 for ; Sat, 25 Jul 2026 03:00:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948456; cv=none; b=Ne9dbW2r8hCpRKoDyNAImhfBtjBqn6IpwXy6elyo7SYhF2gnOz/pH7ojtLJfGr+mR/ZHiS5QeOpi9JbtmQL4weCwo7/GlPqYnH0J2tagf5rHenwr7nV9/GnDi9mLHvmU+ib+xKa9ZCq0tmMWq0paPjn11ICmusoJNLRZ5qVHhVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948456; c=relaxed/simple; bh=Bl1vBTKyV4Yl43UkL2Fpg3MCkLTfKNnIH5PuCVLRdNY=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G0yqfHKBrtZxgH3P2gaJYr0Rivn4uuuv87rS22hCS4OdZZOIT4j1lFlHhwlFe/iFD5LFPnhitk5pDlNBs1hFS5mCqr4c2ImMdEwy8b8TMsORxTr658ZJPqJePjTd/+dHGlOMgRaIfF1uTLeixXxKZZbk+uKuGUXF6pl5ciVwyk0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnScw-0000000036N-3tS3; Sat, 25 Jul 2026 03:00:39 +0000 Date: Sat, 25 Jul 2026 04:00:35 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 11/13] drm/bridge: it6505: don't write an error code back to the reset register Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505_audio_input() saves REG_RESET_CTRL, pulses AUDIO_RESET and writes the saved value back. it6505_read() returns a negative errno on i2c failure, which regmap truncates to eight bits on the way out: -EIO turns into 0xfb, asserting ALL_LOGIC_RESET, VIDEO_RESET, AUX_RESET and HDCP_RESET. A failed REG_AUDIO_INPUT_FREQ read is just as wrong, as any negative value passes the !=3D 0xFF test and reports an audio clock that was never sampled. Bail out before touching the register and only report audio input for a usable readback. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: new patch drivers/gpu/drm/bridge/ite-it6505.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 1678ec5b3ba7..aeaa7b5ecf5a 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -1516,12 +1516,15 @@ static bool it6505_audio_input(struct it6505 *it650= 5) int reg05, regbe; =20 reg05 =3D it6505_read(it6505, REG_RESET_CTRL); + if (reg05 < 0) + return false; + it6505_set_bits(it6505, REG_RESET_CTRL, AUDIO_RESET, 0x00); usleep_range(3000, 4000); regbe =3D it6505_read(it6505, REG_AUDIO_INPUT_FREQ); it6505_write(it6505, REG_RESET_CTRL, reg05); =20 - return regbe !=3D 0xFF; + return regbe > 0 && regbe !=3D 0xFF; } =20 static void it6505_setup_audio_channel_status(struct it6505 *it6505) --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 7314433F383 for ; Sat, 25 Jul 2026 03:01:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948511; cv=none; b=QESNTuJpayoAI4YN/RR4ubKKKaVcD8fuUKxx11+Z5pqf9hyGEbhbad/wjD+SzHQE7+wC3MmXo9pNba3vbfT+zLYa83YC3/njrKL22xUwny/8PFlEWPKNi7Oar14c2Ka1B74cqSPytJ2N0ZqXCH79UmIDqyPF2Sq91j69PnJZ6bc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948511; c=relaxed/simple; bh=vTv5bRAd4bAK3I674uVsfmht611/97NJqEdPx5JXQZM=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UsKU5DS+HbUqbrNS8WusQPcE1b5q85aNY7h0amwsEhwG4uDRPkoclJLrHqwzYzP37rThj9EPy4kR2Krd4BCH9mS0IpeCdKasEMZk+ZVeeaKHcKUqCpR8gLze31/B+MTRv13M1pDnNSjyc4DvD60av+u/5scvdvVOqt2LOG9hUtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSdn-0000000037m-0o5D; Sat, 25 Jul 2026 03:01:31 +0000 Date: Sat, 25 Jul 2026 04:01:28 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 12/13] drm/bridge: it6505: Add audio support Message-ID: <849db02af75f9f8bab9e211395435fda12d27c3e.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jiaxin Yu Add audio support for it6505 by bridging to the hdmi-codec: register an "hdmi-audio-codec" platform device from probe and wire up the previously unused audio helpers via hdmi_codec_ops. This unblocks the mt8186-mt6366 sound card which references it6505 as the I2S3 codec. Audio starts out muted and is only enabled once the stream is unmuted, since some DP-to-HDMI dongles get into a bad state if the InfoFrame is sent without audio data. Enable/disable can race between the FIFO-error IRQ, the delayed enable work, the hdmi-codec ops and the HPD-low path, so the register sequences, the mute state and the cached stream parameters are serialised with a new audio_lock mutex. plugged_cb/codec_dev updates take mode_lock, the lock it6505_detect() holds when calling back into the codec. Signed-off-by: Jiaxin Yu Link: https://lore.kernel.org/all/20230730180803.22570-4-jiaxin.yu@mediatek= .com/ Signed-off-by: Daniel Golle --- v6: no changes v5: update plugged_cb/codec_dev under mode_lock v4: * start out muted * update mute state and cached parameters under audio_lock; the FIFO-error IRQ probes and enables audio in one locked section * unregister the codec device only after quiesce on remove v3: serialise enable/disable with audio_lock; track mute state so the FIFO-error IRQ cannot undo a mute v2: * drive enable/disable from .mute_stream (hdmi_codec_ops lost .trigger), use it6505->dev * keep and unregister the codec platform_device on remove, cancel delayed_audio on shutdown and remove, disable audio when muting v1: respin of Jiaxin Yu's v3 on current -next drivers/gpu/drm/bridge/ite-it6505.c | 163 +++++++++++++++++++++++----- 1 file changed, 134 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index aeaa7b5ecf5a..c560f1258f6d 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -407,6 +407,7 @@ struct it6505_audio_data { u8 i2s_data_delay; u8 i2s_ws_channel; u8 i2s_data_sequence; + bool mute; }; =20 struct it6505_audio_sample_rate_map { @@ -439,6 +440,7 @@ struct it6505 { struct mutex extcon_lock; struct mutex mode_lock; /* used to bridge_detect */ struct mutex aux_lock; /* used to aux data transfers */ + struct mutex audio_lock; /* serializes audio enable/disable */ struct regmap *regmap; struct drm_display_mode source_output_mode; struct drm_display_mode video_info; @@ -477,6 +479,7 @@ struct it6505 { bool enable_enhanced_frame; hdmi_codec_plugged_cb plugged_cb; struct device *codec_dev; + struct platform_device *audio_pdev; struct delayed_work delayed_audio; struct it6505_audio_data audio; struct dentry *debugfs; @@ -1599,7 +1602,7 @@ static void it6505_enable_audio_infoframe(struct it65= 05 *it6505) EN_AUD_CTRL_PKT); } =20 -static void it6505_disable_audio(struct it6505 *it6505) +static void __it6505_disable_audio(struct it6505 *it6505) { it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_AUD_MUTE, EN_AUD_MUTE); it6505_set_bits(it6505, REG_AUDIO_SRC_CTRL, M_AUDIO_I2S_EN, 0x00); @@ -1607,13 +1610,21 @@ static void it6505_disable_audio(struct it6505 *it6= 505) it6505_set_bits(it6505, REG_RESET_CTRL, AUDIO_RESET, AUDIO_RESET); } =20 -static void it6505_enable_audio(struct it6505 *it6505) +static void it6505_disable_audio(struct it6505 *it6505) +{ + mutex_lock(&it6505->audio_lock); + __it6505_disable_audio(it6505); + mutex_unlock(&it6505->audio_lock); +} + +static void __it6505_enable_audio(struct it6505 *it6505) { struct device *dev =3D it6505->dev; int regbe; =20 DRM_DEV_DEBUG_DRIVER(dev, "start"); - it6505_disable_audio(it6505); + + __it6505_disable_audio(it6505); =20 it6505_setup_audio_channel_status(it6505); it6505_setup_audio_format(it6505); @@ -1637,6 +1648,14 @@ static void it6505_enable_audio(struct it6505 *it650= 5) it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_AUD_MUTE, 0x00); } =20 +static void it6505_enable_audio(struct it6505 *it6505) +{ + mutex_lock(&it6505->audio_lock); + if (!it6505->audio.mute) + __it6505_enable_audio(it6505); + mutex_unlock(&it6505->audio_lock); +} + static bool it6505_use_step_train_check(struct it6505 *it6505) { if (it6505->link.revision >=3D 0x12) @@ -2331,19 +2350,12 @@ static void it6505_stop_link_train(struct it6505 *i= t6505) =20 static void it6505_link_train_ok(struct it6505 *it6505) { - struct device *dev =3D it6505->dev; - it6505->link_state =3D LINK_OK; /* disalbe mute enable avi info frame */ it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_VID_MUTE, 0x00); it6505_set_bits(it6505, REG_INFOFRAME_CTRL, EN_VID_CTRL_PKT, EN_VID_CTRL_PKT); =20 - if (it6505_audio_input(it6505)) { - DRM_DEV_DEBUG_DRIVER(dev, "Enable audio!"); - it6505_enable_audio(it6505); - } - if (it6505->hdcp_desired) it6505_start_hdcp(it6505); } @@ -2635,8 +2647,10 @@ static void it6505_irq_audio_fifo_error(struct it650= 5 *it6505) =20 DRM_DEV_DEBUG_DRIVER(dev, "audio fifo error Interrupt"); =20 - if (it6505_audio_input(it6505)) - it6505_enable_audio(it6505); + mutex_lock(&it6505->audio_lock); + if (!it6505->audio.mute && it6505_audio_input(it6505)) + __it6505_enable_audio(it6505); + mutex_unlock(&it6505->audio_lock); } =20 static void it6505_irq_link_train_fail(struct it6505 *it6505) @@ -2985,7 +2999,7 @@ static void it6505_remove_notifier_module(struct it65= 05 *it6505) flush_work(&it6505->extcon_wq); } =20 -static void __maybe_unused it6505_delayed_audio(struct work_struct *work) +static void it6505_delayed_audio(struct work_struct *work) { struct it6505 *it6505 =3D container_of(work, struct it6505, delayed_audio.work); @@ -2999,11 +3013,12 @@ static void __maybe_unused it6505_delayed_audio(str= uct work_struct *work) it6505_enable_audio(it6505); } =20 -static int __maybe_unused it6505_audio_setup_hw_params(struct it6505 *it65= 05, - struct hdmi_codec_params - *params) +static int it6505_audio_setup_hw_params(struct it6505 *it6505, + struct hdmi_codec_params + *params) { struct device *dev =3D it6505->dev; + u8 word_length; int i =3D 0; =20 DRM_DEV_DEBUG_DRIVER(dev, "%s %d Hz, %d bit, %d channels\n", __func__, @@ -3019,8 +3034,6 @@ static int __maybe_unused it6505_audio_setup_hw_param= s(struct it6505 *it6505, return -EINVAL; } =20 - it6505->audio.channel_count =3D params->cea.channels; - while (i < ARRAY_SIZE(audio_sample_rate_map) && params->sample_rate !=3D audio_sample_rate_map[i].sample_rate_value) { @@ -3031,21 +3044,20 @@ static int __maybe_unused it6505_audio_setup_hw_par= ams(struct it6505 *it6505, params->sample_rate); return -EINVAL; } - it6505->audio.sample_rate =3D audio_sample_rate_map[i].rate; =20 switch (params->sample_width) { case 16: - it6505->audio.word_length =3D WORD_LENGTH_16BIT; + word_length =3D WORD_LENGTH_16BIT; break; case 18: - it6505->audio.word_length =3D WORD_LENGTH_18BIT; + word_length =3D WORD_LENGTH_18BIT; break; case 20: - it6505->audio.word_length =3D WORD_LENGTH_20BIT; + word_length =3D WORD_LENGTH_20BIT; break; case 24: case 32: - it6505->audio.word_length =3D WORD_LENGTH_24BIT; + word_length =3D WORD_LENGTH_24BIT; break; default: DRM_DEV_DEBUG_DRIVER(dev, "wordlength: %d bit not support", @@ -3053,27 +3065,111 @@ static int __maybe_unused it6505_audio_setup_hw_pa= rams(struct it6505 *it6505, return -EINVAL; } =20 + mutex_lock(&it6505->audio_lock); + it6505->audio.channel_count =3D params->cea.channels; + it6505->audio.sample_rate =3D audio_sample_rate_map[i].rate; + it6505->audio.word_length =3D word_length; + mutex_unlock(&it6505->audio_lock); + return 0; } =20 -static void __maybe_unused it6505_audio_shutdown(struct device *dev, void = *data) +static void it6505_audio_shutdown(struct device *dev, void *data) { struct it6505 *it6505 =3D dev_get_drvdata(dev); =20 + mutex_lock(&it6505->audio_lock); + it6505->audio.mute =3D true; if (it6505->powered) - it6505_disable_audio(it6505); + __it6505_disable_audio(it6505); + mutex_unlock(&it6505->audio_lock); + cancel_delayed_work_sync(&it6505->delayed_audio); +} + +static int it6505_audio_hw_params(struct device *dev, void *data, + struct hdmi_codec_daifmt *daifmt, + struct hdmi_codec_params *params) +{ + struct it6505 *it6505 =3D dev_get_drvdata(dev); + + return it6505_audio_setup_hw_params(it6505, params); } =20 -static int __maybe_unused it6505_audio_hook_plugged_cb(struct device *dev, - void *data, - hdmi_codec_plugged_cb fn, - struct device *codec_dev) +static int it6505_audio_mute(struct device *dev, void *data, + bool enable, int direction) +{ + struct it6505 *it6505 =3D dev_get_drvdata(dev); + + DRM_DEV_DEBUG_DRIVER(dev, "mute: %d", enable); + + /* + * Delay enabling audio until the stream is unmuted; InfoFrames + * without audio data upset some DP-to-HDMI dongles. + */ + if (enable) { + mutex_lock(&it6505->audio_lock); + it6505->audio.mute =3D true; + if (it6505->powered) + __it6505_disable_audio(it6505); + mutex_unlock(&it6505->audio_lock); + cancel_delayed_work_sync(&it6505->delayed_audio); + } else { + mutex_lock(&it6505->audio_lock); + it6505->audio.mute =3D false; + mutex_unlock(&it6505->audio_lock); + queue_delayed_work(system_wq, &it6505->delayed_audio, + msecs_to_jiffies(180)); + } + + return 0; +} + +static int it6505_audio_hook_plugged_cb(struct device *dev, + void *data, + hdmi_codec_plugged_cb fn, + struct device *codec_dev) { struct it6505 *it6505 =3D data; =20 + mutex_lock(&it6505->mode_lock); it6505->plugged_cb =3D fn; it6505->codec_dev =3D codec_dev; it6505_plugged_status_to_codec(it6505); + mutex_unlock(&it6505->mode_lock); + + return 0; +} + +static const struct hdmi_codec_ops it6505_audio_codec_ops =3D { + .hw_params =3D it6505_audio_hw_params, + .mute_stream =3D it6505_audio_mute, + .audio_shutdown =3D it6505_audio_shutdown, + .hook_plugged_cb =3D it6505_audio_hook_plugged_cb, +}; + +static int it6505_register_audio_driver(struct device *dev) +{ + struct it6505 *it6505 =3D dev_get_drvdata(dev); + struct hdmi_codec_pdata codec_data =3D { + .ops =3D &it6505_audio_codec_ops, + .max_i2s_channels =3D 8, + .i2s =3D 1, + .no_capture_mute =3D 1, + .data =3D it6505, + }; + struct platform_device *pdev; + + it6505->audio.mute =3D true; + INIT_DELAYED_WORK(&it6505->delayed_audio, it6505_delayed_audio); + + pdev =3D platform_device_register_data(dev, HDMI_CODEC_DRV_NAME, + PLATFORM_DEVID_AUTO, &codec_data, + sizeof(codec_data)); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + + it6505->audio_pdev =3D pdev; + DRM_DEV_DEBUG_DRIVER(dev, "bound to %s", HDMI_CODEC_DRV_NAME); =20 return 0; } @@ -3589,6 +3685,7 @@ static int it6505_i2c_probe(struct i2c_client *client) mutex_init(&it6505->extcon_lock); mutex_init(&it6505->mode_lock); mutex_init(&it6505->aux_lock); + mutex_init(&it6505->audio_lock); =20 it6505->bridge.of_node =3D client->dev.of_node; it6505->connector_status =3D connector_status_disconnected; @@ -3639,6 +3736,12 @@ static int it6505_i2c_probe(struct i2c_client *clien= t) return err; } =20 + err =3D it6505_register_audio_driver(dev); + if (err < 0) { + dev_err(dev, "Failed to register audio driver: %d", err); + return err; + } + INIT_WORK(&it6505->link_works, it6505_link_training_work); INIT_WORK(&it6505->hdcp_wait_ksv_list, it6505_hdcp_wait_ksv_list); INIT_DELAYED_WORK(&it6505->hdcp_work, it6505_hdcp_work); @@ -3680,6 +3783,8 @@ static void it6505_i2c_remove(struct i2c_client *clie= nt) cancel_work_sync(&it6505->hdcp_wait_ksv_list); cancel_delayed_work_sync(&it6505->hdcp_work); cancel_work_sync(&it6505->extcon_wq); + platform_device_unregister(it6505->audio_pdev); + cancel_delayed_work_sync(&it6505->delayed_audio); if (it6505->extcon_state) pm_runtime_put_sync(&client->dev); pm_runtime_disable(&client->dev); --=20 2.55.0 From nobody Sat Jul 25 04:15:27 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 EDFED30E82E for ; Sat, 25 Jul 2026 03:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948518; cv=none; b=lHBNkg2dwNNGeqxU23Dw+ra7Pc9KBcFKKZiR0JXV50o8ek4SqDcXYWtjisK3EoL42MHmN3/5SExR0594/lqXxE95JmV2fXIXeg4tnU8Zsed1VyFp/B/zMQJSToK/E5530Avbxlce4MBiFB76H5olNED4PuHyj5X5LuYlbwg1Vpc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784948518; c=relaxed/simple; bh=LaqrP9bRD2B7l6BzPVq3Mnhau/GXK//DTVlNfl76pf8=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=msHx1Tq8FcdFvA5xlTpLlg4uD0HnlPiwrD2Cxl9WJrSl3ZX4ve5coqfdsWqTw1afh+0uN7CfAqj/FQ/Bl6krP7zTWT1bTEgeT/dLqm9qtVMhjyKHYZTAJTleQrqZ63JsVXXDufe9sBYOYxBkjDMeZzI2264KpV4qOzKR0V+52B8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1wnSdz-00000000385-1ddo; Sat, 25 Jul 2026 03:01:43 +0000 Date: Sat, 25 Jul 2026 04:01:40 +0100 From: Daniel Golle To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Allen Chen , Hermes Wu , Pin-yen Lin , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Chen-Yu Tsai Subject: [PATCH v6 13/13] drm/bridge: it6505: Don't reject audio hw_params without an encoder Message-ID: <3ff0cd53a0c585285f497ee0b5f63de4cee0c9eb.1784947240.git.daniel@makrotopia.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" it6505_audio_setup_hw_params() returns -ENODEV when no encoder is attached. With it6505 registering an hdmi-audio-codec this runs for every stream on the I2S DAI, and on mt8186-corsola, where the rt1019 speaker amplifier shares I2S3, the error tears down the whole DPCM backend and breaks speaker playback whenever no display is attached. The function only caches stream parameters, which needs no encoder. Drop the check, and apply the audio defaults once at probe instead of in it6505_variable_config(), which would clobber the cached parameters again on every hotplug. Actual audio output remains gated by it6505->powered. Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") Signed-off-by: Daniel Golle --- v6: no changes v5: no changes v4: apply audio defaults at probe time instead of in it6505_variable_config() v3: no changes v2: drop the encoder check entirely instead of returning 0 early drivers/gpu/drm/bridge/ite-it6505.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index c560f1258f6d..0cb16be45d93 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -1371,16 +1371,6 @@ static void it6505_variable_config(struct it6505 *it= 6505) it6505->link_state =3D LINK_IDLE; it6505->hdcp_desired =3D HDCP_DESIRED; it6505->auto_train_retry =3D AUTO_TRAIN_RETRY; - it6505->audio.select =3D AUDIO_SELECT; - it6505->audio.sample_rate =3D AUDIO_SAMPLE_RATE; - it6505->audio.channel_count =3D AUDIO_CHANNEL_COUNT; - it6505->audio.type =3D AUDIO_TYPE; - it6505->audio.i2s_input_format =3D I2S_INPUT_FORMAT; - it6505->audio.i2s_justified =3D I2S_JUSTIFIED; - it6505->audio.i2s_data_delay =3D I2S_DATA_DELAY; - it6505->audio.i2s_ws_channel =3D I2S_WS_CHANNEL; - it6505->audio.i2s_data_sequence =3D I2S_DATA_SEQUENCE; - it6505->audio.word_length =3D AUDIO_WORD_LENGTH; memset(it6505->sha1_input, 0, sizeof(it6505->sha1_input)); memset(it6505->bksvs, 0, sizeof(it6505->bksvs)); } @@ -3025,9 +3015,6 @@ static int it6505_audio_setup_hw_params(struct it6505= *it6505, params->sample_rate, params->sample_width, params->cea.channels); =20 - if (!it6505->bridge.encoder) - return -ENODEV; - if (params->cea.channels <=3D 1 || params->cea.channels > 8) { DRM_DEV_DEBUG_DRIVER(dev, "channel number: %d not support", params->cea.channels); @@ -3159,6 +3146,16 @@ static int it6505_register_audio_driver(struct devic= e *dev) }; struct platform_device *pdev; =20 + it6505->audio.select =3D AUDIO_SELECT; + it6505->audio.sample_rate =3D AUDIO_SAMPLE_RATE; + it6505->audio.channel_count =3D AUDIO_CHANNEL_COUNT; + it6505->audio.type =3D AUDIO_TYPE; + it6505->audio.i2s_input_format =3D I2S_INPUT_FORMAT; + it6505->audio.i2s_justified =3D I2S_JUSTIFIED; + it6505->audio.i2s_data_delay =3D I2S_DATA_DELAY; + it6505->audio.i2s_ws_channel =3D I2S_WS_CHANNEL; + it6505->audio.i2s_data_sequence =3D I2S_DATA_SEQUENCE; + it6505->audio.word_length =3D AUDIO_WORD_LENGTH; it6505->audio.mute =3D true; INIT_DELAYED_WORK(&it6505->delayed_audio, it6505_delayed_audio); =20 --=20 2.55.0