aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2021-08-21 10:54:34 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2021-08-21 19:07:07 +0200
commit8299d1f057439f94c6a4412e2e5c5082b82a30c9 (patch)
tree1bf678d61f11f7394493be464c7876e496f7faed /target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch
parent33b6885975ce376ff075362b7f0890326043111b (diff)
downloadupstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.tar.gz
upstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.tar.bz2
upstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.zip
bcm27xx: add kernel 5.10 support
Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted patches, wireless patches and defconfig patches. bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 4B v1.1 4G bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch b/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch
new file mode 100644
index 0000000000..e436a0e54b
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.10/950-0675-drm-vc4-hdmi-Drop-devm-interrupt-handler-for-CEC-int.patch
@@ -0,0 +1,106 @@
+From 687a0fc86f37e0bc74c8382c0d89b0929fade1de Mon Sep 17 00:00:00 2001
+From: Maxime Ripard <maxime@cerno.tech>
+Date: Mon, 5 Jul 2021 15:47:43 +0200
+Subject: [PATCH] drm/vc4: hdmi: Drop devm interrupt handler for CEC
+ interrupts
+
+The CEC interrupt handlers are registered through the
+devm_request_threaded_irq function. However, while free_irq is indeed
+called properly when the device is unbound or bind fails, it's called
+after unbind or bind is done.
+
+In our particular case, it means that on failure it creates a window
+where our interrupt handler can be called, but we're freeing every
+resource (CEC adapter, DRM objects, etc.) it might need.
+
+In order to address this, let's switch to the non-devm variant to
+control better when the handler will be unregistered and allow us to
+make it safe.
+
+Fixes: 15b4511a4af6 ("drm/vc4: add HDMI CEC support")
+Signed-off-by: Maxime Ripard <maxime@cerno.tech>
+---
+ drivers/gpu/drm/vc4/vc4_hdmi.c | 49 +++++++++++++++++++++++-----------
+ 1 file changed, 33 insertions(+), 16 deletions(-)
+
+--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
+@@ -1903,38 +1903,46 @@ static int vc4_hdmi_cec_init(struct vc4_
+ vc4_hdmi_cec_update_clk_div(vc4_hdmi);
+
+ if (vc4_hdmi->variant->external_irq_controller) {
+- ret = devm_request_threaded_irq(&pdev->dev,
+- platform_get_irq_byname(pdev, "cec-rx"),
+- vc4_cec_irq_handler_rx_bare,
+- vc4_cec_irq_handler_rx_thread, 0,
+- "vc4 hdmi cec rx", vc4_hdmi);
++ ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-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;
+
+- ret = devm_request_threaded_irq(&pdev->dev,
+- platform_get_irq_byname(pdev, "cec-tx"),
+- vc4_cec_irq_handler_tx_bare,
+- vc4_cec_irq_handler_tx_thread, 0,
+- "vc4 hdmi cec tx", vc4_hdmi);
++ ret = request_threaded_irq(platform_get_irq_byname(pdev, "cec-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;
++ goto err_remove_cec_rx_handler;
+ } else {
+ HDMI_WRITE(HDMI_CEC_CPU_MASK_SET, 0xffffffff);
+
+- ret = devm_request_threaded_irq(&pdev->dev, platform_get_irq(pdev, 0),
+- vc4_cec_irq_handler,
+- vc4_cec_irq_handler_thread, 0,
+- "vc4 hdmi cec", vc4_hdmi);
++ ret = request_threaded_irq(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;
+ }
+
+ ret = cec_register_adapter(vc4_hdmi->cec_adap, &pdev->dev);
+ if (ret < 0)
+- goto err_delete_cec_adap;
++ goto err_remove_handlers;
+
+ return 0;
+
++err_remove_handlers:
++ if (vc4_hdmi->variant->external_irq_controller)
++ free_irq(platform_get_irq_byname(pdev, "cec-tx"), vc4_hdmi);
++ else
++ free_irq(platform_get_irq(pdev, 0), vc4_hdmi);
++
++err_remove_cec_rx_handler:
++ if (vc4_hdmi->variant->external_irq_controller)
++ free_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_hdmi);
++
+ err_delete_cec_adap:
+ cec_delete_adapter(vc4_hdmi->cec_adap);
+
+@@ -1943,6 +1951,15 @@ err_delete_cec_adap:
+
+ static void vc4_hdmi_cec_exit(struct vc4_hdmi *vc4_hdmi)
+ {
++ struct platform_device *pdev = vc4_hdmi->pdev;
++
++ if (vc4_hdmi->variant->external_irq_controller) {
++ free_irq(platform_get_irq_byname(pdev, "cec-rx"), vc4_hdmi);
++ free_irq(platform_get_irq_byname(pdev, "cec-tx"), vc4_hdmi);
++ } else {
++ free_irq(platform_get_irq(pdev, 0), vc4_hdmi);
++ }
++
+ cec_unregister_adapter(vc4_hdmi->cec_adap);
+ }
+ #else