aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-02-16 10:43:09 -0500
committerTakashi Iwai <tiwai@suse.de>2012-02-16 10:43:09 -0500
commit00bc0ce9130551ef193c3f5db0b7b6e70dff28ac (patch)
treeb6b022250a08073e522ed1bba56586b534a3c77e /sound
parenta7f3eedc88b547e0ec35ba4cc4ae61cd9bc760ac (diff)
parentc14c95f62ecb8710af14ae0d48e01991b70bb6f4 (diff)
Merge branch 'fix/hda' into topic/hda
The fix for bitmap-overflow in Realtek codec driver is needed for the further development of the auto-parser with badness evaluation.
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c34
-rw-r--r--sound/pci/hda/patch_via.c3
-rw-r--r--sound/pci/intel8x0.c6
-rw-r--r--sound/soc/sh/fsi.c6
-rw-r--r--sound/usb/card.h1
-rw-r--r--sound/usb/format.c4
-rw-r--r--sound/usb/quirks.c6
7 files changed, 48 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b8e06eb96e11..0ffccc178957 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -80,6 +80,8 @@ enum {
80 ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */ 80 ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */
81}; 81};
82 82
83#define MAX_VOL_NIDS 0x40
84
83struct alc_spec { 85struct alc_spec {
84 /* codec parameterization */ 86 /* codec parameterization */
85 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 87 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
@@ -118,8 +120,8 @@ struct alc_spec {
118 const hda_nid_t *capsrc_nids; 120 const hda_nid_t *capsrc_nids;
119 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 121 hda_nid_t dig_in_nid; /* digital-in NID; optional */
120 hda_nid_t mixer_nid; /* analog-mixer NID */ 122 hda_nid_t mixer_nid; /* analog-mixer NID */
121 DECLARE_BITMAP(vol_ctls, 0x20 << 1); 123 DECLARE_BITMAP(vol_ctls, MAX_VOL_NIDS << 1);
122 DECLARE_BITMAP(sw_ctls, 0x20 << 1); 124 DECLARE_BITMAP(sw_ctls, MAX_VOL_NIDS << 1);
123 125
124 /* capture setup for dynamic dual-adc switch */ 126 /* capture setup for dynamic dual-adc switch */
125 hda_nid_t cur_adc; 127 hda_nid_t cur_adc;
@@ -3125,7 +3127,10 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3125static inline unsigned int get_ctl_pos(unsigned int data) 3127static inline unsigned int get_ctl_pos(unsigned int data)
3126{ 3128{
3127 hda_nid_t nid = get_amp_nid_(data); 3129 hda_nid_t nid = get_amp_nid_(data);
3128 unsigned int dir = get_amp_direction_(data); 3130 unsigned int dir;
3131 if (snd_BUG_ON(nid >= MAX_VOL_NIDS))
3132 return 0;
3133 dir = get_amp_direction_(data);
3129 return (nid << 1) | dir; 3134 return (nid << 1) | dir;
3130} 3135}
3131 3136
@@ -4399,6 +4404,7 @@ enum {
4399 ALC882_FIXUP_ACER_ASPIRE_8930G, 4404 ALC882_FIXUP_ACER_ASPIRE_8930G,
4400 ALC882_FIXUP_ASPIRE_8930G_VERBS, 4405 ALC882_FIXUP_ASPIRE_8930G_VERBS,
4401 ALC885_FIXUP_MACPRO_GPIO, 4406 ALC885_FIXUP_MACPRO_GPIO,
4407 ALC889_FIXUP_DAC_ROUTE,
4402}; 4408};
4403 4409
4404static void alc889_fixup_coef(struct hda_codec *codec, 4410static void alc889_fixup_coef(struct hda_codec *codec,
@@ -4452,6 +4458,23 @@ static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
4452 alc882_gpio_mute(codec, 1, 0); 4458 alc882_gpio_mute(codec, 1, 0);
4453} 4459}
4454 4460
4461/* Fix the connection of some pins for ALC889:
4462 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
4463 * work correctly (bko#42740)
4464 */
4465static void alc889_fixup_dac_route(struct hda_codec *codec,
4466 const struct alc_fixup *fix, int action)
4467{
4468 if (action == ALC_FIXUP_ACT_PRE_PROBE) {
4469 hda_nid_t conn1[2] = { 0x0c, 0x0d };
4470 hda_nid_t conn2[2] = { 0x0e, 0x0f };
4471 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
4472 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
4473 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
4474 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
4475 }
4476}
4477
4455static const struct alc_fixup alc882_fixups[] = { 4478static const struct alc_fixup alc882_fixups[] = {
4456 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 4479 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
4457 .type = ALC_FIXUP_PINS, 4480 .type = ALC_FIXUP_PINS,
@@ -4599,6 +4622,10 @@ static const struct alc_fixup alc882_fixups[] = {
4599 .type = ALC_FIXUP_FUNC, 4622 .type = ALC_FIXUP_FUNC,
4600 .v.func = alc885_fixup_macpro_gpio, 4623 .v.func = alc885_fixup_macpro_gpio,
4601 }, 4624 },
4625 [ALC889_FIXUP_DAC_ROUTE] = {
4626 .type = ALC_FIXUP_FUNC,
4627 .v.func = alc889_fixup_dac_route,
4628 },
4602}; 4629};
4603 4630
4604static const struct snd_pci_quirk alc882_fixup_tbl[] = { 4631static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -4623,6 +4650,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
4623 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", 4650 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
4624 ALC882_FIXUP_ACER_ASPIRE_4930G), 4651 ALC882_FIXUP_ACER_ASPIRE_4930G),
4625 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), 4652 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
4653 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
4626 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), 4654 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
4627 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), 4655 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
4628 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), 4656 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index e5842fe1b1e8..c7eb4d7d05c0 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -666,6 +666,9 @@ static void via_auto_init_analog_input(struct hda_codec *codec)
666 /* init input-src */ 666 /* init input-src */
667 for (i = 0; i < spec->num_adc_nids; i++) { 667 for (i = 0; i < spec->num_adc_nids; i++) {
668 int adc_idx = spec->inputs[spec->cur_mux[i]].adc_idx; 668 int adc_idx = spec->inputs[spec->cur_mux[i]].adc_idx;
669 /* secondary ADCs must have the unique MUX */
670 if (i > 0 && !spec->mux_nids[i])
671 break;
669 if (spec->mux_nids[adc_idx]) { 672 if (spec->mux_nids[adc_idx]) {
670 int mux_idx = spec->inputs[spec->cur_mux[i]].mux_idx; 673 int mux_idx = spec->inputs[spec->cur_mux[i]].mux_idx;
671 snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, 674 snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0,
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 9f3b01bb72c8..e0a4263baa20 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2102,6 +2102,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
2102 }, 2102 },
2103 { 2103 {
2104 .subvendor = 0x161f, 2104 .subvendor = 0x161f,
2105 .subdevice = 0x202f,
2106 .name = "Gateway M520",
2107 .type = AC97_TUNE_INV_EAPD
2108 },
2109 {
2110 .subvendor = 0x161f,
2105 .subdevice = 0x203a, 2111 .subdevice = 0x203a,
2106 .name = "Gateway 4525GZ", /* AD1981B */ 2112 .name = "Gateway 4525GZ", /* AD1981B */
2107 .type = AC97_TUNE_INV_EAPD 2113 .type = AC97_TUNE_INV_EAPD
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index db6c89a28bda..ea4a82d01160 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1152,12 +1152,8 @@ static snd_pcm_uframes_t fsi_pointer(struct snd_pcm_substream *substream)
1152{ 1152{
1153 struct fsi_priv *fsi = fsi_get_priv(substream); 1153 struct fsi_priv *fsi = fsi_get_priv(substream);
1154 struct fsi_stream *io = fsi_get_stream(fsi, fsi_is_play(substream)); 1154 struct fsi_stream *io = fsi_get_stream(fsi, fsi_is_play(substream));
1155 int samples_pos = io->buff_sample_pos - 1;
1156 1155
1157 if (samples_pos < 0) 1156 return fsi_sample2frame(fsi, io->buff_sample_pos);
1158 samples_pos = 0;
1159
1160 return fsi_sample2frame(fsi, samples_pos);
1161} 1157}
1162 1158
1163static struct snd_pcm_ops fsi_pcm_ops = { 1159static struct snd_pcm_ops fsi_pcm_ops = {
diff --git a/sound/usb/card.h b/sound/usb/card.h
index a39edcc32a93..da5fa1ac4eda 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -1,6 +1,7 @@
1#ifndef __USBAUDIO_CARD_H 1#ifndef __USBAUDIO_CARD_H
2#define __USBAUDIO_CARD_H 2#define __USBAUDIO_CARD_H
3 3
4#define MAX_NR_RATES 1024
4#define MAX_PACKS 20 5#define MAX_PACKS 20
5#define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ 6#define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */
6#define MAX_URBS 8 7#define MAX_URBS 8
diff --git a/sound/usb/format.c b/sound/usb/format.c
index e09aba19375c..ddfef57c4c9f 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -209,8 +209,6 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
209 return 0; 209 return 0;
210} 210}
211 211
212#define MAX_UAC2_NR_RATES 1024
213
214/* 212/*
215 * Helper function to walk the array of sample rate triplets reported by 213 * Helper function to walk the array of sample rate triplets reported by
216 * the device. The problem is that we need to parse whole array first to 214 * the device. The problem is that we need to parse whole array first to
@@ -255,7 +253,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,
255 fp->rates |= snd_pcm_rate_to_rate_bit(rate); 253 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
256 254
257 nr_rates++; 255 nr_rates++;
258 if (nr_rates >= MAX_UAC2_NR_RATES) { 256 if (nr_rates >= MAX_NR_RATES) {
259 snd_printk(KERN_ERR "invalid uac2 rates\n"); 257 snd_printk(KERN_ERR "invalid uac2 rates\n");
260 break; 258 break;
261 } 259 }
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index a3ddac0deffd..27817266867a 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -132,10 +132,14 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
132 unsigned *rate_table = NULL; 132 unsigned *rate_table = NULL;
133 133
134 fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); 134 fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL);
135 if (! fp) { 135 if (!fp) {
136 snd_printk(KERN_ERR "cannot memdup\n"); 136 snd_printk(KERN_ERR "cannot memdup\n");
137 return -ENOMEM; 137 return -ENOMEM;
138 } 138 }
139 if (fp->nr_rates > MAX_NR_RATES) {
140 kfree(fp);
141 return -EINVAL;
142 }
139 if (fp->nr_rates > 0) { 143 if (fp->nr_rates > 0) {
140 rate_table = kmemdup(fp->rate_table, 144 rate_table = kmemdup(fp->rate_table,
141 sizeof(int) * fp->nr_rates, GFP_KERNEL); 145 sizeof(int) * fp->nr_rates, GFP_KERNEL);