Commit af8a3b12 authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: hdmi: Use devm to register hotplug interrupts

Commit 776efe80 ("drm/vc4: hdmi: Drop devm interrupt handler for
hotplug interrupts") dropped the device-managed interrupt registration
because it was creating bugs and races whenever an interrupt was coming in
while the device was removed.

However, our latest patches to the HDMI controller driver fix this as well,
so we can use device-managed interrupt handlers again.
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220711173939.1132294-46-maxime@cerno.tech
parent a3dbb1c0
...@@ -2216,21 +2216,19 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi) ...@@ -2216,21 +2216,19 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi)
unsigned int hpd_con = platform_get_irq_byname(pdev, "hpd-connected"); unsigned int hpd_con = platform_get_irq_byname(pdev, "hpd-connected");
unsigned int hpd_rm = platform_get_irq_byname(pdev, "hpd-removed"); unsigned int hpd_rm = platform_get_irq_byname(pdev, "hpd-removed");
ret = request_threaded_irq(hpd_con, ret = devm_request_threaded_irq(&pdev->dev, hpd_con,
NULL, NULL,
vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT, vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
"vc4 hdmi hpd connected", vc4_hdmi); "vc4 hdmi hpd connected", vc4_hdmi);
if (ret) if (ret)
return ret; return ret;
ret = request_threaded_irq(hpd_rm, ret = devm_request_threaded_irq(&pdev->dev, hpd_rm,
NULL, NULL,
vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT, vc4_hdmi_hpd_irq_thread, IRQF_ONESHOT,
"vc4 hdmi hpd disconnected", vc4_hdmi); "vc4 hdmi hpd disconnected", vc4_hdmi);
if (ret) { if (ret)
free_irq(hpd_con, vc4_hdmi);
return ret; return ret;
}
connector->polled = DRM_CONNECTOR_POLL_HPD; connector->polled = DRM_CONNECTOR_POLL_HPD;
} }
...@@ -2238,16 +2236,6 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi) ...@@ -2238,16 +2236,6 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi)
return 0; return 0;
} }
static void vc4_hdmi_hotplug_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, "hpd-connected"), vc4_hdmi);
free_irq(platform_get_irq_byname(pdev, "hpd-removed"), vc4_hdmi);
}
}
#ifdef CONFIG_DRM_VC4_HDMI_CEC #ifdef CONFIG_DRM_VC4_HDMI_CEC
static irqreturn_t vc4_cec_irq_handler_rx_thread(int irq, void *priv) static irqreturn_t vc4_cec_irq_handler_rx_thread(int irq, void *priv)
{ {
...@@ -3069,11 +3057,11 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -3069,11 +3057,11 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
ret = vc4_hdmi_cec_init(vc4_hdmi); ret = vc4_hdmi_cec_init(vc4_hdmi);
if (ret) if (ret)
goto err_free_hotplug; goto err_put_runtime_pm;
ret = vc4_hdmi_audio_init(vc4_hdmi); ret = vc4_hdmi_audio_init(vc4_hdmi);
if (ret) if (ret)
goto err_free_hotplug; goto err_put_runtime_pm;
vc4_debugfs_add_file(drm, variant->debugfs_name, vc4_debugfs_add_file(drm, variant->debugfs_name,
vc4_hdmi_debugfs_regs, vc4_hdmi_debugfs_regs,
...@@ -3083,8 +3071,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -3083,8 +3071,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
return 0; return 0;
err_free_hotplug:
vc4_hdmi_hotplug_exit(vc4_hdmi);
err_put_runtime_pm: err_put_runtime_pm:
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
err_disable_runtime_pm: err_disable_runtime_pm:
...@@ -3096,8 +3082,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -3096,8 +3082,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
static void vc4_hdmi_unbind(struct device *dev, struct device *master, static void vc4_hdmi_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct vc4_hdmi *vc4_hdmi;
/* /*
* ASoC makes it a bit hard to retrieve a pointer to the * ASoC makes it a bit hard to retrieve a pointer to the
* vc4_hdmi structure. Registering the card will overwrite our * vc4_hdmi structure. Registering the card will overwrite our
...@@ -3117,9 +3101,6 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, ...@@ -3117,9 +3101,6 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
*/ */
BUILD_BUG_ON(offsetof(struct vc4_hdmi_audio, card) != 0); BUILD_BUG_ON(offsetof(struct vc4_hdmi_audio, card) != 0);
BUILD_BUG_ON(offsetof(struct vc4_hdmi, audio) != 0); BUILD_BUG_ON(offsetof(struct vc4_hdmi, audio) != 0);
vc4_hdmi = dev_get_drvdata(dev);
vc4_hdmi_hotplug_exit(vc4_hdmi);
pm_runtime_disable(dev); pm_runtime_disable(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment