* [PATCH] drm/msm/dp: unregister audio driver during unbind
@ 2023-04-21 14:56 Srinivas Kandagatla
2023-04-21 18:41 ` Abhinav Kumar
2023-04-28 19:52 ` Abhinav Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2023-04-21 14:56 UTC (permalink / raw)
To: robdclark, quic_abhinavk, sean, dmitry.baryshkov, airlied, daniel,
lyude
Cc: javierm, tzimmermann, quic_khsieh, quic_bjorande, johan+linaro,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
Srinivas Kandagatla
while binding the code always registers a audio driver, however there
is no corresponding unregistration done in unbind. This leads to multiple
redundant audio platform devices if dp_display_bind and dp_display_unbind
happens multiple times during startup. On X13s platform this resulted in
6 to 9 audio codec device instead of just 3 codec devices for 3 dp ports.
Fix this by unregistering codecs on unbind.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/gpu/drm/msm/dp/dp_audio.c | 12 ++++++++++++
drivers/gpu/drm/msm/dp/dp_audio.h | 2 ++
drivers/gpu/drm/msm/dp/dp_display.c | 1 +
3 files changed, 15 insertions(+)
diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c
index 6666783e1468..1245c7aa49df 100644
--- a/drivers/gpu/drm/msm/dp/dp_audio.c
+++ b/drivers/gpu/drm/msm/dp/dp_audio.c
@@ -593,6 +593,18 @@ static struct hdmi_codec_pdata codec_data = {
.i2s = 1,
};
+void dp_unregister_audio_driver(struct device *dev, struct dp_audio *dp_audio)
+{
+ struct dp_audio_private *audio_priv;
+
+ audio_priv = container_of(dp_audio, struct dp_audio_private, dp_audio);
+
+ if (audio_priv->audio_pdev) {
+ platform_device_unregister(audio_priv->audio_pdev);
+ audio_priv->audio_pdev = NULL;
+ }
+}
+
int dp_register_audio_driver(struct device *dev,
struct dp_audio *dp_audio)
{
diff --git a/drivers/gpu/drm/msm/dp/dp_audio.h b/drivers/gpu/drm/msm/dp/dp_audio.h
index 84e5f4a5d26b..4ab78880af82 100644
--- a/drivers/gpu/drm/msm/dp/dp_audio.h
+++ b/drivers/gpu/drm/msm/dp/dp_audio.h
@@ -53,6 +53,8 @@ struct dp_audio *dp_audio_get(struct platform_device *pdev,
int dp_register_audio_driver(struct device *dev,
struct dp_audio *dp_audio);
+void dp_unregister_audio_driver(struct device *dev, struct dp_audio *dp_audio);
+
/**
* dp_audio_put()
*
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 3e13acdfa7e5..99a38dbe51c0 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -326,6 +326,7 @@ static void dp_display_unbind(struct device *dev, struct device *master,
kthread_stop(dp->ev_tsk);
dp_power_client_deinit(dp->power);
+ dp_unregister_audio_driver(dev, dp->audio);
dp_aux_unregister(dp->aux);
dp->drm_dev = NULL;
dp->aux->drm_dev = NULL;
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/msm/dp: unregister audio driver during unbind
2023-04-21 14:56 [PATCH] drm/msm/dp: unregister audio driver during unbind Srinivas Kandagatla
@ 2023-04-21 18:41 ` Abhinav Kumar
2023-04-28 19:52 ` Abhinav Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Abhinav Kumar @ 2023-04-21 18:41 UTC (permalink / raw)
To: Srinivas Kandagatla, robdclark, sean, dmitry.baryshkov, airlied,
daniel, lyude
Cc: javierm, tzimmermann, quic_khsieh, quic_bjorande, johan+linaro,
linux-arm-msm, dri-devel, freedreno, linux-kernel
On 4/21/2023 7:56 AM, Srinivas Kandagatla wrote:
> while binding the code always registers a audio driver, however there
> is no corresponding unregistration done in unbind. This leads to multiple
> redundant audio platform devices if dp_display_bind and dp_display_unbind
> happens multiple times during startup. On X13s platform this resulted in
> 6 to 9 audio codec device instead of just 3 codec devices for 3 dp ports.
>
> Fix this by unregistering codecs on unbind.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
Fixes: d13e36d7d222 ("drm/msm/dp: add audio support for Display Port on
MSM")
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
(pls ignore the line break in the fixes tag, its a mail editor issue, I
will apply the tag properly while applying to -fixes)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/msm/dp: unregister audio driver during unbind
2023-04-21 14:56 [PATCH] drm/msm/dp: unregister audio driver during unbind Srinivas Kandagatla
2023-04-21 18:41 ` Abhinav Kumar
@ 2023-04-28 19:52 ` Abhinav Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Abhinav Kumar @ 2023-04-28 19:52 UTC (permalink / raw)
To: robdclark, sean, dmitry.baryshkov, airlied, daniel, lyude,
Srinivas Kandagatla
Cc: Abhinav Kumar, javierm, tzimmermann, quic_khsieh, quic_bjorande,
johan+linaro, linux-arm-msm, dri-devel, freedreno, linux-kernel
On Fri, 21 Apr 2023 15:56:57 +0100, Srinivas Kandagatla wrote:
> while binding the code always registers a audio driver, however there
> is no corresponding unregistration done in unbind. This leads to multiple
> redundant audio platform devices if dp_display_bind and dp_display_unbind
> happens multiple times during startup. On X13s platform this resulted in
> 6 to 9 audio codec device instead of just 3 codec devices for 3 dp ports.
>
> Fix this by unregistering codecs on unbind.
>
> [...]
Applied, thanks!
[1/1] drm/msm/dp: unregister audio driver during unbind
https://gitlab.freedesktop.org/abhinavk/msm/-/commit/85c636284cb6
Best regards,
--
Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-28 19:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 14:56 [PATCH] drm/msm/dp: unregister audio driver during unbind Srinivas Kandagatla
2023-04-21 18:41 ` Abhinav Kumar
2023-04-28 19:52 ` Abhinav Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox