Skip to content

Commit 85c6362

Browse files
Srinivas-KandagatlaAbhinav Kumar
authored andcommitted
drm/msm/dp: unregister audio driver during unbind
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: d13e36d ("drm/msm/dp: add audio support for Display Port on MSM") Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Patchwork: https://patchwork.freedesktop.org/patch/533324/ Link: https://lore.kernel.org/r/20230421145657.12186-1-srinivas.kandagatla@linaro.org Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
1 parent 16eb51a commit 85c6362

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/gpu/drm/msm/dp/dp_audio.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,18 @@ static struct hdmi_codec_pdata codec_data = {
593593
.i2s = 1,
594594
};
595595

596+
void dp_unregister_audio_driver(struct device *dev, struct dp_audio *dp_audio)
597+
{
598+
struct dp_audio_private *audio_priv;
599+
600+
audio_priv = container_of(dp_audio, struct dp_audio_private, dp_audio);
601+
602+
if (audio_priv->audio_pdev) {
603+
platform_device_unregister(audio_priv->audio_pdev);
604+
audio_priv->audio_pdev = NULL;
605+
}
606+
}
607+
596608
int dp_register_audio_driver(struct device *dev,
597609
struct dp_audio *dp_audio)
598610
{

drivers/gpu/drm/msm/dp/dp_audio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ struct dp_audio *dp_audio_get(struct platform_device *pdev,
5353
int dp_register_audio_driver(struct device *dev,
5454
struct dp_audio *dp_audio);
5555

56+
void dp_unregister_audio_driver(struct device *dev, struct dp_audio *dp_audio);
57+
5658
/**
5759
* dp_audio_put()
5860
*

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ static void dp_display_unbind(struct device *dev, struct device *master,
326326
kthread_stop(dp->ev_tsk);
327327

328328
dp_power_client_deinit(dp->power);
329+
dp_unregister_audio_driver(dev, dp->audio);
329330
dp_aux_unregister(dp->aux);
330331
dp->drm_dev = NULL;
331332
dp->aux->drm_dev = NULL;

0 commit comments

Comments
 (0)