aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/ice1724.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ice1712/ice1724.c')
-rw-r--r--sound/pci/ice1712/ice1724.c85
1 files changed, 48 insertions, 37 deletions
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 245d874891ba..ce70e7f113e0 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -54,6 +53,7 @@
54#include "wtm.h" 53#include "wtm.h"
55#include "se.h" 54#include "se.h"
56#include "quartet.h" 55#include "quartet.h"
56#include "psc724.h"
57 57
58MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); 58MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
59MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)"); 59MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)");
@@ -106,7 +106,7 @@ static int PRO_RATE_LOCKED;
106static int PRO_RATE_RESET = 1; 106static int PRO_RATE_RESET = 1;
107static unsigned int PRO_RATE_DEFAULT = 44100; 107static unsigned int PRO_RATE_DEFAULT = 44100;
108 108
109static char *ext_clock_names[1] = { "IEC958 In" }; 109static const char * const ext_clock_names[1] = { "IEC958 In" };
110 110
111/* 111/*
112 * Basic I/O 112 * Basic I/O
@@ -1135,7 +1135,7 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
1135 .pointer = snd_vt1724_pcm_pointer, 1135 .pointer = snd_vt1724_pcm_pointer,
1136}; 1136};
1137 1137
1138static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) 1138static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
1139{ 1139{
1140 struct snd_pcm *pcm; 1140 struct snd_pcm *pcm;
1141 int capt, err; 1141 int capt, err;
@@ -1315,7 +1315,7 @@ static struct snd_pcm_ops snd_vt1724_capture_spdif_ops = {
1315}; 1315};
1316 1316
1317 1317
1318static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) 1318static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
1319{ 1319{
1320 char *name; 1320 char *name;
1321 struct snd_pcm *pcm; 1321 struct snd_pcm *pcm;
@@ -1449,7 +1449,7 @@ static struct snd_pcm_ops snd_vt1724_playback_indep_ops = {
1449}; 1449};
1450 1450
1451 1451
1452static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) 1452static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
1453{ 1453{
1454 struct snd_pcm *pcm; 1454 struct snd_pcm *pcm;
1455 int play; 1455 int play;
@@ -1484,7 +1484,7 @@ static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
1484 * Mixer section 1484 * Mixer section
1485 */ 1485 */
1486 1486
1487static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 *ice) 1487static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice)
1488{ 1488{
1489 int err; 1489 int err;
1490 1490
@@ -1570,7 +1570,7 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry,
1570 idx, inb(ice->profi_port+idx)); 1570 idx, inb(ice->profi_port+idx));
1571} 1571}
1572 1572
1573static void __devinit snd_vt1724_proc_init(struct snd_ice1712 *ice) 1573static void snd_vt1724_proc_init(struct snd_ice1712 *ice)
1574{ 1574{
1575 struct snd_info_entry *entry; 1575 struct snd_info_entry *entry;
1576 1576
@@ -1599,7 +1599,7 @@ static int snd_vt1724_eeprom_get(struct snd_kcontrol *kcontrol,
1599 return 0; 1599 return 0;
1600} 1600}
1601 1601
1602static struct snd_kcontrol_new snd_vt1724_eeprom __devinitdata = { 1602static struct snd_kcontrol_new snd_vt1724_eeprom = {
1603 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1603 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1604 .name = "ICE1724 EEPROM", 1604 .name = "ICE1724 EEPROM",
1605 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1605 .access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -1712,7 +1712,7 @@ static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol,
1712 return val != old; 1712 return val != old;
1713} 1713}
1714 1714
1715static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata = 1715static struct snd_kcontrol_new snd_vt1724_spdif_default =
1716{ 1716{
1717 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1717 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1718 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), 1718 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
@@ -1744,7 +1744,7 @@ static int snd_vt1724_spdif_maskp_get(struct snd_kcontrol *kcontrol,
1744 return 0; 1744 return 0;
1745} 1745}
1746 1746
1747static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata = 1747static struct snd_kcontrol_new snd_vt1724_spdif_maskc =
1748{ 1748{
1749 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1749 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1750 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1750 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1753,7 +1753,7 @@ static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata =
1753 .get = snd_vt1724_spdif_maskc_get, 1753 .get = snd_vt1724_spdif_maskc_get,
1754}; 1754};
1755 1755
1756static struct snd_kcontrol_new snd_vt1724_spdif_maskp __devinitdata = 1756static struct snd_kcontrol_new snd_vt1724_spdif_maskp =
1757{ 1757{
1758 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1758 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1759 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1759 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1790,7 +1790,7 @@ static int snd_vt1724_spdif_sw_put(struct snd_kcontrol *kcontrol,
1790 return old != val; 1790 return old != val;
1791} 1791}
1792 1792
1793static struct snd_kcontrol_new snd_vt1724_spdif_switch __devinitdata = 1793static struct snd_kcontrol_new snd_vt1724_spdif_switch =
1794{ 1794{
1795 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1795 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1796 /* FIXME: the following conflict with IEC958 Playback Route */ 1796 /* FIXME: the following conflict with IEC958 Playback Route */
@@ -1965,7 +1965,7 @@ static int snd_vt1724_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
1965 return old_rate != new_rate; 1965 return old_rate != new_rate;
1966} 1966}
1967 1967
1968static struct snd_kcontrol_new snd_vt1724_pro_internal_clock __devinitdata = { 1968static struct snd_kcontrol_new snd_vt1724_pro_internal_clock = {
1969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1970 .name = "Multi Track Internal Clock", 1970 .name = "Multi Track Internal Clock",
1971 .info = snd_vt1724_pro_internal_clock_info, 1971 .info = snd_vt1724_pro_internal_clock_info,
@@ -1996,7 +1996,7 @@ static int snd_vt1724_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
1996 return change; 1996 return change;
1997} 1997}
1998 1998
1999static struct snd_kcontrol_new snd_vt1724_pro_rate_locking __devinitdata = { 1999static struct snd_kcontrol_new snd_vt1724_pro_rate_locking = {
2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2001 .name = "Multi Track Rate Locking", 2001 .name = "Multi Track Rate Locking",
2002 .info = snd_vt1724_pro_rate_locking_info, 2002 .info = snd_vt1724_pro_rate_locking_info,
@@ -2027,7 +2027,7 @@ static int snd_vt1724_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
2027 return change; 2027 return change;
2028} 2028}
2029 2029
2030static struct snd_kcontrol_new snd_vt1724_pro_rate_reset __devinitdata = { 2030static struct snd_kcontrol_new snd_vt1724_pro_rate_reset = {
2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2032 .name = "Multi Track Rate Reset", 2032 .name = "Multi Track Rate Reset",
2033 .info = snd_vt1724_pro_rate_reset_info, 2033 .info = snd_vt1724_pro_rate_reset_info,
@@ -2042,7 +2042,7 @@ static struct snd_kcontrol_new snd_vt1724_pro_rate_reset __devinitdata = {
2042static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol, 2042static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol,
2043 struct snd_ctl_elem_info *uinfo) 2043 struct snd_ctl_elem_info *uinfo)
2044{ 2044{
2045 static char *texts[] = { 2045 static const char * const texts[] = {
2046 "PCM Out", /* 0 */ 2046 "PCM Out", /* 0 */
2047 "H/W In 0", "H/W In 1", /* 1-2 */ 2047 "H/W In 0", "H/W In 1", /* 1-2 */
2048 "IEC958 In L", "IEC958 In R", /* 3-4 */ 2048 "IEC958 In L", "IEC958 In R", /* 3-4 */
@@ -2149,7 +2149,7 @@ static int snd_vt1724_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
2149 digital_route_shift(idx)); 2149 digital_route_shift(idx));
2150} 2150}
2151 2151
2152static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = 2152static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route =
2153{ 2153{
2154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2155 .name = "H/W Playback Route", 2155 .name = "H/W Playback Route",
@@ -2158,7 +2158,7 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata =
2158 .put = snd_vt1724_pro_route_analog_put, 2158 .put = snd_vt1724_pro_route_analog_put,
2159}; 2159};
2160 2160
2161static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = { 2161static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route = {
2162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2163 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route", 2163 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route",
2164 .info = snd_vt1724_pro_route_info, 2164 .info = snd_vt1724_pro_route_info,
@@ -2194,7 +2194,7 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol,
2194 return 0; 2194 return 0;
2195} 2195}
2196 2196
2197static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = { 2197static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak = {
2198 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2198 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2199 .name = "Multi Track Peak", 2199 .name = "Multi Track Peak",
2200 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 2200 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -2206,13 +2206,13 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = {
2206 * 2206 *
2207 */ 2207 */
2208 2208
2209static struct snd_ice1712_card_info no_matched __devinitdata; 2209static struct snd_ice1712_card_info no_matched;
2210 2210
2211 2211
2212/* 2212/*
2213 ooAoo cards with no controls 2213 ooAoo cards with no controls
2214*/ 2214*/
2215static unsigned char ooaoo_sq210_eeprom[] __devinitdata = { 2215static unsigned char ooaoo_sq210_eeprom[] = {
2216 [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC, 2216 [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC,
2217 1xDACs */ 2217 1xDACs */
2218 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 2218 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
@@ -2232,7 +2232,7 @@ static unsigned char ooaoo_sq210_eeprom[] __devinitdata = {
2232}; 2232};
2233 2233
2234 2234
2235struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = { 2235static struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] = {
2236 { 2236 {
2237 .name = "ooAoo SQ210a", 2237 .name = "ooAoo SQ210a",
2238 .model = "sq210a", 2238 .model = "sq210a",
@@ -2242,7 +2242,7 @@ struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = {
2242 { } /* terminator */ 2242 { } /* terminator */
2243}; 2243};
2244 2244
2245static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 2245static struct snd_ice1712_card_info *card_tables[] = {
2246 snd_vt1724_revo_cards, 2246 snd_vt1724_revo_cards,
2247 snd_vt1724_amp_cards, 2247 snd_vt1724_amp_cards,
2248 snd_vt1724_aureon_cards, 2248 snd_vt1724_aureon_cards,
@@ -2257,6 +2257,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
2257 snd_vt1724_se_cards, 2257 snd_vt1724_se_cards,
2258 snd_vt1724_qtet_cards, 2258 snd_vt1724_qtet_cards,
2259 snd_vt1724_ooaoo_cards, 2259 snd_vt1724_ooaoo_cards,
2260 snd_vt1724_psc724_cards,
2260 NULL, 2261 NULL,
2261}; 2262};
2262 2263
@@ -2306,8 +2307,8 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
2306 mutex_unlock(&ice->i2c_mutex); 2307 mutex_unlock(&ice->i2c_mutex);
2307} 2308}
2308 2309
2309static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, 2310static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2310 const char *modelname) 2311 const char *modelname)
2311{ 2312{
2312 const int dev = 0xa0; /* EEPROM device address */ 2313 const int dev = 0xa0; /* EEPROM device address */
2313 unsigned int i, size; 2314 unsigned int i, size;
@@ -2348,6 +2349,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2348 ice->eeprom.subvendor = c->subvendor; 2349 ice->eeprom.subvendor = c->subvendor;
2349 } else if (c->subvendor != ice->eeprom.subvendor) 2350 } else if (c->subvendor != ice->eeprom.subvendor)
2350 continue; 2351 continue;
2352 ice->card_info = c;
2351 if (!c->eeprom_size || !c->eeprom_data) 2353 if (!c->eeprom_size || !c->eeprom_data)
2352 goto found; 2354 goto found;
2353 /* if the EEPROM is given by the driver, use it */ 2355 /* if the EEPROM is given by the driver, use it */
@@ -2360,6 +2362,10 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2360 } 2362 }
2361 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", 2363 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n",
2362 ice->eeprom.subvendor); 2364 ice->eeprom.subvendor);
2365#ifdef CONFIG_PM_SLEEP
2366 /* assume AC97-only card which can suspend without additional code */
2367 ice->pm_suspend_enabled = 1;
2368#endif
2363 2369
2364 found: 2370 found:
2365 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); 2371 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
@@ -2371,7 +2377,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2371 return -EIO; 2377 return -EIO;
2372 } 2378 }
2373 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); 2379 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
2374 if (ice->eeprom.version != 2) 2380 if (ice->eeprom.version != 1 && ice->eeprom.version != 2)
2375 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", 2381 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n",
2376 ice->eeprom.version); 2382 ice->eeprom.version);
2377 size = ice->eeprom.size - 6; 2383 size = ice->eeprom.size - 6;
@@ -2424,7 +2430,7 @@ static int snd_vt1724_chip_init(struct snd_ice1712 *ice)
2424 return 0; 2430 return 0;
2425} 2431}
2426 2432
2427static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice) 2433static int snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
2428{ 2434{
2429 int err; 2435 int err;
2430 struct snd_kcontrol *kctl; 2436 struct snd_kcontrol *kctl;
@@ -2466,7 +2472,7 @@ static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
2466} 2472}
2467 2473
2468 2474
2469static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice) 2475static int snd_vt1724_build_controls(struct snd_ice1712 *ice)
2470{ 2476{
2471 int err; 2477 int err;
2472 2478
@@ -2526,10 +2532,10 @@ static int snd_vt1724_dev_free(struct snd_device *device)
2526 return snd_vt1724_free(ice); 2532 return snd_vt1724_free(ice);
2527} 2533}
2528 2534
2529static int __devinit snd_vt1724_create(struct snd_card *card, 2535static int snd_vt1724_create(struct snd_card *card,
2530 struct pci_dev *pci, 2536 struct pci_dev *pci,
2531 const char *modelname, 2537 const char *modelname,
2532 struct snd_ice1712 **r_ice1712) 2538 struct snd_ice1712 **r_ice1712)
2533{ 2539{
2534 struct snd_ice1712 *ice; 2540 struct snd_ice1712 *ice;
2535 int err; 2541 int err;
@@ -2616,8 +2622,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
2616 * 2622 *
2617 */ 2623 */
2618 2624
2619static int __devinit snd_vt1724_probe(struct pci_dev *pci, 2625static int snd_vt1724_probe(struct pci_dev *pci,
2620 const struct pci_device_id *pci_id) 2626 const struct pci_device_id *pci_id)
2621{ 2627{
2622 static int dev; 2628 static int dev;
2623 struct snd_card *card; 2629 struct snd_card *card;
@@ -2786,9 +2792,14 @@ __found:
2786 return 0; 2792 return 0;
2787} 2793}
2788 2794
2789static void __devexit snd_vt1724_remove(struct pci_dev *pci) 2795static void snd_vt1724_remove(struct pci_dev *pci)
2790{ 2796{
2791 snd_card_free(pci_get_drvdata(pci)); 2797 struct snd_card *card = pci_get_drvdata(pci);
2798 struct snd_ice1712 *ice = card->private_data;
2799
2800 if (ice->card_info && ice->card_info->chip_exit)
2801 ice->card_info->chip_exit(ice);
2802 snd_card_free(card);
2792 pci_set_drvdata(pci, NULL); 2803 pci_set_drvdata(pci, NULL);
2793} 2804}
2794 2805
@@ -2889,7 +2900,7 @@ static struct pci_driver vt1724_driver = {
2889 .name = KBUILD_MODNAME, 2900 .name = KBUILD_MODNAME,
2890 .id_table = snd_vt1724_ids, 2901 .id_table = snd_vt1724_ids,
2891 .probe = snd_vt1724_probe, 2902 .probe = snd_vt1724_probe,
2892 .remove = __devexit_p(snd_vt1724_remove), 2903 .remove = snd_vt1724_remove,
2893 .driver = { 2904 .driver = {
2894 .pm = SND_VT1724_PM_OPS, 2905 .pm = SND_VT1724_PM_OPS,
2895 }, 2906 },