aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-01-08 03:26:34 -0500
committerJaroslav Kysela <perex@perex.cz>2010-01-08 03:26:34 -0500
commit1cb4f624ea38361b6397966470f0a1bed5532483 (patch)
tree418b05ddc854b09d64f7d5ee0c78875e42b5f151 /sound/pci/hda
parent444c1953d496d272208902ff7010dc70d1f887f0 (diff)
parent2c1f1895ef2aa8f0e5497893eff71304aef332e1 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into fixes
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c20
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_hwdep.c7
-rw-r--r--sound/pci/hda/hda_intel.c22
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_cirrus.c22
-rw-r--r--sound/pci/hda/patch_realtek.c75
-rw-r--r--sound/pci/hda/patch_sigmatel.c40
9 files changed, 169 insertions, 50 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 5fe34a8d8c81..e4581a42ace5 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work)
42 return; 42 return;
43 43
44 /* generate tone */ 44 /* generate tone */
45 snd_hda_codec_write_cache(codec, beep->nid, 0, 45 snd_hda_codec_write(codec, beep->nid, 0,
46 AC_VERB_SET_BEEP_CONTROL, beep->tone); 46 AC_VERB_SET_BEEP_CONTROL, beep->tone);
47} 47}
48 48
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep)
119 beep->dev = NULL; 119 beep->dev = NULL;
120 cancel_work_sync(&beep->beep_work); 120 cancel_work_sync(&beep->beep_work);
121 /* turn off beep for sure */ 121 /* turn off beep for sure */
122 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 122 snd_hda_codec_write(beep->codec, beep->nid, 0,
123 AC_VERB_SET_BEEP_CONTROL, 0); 123 AC_VERB_SET_BEEP_CONTROL, 0);
124} 124}
125 125
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
192 beep->enabled = enable; 192 beep->enabled = enable;
193 if (!enable) { 193 if (!enable) {
194 /* turn off beep */ 194 /* turn off beep */
195 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 195 snd_hda_codec_write(beep->codec, beep->nid, 0,
196 AC_VERB_SET_BEEP_CONTROL, 0); 196 AC_VERB_SET_BEEP_CONTROL, 0);
197 } 197 }
198 if (beep->mode == HDA_BEEP_MODE_SWREG) { 198 if (beep->mode == HDA_BEEP_MODE_SWREG) {
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
239 mutex_init(&beep->mutex); 239 mutex_init(&beep->mutex);
240 240
241 if (beep->mode == HDA_BEEP_MODE_ON) { 241 if (beep->mode == HDA_BEEP_MODE_ON) {
242 beep->enabled = 1; 242 int err = snd_hda_do_attach(beep);
243 snd_hda_do_register(&beep->register_work); 243 if (err < 0) {
244 kfree(beep);
245 codec->beep = NULL;
246 return err;
247 }
244 } 248 }
245 249
246 return 0; 250 return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
253 if (beep) { 257 if (beep) {
254 cancel_work_sync(&beep->register_work); 258 cancel_work_sync(&beep->register_work);
255 cancel_delayed_work(&beep->unregister_work); 259 cancel_delayed_work(&beep->unregister_work);
256 if (beep->enabled) 260 if (beep->dev)
257 snd_hda_do_detach(beep); 261 snd_hda_do_detach(beep);
258 codec->beep = NULL; 262 codec->beep = NULL;
259 kfree(beep); 263 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 9cfdb771928c..f98b47cd6cfb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1086,11 +1086,6 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1086 if (err < 0) 1086 if (err < 0)
1087 return err; 1087 return err;
1088 } 1088 }
1089 /* audio codec should override the mixer name */
1090 if (codec->afg || !*codec->bus->card->mixername)
1091 snprintf(codec->bus->card->mixername,
1092 sizeof(codec->bus->card->mixername),
1093 "%s %s", codec->vendor_name, codec->chip_name);
1094 1089
1095 if (is_generic_config(codec)) { 1090 if (is_generic_config(codec)) {
1096 err = snd_hda_parse_generic_codec(codec); 1091 err = snd_hda_parse_generic_codec(codec);
@@ -1109,6 +1104,11 @@ int snd_hda_codec_configure(struct hda_codec *codec)
1109 patched: 1104 patched:
1110 if (!err && codec->patch_ops.unsol_event) 1105 if (!err && codec->patch_ops.unsol_event)
1111 err = init_unsol_queue(codec->bus); 1106 err = init_unsol_queue(codec->bus);
1107 /* audio codec should override the mixer name */
1108 if (!err && (codec->afg || !*codec->bus->card->mixername))
1109 snprintf(codec->bus->card->mixername,
1110 sizeof(codec->bus->card->mixername),
1111 "%s %s", codec->vendor_name, codec->chip_name);
1112 return err; 1112 return err;
1113} 1113}
1114EXPORT_SYMBOL_HDA(snd_hda_codec_configure); 1114EXPORT_SYMBOL_HDA(snd_hda_codec_configure);
@@ -1327,11 +1327,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1327 */ 1327 */
1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) 1328u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1329{ 1329{
1330 u32 pincap = snd_hda_query_pin_caps(codec, nid); 1330 u32 pincap;
1331
1332 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1333 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1334 1331
1332 if (!codec->no_trigger_sense) {
1333 pincap = snd_hda_query_pin_caps(codec, nid);
1334 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1335 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1336 }
1335 return snd_hda_codec_read(codec, nid, 0, 1337 return snd_hda_codec_read(codec, nid, 0,
1336 AC_VERB_GET_PIN_SENSE, 0); 1338 AC_VERB_GET_PIN_SENSE, 0);
1337} 1339}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 1d541b7f5547..0a770a28e71f 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -817,6 +817,7 @@ struct hda_codec {
817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 817 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
818 * (e.g. Conexant codecs) 818 * (e.g. Conexant codecs)
819 */ 819 */
820 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
820#ifdef CONFIG_SND_HDA_POWER_SAVE 821#ifdef CONFIG_SND_HDA_POWER_SAVE
821 unsigned int power_on :1; /* current (global) power-state */ 822 unsigned int power_on :1; /* current (global) power-state */
822 unsigned int power_transition :1; /* power-state in transition */ 823 unsigned int power_transition :1; /* power-state in transition */
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index d24328661c6a..40ccb419b6e9 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -24,6 +24,7 @@
24#include <linux/compat.h> 24#include <linux/compat.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/string.h>
27#include <linux/firmware.h> 28#include <linux/firmware.h>
28#include <sound/core.h> 29#include <sound/core.h>
29#include "hda_codec.h" 30#include "hda_codec.h"
@@ -428,8 +429,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf)
428 char *key, *val; 429 char *key, *val;
429 struct hda_hint *hint; 430 struct hda_hint *hint;
430 431
431 while (isspace(*buf)) 432 buf = skip_spaces(buf);
432 buf++;
433 if (!*buf || *buf == '#' || *buf == '\n') 433 if (!*buf || *buf == '#' || *buf == '\n')
434 return 0; 434 return 0;
435 if (*buf == '=') 435 if (*buf == '=')
@@ -444,8 +444,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf)
444 return -EINVAL; 444 return -EINVAL;
445 } 445 }
446 *val++ = 0; 446 *val++ = 0;
447 while (isspace(*val)) 447 val = skip_spaces(val);
448 val++;
449 remove_trail_spaces(key); 448 remove_trail_spaces(key);
450 remove_trail_spaces(val); 449 remove_trail_spaces(val);
451 hint = get_hint(codec, key); 450 hint = get_hint(codec, key);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 9b56f937913e..ec9c348336cc 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -356,6 +356,7 @@ struct azx_dev {
356 */ 356 */
357 unsigned char stream_tag; /* assigned stream */ 357 unsigned char stream_tag; /* assigned stream */
358 unsigned char index; /* stream index */ 358 unsigned char index; /* stream index */
359 int device; /* last device number assigned to */
359 360
360 unsigned int opened :1; 361 unsigned int opened :1;
361 unsigned int running :1; 362 unsigned int running :1;
@@ -1441,10 +1442,13 @@ static int __devinit azx_codec_configure(struct azx *chip)
1441 */ 1442 */
1442 1443
1443/* assign a stream for the PCM */ 1444/* assign a stream for the PCM */
1444static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) 1445static inline struct azx_dev *
1446azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
1445{ 1447{
1446 int dev, i, nums; 1448 int dev, i, nums;
1447 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1449 struct azx_dev *res = NULL;
1450
1451 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
1448 dev = chip->playback_index_offset; 1452 dev = chip->playback_index_offset;
1449 nums = chip->playback_streams; 1453 nums = chip->playback_streams;
1450 } else { 1454 } else {
@@ -1453,10 +1457,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream)
1453 } 1457 }
1454 for (i = 0; i < nums; i++, dev++) 1458 for (i = 0; i < nums; i++, dev++)
1455 if (!chip->azx_dev[dev].opened) { 1459 if (!chip->azx_dev[dev].opened) {
1456 chip->azx_dev[dev].opened = 1; 1460 res = &chip->azx_dev[dev];
1457 return &chip->azx_dev[dev]; 1461 if (res->device == substream->pcm->device)
1462 break;
1458 } 1463 }
1459 return NULL; 1464 if (res) {
1465 res->opened = 1;
1466 res->device = substream->pcm->device;
1467 }
1468 return res;
1460} 1469}
1461 1470
1462/* release the assigned stream */ 1471/* release the assigned stream */
@@ -1505,7 +1514,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1505 int err; 1514 int err;
1506 1515
1507 mutex_lock(&chip->open_mutex); 1516 mutex_lock(&chip->open_mutex);
1508 azx_dev = azx_assign_device(chip, substream->stream); 1517 azx_dev = azx_assign_device(chip, substream);
1509 if (azx_dev == NULL) { 1518 if (azx_dev == NULL) {
1510 mutex_unlock(&chip->open_mutex); 1519 mutex_unlock(&chip->open_mutex);
1511 return -EBUSY; 1520 return -EBUSY;
@@ -2322,6 +2331,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2322 * white/black-list for enable_msi 2331 * white/black-list for enable_msi
2323 */ 2332 */
2324static struct snd_pci_quirk msi_black_list[] __devinitdata = { 2333static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2334 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2325 {} 2335 {}
2326}; 2336};
2327 2337
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1a36137e13ec..69a941c7b158 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1186,6 +1186,8 @@ static int patch_ad1986a(struct hda_codec *codec)
1186 */ 1186 */
1187 spec->multiout.no_share_stream = 1; 1187 spec->multiout.no_share_stream = 1;
1188 1188
1189 codec->no_trigger_sense = 1;
1190
1189 return 0; 1191 return 0;
1190} 1192}
1191 1193
@@ -1371,6 +1373,8 @@ static int patch_ad1983(struct hda_codec *codec)
1371 1373
1372 codec->patch_ops = ad198x_patch_ops; 1374 codec->patch_ops = ad198x_patch_ops;
1373 1375
1376 codec->no_trigger_sense = 1;
1377
1374 return 0; 1378 return 0;
1375} 1379}
1376 1380
@@ -1813,6 +1817,9 @@ static int patch_ad1981(struct hda_codec *codec)
1813 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1817 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1814 break; 1818 break;
1815 } 1819 }
1820
1821 codec->no_trigger_sense = 1;
1822
1816 return 0; 1823 return 0;
1817} 1824}
1818 1825
@@ -3118,6 +3125,8 @@ static int patch_ad1988(struct hda_codec *codec)
3118#endif 3125#endif
3119 spec->vmaster_nid = 0x04; 3126 spec->vmaster_nid = 0x04;
3120 3127
3128 codec->no_trigger_sense = 1;
3129
3121 return 0; 3130 return 0;
3122} 3131}
3123 3132
@@ -3330,6 +3339,8 @@ static int patch_ad1884(struct hda_codec *codec)
3330 3339
3331 codec->patch_ops = ad198x_patch_ops; 3340 codec->patch_ops = ad198x_patch_ops;
3332 3341
3342 codec->no_trigger_sense = 1;
3343
3333 return 0; 3344 return 0;
3334} 3345}
3335 3346
@@ -4287,6 +4298,8 @@ static int patch_ad1884a(struct hda_codec *codec)
4287 break; 4298 break;
4288 } 4299 }
4289 4300
4301 codec->no_trigger_sense = 1;
4302
4290 return 0; 4303 return 0;
4291} 4304}
4292 4305
@@ -4623,6 +4636,9 @@ static int patch_ad1882(struct hda_codec *codec)
4623 spec->mixers[2] = ad1882_6stack_mixers; 4636 spec->mixers[2] = ad1882_6stack_mixers;
4624 break; 4637 break;
4625 } 4638 }
4639
4640 codec->no_trigger_sense = 1;
4641
4626 return 0; 4642 return 0;
4627} 4643}
4628 4644
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 4b200da1bd18..fe0423c39598 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -66,6 +66,7 @@ struct cs_spec {
66/* available models */ 66/* available models */
67enum { 67enum {
68 CS420X_MBP55, 68 CS420X_MBP55,
69 CS420X_IMAC27,
69 CS420X_AUTO, 70 CS420X_AUTO,
70 CS420X_MODELS 71 CS420X_MODELS
71}; 72};
@@ -827,7 +828,8 @@ static void cs_automute(struct hda_codec *codec)
827 AC_VERB_SET_PIN_WIDGET_CONTROL, 828 AC_VERB_SET_PIN_WIDGET_CONTROL,
828 hp_present ? 0 : PIN_OUT); 829 hp_present ? 0 : PIN_OUT);
829 } 830 }
830 if (spec->board_config == CS420X_MBP55) { 831 if (spec->board_config == CS420X_MBP55 ||
832 spec->board_config == CS420X_IMAC27) {
831 unsigned int gpio = hp_present ? 0x02 : 0x08; 833 unsigned int gpio = hp_present ? 0x02 : 0x08;
832 snd_hda_codec_write(codec, 0x01, 0, 834 snd_hda_codec_write(codec, 0x01, 0,
833 AC_VERB_SET_GPIO_DATA, gpio); 835 AC_VERB_SET_GPIO_DATA, gpio);
@@ -1069,12 +1071,14 @@ static int cs_parse_auto_config(struct hda_codec *codec)
1069 1071
1070static const char *cs420x_models[CS420X_MODELS] = { 1072static const char *cs420x_models[CS420X_MODELS] = {
1071 [CS420X_MBP55] = "mbp55", 1073 [CS420X_MBP55] = "mbp55",
1074 [CS420X_IMAC27] = "imac27",
1072 [CS420X_AUTO] = "auto", 1075 [CS420X_AUTO] = "auto",
1073}; 1076};
1074 1077
1075 1078
1076static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1079static struct snd_pci_quirk cs420x_cfg_tbl[] = {
1077 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1080 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1081 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
1078 {} /* terminator */ 1082 {} /* terminator */
1079}; 1083};
1080 1084
@@ -1097,8 +1101,23 @@ static struct cs_pincfg mbp55_pincfgs[] = {
1097 {} /* terminator */ 1101 {} /* terminator */
1098}; 1102};
1099 1103
1104static struct cs_pincfg imac27_pincfgs[] = {
1105 { 0x09, 0x012b4050 },
1106 { 0x0a, 0x90100140 },
1107 { 0x0b, 0x90100142 },
1108 { 0x0c, 0x018b3020 },
1109 { 0x0d, 0x90a00110 },
1110 { 0x0e, 0x400000f0 },
1111 { 0x0f, 0x01cbe030 },
1112 { 0x10, 0x014be060 },
1113 { 0x12, 0x01ab9070 },
1114 { 0x15, 0x400000f0 },
1115 {} /* terminator */
1116};
1117
1100static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { 1118static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1101 [CS420X_MBP55] = mbp55_pincfgs, 1119 [CS420X_MBP55] = mbp55_pincfgs,
1120 [CS420X_IMAC27] = imac27_pincfgs,
1102}; 1121};
1103 1122
1104static void fix_pincfg(struct hda_codec *codec, int model) 1123static void fix_pincfg(struct hda_codec *codec, int model)
@@ -1128,6 +1147,7 @@ static int patch_cs420x(struct hda_codec *codec)
1128 fix_pincfg(codec, spec->board_config); 1147 fix_pincfg(codec, spec->board_config);
1129 1148
1130 switch (spec->board_config) { 1149 switch (spec->board_config) {
1150 case CS420X_IMAC27:
1131 case CS420X_MBP55: 1151 case CS420X_MBP55:
1132 /* GPIO1 = headphones */ 1152 /* GPIO1 = headphones */
1133 /* GPIO3 = speakers */ 1153 /* GPIO3 = speakers */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2d3f4f893ef3..c7465053d6bb 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -337,6 +337,9 @@ struct alc_spec {
337 /* hooks */ 337 /* hooks */
338 void (*init_hook)(struct hda_codec *codec); 338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340#ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
342#endif
340 343
341 /* for pin sensing */ 344 /* for pin sensing */
342 unsigned int sense_updated: 1; 345 unsigned int sense_updated: 1;
@@ -388,6 +391,7 @@ struct alc_config_preset {
388 void (*init_hook)(struct hda_codec *); 391 void (*init_hook)(struct hda_codec *);
389#ifdef CONFIG_SND_HDA_POWER_SAVE 392#ifdef CONFIG_SND_HDA_POWER_SAVE
390 struct hda_amp_list *loopbacks; 393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
391#endif 395#endif
392}; 396};
393 397
@@ -900,6 +904,7 @@ static void setup_preset(struct hda_codec *codec,
900 spec->unsol_event = preset->unsol_event; 904 spec->unsol_event = preset->unsol_event;
901 spec->init_hook = preset->init_hook; 905 spec->init_hook = preset->init_hook;
902#ifdef CONFIG_SND_HDA_POWER_SAVE 906#ifdef CONFIG_SND_HDA_POWER_SAVE
907 spec->power_hook = preset->power_hook;
903 spec->loopback.amplist = preset->loopbacks; 908 spec->loopback.amplist = preset->loopbacks;
904#endif 909#endif
905 910
@@ -1665,9 +1670,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1665/* some bit here disables the other DACs. Init=0x4900 */ 1670/* some bit here disables the other DACs. Init=0x4900 */
1666 {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1667 {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, 1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668/* Enable amplifiers */
1669 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1670 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1671/* DMIC fix 1673/* DMIC fix
1672 * This laptop has a stereo digital microphone. The mics are only 1cm apart 1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1673 * which makes the stereo useless. However, either the mic or the ALC889 1675 * which makes the stereo useless. However, either the mic or the ALC889
@@ -1780,6 +1782,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1780 { } /* end */ 1782 { } /* end */
1781}; 1783};
1782 1784
1785static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1786 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1789 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1790 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1791 HDA_OUTPUT),
1792 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1794 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1795 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1796 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1797 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1798 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1799 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1800 { } /* end */
1801};
1802
1803
1783static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) 1804static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1784{ 1805{
1785 struct alc_spec *spec = codec->spec; 1806 struct alc_spec *spec = codec->spec;
@@ -1810,6 +1831,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1810 spec->autocfg.speaker_pins[2] = 0x1b; 1831 spec->autocfg.speaker_pins[2] = 0x1b;
1811} 1832}
1812 1833
1834#ifdef CONFIG_SND_HDA_POWER_SAVE
1835static void alc889_power_eapd(struct hda_codec *codec, int power)
1836{
1837 snd_hda_codec_write(codec, 0x14, 0,
1838 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1839 snd_hda_codec_write(codec, 0x15, 0,
1840 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1841}
1842#endif
1843
1813/* 1844/*
1814 * ALC880 3-stack model 1845 * ALC880 3-stack model
1815 * 1846 *
@@ -3603,12 +3634,29 @@ static void alc_free(struct hda_codec *codec)
3603 snd_hda_detach_beep_device(codec); 3634 snd_hda_detach_beep_device(codec);
3604} 3635}
3605 3636
3637#ifdef CONFIG_SND_HDA_POWER_SAVE
3638static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3639{
3640 struct alc_spec *spec = codec->spec;
3641 if (spec && spec->power_hook)
3642 spec->power_hook(codec, 0);
3643 return 0;
3644}
3645#endif
3646
3606#ifdef SND_HDA_NEEDS_RESUME 3647#ifdef SND_HDA_NEEDS_RESUME
3607static int alc_resume(struct hda_codec *codec) 3648static int alc_resume(struct hda_codec *codec)
3608{ 3649{
3650#ifdef CONFIG_SND_HDA_POWER_SAVE
3651 struct alc_spec *spec = codec->spec;
3652#endif
3609 codec->patch_ops.init(codec); 3653 codec->patch_ops.init(codec);
3610 snd_hda_codec_resume_amp(codec); 3654 snd_hda_codec_resume_amp(codec);
3611 snd_hda_codec_resume_cache(codec); 3655 snd_hda_codec_resume_cache(codec);
3656#ifdef CONFIG_SND_HDA_POWER_SAVE
3657 if (spec && spec->power_hook)
3658 spec->power_hook(codec, 1);
3659#endif
3612 return 0; 3660 return 0;
3613} 3661}
3614#endif 3662#endif
@@ -3625,6 +3673,7 @@ static struct hda_codec_ops alc_patch_ops = {
3625 .resume = alc_resume, 3673 .resume = alc_resume,
3626#endif 3674#endif
3627#ifdef CONFIG_SND_HDA_POWER_SAVE 3675#ifdef CONFIG_SND_HDA_POWER_SAVE
3676 .suspend = alc_suspend,
3628 .check_power_status = alc_check_power_status, 3677 .check_power_status = alc_check_power_status,
3629#endif 3678#endif
3630}; 3679};
@@ -9381,10 +9430,11 @@ static struct alc_config_preset alc882_presets[] = {
9381 .init_hook = alc_automute_amp, 9430 .init_hook = alc_automute_amp,
9382 }, 9431 },
9383 [ALC888_ACER_ASPIRE_8930G] = { 9432 [ALC888_ACER_ASPIRE_8930G] = {
9384 .mixers = { alc888_base_mixer, 9433 .mixers = { alc889_acer_aspire_8930g_mixer,
9385 alc883_chmode_mixer }, 9434 alc883_chmode_mixer },
9386 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 9435 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9387 alc889_acer_aspire_8930g_verbs }, 9436 alc889_acer_aspire_8930g_verbs,
9437 alc889_eapd_verbs},
9388 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9389 .dac_nids = alc883_dac_nids, 9439 .dac_nids = alc883_dac_nids,
9390 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), 9440 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
@@ -9401,6 +9451,9 @@ static struct alc_config_preset alc882_presets[] = {
9401 .unsol_event = alc_automute_amp_unsol_event, 9451 .unsol_event = alc_automute_amp_unsol_event,
9402 .setup = alc889_acer_aspire_8930g_setup, 9452 .setup = alc889_acer_aspire_8930g_setup,
9403 .init_hook = alc_automute_amp, 9453 .init_hook = alc_automute_amp,
9454#ifdef CONFIG_SND_HDA_POWER_SAVE
9455 .power_hook = alc889_power_eapd,
9456#endif
9404 }, 9457 },
9405 [ALC888_ACER_ASPIRE_7730G] = { 9458 [ALC888_ACER_ASPIRE_7730G] = {
9406 .mixers = { alc883_3ST_6ch_mixer, 9459 .mixers = { alc883_3ST_6ch_mixer,
@@ -10684,6 +10737,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10684 {} 10737 {}
10685}; 10738};
10686 10739
10740static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10741 /* Front Mic pin: input vref at 50% */
10742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10744 {}
10745};
10746
10687static struct hda_input_mux alc262_fujitsu_capture_source = { 10747static struct hda_input_mux alc262_fujitsu_capture_source = {
10688 .num_items = 3, 10748 .num_items = 3,
10689 .items = { 10749 .items = {
@@ -11726,7 +11786,8 @@ static struct alc_config_preset alc262_presets[] = {
11726 [ALC262_LENOVO_3000] = { 11786 [ALC262_LENOVO_3000] = {
11727 .mixers = { alc262_lenovo_3000_mixer }, 11787 .mixers = { alc262_lenovo_3000_mixer },
11728 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, 11788 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11729 alc262_lenovo_3000_unsol_verbs }, 11789 alc262_lenovo_3000_unsol_verbs,
11790 alc262_lenovo_3000_init_verbs },
11730 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11731 .dac_nids = alc262_dac_nids, 11792 .dac_nids = alc262_dac_nids,
11732 .hp_nid = 0x03, 11793 .hp_nid = 0x03,
@@ -12863,7 +12924,7 @@ static int patch_alc268(struct hda_codec *codec)
12863 int board_config; 12924 int board_config;
12864 int i, has_beep, err; 12925 int i, has_beep, err;
12865 12926
12866 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 12927 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12867 if (spec == NULL) 12928 if (spec == NULL)
12868 return -ENOMEM; 12929 return -ENOMEM;
12869 12930
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3d59f8325848..2291a8396817 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2104,6 +2104,7 @@ static unsigned int ref9205_pin_configs[12] = {
2104 10280204 2104 10280204
2105 1028021F 2105 1028021F
2106 10280228 (Dell Vostro 1500) 2106 10280228 (Dell Vostro 1500)
2107 10280229 (Dell Vostro 1700)
2107*/ 2108*/
2108static unsigned int dell_9205_m42_pin_configs[12] = { 2109static unsigned int dell_9205_m42_pin_configs[12] = {
2109 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, 2110 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
@@ -2189,6 +2190,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2189 "Dell Inspiron", STAC_9205_DELL_M44), 2190 "Dell Inspiron", STAC_9205_DELL_M44),
2190 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, 2191 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
2191 "Dell Vostro 1500", STAC_9205_DELL_M42), 2192 "Dell Vostro 1500", STAC_9205_DELL_M42),
2193 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
2194 "Dell Vostro 1700", STAC_9205_DELL_M42),
2192 /* Gateway */ 2195 /* Gateway */
2193 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), 2196 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
2194 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), 2197 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
@@ -3779,15 +3782,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3779 err = snd_hda_attach_beep_device(codec, nid); 3782 err = snd_hda_attach_beep_device(codec, nid);
3780 if (err < 0) 3783 if (err < 0)
3781 return err; 3784 return err;
3782 /* IDT/STAC codecs have linear beep tone parameter */ 3785 if (codec->beep) {
3783 codec->beep->linear_tone = 1; 3786 /* IDT/STAC codecs have linear beep tone parameter */
3784 /* if no beep switch is available, make its own one */ 3787 codec->beep->linear_tone = 1;
3785 caps = query_amp_caps(codec, nid, HDA_OUTPUT); 3788 /* if no beep switch is available, make its own one */
3786 if (codec->beep && 3789 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3787 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { 3790 if (!(caps & AC_AMPCAP_MUTE)) {
3788 err = stac92xx_beep_switch_ctl(codec); 3791 err = stac92xx_beep_switch_ctl(codec);
3789 if (err < 0) 3792 if (err < 0)
3790 return err; 3793 return err;
3794 }
3791 } 3795 }
3792 } 3796 }
3793#endif 3797#endif
@@ -4449,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4449{ 4453{
4450 if (!nid) 4454 if (!nid)
4451 return 0; 4455 return 0;
4452 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4456 return snd_hda_jack_detect(codec, nid);
4453 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4454 * the pincap gives TRIG_REQ bit.
4455 */
4456 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4457 AC_PINSENSE_PRESENCE)
4458 return 1;
4459 return 0;
4460} 4457}
4461 4458
4462static void stac92xx_line_out_detect(struct hda_codec *codec, 4459static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4958,6 +4955,7 @@ static int patch_stac9200(struct hda_codec *codec)
4958 if (spec == NULL) 4955 if (spec == NULL)
4959 return -ENOMEM; 4956 return -ENOMEM;
4960 4957
4958 codec->no_trigger_sense = 1;
4961 codec->spec = spec; 4959 codec->spec = spec;
4962 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4960 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4963 spec->pin_nids = stac9200_pin_nids; 4961 spec->pin_nids = stac9200_pin_nids;
@@ -5020,6 +5018,7 @@ static int patch_stac925x(struct hda_codec *codec)
5020 if (spec == NULL) 5018 if (spec == NULL)
5021 return -ENOMEM; 5019 return -ENOMEM;
5022 5020
5021 codec->no_trigger_sense = 1;
5023 codec->spec = spec; 5022 codec->spec = spec;
5024 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5023 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5025 spec->pin_nids = stac925x_pin_nids; 5024 spec->pin_nids = stac925x_pin_nids;
@@ -5104,6 +5103,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5104 if (spec == NULL) 5103 if (spec == NULL)
5105 return -ENOMEM; 5104 return -ENOMEM;
5106 5105
5106 codec->no_trigger_sense = 1;
5107 codec->spec = spec; 5107 codec->spec = spec;
5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5251,6 +5251,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5251 if (spec == NULL) 5251 if (spec == NULL)
5252 return -ENOMEM; 5252 return -ENOMEM;
5253 5253
5254 codec->no_trigger_sense = 1;
5254 codec->spec = spec; 5255 codec->spec = spec;
5255 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5256 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5256 spec->digbeep_nid = 0x21; 5257 spec->digbeep_nid = 0x21;
@@ -5414,6 +5415,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5414 if (spec == NULL) 5415 if (spec == NULL)
5415 return -ENOMEM; 5416 return -ENOMEM;
5416 5417
5418 codec->no_trigger_sense = 1;
5417 codec->spec = spec; 5419 codec->spec = spec;
5418 codec->patch_ops = stac92xx_patch_ops; 5420 codec->patch_ops = stac92xx_patch_ops;
5419 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5421 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5657,6 +5659,7 @@ static int patch_stac922x(struct hda_codec *codec)
5657 if (spec == NULL) 5659 if (spec == NULL)
5658 return -ENOMEM; 5660 return -ENOMEM;
5659 5661
5662 codec->no_trigger_sense = 1;
5660 codec->spec = spec; 5663 codec->spec = spec;
5661 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5664 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5662 spec->pin_nids = stac922x_pin_nids; 5665 spec->pin_nids = stac922x_pin_nids;
@@ -5760,6 +5763,7 @@ static int patch_stac927x(struct hda_codec *codec)
5760 if (spec == NULL) 5763 if (spec == NULL)
5761 return -ENOMEM; 5764 return -ENOMEM;
5762 5765
5766 codec->no_trigger_sense = 1;
5763 codec->spec = spec; 5767 codec->spec = spec;
5764 codec->slave_dig_outs = stac927x_slave_dig_outs; 5768 codec->slave_dig_outs = stac927x_slave_dig_outs;
5765 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5769 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5894,6 +5898,7 @@ static int patch_stac9205(struct hda_codec *codec)
5894 if (spec == NULL) 5898 if (spec == NULL)
5895 return -ENOMEM; 5899 return -ENOMEM;
5896 5900
5901 codec->no_trigger_sense = 1;
5897 codec->spec = spec; 5902 codec->spec = spec;
5898 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5903 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5899 spec->pin_nids = stac9205_pin_nids; 5904 spec->pin_nids = stac9205_pin_nids;
@@ -6049,6 +6054,7 @@ static int patch_stac9872(struct hda_codec *codec)
6049 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6050 if (spec == NULL) 6055 if (spec == NULL)
6051 return -ENOMEM; 6056 return -ENOMEM;
6057 codec->no_trigger_sense = 1;
6052 codec->spec = spec; 6058 codec->spec = spec;
6053 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6059 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6054 spec->pin_nids = stac9872_pin_nids; 6060 spec->pin_nids = stac9872_pin_nids;