aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/Procfile.txt2
-rw-r--r--sound/arm/aaci.c3
-rw-r--r--sound/core/pcm_native.c8
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_intel.c21
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_sigmatel.c18
9 files changed, 64 insertions, 31 deletions
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt
index 719a819f8cc2..07301de12cc4 100644
--- a/Documentation/sound/alsa/Procfile.txt
+++ b/Documentation/sound/alsa/Procfile.txt
@@ -95,7 +95,7 @@ card*/pcm*/xrun_debug
95 It takes an integer value, can be changed by writing to this 95 It takes an integer value, can be changed by writing to this
96 file, such as 96 file, such as
97 97
98 # cat 5 > /proc/asound/card0/pcm0p/xrun_debug 98 # echo 5 > /proc/asound/card0/pcm0p/xrun_debug
99 99
100 The value consists of the following bit flags: 100 The value consists of the following bit flags:
101 bit 0 = Enable XRUN/jiffies debug messages 101 bit 0 = Enable XRUN/jiffies debug messages
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index c5699863643b..656e474dca47 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -441,6 +441,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
441 struct snd_pcm_hw_params *params) 441 struct snd_pcm_hw_params *params)
442{ 442{
443 int err; 443 int err;
444 struct aaci *aaci = substream->private_data;
444 445
445 aaci_pcm_hw_free(substream); 446 aaci_pcm_hw_free(substream);
446 if (aacirun->pcm_open) { 447 if (aacirun->pcm_open) {
@@ -560,7 +561,6 @@ static int aaci_pcm_open(struct snd_pcm_substream *substream)
560static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream, 561static int aaci_pcm_playback_hw_params(struct snd_pcm_substream *substream,
561 struct snd_pcm_hw_params *params) 562 struct snd_pcm_hw_params *params)
562{ 563{
563 struct aaci *aaci = substream->private_data;
564 struct aaci_runtime *aacirun = substream->runtime->private_data; 564 struct aaci_runtime *aacirun = substream->runtime->private_data;
565 unsigned int channels = params_channels(params); 565 unsigned int channels = params_channels(params);
566 int ret; 566 int ret;
@@ -659,7 +659,6 @@ static struct snd_pcm_ops aaci_playback_ops = {
659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 659static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
660 struct snd_pcm_hw_params *params) 660 struct snd_pcm_hw_params *params)
661{ 661{
662 struct aaci *aaci = substream->private_data;
663 struct aaci_runtime *aacirun = substream->runtime->private_data; 662 struct aaci_runtime *aacirun = substream->runtime->private_data;
664 int ret; 663 int ret;
665 664
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 29ab46a12e11..25b0641e6b8c 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1918,13 +1918,13 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1918 1918
1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 1919 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
1920 hw->rate_min, hw->rate_max); 1920 hw->rate_min, hw->rate_max);
1921 if (err < 0) 1921 if (err < 0)
1922 return err; 1922 return err;
1923 1923
1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1924 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
1925 hw->period_bytes_min, hw->period_bytes_max); 1925 hw->period_bytes_min, hw->period_bytes_max);
1926 if (err < 0) 1926 if (err < 0)
1927 return err; 1927 return err;
1928 1928
1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, 1929 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
1930 hw->periods_min, hw->periods_max); 1930 hw->periods_min, hw->periods_max);
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 950ee5cfcacf..f98b47cd6cfb 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -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_intel.c b/sound/pci/hda/hda_intel.c
index ff8ad46cc50e..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;
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_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index eeda7beeb57a..2291a8396817 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4453,14 +4453,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4453{ 4453{
4454 if (!nid) 4454 if (!nid)
4455 return 0; 4455 return 0;
4456 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4456 return snd_hda_jack_detect(codec, nid);
4457 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4458 * the pincap gives TRIG_REQ bit.
4459 */
4460 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4461 AC_PINSENSE_PRESENCE)
4462 return 1;
4463 return 0;
4464} 4457}
4465 4458
4466static void stac92xx_line_out_detect(struct hda_codec *codec, 4459static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4962,6 +4955,7 @@ static int patch_stac9200(struct hda_codec *codec)
4962 if (spec == NULL) 4955 if (spec == NULL)
4963 return -ENOMEM; 4956 return -ENOMEM;
4964 4957
4958 codec->no_trigger_sense = 1;
4965 codec->spec = spec; 4959 codec->spec = spec;
4966 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4960 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4967 spec->pin_nids = stac9200_pin_nids; 4961 spec->pin_nids = stac9200_pin_nids;
@@ -5024,6 +5018,7 @@ static int patch_stac925x(struct hda_codec *codec)
5024 if (spec == NULL) 5018 if (spec == NULL)
5025 return -ENOMEM; 5019 return -ENOMEM;
5026 5020
5021 codec->no_trigger_sense = 1;
5027 codec->spec = spec; 5022 codec->spec = spec;
5028 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5023 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5029 spec->pin_nids = stac925x_pin_nids; 5024 spec->pin_nids = stac925x_pin_nids;
@@ -5108,6 +5103,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5108 if (spec == NULL) 5103 if (spec == NULL)
5109 return -ENOMEM; 5104 return -ENOMEM;
5110 5105
5106 codec->no_trigger_sense = 1;
5111 codec->spec = spec; 5107 codec->spec = spec;
5112 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5108 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5113 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5109 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5255,6 +5251,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5255 if (spec == NULL) 5251 if (spec == NULL)
5256 return -ENOMEM; 5252 return -ENOMEM;
5257 5253
5254 codec->no_trigger_sense = 1;
5258 codec->spec = spec; 5255 codec->spec = spec;
5259 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5256 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5260 spec->digbeep_nid = 0x21; 5257 spec->digbeep_nid = 0x21;
@@ -5418,6 +5415,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5418 if (spec == NULL) 5415 if (spec == NULL)
5419 return -ENOMEM; 5416 return -ENOMEM;
5420 5417
5418 codec->no_trigger_sense = 1;
5421 codec->spec = spec; 5419 codec->spec = spec;
5422 codec->patch_ops = stac92xx_patch_ops; 5420 codec->patch_ops = stac92xx_patch_ops;
5423 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5421 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5661,6 +5659,7 @@ static int patch_stac922x(struct hda_codec *codec)
5661 if (spec == NULL) 5659 if (spec == NULL)
5662 return -ENOMEM; 5660 return -ENOMEM;
5663 5661
5662 codec->no_trigger_sense = 1;
5664 codec->spec = spec; 5663 codec->spec = spec;
5665 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5664 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5666 spec->pin_nids = stac922x_pin_nids; 5665 spec->pin_nids = stac922x_pin_nids;
@@ -5764,6 +5763,7 @@ static int patch_stac927x(struct hda_codec *codec)
5764 if (spec == NULL) 5763 if (spec == NULL)
5765 return -ENOMEM; 5764 return -ENOMEM;
5766 5765
5766 codec->no_trigger_sense = 1;
5767 codec->spec = spec; 5767 codec->spec = spec;
5768 codec->slave_dig_outs = stac927x_slave_dig_outs; 5768 codec->slave_dig_outs = stac927x_slave_dig_outs;
5769 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5769 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5898,6 +5898,7 @@ static int patch_stac9205(struct hda_codec *codec)
5898 if (spec == NULL) 5898 if (spec == NULL)
5899 return -ENOMEM; 5899 return -ENOMEM;
5900 5900
5901 codec->no_trigger_sense = 1;
5901 codec->spec = spec; 5902 codec->spec = spec;
5902 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5903 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5903 spec->pin_nids = stac9205_pin_nids; 5904 spec->pin_nids = stac9205_pin_nids;
@@ -6053,6 +6054,7 @@ static int patch_stac9872(struct hda_codec *codec)
6053 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6054 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6054 if (spec == NULL) 6055 if (spec == NULL)
6055 return -ENOMEM; 6056 return -ENOMEM;
6057 codec->no_trigger_sense = 1;
6056 codec->spec = spec; 6058 codec->spec = spec;
6057 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6059 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6058 spec->pin_nids = stac9872_pin_nids; 6060 spec->pin_nids = stac9872_pin_nids;