diff options
author | Wai Yew CHAY <wychay@ctl.creative.com> | 2009-05-14 02:05:58 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-14 02:24:10 -0400 |
commit | 8cc72361481f00253f1e468ade5795427386d593 (patch) | |
tree | ec6f3ea304f90fa9c99abb1bf2354fc5d357db27 /sound/pci/ctxfi/xfi.c | |
parent | 091bf7624d1c90cec9e578a18529f615213ff847 (diff) |
ALSA: SB X-Fi driver merge
The Sound Blaster X-Fi driver supports Creative solutions based on
20K1 and 20K2 chipsets.
Supported hardware :
Creative Sound Blaster X-Fi Titanium Fatal1ty® Champion Series
Creative Sound Blaster X-Fi Titanium Fatal1ty Professional Series
Creative Sound Blaster X-Fi Titanium Professional Audio
Creative Sound Blaster X-Fi Titanium
Creative Sound Blaster X-Fi Elite Pro
Creative Sound Blaster X-Fi Platinum
Creative Sound Blaster X-Fi Fatal1ty
Creative Sound Blaster X-Fi XtremeGamer
Creative Sound Blaster X-Fi XtremeMusic
Current release features:
* ALSA PCM Playback
* ALSA Record
* ALSA Mixer
Note:
* External I/O modules detection not included.
Signed-off-by: Wai Yew CHAY <wychay@ctl.creative.com>
Singed-off-by: Ryan RICHARDS <ryan_richards@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ctxfi/xfi.c')
-rw-r--r-- | sound/pci/ctxfi/xfi.c | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c new file mode 100644 index 000000000000..f91144036512 --- /dev/null +++ b/sound/pci/ctxfi/xfi.c | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * xfi linux driver. | ||
3 | * | ||
4 | * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved. | ||
5 | * | ||
6 | * This source file is released under GPL v2 license (no other versions). | ||
7 | * See the COPYING file included in the main directory of this source | ||
8 | * distribution for the license terms and conditions. | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/pci.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <sound/core.h> | ||
15 | #include <sound/initval.h> | ||
16 | #include "ctatc.h" | ||
17 | #include "ctdrv.h" | ||
18 | |||
19 | MODULE_AUTHOR("Creative Technology Ltd"); | ||
20 | MODULE_DESCRIPTION("X-Fi driver version 1.03"); | ||
21 | MODULE_LICENSE("GPLv2"); | ||
22 | MODULE_SUPPORTED_DEVICE("{{Creative Labs, Sound Blaster X-Fi}"); | ||
23 | |||
24 | static unsigned int reference_rate = 48000; | ||
25 | static unsigned int multiple = 2; | ||
26 | module_param(reference_rate, uint, S_IRUGO); | ||
27 | module_param(multiple, uint, S_IRUGO); | ||
28 | |||
29 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | ||
30 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | ||
31 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | ||
32 | |||
33 | static struct pci_device_id ct_pci_dev_ids[] = { | ||
34 | /* only X-Fi is supported, so... */ | ||
35 | { PCI_DEVICE(PCI_VENDOR_CREATIVE, PCI_DEVICE_CREATIVE_20K1) }, | ||
36 | { PCI_DEVICE(PCI_VENDOR_CREATIVE, PCI_DEVICE_CREATIVE_20K2) }, | ||
37 | { 0, } | ||
38 | }; | ||
39 | MODULE_DEVICE_TABLE(pci, ct_pci_dev_ids); | ||
40 | |||
41 | static int __devinit | ||
42 | ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | ||
43 | { | ||
44 | static int dev; | ||
45 | struct snd_card *card; | ||
46 | struct ct_atc *atc; | ||
47 | int err; | ||
48 | |||
49 | if (dev >= SNDRV_CARDS) | ||
50 | return -ENODEV; | ||
51 | |||
52 | if (!enable[dev]) { | ||
53 | dev++; | ||
54 | return -ENOENT; | ||
55 | } | ||
56 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | ||
57 | if (err) | ||
58 | return err; | ||
59 | if ((reference_rate != 48000) && (reference_rate != 44100)) { | ||
60 | printk(KERN_ERR "Invalid reference_rate value %u!!!\n" | ||
61 | "The valid values for reference_rate " | ||
62 | "are 48000 and 44100.\nValue 48000 is " | ||
63 | "assumed.\n", reference_rate); | ||
64 | reference_rate = 48000; | ||
65 | } | ||
66 | if ((multiple != 1) && (multiple != 2)) { | ||
67 | printk(KERN_ERR "Invalid multiple value %u!!!\nThe valid " | ||
68 | "values for multiple are 1 and 2.\nValue 2 " | ||
69 | "is assumed.\n", multiple); | ||
70 | multiple = 2; | ||
71 | } | ||
72 | err = ct_atc_create(card, pci, reference_rate, multiple, &atc); | ||
73 | if (err < 0) | ||
74 | goto error; | ||
75 | |||
76 | card->private_data = atc; | ||
77 | |||
78 | /* Create alsa devices supported by this card */ | ||
79 | err = atc->create_alsa_devs(atc); | ||
80 | if (err < 0) | ||
81 | goto error; | ||
82 | |||
83 | strcpy(card->driver, "SB-XFi"); | ||
84 | strcpy(card->shortname, "Creative X-Fi"); | ||
85 | strcpy(card->longname, "Creative ALSA Driver X-Fi"); | ||
86 | |||
87 | err = snd_card_register(card); | ||
88 | if (err < 0) | ||
89 | goto error; | ||
90 | |||
91 | pci_set_drvdata(pci, card); | ||
92 | dev++; | ||
93 | |||
94 | return 0; | ||
95 | |||
96 | error: | ||
97 | snd_card_free(card); | ||
98 | return err; | ||
99 | } | ||
100 | |||
101 | static void __devexit ct_card_remove(struct pci_dev *pci) | ||
102 | { | ||
103 | snd_card_free(pci_get_drvdata(pci)); | ||
104 | pci_set_drvdata(pci, NULL); | ||
105 | } | ||
106 | |||
107 | static struct pci_driver ct_driver = { | ||
108 | .name = "SB-XFi", | ||
109 | .id_table = ct_pci_dev_ids, | ||
110 | .probe = ct_card_probe, | ||
111 | .remove = __devexit_p(ct_card_remove), | ||
112 | }; | ||
113 | |||
114 | static int __init ct_card_init(void) | ||
115 | { | ||
116 | return pci_register_driver(&ct_driver); | ||
117 | } | ||
118 | |||
119 | static void __exit ct_card_exit(void) | ||
120 | { | ||
121 | pci_unregister_driver(&ct_driver); | ||
122 | } | ||
123 | |||
124 | module_init(ct_card_init) | ||
125 | module_exit(ct_card_exit) | ||