Commit 31b59cf9 authored by Paul Fertser's avatar Paul Fertser Committed by Mark Brown
Browse files

ASoC: Fix WM8753 DAIs unregistering



WM8753 uses a tricky way to switch DAIs "on the fly", for that it
registers 2 dummy DAIs and substitutes them depending on mixer control.

List element of registered dummy DAIs should be preserved to allow
unregistering of DAIs on module unload.

Signed-off-by: default avatarPaul Fertser <fercerpav@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent bf3dbe5c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1451,30 +1451,35 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec, unsigned int mode)
	if (mode < 4) {
		int playback_active, capture_active, codec_active, pop_wait;
		void *private_data;
		struct list_head list;

		playback_active = wm8753_dai[0].playback.active;
		capture_active = wm8753_dai[0].capture.active;
		codec_active = wm8753_dai[0].active;
		private_data = wm8753_dai[0].private_data;
		pop_wait = wm8753_dai[0].pop_wait;
		list = wm8753_dai[0].list;
		wm8753_dai[0] = wm8753_all_dai[mode << 1];
		wm8753_dai[0].playback.active = playback_active;
		wm8753_dai[0].capture.active = capture_active;
		wm8753_dai[0].active = codec_active;
		wm8753_dai[0].private_data = private_data;
		wm8753_dai[0].pop_wait = pop_wait;
		wm8753_dai[0].list = list;

		playback_active = wm8753_dai[1].playback.active;
		capture_active = wm8753_dai[1].capture.active;
		codec_active = wm8753_dai[1].active;
		private_data = wm8753_dai[1].private_data;
		pop_wait = wm8753_dai[1].pop_wait;
		list = wm8753_dai[1].list;
		wm8753_dai[1] = wm8753_all_dai[(mode << 1) + 1];
		wm8753_dai[1].playback.active = playback_active;
		wm8753_dai[1].capture.active = capture_active;
		wm8753_dai[1].active = codec_active;
		wm8753_dai[1].private_data = private_data;
		wm8753_dai[1].pop_wait = pop_wait;
		wm8753_dai[1].list = list;
	}
	wm8753_dai[0].codec = codec;
	wm8753_dai[1].codec = codec;