aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-02-20 13:15:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-02-20 13:15:57 -0500
commit6f576d57f1fa0d6026b495d8746d56d949989161 (patch)
treef1869e45eb1eb7ceff54610d121dc5dd4a977561 /sound
parenta0c85e96d3b5609c918edd5a534a7cde9845b3fa (diff)
parent89724958e5d596bb91328644c97dd80399443e87 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: ALSA: HDA: Do not announce false surround in Conexant auto ALSA: HDA: Conexant auto: Handle multiple connections to ADC node ALSA: HDA: Add position_fix quirk for an Asus device ALSA: caiaq - Fix possible string-buffer overflow ALSA: au88x0 - Modify pointer callback to give accurate playback position
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/au88x0/au88x0_core.c14
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/pci/hda/patch_conexant.c63
-rw-r--r--sound/usb/caiaq/audio.c2
-rw-r--r--sound/usb/caiaq/midi.c2
5 files changed, 63 insertions, 19 deletions
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index 23f49f356e0f..16c0bdfbb164 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -1252,11 +1252,19 @@ static void vortex_adbdma_resetup(vortex_t *vortex, int adbdma) {
1252static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma) 1252static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma)
1253{ 1253{
1254 stream_t *dma = &vortex->dma_adb[adbdma]; 1254 stream_t *dma = &vortex->dma_adb[adbdma];
1255 int temp; 1255 int temp, page, delta;
1256 1256
1257 temp = hwread(vortex->mmio, VORTEX_ADBDMA_STAT + (adbdma << 2)); 1257 temp = hwread(vortex->mmio, VORTEX_ADBDMA_STAT + (adbdma << 2));
1258 temp = (dma->period_virt * dma->period_bytes) + (temp & (dma->period_bytes - 1)); 1258 page = (temp & ADB_SUBBUF_MASK) >> ADB_SUBBUF_SHIFT;
1259 return temp; 1259 if (dma->nr_periods >= 4)
1260 delta = (page - dma->period_real) & 3;
1261 else {
1262 delta = (page - dma->period_real);
1263 if (delta < 0)
1264 delta += dma->nr_periods;
1265 }
1266 return (dma->period_virt + delta) * dma->period_bytes
1267 + (temp & (dma->period_bytes - 1));
1260} 1268}
1261 1269
1262static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma) 1270static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 0baffcdee8f9..fcedad9a5fef 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2308,6 +2308,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2308 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2308 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2309 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2309 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
2310 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2310 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
2311 SND_PCI_QUIRK(0x1043, 0x8410, "ASUS", POS_FIX_LPIB),
2311 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2312 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2312 SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), 2313 SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
2313 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB), 2314 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index fbe97d32140d..dd7c5c12225d 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3410,7 +3410,7 @@ static void cx_auto_parse_output(struct hda_codec *codec)
3410 } 3410 }
3411 } 3411 }
3412 spec->multiout.dac_nids = spec->private_dac_nids; 3412 spec->multiout.dac_nids = spec->private_dac_nids;
3413 spec->multiout.max_channels = nums * 2; 3413 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3414 3414
3415 if (cfg->hp_outs > 0) 3415 if (cfg->hp_outs > 0)
3416 spec->auto_mute = 1; 3416 spec->auto_mute = 1;
@@ -3729,9 +3729,9 @@ static int cx_auto_init(struct hda_codec *codec)
3729 return 0; 3729 return 0;
3730} 3730}
3731 3731
3732static int cx_auto_add_volume(struct hda_codec *codec, const char *basename, 3732static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename,
3733 const char *dir, int cidx, 3733 const char *dir, int cidx,
3734 hda_nid_t nid, int hda_dir) 3734 hda_nid_t nid, int hda_dir, int amp_idx)
3735{ 3735{
3736 static char name[32]; 3736 static char name[32];
3737 static struct snd_kcontrol_new knew[] = { 3737 static struct snd_kcontrol_new knew[] = {
@@ -3743,7 +3743,8 @@ static int cx_auto_add_volume(struct hda_codec *codec, const char *basename,
3743 3743
3744 for (i = 0; i < 2; i++) { 3744 for (i = 0; i < 2; i++) {
3745 struct snd_kcontrol *kctl; 3745 struct snd_kcontrol *kctl;
3746 knew[i].private_value = HDA_COMPOSE_AMP_VAL(nid, 3, 0, hda_dir); 3746 knew[i].private_value = HDA_COMPOSE_AMP_VAL(nid, 3, amp_idx,
3747 hda_dir);
3747 knew[i].subdevice = HDA_SUBDEV_AMP_FLAG; 3748 knew[i].subdevice = HDA_SUBDEV_AMP_FLAG;
3748 knew[i].index = cidx; 3749 knew[i].index = cidx;
3749 snprintf(name, sizeof(name), "%s%s %s", basename, dir, sfx[i]); 3750 snprintf(name, sizeof(name), "%s%s %s", basename, dir, sfx[i]);
@@ -3759,6 +3760,9 @@ static int cx_auto_add_volume(struct hda_codec *codec, const char *basename,
3759 return 0; 3760 return 0;
3760} 3761}
3761 3762
3763#define cx_auto_add_volume(codec, str, dir, cidx, nid, hda_dir) \
3764 cx_auto_add_volume_idx(codec, str, dir, cidx, nid, hda_dir, 0)
3765
3762#define cx_auto_add_pb_volume(codec, nid, str, idx) \ 3766#define cx_auto_add_pb_volume(codec, nid, str, idx) \
3763 cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT) 3767 cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT)
3764 3768
@@ -3808,29 +3812,60 @@ static int cx_auto_build_input_controls(struct hda_codec *codec)
3808 struct conexant_spec *spec = codec->spec; 3812 struct conexant_spec *spec = codec->spec;
3809 struct auto_pin_cfg *cfg = &spec->autocfg; 3813 struct auto_pin_cfg *cfg = &spec->autocfg;
3810 static const char *prev_label; 3814 static const char *prev_label;
3811 int i, err, cidx; 3815 int i, err, cidx, conn_len;
3816 hda_nid_t conn[HDA_MAX_CONNECTIONS];
3817
3818 int multi_adc_volume = 0; /* If the ADC nid has several input volumes */
3819 int adc_nid = spec->adc_nids[0];
3820
3821 conn_len = snd_hda_get_connections(codec, adc_nid, conn,
3822 HDA_MAX_CONNECTIONS);
3823 if (conn_len < 0)
3824 return conn_len;
3825
3826 multi_adc_volume = cfg->num_inputs > 1 && conn_len > 1;
3827 if (!multi_adc_volume) {
3828 err = cx_auto_add_volume(codec, "Capture", "", 0, adc_nid,
3829 HDA_INPUT);
3830 if (err < 0)
3831 return err;
3832 }
3812 3833
3813 err = cx_auto_add_volume(codec, "Capture", "", 0, spec->adc_nids[0],
3814 HDA_INPUT);
3815 if (err < 0)
3816 return err;
3817 prev_label = NULL; 3834 prev_label = NULL;
3818 cidx = 0; 3835 cidx = 0;
3819 for (i = 0; i < cfg->num_inputs; i++) { 3836 for (i = 0; i < cfg->num_inputs; i++) {
3820 hda_nid_t nid = cfg->inputs[i].pin; 3837 hda_nid_t nid = cfg->inputs[i].pin;
3821 const char *label; 3838 const char *label;
3822 if (!(get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) 3839 int j;
3840 int pin_amp = get_wcaps(codec, nid) & AC_WCAP_IN_AMP;
3841 if (!pin_amp && !multi_adc_volume)
3823 continue; 3842 continue;
3843
3824 label = hda_get_autocfg_input_label(codec, cfg, i); 3844 label = hda_get_autocfg_input_label(codec, cfg, i);
3825 if (label == prev_label) 3845 if (label == prev_label)
3826 cidx++; 3846 cidx++;
3827 else 3847 else
3828 cidx = 0; 3848 cidx = 0;
3829 prev_label = label; 3849 prev_label = label;
3830 err = cx_auto_add_volume(codec, label, " Capture", cidx, 3850
3831 nid, HDA_INPUT); 3851 if (pin_amp) {
3832 if (err < 0) 3852 err = cx_auto_add_volume(codec, label, " Boost", cidx,
3833 return err; 3853 nid, HDA_INPUT);
3854 if (err < 0)
3855 return err;
3856 }
3857
3858 if (!multi_adc_volume)
3859 continue;
3860 for (j = 0; j < conn_len; j++) {
3861 if (conn[j] == nid) {
3862 err = cx_auto_add_volume_idx(codec, label,
3863 " Capture", cidx, adc_nid, HDA_INPUT, j);
3864 if (err < 0)
3865 return err;
3866 break;
3867 }
3868 }
3834 } 3869 }
3835 return 0; 3870 return 0;
3836} 3871}
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 68b97477577b..66eabafb1c24 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -785,7 +785,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev)
785 } 785 }
786 786
787 dev->pcm->private_data = dev; 787 dev->pcm->private_data = dev;
788 strcpy(dev->pcm->name, dev->product_name); 788 strlcpy(dev->pcm->name, dev->product_name, sizeof(dev->pcm->name));
789 789
790 memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); 790 memset(dev->sub_playback, 0, sizeof(dev->sub_playback));
791 memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); 791 memset(dev->sub_capture, 0, sizeof(dev->sub_capture));
diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c
index 2f218c77fff2..a1a47088fd0c 100644
--- a/sound/usb/caiaq/midi.c
+++ b/sound/usb/caiaq/midi.c
@@ -136,7 +136,7 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
136 if (ret < 0) 136 if (ret < 0)
137 return ret; 137 return ret;
138 138
139 strcpy(rmidi->name, device->product_name); 139 strlcpy(rmidi->name, device->product_name, sizeof(rmidi->name));
140 140
141 rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX; 141 rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX;
142 rmidi->private_data = device; 142 rmidi->private_data = device;