diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0016-ALSA-hda-Add-a-fake-mute-feature.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0016-ALSA-hda-Add-a-fake-mute-feature.patch | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0016-ALSA-hda-Add-a-fake-mute-feature.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0016-ALSA-hda-Add-a-fake-mute-feature.patch new file mode 100644 index 00000000..79be8910 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0016-ALSA-hda-Add-a-fake-mute-feature.patch | |||
@@ -0,0 +1,119 @@ | |||
1 | From 889d0ed385a0bbda6f59b820b95e8c8e2af73b99 Mon Sep 17 00:00:00 2001 | ||
2 | From: Takashi Iwai <tiwai@suse.de> | ||
3 | Date: Mon, 27 Feb 2012 15:00:58 +0100 | ||
4 | Subject: [PATCH 16/95] ALSA: hda - Add a fake mute feature | ||
5 | |||
6 | commit 3868137ea41866773e75d9ac4b9988dcc361ff1d upstream. | ||
7 | |||
8 | Some codecs don't supply the mute amp-capabilities although the lowest | ||
9 | volume gives the mute. It'd be handy if the parser provides the mute | ||
10 | mixers in such a case. | ||
11 | |||
12 | This patch adds an extension amp-cap bit (which is used only in the | ||
13 | driver) to represent the min volume = mute state. Also modified the | ||
14 | amp cache code to support the fake mute feature when this bit is set | ||
15 | but the real mute bit is unset. | ||
16 | |||
17 | In addition, conexant cx5051 parser uses this new feature to implement | ||
18 | the missing mute controls. | ||
19 | |||
20 | Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42825 | ||
21 | |||
22 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | ||
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
24 | --- | ||
25 | sound/pci/hda/hda_codec.c | 8 ++++++-- | ||
26 | sound/pci/hda/hda_codec.h | 3 +++ | ||
27 | sound/pci/hda/patch_conexant.c | 22 +++++++++++++++++++++- | ||
28 | 3 files changed, 30 insertions(+), 3 deletions(-) | ||
29 | |||
30 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c | ||
31 | index 05c8768..f3be54e 100644 | ||
32 | --- a/sound/pci/hda/hda_codec.c | ||
33 | +++ b/sound/pci/hda/hda_codec.c | ||
34 | @@ -1795,7 +1795,11 @@ static void put_vol_mute(struct hda_codec *codec, struct hda_amp_info *info, | ||
35 | parm = ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT; | ||
36 | parm |= direction == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT; | ||
37 | parm |= index << AC_AMP_SET_INDEX_SHIFT; | ||
38 | - parm |= val; | ||
39 | + if ((val & HDA_AMP_MUTE) && !(info->amp_caps & AC_AMPCAP_MUTE) && | ||
40 | + (info->amp_caps & AC_AMPCAP_MIN_MUTE)) | ||
41 | + ; /* set the zero value as a fake mute */ | ||
42 | + else | ||
43 | + parm |= val; | ||
44 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm); | ||
45 | info->vol[ch] = val; | ||
46 | } | ||
47 | @@ -2062,7 +2066,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, | ||
48 | val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); | ||
49 | val1 += ofs; | ||
50 | val1 = ((int)val1) * ((int)val2); | ||
51 | - if (min_mute) | ||
52 | + if (min_mute || (caps & AC_AMPCAP_MIN_MUTE)) | ||
53 | val2 |= TLV_DB_SCALE_MUTE; | ||
54 | if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) | ||
55 | return -EFAULT; | ||
56 | diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h | ||
57 | index 5644711..71f6744 100644 | ||
58 | --- a/sound/pci/hda/hda_codec.h | ||
59 | +++ b/sound/pci/hda/hda_codec.h | ||
60 | @@ -298,6 +298,9 @@ enum { | ||
61 | #define AC_AMPCAP_MUTE (1<<31) /* mute capable */ | ||
62 | #define AC_AMPCAP_MUTE_SHIFT 31 | ||
63 | |||
64 | +/* driver-specific amp-caps: using bits 24-30 */ | ||
65 | +#define AC_AMPCAP_MIN_MUTE (1 << 30) /* min-volume = mute */ | ||
66 | + | ||
67 | /* Connection list */ | ||
68 | #define AC_CLIST_LENGTH (0x7f<<0) | ||
69 | #define AC_CLIST_LONG (1<<7) | ||
70 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c | ||
71 | index 08bad5b..ae94929 100644 | ||
72 | --- a/sound/pci/hda/patch_conexant.c | ||
73 | +++ b/sound/pci/hda/patch_conexant.c | ||
74 | @@ -4132,7 +4132,8 @@ static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename, | ||
75 | err = snd_hda_ctl_add(codec, nid, kctl); | ||
76 | if (err < 0) | ||
77 | return err; | ||
78 | - if (!(query_amp_caps(codec, nid, hda_dir) & AC_AMPCAP_MUTE)) | ||
79 | + if (!(query_amp_caps(codec, nid, hda_dir) & | ||
80 | + (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE))) | ||
81 | break; | ||
82 | } | ||
83 | return 0; | ||
84 | @@ -4425,6 +4426,22 @@ static const struct snd_pci_quirk cxt_fixups[] = { | ||
85 | {} | ||
86 | }; | ||
87 | |||
88 | +/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches | ||
89 | + * can be created (bko#42825) | ||
90 | + */ | ||
91 | +static void add_cx5051_fake_mutes(struct hda_codec *codec) | ||
92 | +{ | ||
93 | + static hda_nid_t out_nids[] = { | ||
94 | + 0x10, 0x11, 0 | ||
95 | + }; | ||
96 | + hda_nid_t *p; | ||
97 | + | ||
98 | + for (p = out_nids; *p; p++) | ||
99 | + snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, | ||
100 | + AC_AMPCAP_MIN_MUTE | | ||
101 | + query_amp_caps(codec, *p, HDA_OUTPUT)); | ||
102 | +} | ||
103 | + | ||
104 | static int patch_conexant_auto(struct hda_codec *codec) | ||
105 | { | ||
106 | struct conexant_spec *spec; | ||
107 | @@ -4443,6 +4460,9 @@ static int patch_conexant_auto(struct hda_codec *codec) | ||
108 | case 0x14f15045: | ||
109 | spec->single_adc_amp = 1; | ||
110 | break; | ||
111 | + case 0x14f15051: | ||
112 | + add_cx5051_fake_mutes(codec); | ||
113 | + break; | ||
114 | } | ||
115 | |||
116 | apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); | ||
117 | -- | ||
118 | 1.7.9.4 | ||
119 | |||