diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-11-24 08:06:08 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-04 09:25:03 -0500 |
commit | 5da95273c2e63c9607652b5e8dd39808b6992d7c (patch) | |
tree | f4f7b0c7af29c29524ea93855552d326a0cc58ff /sound/pci/ca0106/ca0106_main.c | |
parent | 9bf1a2445f3c569098b8de7097ca324e65abecc2 (diff) |
ALSA: ca0106 - Add power-management support
Added the missing PM support for snd-ca0106 driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ca0106/ca0106_main.c')
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 519 |
1 files changed, 306 insertions, 213 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 88fbf285d2b7..cea8a7cdb1d5 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -847,15 +847,18 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, | |||
847 | struct snd_pcm_substream *s; | 847 | struct snd_pcm_substream *s; |
848 | u32 basic = 0; | 848 | u32 basic = 0; |
849 | u32 extended = 0; | 849 | u32 extended = 0; |
850 | int running=0; | 850 | u32 bits; |
851 | int running = 0; | ||
851 | 852 | ||
852 | switch (cmd) { | 853 | switch (cmd) { |
853 | case SNDRV_PCM_TRIGGER_START: | 854 | case SNDRV_PCM_TRIGGER_START: |
854 | running=1; | 855 | case SNDRV_PCM_TRIGGER_RESUME: |
856 | running = 1; | ||
855 | break; | 857 | break; |
856 | case SNDRV_PCM_TRIGGER_STOP: | 858 | case SNDRV_PCM_TRIGGER_STOP: |
859 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
857 | default: | 860 | default: |
858 | running=0; | 861 | running = 0; |
859 | break; | 862 | break; |
860 | } | 863 | } |
861 | snd_pcm_group_for_each_entry(s, substream) { | 864 | snd_pcm_group_for_each_entry(s, substream) { |
@@ -865,22 +868,32 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, | |||
865 | runtime = s->runtime; | 868 | runtime = s->runtime; |
866 | epcm = runtime->private_data; | 869 | epcm = runtime->private_data; |
867 | channel = epcm->channel_id; | 870 | channel = epcm->channel_id; |
868 | //snd_printk("channel=%d\n",channel); | 871 | /* snd_printk("channel=%d\n",channel); */ |
869 | epcm->running = running; | 872 | epcm->running = running; |
870 | basic |= (0x1<<channel); | 873 | basic |= (0x1 << channel); |
871 | extended |= (0x10<<channel); | 874 | extended |= (0x10 << channel); |
872 | snd_pcm_trigger_done(s, substream); | 875 | snd_pcm_trigger_done(s, substream); |
873 | } | 876 | } |
874 | //snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); | 877 | /* snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); */ |
875 | 878 | ||
876 | switch (cmd) { | 879 | switch (cmd) { |
877 | case SNDRV_PCM_TRIGGER_START: | 880 | case SNDRV_PCM_TRIGGER_START: |
878 | snd_ca0106_ptr_write(emu, EXTENDED_INT_MASK, 0, snd_ca0106_ptr_read(emu, EXTENDED_INT_MASK, 0) | (extended)); | 881 | case SNDRV_PCM_TRIGGER_RESUME: |
879 | snd_ca0106_ptr_write(emu, BASIC_INTERRUPT, 0, snd_ca0106_ptr_read(emu, BASIC_INTERRUPT, 0)|(basic)); | 882 | bits = snd_ca0106_ptr_read(emu, EXTENDED_INT_MASK, 0); |
883 | bits |= extended; | ||
884 | snd_ca0106_ptr_write(emu, EXTENDED_INT_MASK, 0, bits); | ||
885 | bits = snd_ca0106_ptr_read(emu, BASIC_INTERRUPT, 0); | ||
886 | bits |= basic; | ||
887 | snd_ca0106_ptr_write(emu, BASIC_INTERRUPT, 0, bits); | ||
880 | break; | 888 | break; |
881 | case SNDRV_PCM_TRIGGER_STOP: | 889 | case SNDRV_PCM_TRIGGER_STOP: |
882 | snd_ca0106_ptr_write(emu, BASIC_INTERRUPT, 0, snd_ca0106_ptr_read(emu, BASIC_INTERRUPT, 0) & ~(basic)); | 890 | case SNDRV_PCM_TRIGGER_SUSPEND: |
883 | snd_ca0106_ptr_write(emu, EXTENDED_INT_MASK, 0, snd_ca0106_ptr_read(emu, EXTENDED_INT_MASK, 0) & ~(extended)); | 891 | bits = snd_ca0106_ptr_read(emu, BASIC_INTERRUPT, 0); |
892 | bits &= ~basic; | ||
893 | snd_ca0106_ptr_write(emu, BASIC_INTERRUPT, 0, bits); | ||
894 | bits = snd_ca0106_ptr_read(emu, EXTENDED_INT_MASK, 0); | ||
895 | bits &= ~extended; | ||
896 | snd_ca0106_ptr_write(emu, EXTENDED_INT_MASK, 0, bits); | ||
884 | break; | 897 | break; |
885 | default: | 898 | default: |
886 | result = -EINVAL; | 899 | result = -EINVAL; |
@@ -1103,21 +1116,13 @@ static int snd_ca0106_ac97(struct snd_ca0106 *chip) | |||
1103 | return snd_ac97_mixer(pbus, &ac97, &chip->ac97); | 1116 | return snd_ac97_mixer(pbus, &ac97, &chip->ac97); |
1104 | } | 1117 | } |
1105 | 1118 | ||
1119 | static void ca0106_stop_chip(struct snd_ca0106 *chip); | ||
1120 | |||
1106 | static int snd_ca0106_free(struct snd_ca0106 *chip) | 1121 | static int snd_ca0106_free(struct snd_ca0106 *chip) |
1107 | { | 1122 | { |
1108 | if (chip->res_port != NULL) { /* avoid access to already used hardware */ | 1123 | if (chip->res_port != NULL) { |
1109 | // disable interrupts | 1124 | /* avoid access to already used hardware */ |
1110 | snd_ca0106_ptr_write(chip, BASIC_INTERRUPT, 0, 0); | 1125 | ca0106_stop_chip(chip); |
1111 | outl(0, chip->port + INTE); | ||
1112 | snd_ca0106_ptr_write(chip, EXTENDED_INT_MASK, 0, 0); | ||
1113 | udelay(1000); | ||
1114 | // disable audio | ||
1115 | //outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG); | ||
1116 | outl(0, chip->port + HCFG); | ||
1117 | /* FIXME: We need to stop and DMA transfers here. | ||
1118 | * But as I am not sure how yet, we cannot from the dma pages. | ||
1119 | * So we can fix: snd-malloc: Memory leak? pages not freed = 8 | ||
1120 | */ | ||
1121 | } | 1126 | } |
1122 | if (chip->irq >= 0) | 1127 | if (chip->irq >= 0) |
1123 | free_irq(chip->irq, chip); | 1128 | free_irq(chip->irq, chip); |
@@ -1203,15 +1208,14 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) | |||
1203 | return IRQ_HANDLED; | 1208 | return IRQ_HANDLED; |
1204 | } | 1209 | } |
1205 | 1210 | ||
1206 | static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device, struct snd_pcm **rpcm) | 1211 | static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) |
1207 | { | 1212 | { |
1208 | struct snd_pcm *pcm; | 1213 | struct snd_pcm *pcm; |
1209 | struct snd_pcm_substream *substream; | 1214 | struct snd_pcm_substream *substream; |
1210 | int err; | 1215 | int err; |
1211 | 1216 | ||
1212 | if (rpcm) | 1217 | err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm); |
1213 | *rpcm = NULL; | 1218 | if (err < 0) |
1214 | if ((err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm)) < 0) | ||
1215 | return err; | 1219 | return err; |
1216 | 1220 | ||
1217 | pcm->private_data = emu; | 1221 | pcm->private_data = emu; |
@@ -1238,7 +1242,6 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device, struct s | |||
1238 | pcm->info_flags = 0; | 1242 | pcm->info_flags = 0; |
1239 | pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; | 1243 | pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; |
1240 | strcpy(pcm->name, "CA0106"); | 1244 | strcpy(pcm->name, "CA0106"); |
1241 | emu->pcm = pcm; | ||
1242 | 1245 | ||
1243 | for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 1246 | for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
1244 | substream; | 1247 | substream; |
@@ -1260,8 +1263,7 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device, struct s | |||
1260 | return err; | 1263 | return err; |
1261 | } | 1264 | } |
1262 | 1265 | ||
1263 | if (rpcm) | 1266 | emu->pcm[device] = pcm; |
1264 | *rpcm = pcm; | ||
1265 | 1267 | ||
1266 | return 0; | 1268 | return 0; |
1267 | } | 1269 | } |
@@ -1301,89 +1303,9 @@ static unsigned int i2c_adc_init[][2] = { | |||
1301 | { 0x15, ADC_MUX_LINEIN }, /* ADC Mixer control */ | 1303 | { 0x15, ADC_MUX_LINEIN }, /* ADC Mixer control */ |
1302 | }; | 1304 | }; |
1303 | 1305 | ||
1304 | static int __devinit snd_ca0106_create(int dev, struct snd_card *card, | 1306 | static void ca0106_init_chip(struct snd_ca0106 *chip) |
1305 | struct pci_dev *pci, | ||
1306 | struct snd_ca0106 **rchip) | ||
1307 | { | 1307 | { |
1308 | struct snd_ca0106 *chip; | ||
1309 | struct snd_ca0106_details *c; | ||
1310 | int err; | ||
1311 | int ch; | 1308 | int ch; |
1312 | static struct snd_device_ops ops = { | ||
1313 | .dev_free = snd_ca0106_dev_free, | ||
1314 | }; | ||
1315 | |||
1316 | *rchip = NULL; | ||
1317 | |||
1318 | if ((err = pci_enable_device(pci)) < 0) | ||
1319 | return err; | ||
1320 | if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 || | ||
1321 | pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) { | ||
1322 | printk(KERN_ERR "error to set 32bit mask DMA\n"); | ||
1323 | pci_disable_device(pci); | ||
1324 | return -ENXIO; | ||
1325 | } | ||
1326 | |||
1327 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
1328 | if (chip == NULL) { | ||
1329 | pci_disable_device(pci); | ||
1330 | return -ENOMEM; | ||
1331 | } | ||
1332 | |||
1333 | chip->card = card; | ||
1334 | chip->pci = pci; | ||
1335 | chip->irq = -1; | ||
1336 | |||
1337 | spin_lock_init(&chip->emu_lock); | ||
1338 | |||
1339 | chip->port = pci_resource_start(pci, 0); | ||
1340 | if ((chip->res_port = request_region(chip->port, 0x20, | ||
1341 | "snd_ca0106")) == NULL) { | ||
1342 | snd_ca0106_free(chip); | ||
1343 | printk(KERN_ERR "cannot allocate the port\n"); | ||
1344 | return -EBUSY; | ||
1345 | } | ||
1346 | |||
1347 | if (request_irq(pci->irq, snd_ca0106_interrupt, | ||
1348 | IRQF_SHARED, "snd_ca0106", chip)) { | ||
1349 | snd_ca0106_free(chip); | ||
1350 | printk(KERN_ERR "cannot grab irq\n"); | ||
1351 | return -EBUSY; | ||
1352 | } | ||
1353 | chip->irq = pci->irq; | ||
1354 | |||
1355 | /* This stores the periods table. */ | ||
1356 | if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 1024, &chip->buffer) < 0) { | ||
1357 | snd_ca0106_free(chip); | ||
1358 | return -ENOMEM; | ||
1359 | } | ||
1360 | |||
1361 | pci_set_master(pci); | ||
1362 | /* read serial */ | ||
1363 | pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); | ||
1364 | pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); | ||
1365 | #if 1 | ||
1366 | printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model, | ||
1367 | pci->revision, chip->serial); | ||
1368 | #endif | ||
1369 | strcpy(card->driver, "CA0106"); | ||
1370 | strcpy(card->shortname, "CA0106"); | ||
1371 | |||
1372 | for (c = ca0106_chip_details; c->serial; c++) { | ||
1373 | if (subsystem[dev]) { | ||
1374 | if (c->serial == subsystem[dev]) | ||
1375 | break; | ||
1376 | } else if (c->serial == chip->serial) | ||
1377 | break; | ||
1378 | } | ||
1379 | chip->details = c; | ||
1380 | if (subsystem[dev]) { | ||
1381 | printk(KERN_INFO "snd-ca0106: Sound card name=%s, subsystem=0x%x. Forced to subsystem=0x%x\n", | ||
1382 | c->name, chip->serial, subsystem[dev]); | ||
1383 | } | ||
1384 | |||
1385 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
1386 | c->name, chip->port, chip->irq); | ||
1387 | 1309 | ||
1388 | outl(0, chip->port + INTE); | 1310 | outl(0, chip->port + INTE); |
1389 | 1311 | ||
@@ -1401,31 +1323,31 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card, | |||
1401 | * AN = 0 (Audio data) | 1323 | * AN = 0 (Audio data) |
1402 | * P = 0 (Consumer) | 1324 | * P = 0 (Consumer) |
1403 | */ | 1325 | */ |
1404 | snd_ca0106_ptr_write(chip, SPCS0, 0, | 1326 | chip->spdif_bits[0] = |
1405 | chip->spdif_bits[0] = | 1327 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | |
1406 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | | 1328 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | |
1407 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | | 1329 | SPCS_GENERATIONSTATUS | 0x00001200 | |
1408 | SPCS_GENERATIONSTATUS | 0x00001200 | | 1330 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; |
1409 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); | 1331 | snd_ca0106_ptr_write(chip, SPCS0, 0, chip->spdif_bits[0]); |
1410 | /* Only SPCS1 has been tested */ | 1332 | /* Only SPCS1 has been tested */ |
1411 | snd_ca0106_ptr_write(chip, SPCS1, 0, | 1333 | chip->spdif_bits[1] = |
1412 | chip->spdif_bits[1] = | 1334 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | |
1413 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | | 1335 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | |
1414 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | | 1336 | SPCS_GENERATIONSTATUS | 0x00001200 | |
1415 | SPCS_GENERATIONSTATUS | 0x00001200 | | 1337 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; |
1416 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); | 1338 | snd_ca0106_ptr_write(chip, SPCS1, 0, chip->spdif_bits[1]); |
1417 | snd_ca0106_ptr_write(chip, SPCS2, 0, | 1339 | chip->spdif_bits[2] = |
1418 | chip->spdif_bits[2] = | 1340 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | |
1419 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | | 1341 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | |
1420 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | | 1342 | SPCS_GENERATIONSTATUS | 0x00001200 | |
1421 | SPCS_GENERATIONSTATUS | 0x00001200 | | 1343 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; |
1422 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); | 1344 | snd_ca0106_ptr_write(chip, SPCS2, 0, chip->spdif_bits[2]); |
1423 | snd_ca0106_ptr_write(chip, SPCS3, 0, | 1345 | chip->spdif_bits[3] = |
1424 | chip->spdif_bits[3] = | 1346 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | |
1425 | SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | | 1347 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | |
1426 | SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | | 1348 | SPCS_GENERATIONSTATUS | 0x00001200 | |
1427 | SPCS_GENERATIONSTATUS | 0x00001200 | | 1349 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; |
1428 | 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT); | 1350 | snd_ca0106_ptr_write(chip, SPCS3, 0, chip->spdif_bits[3]); |
1429 | 1351 | ||
1430 | snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000); | 1352 | snd_ca0106_ptr_write(chip, PLAYBACK_MUTE, 0, 0x00fc0000); |
1431 | snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000); | 1353 | snd_ca0106_ptr_write(chip, CAPTURE_MUTE, 0, 0x00fc0000); |
@@ -1433,36 +1355,53 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card, | |||
1433 | /* Write 0x8000 to AC97_REC_GAIN to mute it. */ | 1355 | /* Write 0x8000 to AC97_REC_GAIN to mute it. */ |
1434 | outb(AC97_REC_GAIN, chip->port + AC97ADDRESS); | 1356 | outb(AC97_REC_GAIN, chip->port + AC97ADDRESS); |
1435 | outw(0x8000, chip->port + AC97DATA); | 1357 | outw(0x8000, chip->port + AC97DATA); |
1436 | #if 0 | 1358 | #if 0 /* FIXME: what are these? */ |
1437 | snd_ca0106_ptr_write(chip, SPCS0, 0, 0x2108006); | 1359 | snd_ca0106_ptr_write(chip, SPCS0, 0, 0x2108006); |
1438 | snd_ca0106_ptr_write(chip, 0x42, 0, 0x2108006); | 1360 | snd_ca0106_ptr_write(chip, 0x42, 0, 0x2108006); |
1439 | snd_ca0106_ptr_write(chip, 0x43, 0, 0x2108006); | 1361 | snd_ca0106_ptr_write(chip, 0x43, 0, 0x2108006); |
1440 | snd_ca0106_ptr_write(chip, 0x44, 0, 0x2108006); | 1362 | snd_ca0106_ptr_write(chip, 0x44, 0, 0x2108006); |
1441 | #endif | 1363 | #endif |
1442 | 1364 | ||
1443 | //snd_ca0106_ptr_write(chip, SPDIF_SELECT2, 0, 0xf0f003f); /* OSS drivers set this. */ | 1365 | /* OSS drivers set this. */ |
1366 | /* snd_ca0106_ptr_write(chip, SPDIF_SELECT2, 0, 0xf0f003f); */ | ||
1367 | |||
1444 | /* Analog or Digital output */ | 1368 | /* Analog or Digital output */ |
1445 | snd_ca0106_ptr_write(chip, SPDIF_SELECT1, 0, 0xf); | 1369 | snd_ca0106_ptr_write(chip, SPDIF_SELECT1, 0, 0xf); |
1446 | snd_ca0106_ptr_write(chip, SPDIF_SELECT2, 0, 0x000f0000); /* 0x0b000000 for digital, 0x000b0000 for analog, from win2000 drivers. Use 0x000f0000 for surround71 */ | 1370 | /* 0x0b000000 for digital, 0x000b0000 for analog, from win2000 drivers. |
1371 | * Use 0x000f0000 for surround71 | ||
1372 | */ | ||
1373 | snd_ca0106_ptr_write(chip, SPDIF_SELECT2, 0, 0x000f0000); | ||
1374 | |||
1447 | chip->spdif_enable = 0; /* Set digital SPDIF output off */ | 1375 | chip->spdif_enable = 0; /* Set digital SPDIF output off */ |
1448 | //snd_ca0106_ptr_write(chip, 0x45, 0, 0); /* Analogue out */ | 1376 | /*snd_ca0106_ptr_write(chip, 0x45, 0, 0);*/ /* Analogue out */ |
1449 | //snd_ca0106_ptr_write(chip, 0x45, 0, 0xf00); /* Digital out */ | 1377 | /*snd_ca0106_ptr_write(chip, 0x45, 0, 0xf00);*/ /* Digital out */ |
1378 | |||
1379 | /* goes to 0x40c80000 when doing SPDIF IN/OUT */ | ||
1380 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 0, 0x40c81000); | ||
1381 | /* (Mute) CAPTURE feedback into PLAYBACK volume. | ||
1382 | * Only lower 16 bits matter. | ||
1383 | */ | ||
1384 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 1, 0xffffffff); | ||
1385 | /* SPDIF IN Volume */ | ||
1386 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 2, 0x30300000); | ||
1387 | /* SPDIF IN Volume, 0x70 = (vol & 0x3f) | 0x40 */ | ||
1388 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 3, 0x00700000); | ||
1450 | 1389 | ||
1451 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 0, 0x40c81000); /* goes to 0x40c80000 when doing SPDIF IN/OUT */ | ||
1452 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 1, 0xffffffff); /* (Mute) CAPTURE feedback into PLAYBACK volume. Only lower 16 bits matter. */ | ||
1453 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 2, 0x30300000); /* SPDIF IN Volume */ | ||
1454 | snd_ca0106_ptr_write(chip, CAPTURE_CONTROL, 3, 0x00700000); /* SPDIF IN Volume, 0x70 = (vol & 0x3f) | 0x40 */ | ||
1455 | snd_ca0106_ptr_write(chip, PLAYBACK_ROUTING1, 0, 0x32765410); | 1390 | snd_ca0106_ptr_write(chip, PLAYBACK_ROUTING1, 0, 0x32765410); |
1456 | snd_ca0106_ptr_write(chip, PLAYBACK_ROUTING2, 0, 0x76767676); | 1391 | snd_ca0106_ptr_write(chip, PLAYBACK_ROUTING2, 0, 0x76767676); |
1457 | snd_ca0106_ptr_write(chip, CAPTURE_ROUTING1, 0, 0x32765410); | 1392 | snd_ca0106_ptr_write(chip, CAPTURE_ROUTING1, 0, 0x32765410); |
1458 | snd_ca0106_ptr_write(chip, CAPTURE_ROUTING2, 0, 0x76767676); | 1393 | snd_ca0106_ptr_write(chip, CAPTURE_ROUTING2, 0, 0x76767676); |
1459 | for(ch = 0; ch < 4; ch++) { | 1394 | |
1460 | snd_ca0106_ptr_write(chip, CAPTURE_VOLUME1, ch, 0x30303030); /* Only high 16 bits matter */ | 1395 | for (ch = 0; ch < 4; ch++) { |
1396 | /* Only high 16 bits matter */ | ||
1397 | snd_ca0106_ptr_write(chip, CAPTURE_VOLUME1, ch, 0x30303030); | ||
1461 | snd_ca0106_ptr_write(chip, CAPTURE_VOLUME2, ch, 0x30303030); | 1398 | snd_ca0106_ptr_write(chip, CAPTURE_VOLUME2, ch, 0x30303030); |
1462 | //snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME1, ch, 0x40404040); /* Mute */ | 1399 | #if 0 /* Mute */ |
1463 | //snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME2, ch, 0x40404040); /* Mute */ | 1400 | snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME1, ch, 0x40404040); |
1464 | snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME1, ch, 0xffffffff); /* Mute */ | 1401 | snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME2, ch, 0x40404040); |
1465 | snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME2, ch, 0xffffffff); /* Mute */ | 1402 | snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME1, ch, 0xffffffff); |
1403 | snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME2, ch, 0xffffffff); | ||
1404 | #endif | ||
1466 | } | 1405 | } |
1467 | if (chip->details->i2c_adc == 1) { | 1406 | if (chip->details->i2c_adc == 1) { |
1468 | /* Select MIC, Line in, TAD in, AUX in */ | 1407 | /* Select MIC, Line in, TAD in, AUX in */ |
@@ -1481,44 +1420,56 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card, | |||
1481 | chip->capture_source = 3; | 1420 | chip->capture_source = 3; |
1482 | } | 1421 | } |
1483 | 1422 | ||
1484 | if (chip->details->gpio_type == 2) { /* The SB0438 use GPIO differently. */ | 1423 | if (chip->details->gpio_type == 2) { |
1485 | /* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */ | 1424 | /* The SB0438 use GPIO differently. */ |
1425 | /* FIXME: Still need to find out what the other GPIO bits do. | ||
1426 | * E.g. For digital spdif out. | ||
1427 | */ | ||
1486 | outl(0x0, chip->port+GPIO); | 1428 | outl(0x0, chip->port+GPIO); |
1487 | //outl(0x00f0e000, chip->port+GPIO); /* Analog */ | 1429 | /* outl(0x00f0e000, chip->port+GPIO); */ /* Analog */ |
1488 | outl(0x005f5301, chip->port+GPIO); /* Analog */ | 1430 | outl(0x005f5301, chip->port+GPIO); /* Analog */ |
1489 | } else if (chip->details->gpio_type == 1) { /* The SB0410 and SB0413 use GPIO differently. */ | 1431 | } else if (chip->details->gpio_type == 1) { |
1490 | /* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */ | 1432 | /* The SB0410 and SB0413 use GPIO differently. */ |
1433 | /* FIXME: Still need to find out what the other GPIO bits do. | ||
1434 | * E.g. For digital spdif out. | ||
1435 | */ | ||
1491 | outl(0x0, chip->port+GPIO); | 1436 | outl(0x0, chip->port+GPIO); |
1492 | //outl(0x00f0e000, chip->port+GPIO); /* Analog */ | 1437 | /* outl(0x00f0e000, chip->port+GPIO); */ /* Analog */ |
1493 | outl(0x005f5301, chip->port+GPIO); /* Analog */ | 1438 | outl(0x005f5301, chip->port+GPIO); /* Analog */ |
1494 | } else { | 1439 | } else { |
1495 | outl(0x0, chip->port+GPIO); | 1440 | outl(0x0, chip->port+GPIO); |
1496 | outl(0x005f03a3, chip->port+GPIO); /* Analog */ | 1441 | outl(0x005f03a3, chip->port+GPIO); /* Analog */ |
1497 | //outl(0x005f02a2, chip->port+GPIO); /* SPDIF */ | 1442 | /* outl(0x005f02a2, chip->port+GPIO); */ /* SPDIF */ |
1498 | } | 1443 | } |
1499 | snd_ca0106_intr_enable(chip, 0x105); /* Win2000 uses 0x1e0 */ | 1444 | snd_ca0106_intr_enable(chip, 0x105); /* Win2000 uses 0x1e0 */ |
1500 | 1445 | ||
1501 | //outl(HCFG_LOCKSOUNDCACHE|HCFG_AUDIOENABLE, chip->port+HCFG); | 1446 | /* outl(HCFG_LOCKSOUNDCACHE|HCFG_AUDIOENABLE, chip->port+HCFG); */ |
1502 | //outl(0x00001409, chip->port+HCFG); /* 0x1000 causes AC3 to fails. Maybe it effects 24 bit output. */ | 1447 | /* 0x1000 causes AC3 to fails. Maybe it effects 24 bit output. */ |
1503 | //outl(0x00000009, chip->port+HCFG); | 1448 | /* outl(0x00001409, chip->port+HCFG); */ |
1504 | outl(HCFG_AC97 | HCFG_AUDIOENABLE, chip->port+HCFG); /* AC97 2.0, Enable outputs. */ | 1449 | /* outl(0x00000009, chip->port+HCFG); */ |
1450 | /* AC97 2.0, Enable outputs. */ | ||
1451 | outl(HCFG_AC97 | HCFG_AUDIOENABLE, chip->port+HCFG); | ||
1505 | 1452 | ||
1506 | if (chip->details->i2c_adc == 1) { /* The SB0410 and SB0413 use I2C to control ADC. */ | 1453 | if (chip->details->i2c_adc == 1) { |
1454 | /* The SB0410 and SB0413 use I2C to control ADC. */ | ||
1507 | int size, n; | 1455 | int size, n; |
1508 | 1456 | ||
1509 | size = ARRAY_SIZE(i2c_adc_init); | 1457 | size = ARRAY_SIZE(i2c_adc_init); |
1510 | //snd_printk("I2C:array size=0x%x\n", size); | 1458 | /* snd_printk("I2C:array size=0x%x\n", size); */ |
1511 | for (n=0; n < size; n++) { | 1459 | for (n = 0; n < size; n++) |
1512 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], i2c_adc_init[n][1]); | 1460 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], |
1513 | } | 1461 | i2c_adc_init[n][1]); |
1514 | for (n=0; n < 4; n++) { | 1462 | for (n = 0; n < 4; n++) { |
1515 | chip->i2c_capture_volume[n][0]= 0xcf; | 1463 | chip->i2c_capture_volume[n][0] = 0xcf; |
1516 | chip->i2c_capture_volume[n][1]= 0xcf; | 1464 | chip->i2c_capture_volume[n][1] = 0xcf; |
1517 | } | 1465 | } |
1518 | chip->i2c_capture_source=2; /* Line in */ | 1466 | chip->i2c_capture_source = 2; /* Line in */ |
1519 | //snd_ca0106_i2c_write(chip, ADC_MUX, ADC_MUX_LINEIN); /* Enable Line-in capture. MIC in currently untested. */ | 1467 | /* Enable Line-in capture. MIC in currently untested. */ |
1468 | /* snd_ca0106_i2c_write(chip, ADC_MUX, ADC_MUX_LINEIN); */ | ||
1520 | } | 1469 | } |
1521 | if (chip->details->spi_dac == 1) { /* The SB0570 use SPI to control DAC. */ | 1470 | |
1471 | if (chip->details->spi_dac == 1) { | ||
1472 | /* The SB0570 use SPI to control DAC. */ | ||
1522 | int size, n; | 1473 | int size, n; |
1523 | 1474 | ||
1524 | size = ARRAY_SIZE(spi_dac_init); | 1475 | size = ARRAY_SIZE(spi_dac_init); |
@@ -1530,9 +1481,112 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card, | |||
1530 | chip->spi_dac_reg[reg] = spi_dac_init[n]; | 1481 | chip->spi_dac_reg[reg] = spi_dac_init[n]; |
1531 | } | 1482 | } |
1532 | } | 1483 | } |
1484 | } | ||
1485 | |||
1486 | static void ca0106_stop_chip(struct snd_ca0106 *chip) | ||
1487 | { | ||
1488 | /* disable interrupts */ | ||
1489 | snd_ca0106_ptr_write(chip, BASIC_INTERRUPT, 0, 0); | ||
1490 | outl(0, chip->port + INTE); | ||
1491 | snd_ca0106_ptr_write(chip, EXTENDED_INT_MASK, 0, 0); | ||
1492 | udelay(1000); | ||
1493 | /* disable audio */ | ||
1494 | /* outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG); */ | ||
1495 | outl(0, chip->port + HCFG); | ||
1496 | /* FIXME: We need to stop and DMA transfers here. | ||
1497 | * But as I am not sure how yet, we cannot from the dma pages. | ||
1498 | * So we can fix: snd-malloc: Memory leak? pages not freed = 8 | ||
1499 | */ | ||
1500 | } | ||
1533 | 1501 | ||
1534 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, | 1502 | static int __devinit snd_ca0106_create(int dev, struct snd_card *card, |
1535 | chip, &ops)) < 0) { | 1503 | struct pci_dev *pci, |
1504 | struct snd_ca0106 **rchip) | ||
1505 | { | ||
1506 | struct snd_ca0106 *chip; | ||
1507 | struct snd_ca0106_details *c; | ||
1508 | int err; | ||
1509 | static struct snd_device_ops ops = { | ||
1510 | .dev_free = snd_ca0106_dev_free, | ||
1511 | }; | ||
1512 | |||
1513 | *rchip = NULL; | ||
1514 | |||
1515 | err = pci_enable_device(pci); | ||
1516 | if (err < 0) | ||
1517 | return err; | ||
1518 | if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 || | ||
1519 | pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) { | ||
1520 | printk(KERN_ERR "error to set 32bit mask DMA\n"); | ||
1521 | pci_disable_device(pci); | ||
1522 | return -ENXIO; | ||
1523 | } | ||
1524 | |||
1525 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
1526 | if (chip == NULL) { | ||
1527 | pci_disable_device(pci); | ||
1528 | return -ENOMEM; | ||
1529 | } | ||
1530 | |||
1531 | chip->card = card; | ||
1532 | chip->pci = pci; | ||
1533 | chip->irq = -1; | ||
1534 | |||
1535 | spin_lock_init(&chip->emu_lock); | ||
1536 | |||
1537 | chip->port = pci_resource_start(pci, 0); | ||
1538 | chip->res_port = request_region(chip->port, 0x20, "snd_ca0106"); | ||
1539 | if (!chip->res_port) { | ||
1540 | snd_ca0106_free(chip); | ||
1541 | printk(KERN_ERR "cannot allocate the port\n"); | ||
1542 | return -EBUSY; | ||
1543 | } | ||
1544 | |||
1545 | if (request_irq(pci->irq, snd_ca0106_interrupt, | ||
1546 | IRQF_SHARED, "snd_ca0106", chip)) { | ||
1547 | snd_ca0106_free(chip); | ||
1548 | printk(KERN_ERR "cannot grab irq\n"); | ||
1549 | return -EBUSY; | ||
1550 | } | ||
1551 | chip->irq = pci->irq; | ||
1552 | |||
1553 | /* This stores the periods table. */ | ||
1554 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), | ||
1555 | 1024, &chip->buffer) < 0) { | ||
1556 | snd_ca0106_free(chip); | ||
1557 | return -ENOMEM; | ||
1558 | } | ||
1559 | |||
1560 | pci_set_master(pci); | ||
1561 | /* read serial */ | ||
1562 | pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); | ||
1563 | pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); | ||
1564 | printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", | ||
1565 | chip->model, pci->revision, chip->serial); | ||
1566 | strcpy(card->driver, "CA0106"); | ||
1567 | strcpy(card->shortname, "CA0106"); | ||
1568 | |||
1569 | for (c = ca0106_chip_details; c->serial; c++) { | ||
1570 | if (subsystem[dev]) { | ||
1571 | if (c->serial == subsystem[dev]) | ||
1572 | break; | ||
1573 | } else if (c->serial == chip->serial) | ||
1574 | break; | ||
1575 | } | ||
1576 | chip->details = c; | ||
1577 | if (subsystem[dev]) { | ||
1578 | printk(KERN_INFO "snd-ca0106: Sound card name=%s, " | ||
1579 | "subsystem=0x%x. Forced to subsystem=0x%x\n", | ||
1580 | c->name, chip->serial, subsystem[dev]); | ||
1581 | } | ||
1582 | |||
1583 | sprintf(card->longname, "%s at 0x%lx irq %i", | ||
1584 | c->name, chip->port, chip->irq); | ||
1585 | |||
1586 | ca0106_init_chip(chip); | ||
1587 | |||
1588 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); | ||
1589 | if (err < 0) { | ||
1536 | snd_ca0106_free(chip); | 1590 | snd_ca0106_free(chip); |
1537 | return err; | 1591 | return err; |
1538 | } | 1592 | } |
@@ -1629,7 +1683,7 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1629 | static int dev; | 1683 | static int dev; |
1630 | struct snd_card *card; | 1684 | struct snd_card *card; |
1631 | struct snd_ca0106 *chip; | 1685 | struct snd_ca0106 *chip; |
1632 | int err; | 1686 | int i, err; |
1633 | 1687 | ||
1634 | if (dev >= SNDRV_CARDS) | 1688 | if (dev >= SNDRV_CARDS) |
1635 | return -ENODEV; | 1689 | return -ENODEV; |
@@ -1642,44 +1696,30 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1642 | if (card == NULL) | 1696 | if (card == NULL) |
1643 | return -ENOMEM; | 1697 | return -ENOMEM; |
1644 | 1698 | ||
1645 | if ((err = snd_ca0106_create(dev, card, pci, &chip)) < 0) { | 1699 | err = snd_ca0106_create(dev, card, pci, &chip); |
1646 | snd_card_free(card); | 1700 | if (err < 0) |
1647 | return err; | 1701 | goto error; |
1648 | } | ||
1649 | 1702 | ||
1650 | if ((err = snd_ca0106_pcm(chip, 0, NULL)) < 0) { | 1703 | for (i = 0; i < 4; i++) { |
1651 | snd_card_free(card); | 1704 | err = snd_ca0106_pcm(chip, i); |
1652 | return err; | 1705 | if (err < 0) |
1653 | } | 1706 | goto error; |
1654 | if ((err = snd_ca0106_pcm(chip, 1, NULL)) < 0) { | ||
1655 | snd_card_free(card); | ||
1656 | return err; | ||
1657 | } | ||
1658 | if ((err = snd_ca0106_pcm(chip, 2, NULL)) < 0) { | ||
1659 | snd_card_free(card); | ||
1660 | return err; | ||
1661 | } | ||
1662 | if ((err = snd_ca0106_pcm(chip, 3, NULL)) < 0) { | ||
1663 | snd_card_free(card); | ||
1664 | return err; | ||
1665 | } | ||
1666 | if (chip->details->ac97 == 1) { /* The SB0410 and SB0413 do not have an AC97 chip. */ | ||
1667 | if ((err = snd_ca0106_ac97(chip)) < 0) { | ||
1668 | snd_card_free(card); | ||
1669 | return err; | ||
1670 | } | ||
1671 | } | 1707 | } |
1672 | if ((err = snd_ca0106_mixer(chip)) < 0) { | 1708 | |
1673 | snd_card_free(card); | 1709 | if (chip->details->ac97 == 1) { |
1674 | return err; | 1710 | /* The SB0410 and SB0413 do not have an AC97 chip. */ |
1711 | err = snd_ca0106_ac97(chip); | ||
1712 | if (err < 0) | ||
1713 | goto error; | ||
1675 | } | 1714 | } |
1715 | err = snd_ca0106_mixer(chip); | ||
1716 | if (err < 0) | ||
1717 | goto error; | ||
1676 | 1718 | ||
1677 | snd_printdd("ca0106: probe for MIDI channel A ..."); | 1719 | snd_printdd("ca0106: probe for MIDI channel A ..."); |
1678 | if ((err = snd_ca0106_midi(chip,CA0106_MIDI_CHAN_A)) < 0) { | 1720 | err = snd_ca0106_midi(chip, CA0106_MIDI_CHAN_A); |
1679 | snd_card_free(card); | 1721 | if (err < 0) |
1680 | snd_printdd(" failed, err=0x%x\n",err); | 1722 | goto error; |
1681 | return err; | ||
1682 | } | ||
1683 | snd_printdd(" done.\n"); | 1723 | snd_printdd(" done.\n"); |
1684 | 1724 | ||
1685 | #ifdef CONFIG_PROC_FS | 1725 | #ifdef CONFIG_PROC_FS |
@@ -1688,14 +1728,17 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1688 | 1728 | ||
1689 | snd_card_set_dev(card, &pci->dev); | 1729 | snd_card_set_dev(card, &pci->dev); |
1690 | 1730 | ||
1691 | if ((err = snd_card_register(card)) < 0) { | 1731 | err = snd_card_register(card); |
1692 | snd_card_free(card); | 1732 | if (err < 0) |
1693 | return err; | 1733 | goto error; |
1694 | } | ||
1695 | 1734 | ||
1696 | pci_set_drvdata(pci, card); | 1735 | pci_set_drvdata(pci, card); |
1697 | dev++; | 1736 | dev++; |
1698 | return 0; | 1737 | return 0; |
1738 | |||
1739 | error: | ||
1740 | snd_card_free(card); | ||
1741 | return err; | ||
1699 | } | 1742 | } |
1700 | 1743 | ||
1701 | static void __devexit snd_ca0106_remove(struct pci_dev *pci) | 1744 | static void __devexit snd_ca0106_remove(struct pci_dev *pci) |
@@ -1704,6 +1747,52 @@ static void __devexit snd_ca0106_remove(struct pci_dev *pci) | |||
1704 | pci_set_drvdata(pci, NULL); | 1747 | pci_set_drvdata(pci, NULL); |
1705 | } | 1748 | } |
1706 | 1749 | ||
1750 | #ifdef CONFIG_PM | ||
1751 | static int snd_ca0106_suspend(struct pci_dev *pci, pm_message_t state) | ||
1752 | { | ||
1753 | struct snd_card *card = pci_get_drvdata(pci); | ||
1754 | struct snd_ca0106 *chip = card->private_data; | ||
1755 | int i; | ||
1756 | |||
1757 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | ||
1758 | for (i = 0; i < 4; i++) | ||
1759 | snd_pcm_suspend_all(chip->pcm[i]); | ||
1760 | snd_ac97_suspend(chip->ac97); | ||
1761 | snd_ca0106_mixer_suspend(chip); | ||
1762 | |||
1763 | ca0106_stop_chip(chip); | ||
1764 | |||
1765 | pci_disable_device(pci); | ||
1766 | pci_save_state(pci); | ||
1767 | pci_set_power_state(pci, pci_choose_state(pci, state)); | ||
1768 | return 0; | ||
1769 | } | ||
1770 | |||
1771 | static int snd_ca0106_resume(struct pci_dev *pci) | ||
1772 | { | ||
1773 | struct snd_card *card = pci_get_drvdata(pci); | ||
1774 | struct snd_ca0106 *chip = card->private_data; | ||
1775 | int i; | ||
1776 | |||
1777 | pci_set_power_state(pci, PCI_D0); | ||
1778 | pci_restore_state(pci); | ||
1779 | pci_enable_device(pci); | ||
1780 | pci_set_master(pci); | ||
1781 | |||
1782 | ca0106_init_chip(chip); | ||
1783 | |||
1784 | snd_ac97_resume(chip->ac97); | ||
1785 | snd_ca0106_mixer_resume(chip); | ||
1786 | if (chip->details->spi_dac) { | ||
1787 | for (i = 0; i < ARRAY_SIZE(chip->spi_dac_reg); i++) | ||
1788 | snd_ca0106_spi_write(chip, chip->spi_dac_reg[i]); | ||
1789 | } | ||
1790 | |||
1791 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | ||
1792 | return 0; | ||
1793 | } | ||
1794 | #endif | ||
1795 | |||
1707 | // PCI IDs | 1796 | // PCI IDs |
1708 | static struct pci_device_id snd_ca0106_ids[] = { | 1797 | static struct pci_device_id snd_ca0106_ids[] = { |
1709 | { 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Audigy LS or Live 24bit */ | 1798 | { 0x1102, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Audigy LS or Live 24bit */ |
@@ -1717,6 +1806,10 @@ static struct pci_driver driver = { | |||
1717 | .id_table = snd_ca0106_ids, | 1806 | .id_table = snd_ca0106_ids, |
1718 | .probe = snd_ca0106_probe, | 1807 | .probe = snd_ca0106_probe, |
1719 | .remove = __devexit_p(snd_ca0106_remove), | 1808 | .remove = __devexit_p(snd_ca0106_remove), |
1809 | #ifdef CONFIG_PM | ||
1810 | .suspend = snd_ca0106_suspend, | ||
1811 | .resume = snd_ca0106_resume, | ||
1812 | #endif | ||
1720 | }; | 1813 | }; |
1721 | 1814 | ||
1722 | // initialization of the module | 1815 | // initialization of the module |