aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/als300.c4
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c9
-rw-r--r--sound/pci/hda/hda_intel.c42
-rw-r--r--sound/pci/hda/patch_realtek.c24
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/pci/ice1712/ice1724.c7
-rw-r--r--sound/pci/rme9652/hdspm.c234
8 files changed, 210 insertions, 114 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 9473fca9681d..8b0f99688303 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1271,6 +1271,8 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
1271 tmp.index = ac97->num; 1271 tmp.index = ac97->num;
1272 kctl = snd_ctl_new1(&tmp, ac97); 1272 kctl = snd_ctl_new1(&tmp, ac97);
1273 } 1273 }
1274 if (!kctl)
1275 return -ENOMEM;
1274 if (reg >= AC97_PHONE && reg <= AC97_PCM) 1276 if (reg >= AC97_PHONE && reg <= AC97_PCM)
1275 set_tlv_db_scale(kctl, db_scale_5bit_12db_max); 1277 set_tlv_db_scale(kctl, db_scale_5bit_12db_max);
1276 else 1278 else
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 00f157a2cf64..5af3cb6b0c18 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -394,6 +394,8 @@ static int snd_als300_playback_open(struct snd_pcm_substream *substream)
394 struct snd_als300_substream_data *data = kzalloc(sizeof(*data), 394 struct snd_als300_substream_data *data = kzalloc(sizeof(*data),
395 GFP_KERNEL); 395 GFP_KERNEL);
396 396
397 if (!data)
398 return -ENOMEM;
397 snd_als300_dbgcallenter(); 399 snd_als300_dbgcallenter();
398 chip->playback_substream = substream; 400 chip->playback_substream = substream;
399 runtime->hw = snd_als300_playback_hw; 401 runtime->hw = snd_als300_playback_hw;
@@ -425,6 +427,8 @@ static int snd_als300_capture_open(struct snd_pcm_substream *substream)
425 struct snd_als300_substream_data *data = kzalloc(sizeof(*data), 427 struct snd_als300_substream_data *data = kzalloc(sizeof(*data),
426 GFP_KERNEL); 428 GFP_KERNEL);
427 429
430 if (!data)
431 return -ENOMEM;
428 snd_als300_dbgcallenter(); 432 snd_als300_dbgcallenter();
429 chip->capture_substream = substream; 433 chip->capture_substream = substream;
430 runtime->hw = snd_als300_capture_hw; 434 runtime->hw = snd_als300_capture_hw;
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index bed4485f34f6..c21adb6ef1d5 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1416,6 +1416,15 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1416 .ca0108_chip = 1, 1416 .ca0108_chip = 1,
1417 .spk71 = 1, 1417 .spk71 = 1,
1418 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */ 1418 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
1419 /* Tested by Maxim Kachur <mcdebugger@duganet.ru> 17th Oct 2012. */
1420 /* This is MAEM8986, 0202 is MAEM8980 */
1421 {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40071102,
1422 .driver = "Audigy2", .name = "E-mu 1010 PCIe [MAEM8986]",
1423 .id = "EMU1010",
1424 .emu10k2_chip = 1,
1425 .ca0108_chip = 1,
1426 .spk71 = 1,
1427 .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 PCIe */
1419 /* Tested by James@superbug.co.uk 8th July 2005. */ 1428 /* Tested by James@superbug.co.uk 8th July 2005. */
1420 /* This is MAEM8810, 0202 is MAEM8820 */ 1429 /* This is MAEM8810, 0202 is MAEM8820 */
1421 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, 1430 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 6833835a218b..72b085ae7d46 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -501,6 +501,7 @@ struct azx {
501 501
502 /* VGA-switcheroo setup */ 502 /* VGA-switcheroo setup */
503 unsigned int use_vga_switcheroo:1; 503 unsigned int use_vga_switcheroo:1;
504 unsigned int vga_switcheroo_registered:1;
504 unsigned int init_failed:1; /* delayed init failed */ 505 unsigned int init_failed:1; /* delayed init failed */
505 unsigned int disabled:1; /* disabled by VGA-switcher */ 506 unsigned int disabled:1; /* disabled by VGA-switcher */
506 507
@@ -2157,9 +2158,12 @@ static unsigned int azx_get_position(struct azx *chip,
2157 if (delay < 0) 2158 if (delay < 0)
2158 delay += azx_dev->bufsize; 2159 delay += azx_dev->bufsize;
2159 if (delay >= azx_dev->period_bytes) { 2160 if (delay >= azx_dev->period_bytes) {
2160 snd_printdd("delay %d > period_bytes %d\n", 2161 snd_printk(KERN_WARNING SFX
2161 delay, azx_dev->period_bytes); 2162 "Unstable LPIB (%d >= %d); "
2162 delay = 0; /* something is wrong */ 2163 "disabling LPIB delay counting\n",
2164 delay, azx_dev->period_bytes);
2165 delay = 0;
2166 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY;
2163 } 2167 }
2164 azx_dev->substream->runtime->delay = 2168 azx_dev->substream->runtime->delay =
2165 bytes_to_frames(azx_dev->substream->runtime, delay); 2169 bytes_to_frames(azx_dev->substream->runtime, delay);
@@ -2640,7 +2644,9 @@ static void azx_vs_set_state(struct pci_dev *pci,
2640 if (disabled) { 2644 if (disabled) {
2641 azx_suspend(&pci->dev); 2645 azx_suspend(&pci->dev);
2642 chip->disabled = true; 2646 chip->disabled = true;
2643 snd_hda_lock_devices(chip->bus); 2647 if (snd_hda_lock_devices(chip->bus))
2648 snd_printk(KERN_WARNING SFX
2649 "Cannot lock devices!\n");
2644 } else { 2650 } else {
2645 snd_hda_unlock_devices(chip->bus); 2651 snd_hda_unlock_devices(chip->bus);
2646 chip->disabled = false; 2652 chip->disabled = false;
@@ -2683,14 +2689,20 @@ static const struct vga_switcheroo_client_ops azx_vs_ops = {
2683 2689
2684static int __devinit register_vga_switcheroo(struct azx *chip) 2690static int __devinit register_vga_switcheroo(struct azx *chip)
2685{ 2691{
2692 int err;
2693
2686 if (!chip->use_vga_switcheroo) 2694 if (!chip->use_vga_switcheroo)
2687 return 0; 2695 return 0;
2688 /* FIXME: currently only handling DIS controller 2696 /* FIXME: currently only handling DIS controller
2689 * is there any machine with two switchable HDMI audio controllers? 2697 * is there any machine with two switchable HDMI audio controllers?
2690 */ 2698 */
2691 return vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, 2699 err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops,
2692 VGA_SWITCHEROO_DIS, 2700 VGA_SWITCHEROO_DIS,
2693 chip->bus != NULL); 2701 chip->bus != NULL);
2702 if (err < 0)
2703 return err;
2704 chip->vga_switcheroo_registered = 1;
2705 return 0;
2694} 2706}
2695#else 2707#else
2696#define init_vga_switcheroo(chip) /* NOP */ 2708#define init_vga_switcheroo(chip) /* NOP */
@@ -2712,7 +2724,8 @@ static int azx_free(struct azx *chip)
2712 if (use_vga_switcheroo(chip)) { 2724 if (use_vga_switcheroo(chip)) {
2713 if (chip->disabled && chip->bus) 2725 if (chip->disabled && chip->bus)
2714 snd_hda_unlock_devices(chip->bus); 2726 snd_hda_unlock_devices(chip->bus);
2715 vga_switcheroo_unregister_client(chip->pci); 2727 if (chip->vga_switcheroo_registered)
2728 vga_switcheroo_unregister_client(chip->pci);
2716 } 2729 }
2717 2730
2718 if (chip->initialized) { 2731 if (chip->initialized) {
@@ -2813,8 +2826,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2813 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2826 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2814 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2827 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
2815 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2828 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
2816 SND_PCI_QUIRK(0x1043, 0x1ac3, "ASUS X53S", POS_FIX_POSBUF),
2817 SND_PCI_QUIRK(0x1043, 0x1b43, "ASUS K53E", POS_FIX_POSBUF),
2818 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2829 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2819 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB), 2830 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB),
2820 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2831 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
@@ -3062,14 +3073,6 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3062 } 3073 }
3063 3074
3064 ok: 3075 ok:
3065 err = register_vga_switcheroo(chip);
3066 if (err < 0) {
3067 snd_printk(KERN_ERR SFX
3068 "Error registering VGA-switcheroo client\n");
3069 azx_free(chip);
3070 return err;
3071 }
3072
3073 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 3076 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
3074 if (err < 0) { 3077 if (err < 0) {
3075 snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); 3078 snd_printk(KERN_ERR SFX "Error creating device [card]!\n");
@@ -3340,6 +3343,13 @@ static int __devinit azx_probe(struct pci_dev *pci,
3340 if (pci_dev_run_wake(pci)) 3343 if (pci_dev_run_wake(pci))
3341 pm_runtime_put_noidle(&pci->dev); 3344 pm_runtime_put_noidle(&pci->dev);
3342 3345
3346 err = register_vga_switcheroo(chip);
3347 if (err < 0) {
3348 snd_printk(KERN_ERR SFX
3349 "Error registering VGA-switcheroo client\n");
3350 goto out_free;
3351 }
3352
3343 dev++; 3353 dev++;
3344 return 0; 3354 return 0;
3345 3355
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8253b4eeb6a1..f7397ad02a0d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2598,8 +2598,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
2598 return "PCM"; 2598 return "PCM";
2599 break; 2599 break;
2600 } 2600 }
2601 if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) 2601 if (ch >= ARRAY_SIZE(channel_name)) {
2602 snd_BUG();
2602 return "PCM"; 2603 return "PCM";
2604 }
2603 2605
2604 return channel_name[ch]; 2606 return channel_name[ch];
2605} 2607}
@@ -5675,6 +5677,7 @@ static const struct hda_verb alc268_beep_init_verbs[] = {
5675 5677
5676enum { 5678enum {
5677 ALC268_FIXUP_INV_DMIC, 5679 ALC268_FIXUP_INV_DMIC,
5680 ALC268_FIXUP_HP_EAPD,
5678}; 5681};
5679 5682
5680static const struct alc_fixup alc268_fixups[] = { 5683static const struct alc_fixup alc268_fixups[] = {
@@ -5682,10 +5685,26 @@ static const struct alc_fixup alc268_fixups[] = {
5682 .type = ALC_FIXUP_FUNC, 5685 .type = ALC_FIXUP_FUNC,
5683 .v.func = alc_fixup_inv_dmic_0x12, 5686 .v.func = alc_fixup_inv_dmic_0x12,
5684 }, 5687 },
5688 [ALC268_FIXUP_HP_EAPD] = {
5689 .type = ALC_FIXUP_VERBS,
5690 .v.verbs = (const struct hda_verb[]) {
5691 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
5692 {}
5693 }
5694 },
5685}; 5695};
5686 5696
5687static const struct alc_model_fixup alc268_fixup_models[] = { 5697static const struct alc_model_fixup alc268_fixup_models[] = {
5688 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, 5698 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
5699 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
5700 {}
5701};
5702
5703static const struct snd_pci_quirk alc268_fixup_tbl[] = {
5704 /* below is codec SSID since multiple Toshiba laptops have the
5705 * same PCI SSID 1179:ff00
5706 */
5707 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
5689 {} 5708 {}
5690}; 5709};
5691 5710
@@ -5720,7 +5739,7 @@ static int patch_alc268(struct hda_codec *codec)
5720 5739
5721 spec = codec->spec; 5740 spec = codec->spec;
5722 5741
5723 alc_pick_fixup(codec, alc268_fixup_models, NULL, alc268_fixups); 5742 alc_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
5724 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); 5743 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
5725 5744
5726 /* automatic parse from the BIOS config */ 5745 /* automatic parse from the BIOS config */
@@ -6186,6 +6205,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6186 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), 6205 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
6187 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK), 6206 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
6188 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), 6207 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
6208 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
6189 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), 6209 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
6190 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), 6210 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
6191 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), 6211 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 770013ff556f..9ba8af056170 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1763 "HP", STAC_HP_ZEPHYR), 1763 "HP", STAC_HP_ZEPHYR),
1764 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, 1764 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
1765 "HP Mini", STAC_92HD83XXX_HP_LED), 1765 "HP Mini", STAC_92HD83XXX_HP_LED),
1766 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
1767 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
1766 {} /* terminator */ 1768 {} /* terminator */
1767}; 1769};
1768 1770
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 3050a5279253..245d874891ba 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev)
2859 ice->set_spdif_clock(ice, 0); 2859 ice->set_spdif_clock(ice, 0);
2860 } else { 2860 } else {
2861 /* internal on-card clock */ 2861 /* internal on-card clock */
2862 snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); 2862 int rate;
2863 if (ice->cur_rate)
2864 rate = ice->cur_rate;
2865 else
2866 rate = ice->pro_rate_default;
2867 snd_vt1724_set_pro_rate(ice, rate, 1);
2863 } 2868 }
2864 2869
2865 update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); 2870 update_spdif_bits(ice, ice->pm_saved_spdif_ctrl);
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index b12308b5ba2a..f1cd1e387801 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -971,6 +971,7 @@ static inline void snd_hdspm_initialize_midi_flush(struct hdspm *hdspm);
971static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm); 971static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm);
972static int hdspm_autosync_ref(struct hdspm *hdspm); 972static int hdspm_autosync_ref(struct hdspm *hdspm);
973static int snd_hdspm_set_defaults(struct hdspm *hdspm); 973static int snd_hdspm_set_defaults(struct hdspm *hdspm);
974static int hdspm_system_clock_mode(struct hdspm *hdspm);
974static void hdspm_set_sgbuf(struct hdspm *hdspm, 975static void hdspm_set_sgbuf(struct hdspm *hdspm,
975 struct snd_pcm_substream *substream, 976 struct snd_pcm_substream *substream,
976 unsigned int reg, int channels); 977 unsigned int reg, int channels);
@@ -1989,10 +1990,14 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm)
1989 rate = hdspm_calc_dds_value(hdspm, period); 1990 rate = hdspm_calc_dds_value(hdspm, period);
1990 1991
1991 if (rate > 207000) { 1992 if (rate > 207000) {
1992 /* Unreasonable high sample rate as seen on PCI MADI cards. 1993 /* Unreasonable high sample rate as seen on PCI MADI cards. */
1993 * Use the cached value instead. 1994 if (0 == hdspm_system_clock_mode(hdspm)) {
1994 */ 1995 /* master mode, return internal sample rate */
1995 rate = hdspm->system_sample_rate; 1996 rate = hdspm->system_sample_rate;
1997 } else {
1998 /* slave mode, return external sample rate */
1999 rate = hdspm_external_sample_rate(hdspm);
2000 }
1996 } 2001 }
1997 2002
1998 return rate; 2003 return rate;
@@ -2000,12 +2005,14 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm)
2000 2005
2001 2006
2002#define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \ 2007#define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \
2003{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2008{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2004 .name = xname, \ 2009 .name = xname, \
2005 .index = xindex, \ 2010 .index = xindex, \
2006 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 2011 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\
2007 .info = snd_hdspm_info_system_sample_rate, \ 2012 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
2008 .get = snd_hdspm_get_system_sample_rate \ 2013 .info = snd_hdspm_info_system_sample_rate, \
2014 .put = snd_hdspm_put_system_sample_rate, \
2015 .get = snd_hdspm_get_system_sample_rate \
2009} 2016}
2010 2017
2011static int snd_hdspm_info_system_sample_rate(struct snd_kcontrol *kcontrol, 2018static int snd_hdspm_info_system_sample_rate(struct snd_kcontrol *kcontrol,
@@ -2030,6 +2037,16 @@ static int snd_hdspm_get_system_sample_rate(struct snd_kcontrol *kcontrol,
2030 return 0; 2037 return 0;
2031} 2038}
2032 2039
2040static int snd_hdspm_put_system_sample_rate(struct snd_kcontrol *kcontrol,
2041 struct snd_ctl_elem_value *
2042 ucontrol)
2043{
2044 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2045
2046 hdspm_set_dds_value(hdspm, ucontrol->value.enumerated.item[0]);
2047 return 0;
2048}
2049
2033 2050
2034/** 2051/**
2035 * Returns the WordClock sample rate class for the given card. 2052 * Returns the WordClock sample rate class for the given card.
@@ -2163,6 +2180,7 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol,
2163 hdspm_get_s1_sample_rate(hdspm, 2180 hdspm_get_s1_sample_rate(hdspm,
2164 kcontrol->private_value-1); 2181 kcontrol->private_value-1);
2165 } 2182 }
2183 break;
2166 2184
2167 case AIO: 2185 case AIO:
2168 switch (kcontrol->private_value) { 2186 switch (kcontrol->private_value) {
@@ -2183,6 +2201,7 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol,
2183 hdspm_get_s1_sample_rate(hdspm, 2201 hdspm_get_s1_sample_rate(hdspm,
2184 ucontrol->id.index-1); 2202 ucontrol->id.index-1);
2185 } 2203 }
2204 break;
2186 2205
2187 case AES32: 2206 case AES32:
2188 2207
@@ -2204,8 +2223,23 @@ static int snd_hdspm_get_autosync_sample_rate(struct snd_kcontrol *kcontrol,
2204 hdspm_get_s1_sample_rate(hdspm, 2223 hdspm_get_s1_sample_rate(hdspm,
2205 kcontrol->private_value-1); 2224 kcontrol->private_value-1);
2206 break; 2225 break;
2226 }
2227 break;
2207 2228
2229 case MADI:
2230 case MADIface:
2231 {
2232 int rate = hdspm_external_sample_rate(hdspm);
2233 int i, selected_rate = 0;
2234 for (i = 1; i < 10; i++)
2235 if (HDSPM_bit2freq(i) == rate) {
2236 selected_rate = i;
2237 break;
2238 }
2239 ucontrol->value.enumerated.item[0] = selected_rate;
2208 } 2240 }
2241 break;
2242
2209 default: 2243 default:
2210 break; 2244 break;
2211 } 2245 }
@@ -2430,7 +2464,7 @@ static int snd_hdspm_put_clock_source(struct snd_kcontrol *kcontrol,
2430 2464
2431 2465
2432#define HDSPM_PREF_SYNC_REF(xname, xindex) \ 2466#define HDSPM_PREF_SYNC_REF(xname, xindex) \
2433{.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2467{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2434 .name = xname, \ 2468 .name = xname, \
2435 .index = xindex, \ 2469 .index = xindex, \
2436 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\ 2470 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\
@@ -2766,12 +2800,12 @@ static int snd_hdspm_put_pref_sync_ref(struct snd_kcontrol *kcontrol,
2766 2800
2767 2801
2768#define HDSPM_AUTOSYNC_REF(xname, xindex) \ 2802#define HDSPM_AUTOSYNC_REF(xname, xindex) \
2769{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2803{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2770 .name = xname, \ 2804 .name = xname, \
2771 .index = xindex, \ 2805 .index = xindex, \
2772 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 2806 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
2773 .info = snd_hdspm_info_autosync_ref, \ 2807 .info = snd_hdspm_info_autosync_ref, \
2774 .get = snd_hdspm_get_autosync_ref, \ 2808 .get = snd_hdspm_get_autosync_ref, \
2775} 2809}
2776 2810
2777static int hdspm_autosync_ref(struct hdspm *hdspm) 2811static int hdspm_autosync_ref(struct hdspm *hdspm)
@@ -2855,12 +2889,12 @@ static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol,
2855 2889
2856 2890
2857#define HDSPM_LINE_OUT(xname, xindex) \ 2891#define HDSPM_LINE_OUT(xname, xindex) \
2858{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2892{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2859 .name = xname, \ 2893 .name = xname, \
2860 .index = xindex, \ 2894 .index = xindex, \
2861 .info = snd_hdspm_info_line_out, \ 2895 .info = snd_hdspm_info_line_out, \
2862 .get = snd_hdspm_get_line_out, \ 2896 .get = snd_hdspm_get_line_out, \
2863 .put = snd_hdspm_put_line_out \ 2897 .put = snd_hdspm_put_line_out \
2864} 2898}
2865 2899
2866static int hdspm_line_out(struct hdspm * hdspm) 2900static int hdspm_line_out(struct hdspm * hdspm)
@@ -2912,12 +2946,12 @@ static int snd_hdspm_put_line_out(struct snd_kcontrol *kcontrol,
2912 2946
2913 2947
2914#define HDSPM_TX_64(xname, xindex) \ 2948#define HDSPM_TX_64(xname, xindex) \
2915{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2949{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2916 .name = xname, \ 2950 .name = xname, \
2917 .index = xindex, \ 2951 .index = xindex, \
2918 .info = snd_hdspm_info_tx_64, \ 2952 .info = snd_hdspm_info_tx_64, \
2919 .get = snd_hdspm_get_tx_64, \ 2953 .get = snd_hdspm_get_tx_64, \
2920 .put = snd_hdspm_put_tx_64 \ 2954 .put = snd_hdspm_put_tx_64 \
2921} 2955}
2922 2956
2923static int hdspm_tx_64(struct hdspm * hdspm) 2957static int hdspm_tx_64(struct hdspm * hdspm)
@@ -2968,12 +3002,12 @@ static int snd_hdspm_put_tx_64(struct snd_kcontrol *kcontrol,
2968 3002
2969 3003
2970#define HDSPM_C_TMS(xname, xindex) \ 3004#define HDSPM_C_TMS(xname, xindex) \
2971{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3005{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2972 .name = xname, \ 3006 .name = xname, \
2973 .index = xindex, \ 3007 .index = xindex, \
2974 .info = snd_hdspm_info_c_tms, \ 3008 .info = snd_hdspm_info_c_tms, \
2975 .get = snd_hdspm_get_c_tms, \ 3009 .get = snd_hdspm_get_c_tms, \
2976 .put = snd_hdspm_put_c_tms \ 3010 .put = snd_hdspm_put_c_tms \
2977} 3011}
2978 3012
2979static int hdspm_c_tms(struct hdspm * hdspm) 3013static int hdspm_c_tms(struct hdspm * hdspm)
@@ -3024,12 +3058,12 @@ static int snd_hdspm_put_c_tms(struct snd_kcontrol *kcontrol,
3024 3058
3025 3059
3026#define HDSPM_SAFE_MODE(xname, xindex) \ 3060#define HDSPM_SAFE_MODE(xname, xindex) \
3027{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3061{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3028 .name = xname, \ 3062 .name = xname, \
3029 .index = xindex, \ 3063 .index = xindex, \
3030 .info = snd_hdspm_info_safe_mode, \ 3064 .info = snd_hdspm_info_safe_mode, \
3031 .get = snd_hdspm_get_safe_mode, \ 3065 .get = snd_hdspm_get_safe_mode, \
3032 .put = snd_hdspm_put_safe_mode \ 3066 .put = snd_hdspm_put_safe_mode \
3033} 3067}
3034 3068
3035static int hdspm_safe_mode(struct hdspm * hdspm) 3069static int hdspm_safe_mode(struct hdspm * hdspm)
@@ -3080,12 +3114,12 @@ static int snd_hdspm_put_safe_mode(struct snd_kcontrol *kcontrol,
3080 3114
3081 3115
3082#define HDSPM_EMPHASIS(xname, xindex) \ 3116#define HDSPM_EMPHASIS(xname, xindex) \
3083{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3117{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3084 .name = xname, \ 3118 .name = xname, \
3085 .index = xindex, \ 3119 .index = xindex, \
3086 .info = snd_hdspm_info_emphasis, \ 3120 .info = snd_hdspm_info_emphasis, \
3087 .get = snd_hdspm_get_emphasis, \ 3121 .get = snd_hdspm_get_emphasis, \
3088 .put = snd_hdspm_put_emphasis \ 3122 .put = snd_hdspm_put_emphasis \
3089} 3123}
3090 3124
3091static int hdspm_emphasis(struct hdspm * hdspm) 3125static int hdspm_emphasis(struct hdspm * hdspm)
@@ -3136,12 +3170,12 @@ static int snd_hdspm_put_emphasis(struct snd_kcontrol *kcontrol,
3136 3170
3137 3171
3138#define HDSPM_DOLBY(xname, xindex) \ 3172#define HDSPM_DOLBY(xname, xindex) \
3139{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3173{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3140 .name = xname, \ 3174 .name = xname, \
3141 .index = xindex, \ 3175 .index = xindex, \
3142 .info = snd_hdspm_info_dolby, \ 3176 .info = snd_hdspm_info_dolby, \
3143 .get = snd_hdspm_get_dolby, \ 3177 .get = snd_hdspm_get_dolby, \
3144 .put = snd_hdspm_put_dolby \ 3178 .put = snd_hdspm_put_dolby \
3145} 3179}
3146 3180
3147static int hdspm_dolby(struct hdspm * hdspm) 3181static int hdspm_dolby(struct hdspm * hdspm)
@@ -3192,12 +3226,12 @@ static int snd_hdspm_put_dolby(struct snd_kcontrol *kcontrol,
3192 3226
3193 3227
3194#define HDSPM_PROFESSIONAL(xname, xindex) \ 3228#define HDSPM_PROFESSIONAL(xname, xindex) \
3195{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3229{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3196 .name = xname, \ 3230 .name = xname, \
3197 .index = xindex, \ 3231 .index = xindex, \
3198 .info = snd_hdspm_info_professional, \ 3232 .info = snd_hdspm_info_professional, \
3199 .get = snd_hdspm_get_professional, \ 3233 .get = snd_hdspm_get_professional, \
3200 .put = snd_hdspm_put_professional \ 3234 .put = snd_hdspm_put_professional \
3201} 3235}
3202 3236
3203static int hdspm_professional(struct hdspm * hdspm) 3237static int hdspm_professional(struct hdspm * hdspm)
@@ -3247,12 +3281,12 @@ static int snd_hdspm_put_professional(struct snd_kcontrol *kcontrol,
3247} 3281}
3248 3282
3249#define HDSPM_INPUT_SELECT(xname, xindex) \ 3283#define HDSPM_INPUT_SELECT(xname, xindex) \
3250{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3284{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3251 .name = xname, \ 3285 .name = xname, \
3252 .index = xindex, \ 3286 .index = xindex, \
3253 .info = snd_hdspm_info_input_select, \ 3287 .info = snd_hdspm_info_input_select, \
3254 .get = snd_hdspm_get_input_select, \ 3288 .get = snd_hdspm_get_input_select, \
3255 .put = snd_hdspm_put_input_select \ 3289 .put = snd_hdspm_put_input_select \
3256} 3290}
3257 3291
3258static int hdspm_input_select(struct hdspm * hdspm) 3292static int hdspm_input_select(struct hdspm * hdspm)
@@ -3319,12 +3353,12 @@ static int snd_hdspm_put_input_select(struct snd_kcontrol *kcontrol,
3319 3353
3320 3354
3321#define HDSPM_DS_WIRE(xname, xindex) \ 3355#define HDSPM_DS_WIRE(xname, xindex) \
3322{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3356{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3323 .name = xname, \ 3357 .name = xname, \
3324 .index = xindex, \ 3358 .index = xindex, \
3325 .info = snd_hdspm_info_ds_wire, \ 3359 .info = snd_hdspm_info_ds_wire, \
3326 .get = snd_hdspm_get_ds_wire, \ 3360 .get = snd_hdspm_get_ds_wire, \
3327 .put = snd_hdspm_put_ds_wire \ 3361 .put = snd_hdspm_put_ds_wire \
3328} 3362}
3329 3363
3330static int hdspm_ds_wire(struct hdspm * hdspm) 3364static int hdspm_ds_wire(struct hdspm * hdspm)
@@ -3391,12 +3425,12 @@ static int snd_hdspm_put_ds_wire(struct snd_kcontrol *kcontrol,
3391 3425
3392 3426
3393#define HDSPM_QS_WIRE(xname, xindex) \ 3427#define HDSPM_QS_WIRE(xname, xindex) \
3394{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3428{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3395 .name = xname, \ 3429 .name = xname, \
3396 .index = xindex, \ 3430 .index = xindex, \
3397 .info = snd_hdspm_info_qs_wire, \ 3431 .info = snd_hdspm_info_qs_wire, \
3398 .get = snd_hdspm_get_qs_wire, \ 3432 .get = snd_hdspm_get_qs_wire, \
3399 .put = snd_hdspm_put_qs_wire \ 3433 .put = snd_hdspm_put_qs_wire \
3400} 3434}
3401 3435
3402static int hdspm_qs_wire(struct hdspm * hdspm) 3436static int hdspm_qs_wire(struct hdspm * hdspm)
@@ -3563,15 +3597,15 @@ static int snd_hdspm_put_madi_speedmode(struct snd_kcontrol *kcontrol,
3563} 3597}
3564 3598
3565#define HDSPM_MIXER(xname, xindex) \ 3599#define HDSPM_MIXER(xname, xindex) \
3566{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 3600{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \
3567 .name = xname, \ 3601 .name = xname, \
3568 .index = xindex, \ 3602 .index = xindex, \
3569 .device = 0, \ 3603 .device = 0, \
3570 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ 3604 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
3571 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 3605 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
3572 .info = snd_hdspm_info_mixer, \ 3606 .info = snd_hdspm_info_mixer, \
3573 .get = snd_hdspm_get_mixer, \ 3607 .get = snd_hdspm_get_mixer, \
3574 .put = snd_hdspm_put_mixer \ 3608 .put = snd_hdspm_put_mixer \
3575} 3609}
3576 3610
3577static int snd_hdspm_info_mixer(struct snd_kcontrol *kcontrol, 3611static int snd_hdspm_info_mixer(struct snd_kcontrol *kcontrol,
@@ -3670,12 +3704,12 @@ static int snd_hdspm_put_mixer(struct snd_kcontrol *kcontrol,
3670*/ 3704*/
3671 3705
3672#define HDSPM_PLAYBACK_MIXER \ 3706#define HDSPM_PLAYBACK_MIXER \
3673{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3707{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3674 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE | \ 3708 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE | \
3675 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 3709 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
3676 .info = snd_hdspm_info_playback_mixer, \ 3710 .info = snd_hdspm_info_playback_mixer, \
3677 .get = snd_hdspm_get_playback_mixer, \ 3711 .get = snd_hdspm_get_playback_mixer, \
3678 .put = snd_hdspm_put_playback_mixer \ 3712 .put = snd_hdspm_put_playback_mixer \
3679} 3713}
3680 3714
3681static int snd_hdspm_info_playback_mixer(struct snd_kcontrol *kcontrol, 3715static int snd_hdspm_info_playback_mixer(struct snd_kcontrol *kcontrol,
@@ -3851,12 +3885,17 @@ static int hdspm_sync_in_sync_check(struct hdspm *hdspm)
3851 break; 3885 break;
3852 3886
3853 case MADI: 3887 case MADI:
3854 case AES32: 3888 status = hdspm_read(hdspm, HDSPM_statusRegister);
3855 status = hdspm_read(hdspm, HDSPM_statusRegister2);
3856 lock = (status & HDSPM_syncInLock) ? 1 : 0; 3889 lock = (status & HDSPM_syncInLock) ? 1 : 0;
3857 sync = (status & HDSPM_syncInSync) ? 1 : 0; 3890 sync = (status & HDSPM_syncInSync) ? 1 : 0;
3858 break; 3891 break;
3859 3892
3893 case AES32:
3894 status = hdspm_read(hdspm, HDSPM_statusRegister2);
3895 lock = (status & 0x100000) ? 1 : 0;
3896 sync = (status & 0x200000) ? 1 : 0;
3897 break;
3898
3860 case MADIface: 3899 case MADIface:
3861 break; 3900 break;
3862 } 3901 }
@@ -3942,6 +3981,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol,
3942 default: 3981 default:
3943 val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1); 3982 val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1);
3944 } 3983 }
3984 break;
3945 3985
3946 case AIO: 3986 case AIO:
3947 switch (kcontrol->private_value) { 3987 switch (kcontrol->private_value) {
@@ -3954,6 +3994,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol,
3954 default: 3994 default:
3955 val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1); 3995 val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1);
3956 } 3996 }
3997 break;
3957 3998
3958 case MADI: 3999 case MADI:
3959 switch (kcontrol->private_value) { 4000 switch (kcontrol->private_value) {
@@ -3966,6 +4007,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol,
3966 case 3: /* SYNC_IN */ 4007 case 3: /* SYNC_IN */
3967 val = hdspm_sync_in_sync_check(hdspm); break; 4008 val = hdspm_sync_in_sync_check(hdspm); break;
3968 } 4009 }
4010 break;
3969 4011
3970 case MADIface: 4012 case MADIface:
3971 val = hdspm_madi_sync_check(hdspm); /* MADI */ 4013 val = hdspm_madi_sync_check(hdspm); /* MADI */
@@ -3983,6 +4025,7 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol,
3983 val = hdspm_aes_sync_check(hdspm, 4025 val = hdspm_aes_sync_check(hdspm,
3984 kcontrol->private_value-1); 4026 kcontrol->private_value-1);
3985 } 4027 }
4028 break;
3986 4029
3987 } 4030 }
3988 4031
@@ -4427,9 +4470,10 @@ static struct snd_kcontrol_new snd_hdspm_controls_madi[] = {
4427 HDSPM_PREF_SYNC_REF("Preferred Sync Reference", 0), 4470 HDSPM_PREF_SYNC_REF("Preferred Sync Reference", 0),
4428 HDSPM_AUTOSYNC_REF("AutoSync Reference", 0), 4471 HDSPM_AUTOSYNC_REF("AutoSync Reference", 0),
4429 HDSPM_SYSTEM_SAMPLE_RATE("System Sample Rate", 0), 4472 HDSPM_SYSTEM_SAMPLE_RATE("System Sample Rate", 0),
4473 HDSPM_AUTOSYNC_SAMPLE_RATE("External Rate", 0),
4430 HDSPM_SYNC_CHECK("WC SyncCheck", 0), 4474 HDSPM_SYNC_CHECK("WC SyncCheck", 0),
4431 HDSPM_SYNC_CHECK("MADI SyncCheck", 1), 4475 HDSPM_SYNC_CHECK("MADI SyncCheck", 1),
4432 HDSPM_SYNC_CHECK("TCO SyncCHeck", 2), 4476 HDSPM_SYNC_CHECK("TCO SyncCheck", 2),
4433 HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 3), 4477 HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 3),
4434 HDSPM_LINE_OUT("Line Out", 0), 4478 HDSPM_LINE_OUT("Line Out", 0),
4435 HDSPM_TX_64("TX 64 channels mode", 0), 4479 HDSPM_TX_64("TX 64 channels mode", 0),