aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-01-20 09:46:44 -0500
committerTakashi Iwai <tiwai@suse.de>2016-01-20 09:56:42 -0500
commitbca8e988043e39483afd7872a2641f03ed7201a6 (patch)
treee4c65d75876e05ef26c09b085552b7da3ff235ad /sound
parentbed2e98e1f4db8b827df507abc30be7b11b0613d (diff)
ALSA: hda - Fix missing module loading with model=generic option
When the generic codec driver is specified via model option or such, the hda driver doesn't try to load the generic driver module but still loads the codec-specific driver, and this ends up with the binding failure. This patch fixes it by moving the generic module request in the common helper code. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111021 Cc: <stable@vger.kernel.org> # v4.4+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_bind.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 70671ad65d24..6efadbfb3fe3 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -174,14 +174,40 @@ static inline bool codec_probed(struct hda_codec *codec)
174 return device_attach(hda_codec_dev(codec)) > 0 && codec->preset; 174 return device_attach(hda_codec_dev(codec)) > 0 && codec->preset;
175} 175}
176 176
177/* try to auto-load and bind the codec module */ 177/* try to auto-load codec module */
178static void codec_bind_module(struct hda_codec *codec) 178static void request_codec_module(struct hda_codec *codec)
179{ 179{
180#ifdef MODULE 180#ifdef MODULE
181 char modalias[32]; 181 char modalias[32];
182 const char *mod = NULL;
183
184 switch (codec->probe_id) {
185 case HDA_CODEC_ID_GENERIC_HDMI:
186#if IS_MODULE(CONFIG_SND_HDA_CODEC_HDMI)
187 mod = "snd-hda-codec-hdmi";
188#endif
189 break;
190 case HDA_CODEC_ID_GENERIC:
191#if IS_MODULE(CONFIG_SND_HDA_GENERIC)
192 mod = "snd-hda-codec-generic";
193#endif
194 break;
195 default:
196 snd_hdac_codec_modalias(&codec->core, modalias, sizeof(modalias));
197 mod = modalias;
198 break;
199 }
200
201 if (mod)
202 request_module(mod);
203#endif /* MODULE */
204}
182 205
183 snd_hdac_codec_modalias(&codec->core, modalias, sizeof(modalias)); 206/* try to auto-load and bind the codec module */
184 request_module(modalias); 207static void codec_bind_module(struct hda_codec *codec)
208{
209#ifdef MODULE
210 request_codec_module(codec);
185 if (codec_probed(codec)) 211 if (codec_probed(codec))
186 return; 212 return;
187#endif 213#endif
@@ -218,17 +244,13 @@ static int codec_bind_generic(struct hda_codec *codec)
218 244
219 if (is_likely_hdmi_codec(codec)) { 245 if (is_likely_hdmi_codec(codec)) {
220 codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI; 246 codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI;
221#if IS_MODULE(CONFIG_SND_HDA_CODEC_HDMI) 247 request_codec_module(codec);
222 request_module("snd-hda-codec-hdmi");
223#endif
224 if (codec_probed(codec)) 248 if (codec_probed(codec))
225 return 0; 249 return 0;
226 } 250 }
227 251
228 codec->probe_id = HDA_CODEC_ID_GENERIC; 252 codec->probe_id = HDA_CODEC_ID_GENERIC;
229#if IS_MODULE(CONFIG_SND_HDA_GENERIC) 253 request_codec_module(codec);
230 request_module("snd-hda-codec-generic");
231#endif
232 if (codec_probed(codec)) 254 if (codec_probed(codec))
233 return 0; 255 return 0;
234 return -ENODEV; 256 return -ENODEV;