ALSA: hda: Add setup for mario
PATCH 1/1 ALSA: hda: Add setup for mario
Add preset configuration for mario to override amp capabilities
--- sound/pci/hda/patch_realtek.c | 52 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-)
sound/pci/hda/patch_realtek.c +52 -0
@@ -196,6 +196,7 @@ enum {ALC272_DELL ,ALC272_DELL_ZM1 ,ALC272_SAMSUNG_NC10 , +ALC272_MARIO ,ALC662_AUTO , ALC662_MODEL_LAST, };
@@ -17643,6 +17644,18 @@ static struct hda_verb alc663_mode8_init_verbs[] = { {} }; +static struct hda_verb alc272_mario_init_verbs[] = { + {0x12 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_IN }, + {0x21 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_HP }, + {0x21 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE }, + {0x21 ,AC_VERB_SET_CONNECT_SEL ,0x01 },/* Headphone */ + {0x22 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_MUTE (0 )}, + {0x22 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (9 )}, + {0x18 ,AC_VERB_SET_UNSOLICITED_ENABLE ,AC_USRSP_EN |ALC880_MIC_EVENT }, + {0x21 ,AC_VERB_SET_UNSOLICITED_ENABLE ,AC_USRSP_EN |ALC880_HP_EVENT }, + {} +}; +static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {HDA_CODEC_VOLUME ("Capture Volume" ,0x09 ,0x0 ,HDA_INPUT ),HDA_CODEC_MUTE ("Capture Switch" ,0x09 ,0x0 ,HDA_INPUT ),
@@ -18126,6 +18139,20 @@ static void alc663_g50v_unsol_event(struct hda_codec *codec, } } +static void alc272_mario_inithook (struct hda_codec *codec) +{ +alc663_21jd_two_speaker_automute (codec); +alc_mic_automute (codec); +if (snd_hda_override_amp_caps (codec,0x2 ,HDA_OUTPUT , + (0x3b <<AC_AMPCAP_OFFSET_SHIFT ) | + (0x3b <<AC_AMPCAP_NUM_STEPS_SHIFT ) | + (0x03 <<AC_AMPCAP_STEP_SIZE_SHIFT ) | + (0 <<AC_AMPCAP_MUTE_SHIFT ))) { +printk (KERN_WARNING +"hda_codec: failed to override amp caps for NID 0x2\n" ); + } +} +#define alc663_g50v_setup alc663_m51va_setupstatic void alc663_g50v_inithook (struct hda_codec *codec)
@@ -18165,6 +18192,18 @@ static struct snd_kcontrol_new alc272_nc10_mixer[] = { { }/* end */ }; +static struct snd_kcontrol_new alc272_mario_mixer[] = { +HDA_CODEC_VOLUME ("Speaker Playback Volume" ,0x2 ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_MUTE ("Speaker Playback Switch" ,0xc ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_VOLUME ("Headphone Playback Volume" ,0x3 ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_MUTE ("Headphone Playback Switch" ,0xd ,0x0 ,HDA_OUTPUT ), + +HDA_CODEC_VOLUME ("Mic Playback Volume" ,0x0b ,0x0 ,HDA_INPUT ), +HDA_CODEC_MUTE ("Mic Playback Switch" ,0x0b ,0x0 ,HDA_INPUT ), +HDA_CODEC_VOLUME ("Mic Boost" ,0x18 ,0 ,HDA_INPUT ), + { }/* end */ +}; +#ifdef CONFIG_SND_HDA_POWER_SAVE #define alc662_loopbacks alc880_loopbacks#endif
@@ -18203,6 +18242,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { [ALC272_DELL] = "dell", [ALC272_DELL_ZM1] = "dell-zm1", [ALC272_SAMSUNG_NC10] = "samsung-nc10", + [ALC272_MARIO] = "mario", [ALC662_AUTO] = "auto", };
@@ -18590,6 +18630,18 @@ static struct alc_config_preset alc662_presets[] = { .setup = alc663_mode4_setup, .init_hook = alc663_mode4_inithook, }, + [ALC272_MARIO] = { + .mixers = { alc272_mario_mixer }, + .init_verbs = { alc662_init_verbs, + alc272_mario_init_verbs}, + .num_dacs = ARRAY_SIZE(alc272_dac_nids), + .dac_nids = alc272_dac_nids, + .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), + .channel_mode = alc662_3ST_2ch_modes, + .unsol_event = alc663_mode4_unsol_event, + .setup = alc663_mode4_setup, + .init_hook = alc272_mario_inithook, + }, };
Signature · 1 line
1.7.1
At Wed, 27 Oct 2010 13:18:41 -0700,
Quoted 4 lines · Todd Broch
Add preset configuration for mario to override amp capabilities
Signed-off-by Todd Broch <[email protected]>
Thanks for the patch.
But could you give more background, e.g. why this change is necessary, and what exactly it fixes?
Takashi
Quoted 105 lines
--- sound/pci/hda/patch_realtek.c | 52 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-)sound/pci/hda/patch_realtek.c +52
-0@@ -196,6 +196,7 @@ enum {ALC272_DELL ,ALC272_DELL_ZM1 ,ALC272_SAMSUNG_NC10 , +ALC272_MARIO ,ALC662_AUTO , ALC662_MODEL_LAST, };@@ -17643,6 +17644,18 @@ static struct hda_verb alc663_mode8_init_verbs[] = { {} }; +static struct hda_verb alc272_mario_init_verbs[] = { + {0x12 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_IN }, + {0x21 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_HP }, + {0x21 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE }, + {0x21 ,AC_VERB_SET_CONNECT_SEL ,0x01 },/* Headphone */ + {0x22 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_MUTE (0 )}, + {0x22 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (9 )}, + {0x18 ,AC_VERB_SET_UNSOLICITED_ENABLE ,AC_USRSP_EN |ALC880_MIC_EVENT }, + {0x21 ,AC_VERB_SET_UNSOLICITED_ENABLE ,AC_USRSP_EN |ALC880_HP_EVENT }, + {} +}; +static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {HDA_CODEC_VOLUME ("Capture Volume" ,0x09 ,0x0 ,HDA_INPUT ),HDA_CODEC_MUTE ("Capture Switch" ,0x09 ,0x0 ,HDA_INPUT ),@@ -18126,6 +18139,20 @@ static void alc663_g50v_unsol_event(struct hda_codec *codec, } } +static void alc272_mario_inithook (struct hda_codec *codec) +{ +alc663_21jd_two_speaker_automute (codec); +alc_mic_automute (codec); +if (snd_hda_override_amp_caps (codec,0x2 ,HDA_OUTPUT , + (0x3b <<AC_AMPCAP_OFFSET_SHIFT ) | + (0x3b <<AC_AMPCAP_NUM_STEPS_SHIFT ) | + (0x03 <<AC_AMPCAP_STEP_SIZE_SHIFT ) | + (0 <<AC_AMPCAP_MUTE_SHIFT ))) { +printk (KERN_WARNING +"hda_codec: failed to override amp caps for NID 0x2\n" ); + } +} +#define alc663_g50v_setup alc663_m51va_setupstatic void alc663_g50v_inithook (struct hda_codec *codec)@@ -18165,6 +18192,18 @@ static struct snd_kcontrol_new alc272_nc10_mixer[] = { { }/* end */ }; +static struct snd_kcontrol_new alc272_mario_mixer[] = { +HDA_CODEC_VOLUME ("Speaker Playback Volume" ,0x2 ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_MUTE ("Speaker Playback Switch" ,0xc ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_VOLUME ("Headphone Playback Volume" ,0x3 ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_MUTE ("Headphone Playback Switch" ,0xd ,0x0 ,HDA_OUTPUT ), + +HDA_CODEC_VOLUME ("Mic Playback Volume" ,0x0b ,0x0 ,HDA_INPUT ), +HDA_CODEC_MUTE ("Mic Playback Switch" ,0x0b ,0x0 ,HDA_INPUT ), +HDA_CODEC_VOLUME ("Mic Boost" ,0x18 ,0 ,HDA_INPUT ), + { }/* end */ +}; +#ifdef CONFIG_SND_HDA_POWER_SAVE #define alc662_loopbacks alc880_loopbacks#endif @@ -18203,6 +18242,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { [ALC272_DELL] = "dell", [ALC272_DELL_ZM1] = "dell-zm1", [ALC272_SAMSUNG_NC10] = "samsung-nc10", + [ALC272_MARIO] = "mario", [ALC662_AUTO] = "auto", };@@ -18590,6 +18630,18 @@ static struct alc_config_preset alc662_presets[] = { .setup = alc663_mode4_setup, .init_hook = alc663_mode4_inithook, }, + [ALC272_MARIO] = { + .mixers = { alc272_mario_mixer }, + .init_verbs = { alc662_init_verbs, + alc272_mario_init_verbs}, + .num_dacs = ARRAY_SIZE(alc272_dac_nids), + .dac_nids = alc272_dac_nids, + .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), + .channel_mode = alc662_3ST_2ch_modes, + .unsol_event = alc663_mode4_unsol_event, + .setup = alc663_mode4_setup, + .init_hook = alc272_mario_inithook, + }, };Signature · 1 line
1.7.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
At Thu, 28 Oct 2010 12:26:12 -0700,
Quoted 14 lines · Todd Broch
Hi Takashi,
Thanks for the quick response.
The system (mario) I'm working with has an external amplifier (EA) to drive the
d-class speakers. The EA has 4 discrete gains determined by resistor strappings. The chosen strapping coupled with maximum gain out of the codec overdrives the speakers creating distortion. Changing the strappings to a
lower gain would remove distortion but not allow maximum power to speakers.
Quoted 4 lines
The patch, most notably
alc272_mario_inithook, decreases the codec's internal
amplifier maximum by 5dB via thesnd_hda_override_amp_capsfunction. This remedies distortion while still providing maximum power.
OK, so it's essentially only for overriding amp?
In other words, if we can put only the amp-override somewhere for this device, the driver works as is?
I'm asking this because you define init_verbs and mixer arrays. I understand that these are necessary for presets. But, if only the amp override is required, we may define another mechanism like fixup initverb or pin quirks.
thanks,
Takashi
Quoted 137 lines
Todd
Quoted 131 lines · Takashi Iwai
At Wed, 27 Oct 2010 13:18:41 -0700,
Quoted 4 lines · Todd Broch
Add preset configuration for mario to override amp capabilities
Signed-off-by Todd Broch <[email protected]>Thanks for the patch.
But could you give more background, e.g. why this change is necessary, and what exactly it fixes?Takashi
Quoted 2 lines
--- sound/pci/hda/patch_realtek.c | 52+++++++++++++++++++++++++++++++++++++++++
Review
Quoted 3 lines
1 files changed, 52 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/sound/pci/hda/patch_realtek.csound/pci/hda/patch_realtek.c static struct hda_verb alc663_mode8_init_verbs[]
Quoted 12 lines
index 79bf4c8..7c77950 100644
sound/pci/hda/patch_realtek.c +1
-0@@ -196,6 +196,7 @@ enum {ALC272_DELL ,ALC272_DELL_ZM1 ,ALC272_SAMSUNG_NC10 , +ALC272_MARIO ,ALC662_AUTO , ALC662_MODEL_LAST, };@@ -17643,6 +17644,18 @@ static struct hda_verb alc663_mode8_init_verbs[]= {
sound/pci/hda/patch_realtek.c static struct hda_verb alc663_mode8_init_verbs[] = {
Quoted 11 lines
sound/pci/hda/patch_realtek.c +8
-0{} }; +static struct hda_verb alc272_mario_init_verbs[] = { + {0x12 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_IN }, + {0x21 ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_HP }, + {0x21 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE }, + {0x21 ,AC_VERB_SET_CONNECT_SEL ,0x01 },/* Headphone */ + {0x22 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_MUTE (0 )}, + {0x22 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (9 )}, + {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN |
ALC880_MIC_EVENT},sound/pci/hda/patch_realtek.c static struct hda_verb alc663_mode8_init_verbs[] · line 17655
Quoted 1 line
sound/pci/hda/patch_realtek.c +1
-0+ {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN |
ALC880_HP_EVENT},sound/pci/hda/patch_realtek.c static void alc663_g50v_unsol_event(struct
Quoted 7 lines
sound/pci/hda/patch_realtek.c +3
-0+ {} +}; +static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {HDA_CODEC_VOLUME ("Capture Volume" ,0x09 ,0x0 ,HDA_INPUT ),HDA_CODEC_MUTE ("Capture Switch" ,0x09 ,0x0 ,HDA_INPUT ),@@ -18126,6 +18139,20 @@ static void alc663_g50v_unsol_event(struct
hda_codec*codec,Quoted 4 lines
sound/pci/hda/patch_realtek.c +1
-0} } +static void alc272_mario_inithook (struct hda_codec *codec)sound/pci/hda/patch_realtek.c static void alc663_g50v_unsol_event(struct hda_codec *codec,
Quoted 10 lines
sound/pci/hda/patch_realtek.c +10
-0+{ + alc663_21jd_two_speaker_automute(codec); + alc_mic_automute(codec); + if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, + (0x3b << AC_AMPCAP_OFFSET_SHIFT) | + (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | + (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | + (0 << AC_AMPCAP_MUTE_SHIFT))) { + printk(KERN_WARNING + "hda_codec: failed to override amp caps for NID0x2\n");
sound/pci/hda/patch_realtek.c static struct snd_kcontrol_new
Quoted 7 lines
sound/pci/hda/patch_realtek.c +3
-0+ } +} +#define alc663_g50v_setup alc663_m51va_setupstatic void alc663_g50v_inithook (struct hda_codec *codec)@@ -18165,6 +18192,18 @@ static struct snd_kcontrol_newalc272_nc10_mixer[] = {
sound/pci/hda/patch_realtek.c static struct snd_kcontrol_new alc272_nc10_mixer[] = {
Quoted 7 lines
sound/pci/hda/patch_realtek.c +4
-0{ }/* end */ }; +static struct snd_kcontrol_new alc272_mario_mixer[] = { +HDA_CODEC_VOLUME ("Speaker Playback Volume" ,0x2 ,0x0 ,HDA_OUTPUT ), +HDA_CODEC_MUTE ("Speaker Playback Switch" ,0xc ,0x0 ,HDA_OUTPUT ), + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0,
HDA_OUTPUT),sound/pci/hda/patch_realtek.c static const char
Quoted 12 lines
sound/pci/hda/patch_realtek.c +8
-0+HDA_CODEC_MUTE ("Headphone Playback Switch" ,0xd ,0x0 ,HDA_OUTPUT ), + +HDA_CODEC_VOLUME ("Mic Playback Volume" ,0x0b ,0x0 ,HDA_INPUT ), +HDA_CODEC_MUTE ("Mic Playback Switch" ,0x0b ,0x0 ,HDA_INPUT ), + HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), + { } /* end */ +}; +#ifdef CONFIG_SND_HDA_POWER_SAVE #define alc662_loopbacks alc880_loopbacks#endif @@ -18203,6 +18242,7 @@ static const char*alc662_models[ALC662_MODEL_LAST] = {
sound/pci/hda/patch_realtek.c static struct alc_config_preset alc662_presets[]
Quoted 8 lines
sound/pci/hda/patch_realtek.c +1
-0[ALC272_DELL] = "dell", [ALC272_DELL_ZM1] = "dell-zm1", [ALC272_SAMSUNG_NC10] = "samsung-nc10", + [ALC272_MARIO] = "mario", [ALC662_AUTO] = "auto", };@@ -18590,6 +18630,18 @@ static struct alc_config_preset alc662_presets[]= {
Quoted 21 lines
sound/pci/hda/patch_realtek.c +12
-1.setup = alc663_mode4_setup, .init_hook = alc663_mode4_inithook, }, + [ALC272_MARIO] = { + .mixers = { alc272_mario_mixer }, + .init_verbs = { alc662_init_verbs, + alc272_mario_init_verbs}, + .num_dacs = ARRAY_SIZE(alc272_dac_nids), + .dac_nids = alc272_dac_nids, + .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), + .channel_mode = alc662_3ST_2ch_modes, + .unsol_event = alc663_mode4_unsol_event, + .setup = alc663_mode4_setup, + .init_hook = alc272_mario_inithook, + }, }; --1.7.1