aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-08-06 08:32:56 -0400
committerTakashi Iwai <tiwai@suse.de>2014-08-07 04:11:29 -0400
commit875f0dd79987a63f01c07a9994dbe2c457992e41 (patch)
treedccb195f5e4410d69b1c49a7f5ee37cfc33ceca3 /sound
parentc563f473ac31c182d93f4c6ec8eb0ce199439978 (diff)
ALSA: hda - Fix parsing of CMI8888 codec
CMI8888 codec chip has a boost amp (only) on the headphone pin, and this confuses the generic parser, which tends to pick up the most outside amp. This results in the wrong volume setup, as the driver complains like: hda_codec: Mismatching dB step for vmaster slave (-100!=1000) For avoiding this problem, rule out the amp on NID 0x10 and create "Headphone Amp" volume control manually instead. Note that this patch still doesn't fix all problems yet. The sound output from the line out seems still too low. It will be fixed in another patch (hopefully). Reported-and-tested-by: Vincent Lejeune <vljn@ovi.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_cmedia.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index ed3d133ffbb6..c895a8f21192 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -75,15 +75,62 @@ static int patch_cmi9880(struct hda_codec *codec)
75 return err; 75 return err;
76} 76}
77 77
78static int patch_cmi8888(struct hda_codec *codec)
79{
80 struct cmi_spec *spec;
81 struct auto_pin_cfg *cfg;
82 int err;
83
84 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
85 if (!spec)
86 return -ENOMEM;
87
88 codec->spec = spec;
89 cfg = &spec->gen.autocfg;
90 snd_hda_gen_spec_init(&spec->gen);
91
92 /* mask NID 0x10 from the playback volume selection;
93 * it's a headphone boost volume handled manually below
94 */
95 spec->gen.out_vol_mask = (1ULL << 0x10);
96
97 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
98 if (err < 0)
99 goto error;
100 err = snd_hda_gen_parse_auto_config(codec, cfg);
101 if (err < 0)
102 goto error;
103
104 if (get_defcfg_device(snd_hda_codec_get_pincfg(codec, 0x10)) ==
105 AC_JACK_HP_OUT) {
106 static const struct snd_kcontrol_new amp_kctl =
107 HDA_CODEC_VOLUME("Headphone Amp Playback Volume",
108 0x10, 0, HDA_OUTPUT);
109 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &amp_kctl)) {
110 err = -ENOMEM;
111 goto error;
112 }
113 }
114
115 codec->patch_ops = cmi_auto_patch_ops;
116 return 0;
117
118 error:
119 snd_hda_gen_free(codec);
120 return err;
121}
122
78/* 123/*
79 * patch entries 124 * patch entries
80 */ 125 */
81static const struct hda_codec_preset snd_hda_preset_cmedia[] = { 126static const struct hda_codec_preset snd_hda_preset_cmedia[] = {
127 { .id = 0x13f68888, .name = "CMI8888", .patch = patch_cmi8888 },
82 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 }, 128 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 },
83 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 }, 129 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 },
84 {} /* terminator */ 130 {} /* terminator */
85}; 131};
86 132
133MODULE_ALIAS("snd-hda-codec-id:13f68888");
87MODULE_ALIAS("snd-hda-codec-id:13f69880"); 134MODULE_ALIAS("snd-hda-codec-id:13f69880");
88MODULE_ALIAS("snd-hda-codec-id:434d4980"); 135MODULE_ALIAS("snd-hda-codec-id:434d4980");
89 136