]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.drivers/alsa-post-ga-alc268-mono-output-fix
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / alsa-post-ga-alc268-mono-output-fix
1 From 3f3b7c1aed70fa25c6811f830c5fb1a7054681ae Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Fri, 17 Jul 2009 14:36:59 +0200
4 Subject: ALSA: hda - Fix ALC268 parser for mono speaker
5 Patch-mainline:
6 References: bnc#467846
7
8 - Parse the mono output pin 0x16 correctly even as the primary output
9 - Create "Speaker" volume control if the primary output is a speaker
10 - Fix the wrong direction of (optional) "Mono" switch
11
12 Signed-off-by: Takashi Iwai <tiwai@suse.de>
13
14 ---
15 sound/pci/hda/patch_realtek.c | 62 +++++++++++++++++++++++++++++-------------
16 1 file changed, 43 insertions(+), 19 deletions(-)
17
18 --- a/sound/pci/hda/patch_realtek.c
19 +++ b/sound/pci/hda/patch_realtek.c
20 @@ -11421,26 +11421,38 @@ static int alc268_new_analog_output(stru
21 const char *ctlname, int idx)
22 {
23 char name[32];
24 + hda_nid_t dac;
25 int err;
26
27 sprintf(name, "%s Playback Volume", ctlname);
28 - if (nid == 0x14) {
29 - err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
30 - HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
31 - HDA_OUTPUT));
32 - if (err < 0)
33 - return err;
34 - } else if (nid == 0x15) {
35 + switch (nid) {
36 + case 0x14:
37 + case 0x16:
38 + dac = 0x02;
39 + break;
40 + case 0x15:
41 + dac = 0x03;
42 + break;
43 + default:
44 + return 0;
45 + }
46 + if (spec->multiout.dac_nids[0] != dac &&
47 + spec->multiout.dac_nids[1] != dac) {
48 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
49 - HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
50 + HDA_COMPOSE_AMP_VAL(dac, 3, idx,
51 HDA_OUTPUT));
52 if (err < 0)
53 return err;
54 - } else
55 - return -1;
56 + spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
57 + }
58 +
59 sprintf(name, "%s Playback Switch", ctlname);
60 - err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
61 + if (nid != 0x16)
62 + err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
63 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
64 + else /* mono */
65 + err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
66 + HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
67 if (err < 0)
68 return err;
69 return 0;
70 @@ -11453,14 +11465,19 @@ static int alc268_auto_create_multi_out_
71 hda_nid_t nid;
72 int err;
73
74 - spec->multiout.num_dacs = 2; /* only use one dac */
75 spec->multiout.dac_nids = spec->private_dac_nids;
76 - spec->multiout.dac_nids[0] = 2;
77 - spec->multiout.dac_nids[1] = 3;
78
79 nid = cfg->line_out_pins[0];
80 - if (nid)
81 - alc268_new_analog_output(spec, nid, "Front", 0);
82 + if (nid) {
83 + const char *name;
84 + if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
85 + name = "Speaker";
86 + else
87 + name = "Front";
88 + err = alc268_new_analog_output(spec, nid, name, 0);
89 + if (err < 0)
90 + return err;
91 + }
92
93 nid = cfg->speaker_pins[0];
94 if (nid == 0x1d) {
95 @@ -11469,16 +11486,23 @@ static int alc268_auto_create_multi_out_
96 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
97 if (err < 0)
98 return err;
99 + } else {
100 + err = alc268_new_analog_output(spec, nid, "Speaker", 0);
101 + if (err < 0)
102 + return err;
103 }
104 nid = cfg->hp_pins[0];
105 - if (nid)
106 - alc268_new_analog_output(spec, nid, "Headphone", 0);
107 + if (nid) {
108 + err = alc268_new_analog_output(spec, nid, "Headphone", 0);
109 + if (err < 0)
110 + return err;
111 + }
112
113 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
114 if (nid == 0x16) {
115 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
116 "Mono Playback Switch",
117 - HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
118 + HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
119 if (err < 0)
120 return err;
121 }