Skip to content

Commit 64c1390

Browse files
hoshinolinajannau
authored andcommitted
drm/apple: audio: Fix hotplug notifications
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent dd842f7 commit 64c1390

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

drivers/gpu/drm/apple/audio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ static void dcpaud_report_hotplug(struct dcp_audio *dcpaud, bool connected)
500500

501501
if (!connected) {
502502
snd_pcm_stream_lock(substream);
503-
snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
503+
if (substream->runtime)
504+
snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
504505
snd_pcm_stream_unlock(substream);
505506
}
506507
}
@@ -592,7 +593,6 @@ void dcpaud_disconnect(struct platform_device *pdev)
592593

593594
mutex_lock(&dcpaud->data_lock);
594595

595-
dcpaud->dcp_connected = false;
596596
dcpaud_report_hotplug(dcpaud, false);
597597
}
598598

drivers/gpu/drm/apple/av.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ static void av_interface_init(struct apple_epic_service *service, const char *na
6969
{
7070
}
7171

72+
static void av_interface_teardown(struct apple_epic_service *service)
73+
{
74+
struct apple_dcp *dcp = service->ep->dcp;
75+
struct audiosrv_data *asrv = dcp->audiosrv;
76+
77+
mutex_lock(&asrv->plug_lock);
78+
79+
asrv->plugged = false;
80+
if (asrv->audio_dev)
81+
dcpaud_disconnect(asrv->audio_dev);
82+
83+
mutex_unlock(&asrv->plug_lock);
84+
}
85+
7286
static void av_audiosrv_init(struct apple_epic_service *service, const char *name,
7387
const char *class, s64 unit)
7488
{
@@ -258,6 +272,7 @@ static const struct apple_epic_service_ops avep_ops[] = {
258272
{
259273
.name = "DCPAVSimpleVideoInterface",
260274
.init = av_interface_init,
275+
.teardown = av_interface_teardown,
261276
},
262277
{
263278
.name = "DCPAVAudioInterface",

0 commit comments

Comments
 (0)