diff options
100 files changed, 1236 insertions, 923 deletions
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 58ced2346e67..598c22f3b3ac 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -1164,7 +1164,7 @@ | |||
1164 | } | 1164 | } |
1165 | chip->port = pci_resource_start(pci, 0); | 1165 | chip->port = pci_resource_start(pci, 0); |
1166 | if (request_irq(pci->irq, snd_mychip_interrupt, | 1166 | if (request_irq(pci->irq, snd_mychip_interrupt, |
1167 | IRQF_SHARED, "My Chip", chip)) { | 1167 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1168 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | 1168 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); |
1169 | snd_mychip_free(chip); | 1169 | snd_mychip_free(chip); |
1170 | return -EBUSY; | 1170 | return -EBUSY; |
@@ -1197,7 +1197,7 @@ | |||
1197 | 1197 | ||
1198 | /* pci_driver definition */ | 1198 | /* pci_driver definition */ |
1199 | static struct pci_driver driver = { | 1199 | static struct pci_driver driver = { |
1200 | .name = "My Own Chip", | 1200 | .name = KBUILD_MODNAME, |
1201 | .id_table = snd_mychip_ids, | 1201 | .id_table = snd_mychip_ids, |
1202 | .probe = snd_mychip_probe, | 1202 | .probe = snd_mychip_probe, |
1203 | .remove = __devexit_p(snd_mychip_remove), | 1203 | .remove = __devexit_p(snd_mychip_remove), |
@@ -1340,7 +1340,7 @@ | |||
1340 | <programlisting> | 1340 | <programlisting> |
1341 | <![CDATA[ | 1341 | <![CDATA[ |
1342 | if (request_irq(pci->irq, snd_mychip_interrupt, | 1342 | if (request_irq(pci->irq, snd_mychip_interrupt, |
1343 | IRQF_SHARED, "My Chip", chip)) { | 1343 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1344 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | 1344 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); |
1345 | snd_mychip_free(chip); | 1345 | snd_mychip_free(chip); |
1346 | return -EBUSY; | 1346 | return -EBUSY; |
@@ -1616,7 +1616,7 @@ | |||
1616 | <programlisting> | 1616 | <programlisting> |
1617 | <![CDATA[ | 1617 | <![CDATA[ |
1618 | static struct pci_driver driver = { | 1618 | static struct pci_driver driver = { |
1619 | .name = "My Own Chip", | 1619 | .name = KBUILD_MODNAME, |
1620 | .id_table = snd_mychip_ids, | 1620 | .id_table = snd_mychip_ids, |
1621 | .probe = snd_mychip_probe, | 1621 | .probe = snd_mychip_probe, |
1622 | .remove = __devexit_p(snd_mychip_remove), | 1622 | .remove = __devexit_p(snd_mychip_remove), |
@@ -5816,7 +5816,7 @@ struct _snd_pcm_runtime { | |||
5816 | <programlisting> | 5816 | <programlisting> |
5817 | <![CDATA[ | 5817 | <![CDATA[ |
5818 | static struct pci_driver driver = { | 5818 | static struct pci_driver driver = { |
5819 | .name = "My Chip", | 5819 | .name = KBUILD_MODNAME, |
5820 | .id_table = snd_my_ids, | 5820 | .id_table = snd_my_ids, |
5821 | .probe = snd_my_probe, | 5821 | .probe = snd_my_probe, |
5822 | .remove = __devexit_p(snd_my_remove), | 5822 | .remove = __devexit_p(snd_my_remove), |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index a311008af5e1..f23f8bf02b04 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1308,6 +1308,7 @@ | |||
1308 | #define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041 | 1308 | #define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041 |
1309 | #define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042 | 1309 | #define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042 |
1310 | #define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043 | 1310 | #define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043 |
1311 | #define PCI_SUBDEVICE_ID_CREATIVE_SB1270 0x0062 | ||
1311 | #define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000 | 1312 | #define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000 |
1312 | 1313 | ||
1313 | #define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ | 1314 | #define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ |
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h index 2480e7d10dcf..6b14359d9fed 100644 --- a/include/sound/rawmidi.h +++ b/include/sound/rawmidi.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/workqueue.h> | ||
30 | 31 | ||
31 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) | 32 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) |
32 | #include "seq_device.h" | 33 | #include "seq_device.h" |
@@ -63,6 +64,7 @@ struct snd_rawmidi_global_ops { | |||
63 | }; | 64 | }; |
64 | 65 | ||
65 | struct snd_rawmidi_runtime { | 66 | struct snd_rawmidi_runtime { |
67 | struct snd_rawmidi_substream *substream; | ||
66 | unsigned int drain: 1, /* drain stage */ | 68 | unsigned int drain: 1, /* drain stage */ |
67 | oss: 1; /* OSS compatible mode */ | 69 | oss: 1; /* OSS compatible mode */ |
68 | /* midi stream buffer */ | 70 | /* midi stream buffer */ |
@@ -79,7 +81,7 @@ struct snd_rawmidi_runtime { | |||
79 | /* event handler (new bytes, input only) */ | 81 | /* event handler (new bytes, input only) */ |
80 | void (*event)(struct snd_rawmidi_substream *substream); | 82 | void (*event)(struct snd_rawmidi_substream *substream); |
81 | /* defers calls to event [input] or ops->trigger [output] */ | 83 | /* defers calls to event [input] or ops->trigger [output] */ |
82 | struct tasklet_struct tasklet; | 84 | struct work_struct event_work; |
83 | /* private data */ | 85 | /* private data */ |
84 | void *private_data; | 86 | void *private_data; |
85 | void (*private_free)(struct snd_rawmidi_substream *substream); | 87 | void (*private_free)(struct snd_rawmidi_substream *substream); |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index cbbed0db9e56..849a0ed95054 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -92,16 +92,12 @@ static inline int snd_rawmidi_ready_append(struct snd_rawmidi_substream *substre | |||
92 | (!substream->append || runtime->avail >= count); | 92 | (!substream->append || runtime->avail >= count); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void snd_rawmidi_input_event_tasklet(unsigned long data) | 95 | static void snd_rawmidi_input_event_work(struct work_struct *work) |
96 | { | 96 | { |
97 | struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *)data; | 97 | struct snd_rawmidi_runtime *runtime = |
98 | substream->runtime->event(substream); | 98 | container_of(work, struct snd_rawmidi_runtime, event_work); |
99 | } | 99 | if (runtime->event) |
100 | 100 | runtime->event(runtime->substream); | |
101 | static void snd_rawmidi_output_trigger_tasklet(unsigned long data) | ||
102 | { | ||
103 | struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *)data; | ||
104 | substream->ops->trigger(substream, 1); | ||
105 | } | 101 | } |
106 | 102 | ||
107 | static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream) | 103 | static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream) |
@@ -110,16 +106,10 @@ static int snd_rawmidi_runtime_create(struct snd_rawmidi_substream *substream) | |||
110 | 106 | ||
111 | if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) | 107 | if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL) |
112 | return -ENOMEM; | 108 | return -ENOMEM; |
109 | runtime->substream = substream; | ||
113 | spin_lock_init(&runtime->lock); | 110 | spin_lock_init(&runtime->lock); |
114 | init_waitqueue_head(&runtime->sleep); | 111 | init_waitqueue_head(&runtime->sleep); |
115 | if (substream->stream == SNDRV_RAWMIDI_STREAM_INPUT) | 112 | INIT_WORK(&runtime->event_work, snd_rawmidi_input_event_work); |
116 | tasklet_init(&runtime->tasklet, | ||
117 | snd_rawmidi_input_event_tasklet, | ||
118 | (unsigned long)substream); | ||
119 | else | ||
120 | tasklet_init(&runtime->tasklet, | ||
121 | snd_rawmidi_output_trigger_tasklet, | ||
122 | (unsigned long)substream); | ||
123 | runtime->event = NULL; | 113 | runtime->event = NULL; |
124 | runtime->buffer_size = PAGE_SIZE; | 114 | runtime->buffer_size = PAGE_SIZE; |
125 | runtime->avail_min = 1; | 115 | runtime->avail_min = 1; |
@@ -150,12 +140,7 @@ static inline void snd_rawmidi_output_trigger(struct snd_rawmidi_substream *subs | |||
150 | { | 140 | { |
151 | if (!substream->opened) | 141 | if (!substream->opened) |
152 | return; | 142 | return; |
153 | if (up) { | 143 | substream->ops->trigger(substream, up); |
154 | tasklet_schedule(&substream->runtime->tasklet); | ||
155 | } else { | ||
156 | tasklet_kill(&substream->runtime->tasklet); | ||
157 | substream->ops->trigger(substream, 0); | ||
158 | } | ||
159 | } | 144 | } |
160 | 145 | ||
161 | static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) | 146 | static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) |
@@ -163,8 +148,8 @@ static void snd_rawmidi_input_trigger(struct snd_rawmidi_substream *substream, i | |||
163 | if (!substream->opened) | 148 | if (!substream->opened) |
164 | return; | 149 | return; |
165 | substream->ops->trigger(substream, up); | 150 | substream->ops->trigger(substream, up); |
166 | if (!up && substream->runtime->event) | 151 | if (!up) |
167 | tasklet_kill(&substream->runtime->tasklet); | 152 | cancel_work_sync(&substream->runtime->event_work); |
168 | } | 153 | } |
169 | 154 | ||
170 | int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream) | 155 | int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream) |
@@ -641,10 +626,10 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, | |||
641 | return -EINVAL; | 626 | return -EINVAL; |
642 | } | 627 | } |
643 | if (params->buffer_size != runtime->buffer_size) { | 628 | if (params->buffer_size != runtime->buffer_size) { |
644 | newbuf = kmalloc(params->buffer_size, GFP_KERNEL); | 629 | newbuf = krealloc(runtime->buffer, params->buffer_size, |
630 | GFP_KERNEL); | ||
645 | if (!newbuf) | 631 | if (!newbuf) |
646 | return -ENOMEM; | 632 | return -ENOMEM; |
647 | kfree(runtime->buffer); | ||
648 | runtime->buffer = newbuf; | 633 | runtime->buffer = newbuf; |
649 | runtime->buffer_size = params->buffer_size; | 634 | runtime->buffer_size = params->buffer_size; |
650 | runtime->avail = runtime->buffer_size; | 635 | runtime->avail = runtime->buffer_size; |
@@ -668,10 +653,10 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, | |||
668 | return -EINVAL; | 653 | return -EINVAL; |
669 | } | 654 | } |
670 | if (params->buffer_size != runtime->buffer_size) { | 655 | if (params->buffer_size != runtime->buffer_size) { |
671 | newbuf = kmalloc(params->buffer_size, GFP_KERNEL); | 656 | newbuf = krealloc(runtime->buffer, params->buffer_size, |
657 | GFP_KERNEL); | ||
672 | if (!newbuf) | 658 | if (!newbuf) |
673 | return -ENOMEM; | 659 | return -ENOMEM; |
674 | kfree(runtime->buffer); | ||
675 | runtime->buffer = newbuf; | 660 | runtime->buffer = newbuf; |
676 | runtime->buffer_size = params->buffer_size; | 661 | runtime->buffer_size = params->buffer_size; |
677 | } | 662 | } |
@@ -926,7 +911,7 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, | |||
926 | } | 911 | } |
927 | if (result > 0) { | 912 | if (result > 0) { |
928 | if (runtime->event) | 913 | if (runtime->event) |
929 | tasklet_schedule(&runtime->tasklet); | 914 | schedule_work(&runtime->event_work); |
930 | else if (snd_rawmidi_ready(substream)) | 915 | else if (snd_rawmidi_ready(substream)) |
931 | wake_up(&runtime->sleep); | 916 | wake_up(&runtime->sleep); |
932 | } | 917 | } |
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c index 5466de8527bd..3fc257da180c 100644 --- a/sound/firewire/speakers.c +++ b/sound/firewire/speakers.c | |||
@@ -171,7 +171,7 @@ static int fwspk_open(struct snd_pcm_substream *substream) | |||
171 | 171 | ||
172 | err = snd_pcm_hw_constraint_minmax(runtime, | 172 | err = snd_pcm_hw_constraint_minmax(runtime, |
173 | SNDRV_PCM_HW_PARAM_PERIOD_TIME, | 173 | SNDRV_PCM_HW_PARAM_PERIOD_TIME, |
174 | 5000, 8192000); | 174 | 5000, UINT_MAX); |
175 | if (err < 0) | 175 | if (err < 0) |
176 | return err; | 176 | return err; |
177 | 177 | ||
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index d8f6fd65ebbb..201503673f25 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -944,7 +944,7 @@ snd_ad1889_create(struct snd_card *card, | |||
944 | spin_lock_init(&chip->lock); /* only now can we call ad1889_free */ | 944 | spin_lock_init(&chip->lock); /* only now can we call ad1889_free */ |
945 | 945 | ||
946 | if (request_irq(pci->irq, snd_ad1889_interrupt, | 946 | if (request_irq(pci->irq, snd_ad1889_interrupt, |
947 | IRQF_SHARED, card->driver, chip)) { | 947 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
948 | printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq); | 948 | printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq); |
949 | snd_ad1889_free(chip); | 949 | snd_ad1889_free(chip); |
950 | return -EBUSY; | 950 | return -EBUSY; |
@@ -1055,7 +1055,7 @@ static DEFINE_PCI_DEVICE_TABLE(snd_ad1889_ids) = { | |||
1055 | MODULE_DEVICE_TABLE(pci, snd_ad1889_ids); | 1055 | MODULE_DEVICE_TABLE(pci, snd_ad1889_ids); |
1056 | 1056 | ||
1057 | static struct pci_driver ad1889_pci_driver = { | 1057 | static struct pci_driver ad1889_pci_driver = { |
1058 | .name = "AD1889 Audio", | 1058 | .name = KBUILD_MODNAME, |
1059 | .id_table = snd_ad1889_ids, | 1059 | .id_table = snd_ad1889_ids, |
1060 | .probe = snd_ad1889_probe, | 1060 | .probe = snd_ad1889_probe, |
1061 | .remove = __devexit_p(snd_ad1889_remove), | 1061 | .remove = __devexit_p(snd_ad1889_remove), |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 5c6e322a48f0..b444b74d9dcf 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -2090,7 +2090,7 @@ static int __devinit snd_ali_resources(struct snd_ali *codec) | |||
2090 | codec->port = pci_resource_start(codec->pci, 0); | 2090 | codec->port = pci_resource_start(codec->pci, 0); |
2091 | 2091 | ||
2092 | if (request_irq(codec->pci->irq, snd_ali_card_interrupt, | 2092 | if (request_irq(codec->pci->irq, snd_ali_card_interrupt, |
2093 | IRQF_SHARED, "ALI 5451", codec)) { | 2093 | IRQF_SHARED, KBUILD_MODNAME, codec)) { |
2094 | snd_printk(KERN_ERR "Unable to request irq.\n"); | 2094 | snd_printk(KERN_ERR "Unable to request irq.\n"); |
2095 | return -EBUSY; | 2095 | return -EBUSY; |
2096 | } | 2096 | } |
@@ -2295,7 +2295,7 @@ static void __devexit snd_ali_remove(struct pci_dev *pci) | |||
2295 | } | 2295 | } |
2296 | 2296 | ||
2297 | static struct pci_driver driver = { | 2297 | static struct pci_driver driver = { |
2298 | .name = "ALI 5451", | 2298 | .name = KBUILD_MODNAME, |
2299 | .id_table = snd_ali_ids, | 2299 | .id_table = snd_ali_ids, |
2300 | .probe = snd_ali_probe, | 2300 | .probe = snd_ali_probe, |
2301 | .remove = __devexit_p(snd_ali_remove), | 2301 | .remove = __devexit_p(snd_ali_remove), |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index d7653cb7ac60..736c8e93db1f 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -722,7 +722,7 @@ static int __devinit snd_als300_create(struct snd_card *card, | |||
722 | irq_handler = snd_als300_interrupt; | 722 | irq_handler = snd_als300_interrupt; |
723 | 723 | ||
724 | if (request_irq(pci->irq, irq_handler, IRQF_SHARED, | 724 | if (request_irq(pci->irq, irq_handler, IRQF_SHARED, |
725 | card->shortname, chip)) { | 725 | KBUILD_MODNAME, chip)) { |
726 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 726 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
727 | snd_als300_free(chip); | 727 | snd_als300_free(chip); |
728 | return -EBUSY; | 728 | return -EBUSY; |
@@ -846,7 +846,7 @@ static int __devinit snd_als300_probe(struct pci_dev *pci, | |||
846 | } | 846 | } |
847 | 847 | ||
848 | static struct pci_driver driver = { | 848 | static struct pci_driver driver = { |
849 | .name = "ALS300", | 849 | .name = KBUILD_MODNAME, |
850 | .id_table = snd_als300_ids, | 850 | .id_table = snd_als300_ids, |
851 | .probe = snd_als300_probe, | 851 | .probe = snd_als300_probe, |
852 | .remove = __devexit_p(snd_als300_remove), | 852 | .remove = __devexit_p(snd_als300_remove), |
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 0e247cb90ecc..a9c1af33f276 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -1036,7 +1036,7 @@ static int snd_als4000_resume(struct pci_dev *pci) | |||
1036 | 1036 | ||
1037 | 1037 | ||
1038 | static struct pci_driver driver = { | 1038 | static struct pci_driver driver = { |
1039 | .name = "ALS4000", | 1039 | .name = KBUILD_MODNAME, |
1040 | .id_table = snd_als4000_ids, | 1040 | .id_table = snd_als4000_ids, |
1041 | .probe = snd_card_als4000_probe, | 1041 | .probe = snd_card_als4000_probe, |
1042 | .remove = __devexit_p(snd_card_als4000_remove), | 1042 | .remove = __devexit_p(snd_card_als4000_remove), |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index e3569bdd3b64..b941d2541dda 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -49,19 +49,21 @@ MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); | |||
49 | #if defined CONFIG_SND_DEBUG | 49 | #if defined CONFIG_SND_DEBUG |
50 | /* copied from pcm_lib.c, hope later patch will make that version public | 50 | /* copied from pcm_lib.c, hope later patch will make that version public |
51 | and this copy can be removed */ | 51 | and this copy can be removed */ |
52 | static void pcm_debug_name(struct snd_pcm_substream *substream, | 52 | static inline void |
53 | char *name, size_t len) | 53 | snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) |
54 | { | 54 | { |
55 | snprintf(name, len, "pcmC%dD%d%c:%d", | 55 | snprintf(buf, size, "pcmC%dD%d%c:%d", |
56 | substream->pcm->card->number, | 56 | substream->pcm->card->number, |
57 | substream->pcm->device, | 57 | substream->pcm->device, |
58 | substream->stream ? 'c' : 'p', | 58 | substream->stream ? 'c' : 'p', |
59 | substream->number); | 59 | substream->number); |
60 | } | 60 | } |
61 | #define DEBUG_NAME(substream, name) char name[16]; pcm_debug_name(substream, name, sizeof(name)) | ||
62 | #else | 61 | #else |
63 | #define pcm_debug_name(s, n, l) do { } while (0) | 62 | static inline void |
64 | #define DEBUG_NAME(name, substream) do { } while (0) | 63 | snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) |
64 | { | ||
65 | *buf = 0; | ||
66 | } | ||
65 | #endif | 67 | #endif |
66 | 68 | ||
67 | #if defined CONFIG_SND_DEBUG_VERBOSE | 69 | #if defined CONFIG_SND_DEBUG_VERBOSE |
@@ -304,7 +306,8 @@ static u16 handle_error(u16 err, int line, char *filename) | |||
304 | static void print_hwparams(struct snd_pcm_substream *substream, | 306 | static void print_hwparams(struct snd_pcm_substream *substream, |
305 | struct snd_pcm_hw_params *p) | 307 | struct snd_pcm_hw_params *p) |
306 | { | 308 | { |
307 | DEBUG_NAME(substream, name); | 309 | char name[16]; |
310 | snd_pcm_debug_name(substream, name, sizeof(name)); | ||
308 | snd_printd("%s HWPARAMS\n", name); | 311 | snd_printd("%s HWPARAMS\n", name); |
309 | snd_printd(" samplerate %d Hz\n", params_rate(p)); | 312 | snd_printd(" samplerate %d Hz\n", params_rate(p)); |
310 | snd_printd(" channels %d\n", params_channels(p)); | 313 | snd_printd(" channels %d\n", params_channels(p)); |
@@ -576,8 +579,9 @@ static int snd_card_asihpi_trigger(struct snd_pcm_substream *substream, | |||
576 | struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); | 579 | struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); |
577 | struct snd_pcm_substream *s; | 580 | struct snd_pcm_substream *s; |
578 | u16 e; | 581 | u16 e; |
579 | DEBUG_NAME(substream, name); | 582 | char name[16]; |
580 | 583 | ||
584 | snd_pcm_debug_name(substream, name, sizeof(name)); | ||
581 | snd_printdd("%s trigger\n", name); | 585 | snd_printdd("%s trigger\n", name); |
582 | 586 | ||
583 | switch (cmd) { | 587 | switch (cmd) { |
@@ -741,7 +745,9 @@ static void snd_card_asihpi_timer_function(unsigned long data) | |||
741 | int loops = 0; | 745 | int loops = 0; |
742 | u16 state; | 746 | u16 state; |
743 | u32 buffer_size, bytes_avail, samples_played, on_card_bytes; | 747 | u32 buffer_size, bytes_avail, samples_played, on_card_bytes; |
744 | DEBUG_NAME(substream, name); | 748 | char name[16]; |
749 | |||
750 | snd_pcm_debug_name(substream, name, sizeof(name)); | ||
745 | 751 | ||
746 | snd_printdd("%s snd_card_asihpi_timer_function\n", name); | 752 | snd_printdd("%s snd_card_asihpi_timer_function\n", name); |
747 | 753 | ||
@@ -1323,10 +1329,12 @@ static const char * const asihpi_src_names[] = { | |||
1323 | "RF", | 1329 | "RF", |
1324 | "Clock", | 1330 | "Clock", |
1325 | "Bitstream", | 1331 | "Bitstream", |
1326 | "Microphone", | 1332 | "Mic", |
1327 | "Cobranet", | 1333 | "Net", |
1328 | "Analog", | 1334 | "Analog", |
1329 | "Adapter", | 1335 | "Adapter", |
1336 | "RTP", | ||
1337 | "GPI", | ||
1330 | }; | 1338 | }; |
1331 | 1339 | ||
1332 | compile_time_assert( | 1340 | compile_time_assert( |
@@ -1341,8 +1349,10 @@ static const char * const asihpi_dst_names[] = { | |||
1341 | "Digital", | 1349 | "Digital", |
1342 | "RF", | 1350 | "RF", |
1343 | "Speaker", | 1351 | "Speaker", |
1344 | "Cobranet Out", | 1352 | "Net", |
1345 | "Analog" | 1353 | "Analog", |
1354 | "RTP", | ||
1355 | "GPO", | ||
1346 | }; | 1356 | }; |
1347 | 1357 | ||
1348 | compile_time_assert( | 1358 | compile_time_assert( |
@@ -1476,11 +1486,40 @@ static int snd_asihpi_volume_put(struct snd_kcontrol *kcontrol, | |||
1476 | 1486 | ||
1477 | static const DECLARE_TLV_DB_SCALE(db_scale_100, -10000, VOL_STEP_mB, 0); | 1487 | static const DECLARE_TLV_DB_SCALE(db_scale_100, -10000, VOL_STEP_mB, 0); |
1478 | 1488 | ||
1489 | #define snd_asihpi_volume_mute_info snd_ctl_boolean_mono_info | ||
1490 | |||
1491 | static int snd_asihpi_volume_mute_get(struct snd_kcontrol *kcontrol, | ||
1492 | struct snd_ctl_elem_value *ucontrol) | ||
1493 | { | ||
1494 | u32 h_control = kcontrol->private_value; | ||
1495 | u32 mute; | ||
1496 | |||
1497 | hpi_handle_error(hpi_volume_get_mute(h_control, &mute)); | ||
1498 | ucontrol->value.integer.value[0] = mute ? 0 : 1; | ||
1499 | |||
1500 | return 0; | ||
1501 | } | ||
1502 | |||
1503 | static int snd_asihpi_volume_mute_put(struct snd_kcontrol *kcontrol, | ||
1504 | struct snd_ctl_elem_value *ucontrol) | ||
1505 | { | ||
1506 | u32 h_control = kcontrol->private_value; | ||
1507 | int change = 1; | ||
1508 | /* HPI currently only supports all or none muting of multichannel volume | ||
1509 | ALSA Switch element has opposite sense to HPI mute: on==unmuted, off=muted | ||
1510 | */ | ||
1511 | int mute = ucontrol->value.integer.value[0] ? 0 : HPI_BITMASK_ALL_CHANNELS; | ||
1512 | hpi_handle_error(hpi_volume_set_mute(h_control, mute)); | ||
1513 | return change; | ||
1514 | } | ||
1515 | |||
1479 | static int __devinit snd_asihpi_volume_add(struct snd_card_asihpi *asihpi, | 1516 | static int __devinit snd_asihpi_volume_add(struct snd_card_asihpi *asihpi, |
1480 | struct hpi_control *hpi_ctl) | 1517 | struct hpi_control *hpi_ctl) |
1481 | { | 1518 | { |
1482 | struct snd_card *card = asihpi->card; | 1519 | struct snd_card *card = asihpi->card; |
1483 | struct snd_kcontrol_new snd_control; | 1520 | struct snd_kcontrol_new snd_control; |
1521 | int err; | ||
1522 | u32 mute; | ||
1484 | 1523 | ||
1485 | asihpi_ctl_init(&snd_control, hpi_ctl, "Volume"); | 1524 | asihpi_ctl_init(&snd_control, hpi_ctl, "Volume"); |
1486 | snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 1525 | snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
@@ -1490,7 +1529,19 @@ static int __devinit snd_asihpi_volume_add(struct snd_card_asihpi *asihpi, | |||
1490 | snd_control.put = snd_asihpi_volume_put; | 1529 | snd_control.put = snd_asihpi_volume_put; |
1491 | snd_control.tlv.p = db_scale_100; | 1530 | snd_control.tlv.p = db_scale_100; |
1492 | 1531 | ||
1493 | return ctl_add(card, &snd_control, asihpi); | 1532 | err = ctl_add(card, &snd_control, asihpi); |
1533 | if (err) | ||
1534 | return err; | ||
1535 | |||
1536 | if (hpi_volume_get_mute(hpi_ctl->h_control, &mute) == 0) { | ||
1537 | asihpi_ctl_init(&snd_control, hpi_ctl, "Switch"); | ||
1538 | snd_control.access = SNDRV_CTL_ELEM_ACCESS_READWRITE; | ||
1539 | snd_control.info = snd_asihpi_volume_mute_info; | ||
1540 | snd_control.get = snd_asihpi_volume_mute_get; | ||
1541 | snd_control.put = snd_asihpi_volume_mute_put; | ||
1542 | err = ctl_add(card, &snd_control, asihpi); | ||
1543 | } | ||
1544 | return err; | ||
1494 | } | 1545 | } |
1495 | 1546 | ||
1496 | /*------------------------------------------------------------ | 1547 | /*------------------------------------------------------------ |
@@ -2923,7 +2974,7 @@ static DEFINE_PCI_DEVICE_TABLE(asihpi_pci_tbl) = { | |||
2923 | MODULE_DEVICE_TABLE(pci, asihpi_pci_tbl); | 2974 | MODULE_DEVICE_TABLE(pci, asihpi_pci_tbl); |
2924 | 2975 | ||
2925 | static struct pci_driver driver = { | 2976 | static struct pci_driver driver = { |
2926 | .name = "asihpi", | 2977 | .name = KBUILD_MODNAME, |
2927 | .id_table = asihpi_pci_tbl, | 2978 | .id_table = asihpi_pci_tbl, |
2928 | .probe = snd_asihpi_probe, | 2979 | .probe = snd_asihpi_probe, |
2929 | .remove = __devexit_p(snd_asihpi_remove), | 2980 | .remove = __devexit_p(snd_asihpi_remove), |
diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index 255429c32c1c..f20727288994 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -42,12 +42,11 @@ i.e 3.05.02 is a development version | |||
42 | #define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF)) | 42 | #define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF)) |
43 | #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) | 43 | #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) |
44 | 44 | ||
45 | /* Use single digits for versions less that 10 to avoid octal. */ | 45 | #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 8, 0) |
46 | #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 6, 0) | 46 | #define HPI_VER_STRING "4.08.00" |
47 | #define HPI_VER_STRING "4.06.00" | ||
48 | 47 | ||
49 | /* Library version as documented in hpi-api-versions.txt */ | 48 | /* Library version as documented in hpi-api-versions.txt */ |
50 | #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) | 49 | #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 0, 0) |
51 | 50 | ||
52 | #include <linux/types.h> | 51 | #include <linux/types.h> |
53 | #define HPI_BUILD_EXCLUDE_DEPRECATED | 52 | #define HPI_BUILD_EXCLUDE_DEPRECATED |
@@ -211,8 +210,12 @@ enum HPI_SOURCENODES { | |||
211 | HPI_SOURCENODE_COBRANET = 109, | 210 | HPI_SOURCENODE_COBRANET = 109, |
212 | HPI_SOURCENODE_ANALOG = 110, /**< analog input node. */ | 211 | HPI_SOURCENODE_ANALOG = 110, /**< analog input node. */ |
213 | HPI_SOURCENODE_ADAPTER = 111, /**< adapter node. */ | 212 | HPI_SOURCENODE_ADAPTER = 111, /**< adapter node. */ |
213 | /** RTP stream input node - This node is a destination for | ||
214 | packets of RTP audio samples from other devices. */ | ||
215 | HPI_SOURCENODE_RTP_DESTINATION = 112, | ||
216 | HPI_SOURCENODE_GP_IN = 113, /**< general purpose input. */ | ||
214 | /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */ | 217 | /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */ |
215 | HPI_SOURCENODE_LAST_INDEX = 111 /**< largest ID */ | 218 | HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */ |
216 | /* AX6 max sourcenode types = 15 */ | 219 | /* AX6 max sourcenode types = 15 */ |
217 | }; | 220 | }; |
218 | 221 | ||
@@ -228,7 +231,7 @@ enum HPI_DESTNODES { | |||
228 | HPI_DESTNODE_NONE = 200, | 231 | HPI_DESTNODE_NONE = 200, |
229 | /** In Stream (Record) node. */ | 232 | /** In Stream (Record) node. */ |
230 | HPI_DESTNODE_ISTREAM = 201, | 233 | HPI_DESTNODE_ISTREAM = 201, |
231 | HPI_DESTNODE_LINEOUT = 202, /**< line out node. */ | 234 | HPI_DESTNODE_LINEOUT = 202, /**< line out node. */ |
232 | HPI_DESTNODE_AESEBU_OUT = 203, /**< AES/EBU output node. */ | 235 | HPI_DESTNODE_AESEBU_OUT = 203, /**< AES/EBU output node. */ |
233 | HPI_DESTNODE_RF = 204, /**< RF output node. */ | 236 | HPI_DESTNODE_RF = 204, /**< RF output node. */ |
234 | HPI_DESTNODE_SPEAKER = 205, /**< speaker output node. */ | 237 | HPI_DESTNODE_SPEAKER = 205, /**< speaker output node. */ |
@@ -236,9 +239,12 @@ enum HPI_DESTNODES { | |||
236 | Audio samples from the device are sent out on the Cobranet network.*/ | 239 | Audio samples from the device are sent out on the Cobranet network.*/ |
237 | HPI_DESTNODE_COBRANET = 206, | 240 | HPI_DESTNODE_COBRANET = 206, |
238 | HPI_DESTNODE_ANALOG = 207, /**< analog output node. */ | 241 | HPI_DESTNODE_ANALOG = 207, /**< analog output node. */ |
239 | 242 | /** RTP stream output node - This node is a source for | |
243 | packets of RTP audio samples that are sent to other devices. */ | ||
244 | HPI_DESTNODE_RTP_SOURCE = 208, | ||
245 | HPI_DESTNODE_GP_OUT = 209, /**< general purpose output node. */ | ||
240 | /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */ | 246 | /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */ |
241 | HPI_DESTNODE_LAST_INDEX = 207 /**< largest ID */ | 247 | HPI_DESTNODE_LAST_INDEX = 209 /**< largest ID */ |
242 | /* AX6 max destnode types = 15 */ | 248 | /* AX6 max destnode types = 15 */ |
243 | }; | 249 | }; |
244 | 250 | ||
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index df4aed5295dd..3cc6f11c20aa 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c | |||
@@ -359,7 +359,7 @@ void HPI_6000(struct hpi_message *phm, struct hpi_response *phr) | |||
359 | HPI_ERROR_PROCESSING_MESSAGE); | 359 | HPI_ERROR_PROCESSING_MESSAGE); |
360 | 360 | ||
361 | switch (phm->type) { | 361 | switch (phm->type) { |
362 | case HPI_TYPE_MESSAGE: | 362 | case HPI_TYPE_REQUEST: |
363 | switch (phm->object) { | 363 | switch (phm->object) { |
364 | case HPI_OBJ_SUBSYSTEM: | 364 | case HPI_OBJ_SUBSYSTEM: |
365 | subsys_message(phm, phr); | 365 | subsys_message(phm, phr); |
@@ -538,7 +538,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, | |||
538 | 538 | ||
539 | HPI_DEBUG_LOG(VERBOSE, "send ADAPTER_GET_INFO\n"); | 539 | HPI_DEBUG_LOG(VERBOSE, "send ADAPTER_GET_INFO\n"); |
540 | memset(&hm, 0, sizeof(hm)); | 540 | memset(&hm, 0, sizeof(hm)); |
541 | hm.type = HPI_TYPE_MESSAGE; | 541 | hm.type = HPI_TYPE_REQUEST; |
542 | hm.size = sizeof(struct hpi_message); | 542 | hm.size = sizeof(struct hpi_message); |
543 | hm.object = HPI_OBJ_ADAPTER; | 543 | hm.object = HPI_OBJ_ADAPTER; |
544 | hm.function = HPI_ADAPTER_GET_INFO; | 544 | hm.function = HPI_ADAPTER_GET_INFO; |
@@ -946,11 +946,8 @@ static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, | |||
946 | } | 946 | } |
947 | 947 | ||
948 | /* write the DSP code down into the DSPs memory */ | 948 | /* write the DSP code down into the DSPs memory */ |
949 | /*HpiDspCode_Open(nBootLoadFamily,&DspCode,pdwOsErrorCode); */ | 949 | error = hpi_dsp_code_open(boot_load_family, pao->pci.pci_dev, |
950 | dsp_code.ps_dev = pao->pci.pci_dev; | 950 | &dsp_code, pos_error_code); |
951 | |||
952 | error = hpi_dsp_code_open(boot_load_family, &dsp_code, | ||
953 | pos_error_code); | ||
954 | 951 | ||
955 | if (error) | 952 | if (error) |
956 | return error; | 953 | return error; |
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index 9d5df54a6b46..e041a6ae1c5a 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c | |||
@@ -373,6 +373,7 @@ static void instream_message(struct hpi_adapter_obj *pao, | |||
373 | /** Entry point to this HPI backend | 373 | /** Entry point to this HPI backend |
374 | * All calls to the HPI start here | 374 | * All calls to the HPI start here |
375 | */ | 375 | */ |
376 | static | ||
376 | void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm, | 377 | void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm, |
377 | struct hpi_response *phr) | 378 | struct hpi_response *phr) |
378 | { | 379 | { |
@@ -392,7 +393,7 @@ void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm, | |||
392 | 393 | ||
393 | HPI_DEBUG_LOG(VERBOSE, "start of switch\n"); | 394 | HPI_DEBUG_LOG(VERBOSE, "start of switch\n"); |
394 | switch (phm->type) { | 395 | switch (phm->type) { |
395 | case HPI_TYPE_MESSAGE: | 396 | case HPI_TYPE_REQUEST: |
396 | switch (phm->object) { | 397 | switch (phm->object) { |
397 | case HPI_OBJ_SUBSYSTEM: | 398 | case HPI_OBJ_SUBSYSTEM: |
398 | subsys_message(pao, phm, phr); | 399 | subsys_message(pao, phm, phr); |
@@ -402,7 +403,6 @@ void _HPI_6205(struct hpi_adapter_obj *pao, struct hpi_message *phm, | |||
402 | adapter_message(pao, phm, phr); | 403 | adapter_message(pao, phm, phr); |
403 | break; | 404 | break; |
404 | 405 | ||
405 | case HPI_OBJ_CONTROLEX: | ||
406 | case HPI_OBJ_CONTROL: | 406 | case HPI_OBJ_CONTROL: |
407 | control_message(pao, phm, phr); | 407 | control_message(pao, phm, phr); |
408 | break; | 408 | break; |
@@ -634,11 +634,12 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao, | |||
634 | 634 | ||
635 | HPI_DEBUG_LOG(VERBOSE, "init ADAPTER_GET_INFO\n"); | 635 | HPI_DEBUG_LOG(VERBOSE, "init ADAPTER_GET_INFO\n"); |
636 | memset(&hm, 0, sizeof(hm)); | 636 | memset(&hm, 0, sizeof(hm)); |
637 | hm.type = HPI_TYPE_MESSAGE; | 637 | /* wAdapterIndex == version == 0 */ |
638 | hm.type = HPI_TYPE_REQUEST; | ||
638 | hm.size = sizeof(hm); | 639 | hm.size = sizeof(hm); |
639 | hm.object = HPI_OBJ_ADAPTER; | 640 | hm.object = HPI_OBJ_ADAPTER; |
640 | hm.function = HPI_ADAPTER_GET_INFO; | 641 | hm.function = HPI_ADAPTER_GET_INFO; |
641 | hm.adapter_index = 0; | 642 | |
642 | memset(&hr, 0, sizeof(hr)); | 643 | memset(&hr, 0, sizeof(hr)); |
643 | hr.size = sizeof(hr); | 644 | hr.size = sizeof(hr); |
644 | 645 | ||
@@ -658,9 +659,6 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao, | |||
658 | hr.u.ax.info.num_outstreams + | 659 | hr.u.ax.info.num_outstreams + |
659 | hr.u.ax.info.num_instreams; | 660 | hr.u.ax.info.num_instreams; |
660 | 661 | ||
661 | hpios_locked_mem_prepare((max_streams * 6) / 10, max_streams, | ||
662 | 65536, pao->pci.pci_dev); | ||
663 | |||
664 | HPI_DEBUG_LOG(VERBOSE, | 662 | HPI_DEBUG_LOG(VERBOSE, |
665 | "got adapter info type %x index %d serial %d\n", | 663 | "got adapter info type %x index %d serial %d\n", |
666 | hr.u.ax.info.adapter_type, hr.u.ax.info.adapter_index, | 664 | hr.u.ax.info.adapter_type, hr.u.ax.info.adapter_index, |
@@ -709,9 +707,6 @@ static void delete_adapter_obj(struct hpi_adapter_obj *pao) | |||
709 | [i]); | 707 | [i]); |
710 | phw->outstream_host_buffer_size[i] = 0; | 708 | phw->outstream_host_buffer_size[i] = 0; |
711 | } | 709 | } |
712 | |||
713 | hpios_locked_mem_unprepare(pao->pci.pci_dev); | ||
714 | |||
715 | kfree(phw); | 710 | kfree(phw); |
716 | } | 711 | } |
717 | 712 | ||
@@ -1371,9 +1366,8 @@ static u16 adapter_boot_load_dsp(struct hpi_adapter_obj *pao, | |||
1371 | return err; | 1366 | return err; |
1372 | 1367 | ||
1373 | /* write the DSP code down into the DSPs memory */ | 1368 | /* write the DSP code down into the DSPs memory */ |
1374 | dsp_code.ps_dev = pao->pci.pci_dev; | 1369 | err = hpi_dsp_code_open(boot_code_id[dsp], pao->pci.pci_dev, |
1375 | err = hpi_dsp_code_open(boot_code_id[dsp], &dsp_code, | 1370 | &dsp_code, pos_error_code); |
1376 | pos_error_code); | ||
1377 | if (err) | 1371 | if (err) |
1378 | return err; | 1372 | return err; |
1379 | 1373 | ||
@@ -2084,13 +2078,13 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao, | |||
2084 | u16 err = 0; | 2078 | u16 err = 0; |
2085 | 2079 | ||
2086 | message_count++; | 2080 | message_count++; |
2087 | if (phm->size > sizeof(interface->u)) { | 2081 | if (phm->size > sizeof(interface->u.message_buffer)) { |
2088 | phr->error = HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL; | 2082 | phr->error = HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL; |
2089 | phr->specific_error = sizeof(interface->u); | 2083 | phr->specific_error = sizeof(interface->u.message_buffer); |
2090 | phr->size = sizeof(struct hpi_response_header); | 2084 | phr->size = sizeof(struct hpi_response_header); |
2091 | HPI_DEBUG_LOG(ERROR, | 2085 | HPI_DEBUG_LOG(ERROR, |
2092 | "message len %d too big for buffer %zd \n", phm->size, | 2086 | "message len %d too big for buffer %zd \n", phm->size, |
2093 | sizeof(interface->u)); | 2087 | sizeof(interface->u.message_buffer)); |
2094 | return 0; | 2088 | return 0; |
2095 | } | 2089 | } |
2096 | 2090 | ||
@@ -2122,18 +2116,19 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao, | |||
2122 | 2116 | ||
2123 | /* read the result */ | 2117 | /* read the result */ |
2124 | if (time_out) { | 2118 | if (time_out) { |
2125 | if (interface->u.response_buffer.size <= phr->size) | 2119 | if (interface->u.response_buffer.response.size <= phr->size) |
2126 | memcpy(phr, &interface->u.response_buffer, | 2120 | memcpy(phr, &interface->u.response_buffer, |
2127 | interface->u.response_buffer.size); | 2121 | interface->u.response_buffer.response.size); |
2128 | else { | 2122 | else { |
2129 | HPI_DEBUG_LOG(ERROR, | 2123 | HPI_DEBUG_LOG(ERROR, |
2130 | "response len %d too big for buffer %d\n", | 2124 | "response len %d too big for buffer %d\n", |
2131 | interface->u.response_buffer.size, phr->size); | 2125 | interface->u.response_buffer.response.size, |
2126 | phr->size); | ||
2132 | memcpy(phr, &interface->u.response_buffer, | 2127 | memcpy(phr, &interface->u.response_buffer, |
2133 | sizeof(struct hpi_response_header)); | 2128 | sizeof(struct hpi_response_header)); |
2134 | phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL; | 2129 | phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL; |
2135 | phr->specific_error = | 2130 | phr->specific_error = |
2136 | interface->u.response_buffer.size; | 2131 | interface->u.response_buffer.response.size; |
2137 | phr->size = sizeof(struct hpi_response_header); | 2132 | phr->size = sizeof(struct hpi_response_header); |
2138 | } | 2133 | } |
2139 | } | 2134 | } |
@@ -2202,23 +2197,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, | |||
2202 | phm->u.d.u.data.data_size, H620_HIF_GET_DATA); | 2197 | phm->u.d.u.data.data_size, H620_HIF_GET_DATA); |
2203 | break; | 2198 | break; |
2204 | 2199 | ||
2205 | case HPI_CONTROL_SET_STATE: | ||
2206 | if (phm->object == HPI_OBJ_CONTROLEX | ||
2207 | && phm->u.cx.attribute == HPI_COBRANET_SET_DATA) | ||
2208 | err = hpi6205_transfer_data(pao, | ||
2209 | phm->u.cx.u.cobranet_bigdata.pb_data, | ||
2210 | phm->u.cx.u.cobranet_bigdata.byte_count, | ||
2211 | H620_HIF_SEND_DATA); | ||
2212 | break; | ||
2213 | |||
2214 | case HPI_CONTROL_GET_STATE: | ||
2215 | if (phm->object == HPI_OBJ_CONTROLEX | ||
2216 | && phm->u.cx.attribute == HPI_COBRANET_GET_DATA) | ||
2217 | err = hpi6205_transfer_data(pao, | ||
2218 | phm->u.cx.u.cobranet_bigdata.pb_data, | ||
2219 | phr->u.cx.u.cobranet_data.byte_count, | ||
2220 | H620_HIF_GET_DATA); | ||
2221 | break; | ||
2222 | } | 2200 | } |
2223 | phr->error = err; | 2201 | phr->error = err; |
2224 | 2202 | ||
diff --git a/sound/pci/asihpi/hpi6205.h b/sound/pci/asihpi/hpi6205.h index df2f02c0c7b4..ec0827b633a6 100644 --- a/sound/pci/asihpi/hpi6205.h +++ b/sound/pci/asihpi/hpi6205.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -70,15 +70,28 @@ The Host located memory buffer that the 6205 will bus master | |||
70 | in and out of. | 70 | in and out of. |
71 | ************************************************************/ | 71 | ************************************************************/ |
72 | #define HPI6205_SIZEOF_DATA (16*1024) | 72 | #define HPI6205_SIZEOF_DATA (16*1024) |
73 | |||
74 | struct message_buffer_6205 { | ||
75 | struct hpi_message message; | ||
76 | char data[256]; | ||
77 | }; | ||
78 | |||
79 | struct response_buffer_6205 { | ||
80 | struct hpi_response response; | ||
81 | char data[256]; | ||
82 | }; | ||
83 | |||
84 | union buffer_6205 { | ||
85 | struct message_buffer_6205 message_buffer; | ||
86 | struct response_buffer_6205 response_buffer; | ||
87 | u8 b_data[HPI6205_SIZEOF_DATA]; | ||
88 | }; | ||
89 | |||
73 | struct bus_master_interface { | 90 | struct bus_master_interface { |
74 | u32 host_cmd; | 91 | u32 host_cmd; |
75 | u32 dsp_ack; | 92 | u32 dsp_ack; |
76 | u32 transfer_size_in_bytes; | 93 | u32 transfer_size_in_bytes; |
77 | union { | 94 | union buffer_6205 u; |
78 | struct hpi_message_header message_buffer; | ||
79 | struct hpi_response_header response_buffer; | ||
80 | u8 b_data[HPI6205_SIZEOF_DATA]; | ||
81 | } u; | ||
82 | struct controlcache_6205 control_cache; | 95 | struct controlcache_6205 control_cache; |
83 | struct async_event_buffer_6205 async_buffer; | 96 | struct async_event_buffer_6205 async_buffer; |
84 | struct hpi_hostbuffer_status | 97 | struct hpi_hostbuffer_status |
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index bf5eced76bac..d497030c160f 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -32,12 +32,6 @@ HPI internal definitions | |||
32 | #include "hpios.h" | 32 | #include "hpios.h" |
33 | 33 | ||
34 | /* physical memory allocation */ | 34 | /* physical memory allocation */ |
35 | void hpios_locked_mem_init(void | ||
36 | ); | ||
37 | void hpios_locked_mem_free_all(void | ||
38 | ); | ||
39 | #define hpios_locked_mem_prepare(a, b, c, d); | ||
40 | #define hpios_locked_mem_unprepare(a) | ||
41 | 35 | ||
42 | /** Allocate and map an area of locked memory for bus master DMA operations. | 36 | /** Allocate and map an area of locked memory for bus master DMA operations. |
43 | 37 | ||
@@ -226,8 +220,8 @@ enum HPI_CONTROL_ATTRIBUTES { | |||
226 | 220 | ||
227 | HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), | 221 | HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), |
228 | HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), | 222 | HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), |
229 | HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), | 223 | /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */ |
230 | HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), | 224 | /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */ |
231 | HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), | 225 | HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), |
232 | HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), | 226 | HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), |
233 | HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), | 227 | HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), |
@@ -364,10 +358,12 @@ Used in DLL to indicate device not present | |||
364 | #define HPI_ADAPTER_ASI(f) (f) | 358 | #define HPI_ADAPTER_ASI(f) (f) |
365 | 359 | ||
366 | enum HPI_MESSAGE_TYPES { | 360 | enum HPI_MESSAGE_TYPES { |
367 | HPI_TYPE_MESSAGE = 1, | 361 | HPI_TYPE_REQUEST = 1, |
368 | HPI_TYPE_RESPONSE = 2, | 362 | HPI_TYPE_RESPONSE = 2, |
369 | HPI_TYPE_DATA = 3, | 363 | HPI_TYPE_DATA = 3, |
370 | HPI_TYPE_SSX2BYPASS_MESSAGE = 4 | 364 | HPI_TYPE_SSX2BYPASS_MESSAGE = 4, |
365 | HPI_TYPE_COMMAND = 5, | ||
366 | HPI_TYPE_NOTIFICATION = 6 | ||
371 | }; | 367 | }; |
372 | 368 | ||
373 | enum HPI_OBJECT_TYPES { | 369 | enum HPI_OBJECT_TYPES { |
@@ -383,7 +379,7 @@ enum HPI_OBJECT_TYPES { | |||
383 | HPI_OBJ_WATCHDOG = 10, | 379 | HPI_OBJ_WATCHDOG = 10, |
384 | HPI_OBJ_CLOCK = 11, | 380 | HPI_OBJ_CLOCK = 11, |
385 | HPI_OBJ_PROFILE = 12, | 381 | HPI_OBJ_PROFILE = 12, |
386 | HPI_OBJ_CONTROLEX = 13, | 382 | /* HPI_ OBJ_ CONTROLEX = 13, */ |
387 | HPI_OBJ_ASYNCEVENT = 14 | 383 | HPI_OBJ_ASYNCEVENT = 14 |
388 | #define HPI_OBJ_MAXINDEX 14 | 384 | #define HPI_OBJ_MAXINDEX 14 |
389 | }; | 385 | }; |
@@ -608,7 +604,7 @@ struct hpi_data_compat32 { | |||
608 | #endif | 604 | #endif |
609 | 605 | ||
610 | struct hpi_buffer { | 606 | struct hpi_buffer { |
611 | /** placehoder for backward compatibility (see dwBufferSize) */ | 607 | /** placeholder for backward compatibility (see dwBufferSize) */ |
612 | struct hpi_msg_format reserved; | 608 | struct hpi_msg_format reserved; |
613 | u32 command; /**< HPI_BUFFER_CMD_xxx*/ | 609 | u32 command; /**< HPI_BUFFER_CMD_xxx*/ |
614 | u32 pci_address; /**< PCI physical address of buffer for DSP DMA */ | 610 | u32 pci_address; /**< PCI physical address of buffer for DSP DMA */ |
@@ -912,95 +908,13 @@ union hpi_control_union_res { | |||
912 | u32 remaining_chars; | 908 | u32 remaining_chars; |
913 | } chars8; | 909 | } chars8; |
914 | char c_data12[12]; | 910 | char c_data12[12]; |
915 | }; | ||
916 | |||
917 | /* HPI_CONTROLX_STRUCTURES */ | ||
918 | |||
919 | /* Message */ | ||
920 | |||
921 | /** Used for all HMI variables where max length <= 8 bytes | ||
922 | */ | ||
923 | struct hpi_controlx_msg_cobranet_data { | ||
924 | u32 hmi_address; | ||
925 | u32 byte_count; | ||
926 | u32 data[2]; | ||
927 | }; | ||
928 | |||
929 | /** Used for string data, and for packet bridge | ||
930 | */ | ||
931 | struct hpi_controlx_msg_cobranet_bigdata { | ||
932 | u32 hmi_address; | ||
933 | u32 byte_count; | ||
934 | u8 *pb_data; | ||
935 | #ifndef HPI64BIT | ||
936 | u32 padding; | ||
937 | #endif | ||
938 | }; | ||
939 | |||
940 | /** Used for PADS control reading of string fields. | ||
941 | */ | ||
942 | struct hpi_controlx_msg_pad_data { | ||
943 | u32 field; | ||
944 | u32 byte_count; | ||
945 | u8 *pb_data; | ||
946 | #ifndef HPI64BIT | ||
947 | u32 padding; | ||
948 | #endif | ||
949 | }; | ||
950 | |||
951 | /** Used for generic data | ||
952 | */ | ||
953 | |||
954 | struct hpi_controlx_msg_generic { | ||
955 | u32 param1; | ||
956 | u32 param2; | ||
957 | }; | ||
958 | |||
959 | struct hpi_controlx_msg { | ||
960 | u16 attribute; /* control attribute or property */ | ||
961 | u16 saved_index; | ||
962 | union { | ||
963 | struct hpi_controlx_msg_cobranet_data cobranet_data; | ||
964 | struct hpi_controlx_msg_cobranet_bigdata cobranet_bigdata; | ||
965 | struct hpi_controlx_msg_generic generic; | ||
966 | struct hpi_controlx_msg_pad_data pad_data; | ||
967 | /*struct param_value universal_value; */ | ||
968 | /* nothing extra to send for status read */ | ||
969 | } u; | ||
970 | }; | ||
971 | |||
972 | /* Response */ | ||
973 | /** | ||
974 | */ | ||
975 | struct hpi_controlx_res_cobranet_data { | ||
976 | u32 byte_count; | ||
977 | u32 data[2]; | ||
978 | }; | ||
979 | |||
980 | struct hpi_controlx_res_cobranet_bigdata { | ||
981 | u32 byte_count; | ||
982 | }; | ||
983 | |||
984 | struct hpi_controlx_res_cobranet_status { | ||
985 | u32 status; | ||
986 | u32 readable_size; | ||
987 | u32 writeable_size; | ||
988 | }; | ||
989 | |||
990 | struct hpi_controlx_res_generic { | ||
991 | u32 param1; | ||
992 | u32 param2; | ||
993 | }; | ||
994 | |||
995 | struct hpi_controlx_res { | ||
996 | union { | 911 | union { |
997 | struct hpi_controlx_res_cobranet_bigdata cobranet_bigdata; | 912 | struct { |
998 | struct hpi_controlx_res_cobranet_data cobranet_data; | 913 | u32 status; |
999 | struct hpi_controlx_res_cobranet_status cobranet_status; | 914 | u32 readable_size; |
1000 | struct hpi_controlx_res_generic generic; | 915 | u32 writeable_size; |
1001 | /*struct param_info universal_info; */ | 916 | } status; |
1002 | /*struct param_value universal_value; */ | 917 | } cobranet; |
1003 | } u; | ||
1004 | }; | 918 | }; |
1005 | 919 | ||
1006 | struct hpi_nvmemory_msg { | 920 | struct hpi_nvmemory_msg { |
@@ -1126,7 +1040,6 @@ struct hpi_message { | |||
1126 | /* identical to struct hpi_control_msg, | 1040 | /* identical to struct hpi_control_msg, |
1127 | but field naming is improved */ | 1041 | but field naming is improved */ |
1128 | struct hpi_control_union_msg cu; | 1042 | struct hpi_control_union_msg cu; |
1129 | struct hpi_controlx_msg cx; /* extended mixer control; */ | ||
1130 | struct hpi_nvmemory_msg n; | 1043 | struct hpi_nvmemory_msg n; |
1131 | struct hpi_gpio_msg l; /* digital i/o */ | 1044 | struct hpi_gpio_msg l; /* digital i/o */ |
1132 | struct hpi_watchdog_msg w; | 1045 | struct hpi_watchdog_msg w; |
@@ -1151,7 +1064,7 @@ struct hpi_message { | |||
1151 | sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ | 1064 | sizeof(struct hpi_message_header) + sizeof(struct hpi_watchdog_msg),\ |
1152 | sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ | 1065 | sizeof(struct hpi_message_header) + sizeof(struct hpi_clock_msg),\ |
1153 | sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ | 1066 | sizeof(struct hpi_message_header) + sizeof(struct hpi_profile_msg),\ |
1154 | sizeof(struct hpi_message_header) + sizeof(struct hpi_controlx_msg),\ | 1067 | sizeof(struct hpi_message_header), /* controlx obj removed */ \ |
1155 | sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ | 1068 | sizeof(struct hpi_message_header) + sizeof(struct hpi_async_msg) \ |
1156 | } | 1069 | } |
1157 | 1070 | ||
@@ -1188,7 +1101,6 @@ struct hpi_response { | |||
1188 | struct hpi_control_res c; /* mixer control; */ | 1101 | struct hpi_control_res c; /* mixer control; */ |
1189 | /* identical to hpi_control_res, but field naming is improved */ | 1102 | /* identical to hpi_control_res, but field naming is improved */ |
1190 | union hpi_control_union_res cu; | 1103 | union hpi_control_union_res cu; |
1191 | struct hpi_controlx_res cx; /* extended mixer control; */ | ||
1192 | struct hpi_nvmemory_res n; | 1104 | struct hpi_nvmemory_res n; |
1193 | struct hpi_gpio_res l; /* digital i/o */ | 1105 | struct hpi_gpio_res l; /* digital i/o */ |
1194 | struct hpi_watchdog_res w; | 1106 | struct hpi_watchdog_res w; |
@@ -1213,7 +1125,7 @@ struct hpi_response { | |||
1213 | sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ | 1125 | sizeof(struct hpi_response_header) + sizeof(struct hpi_watchdog_res),\ |
1214 | sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ | 1126 | sizeof(struct hpi_response_header) + sizeof(struct hpi_clock_res),\ |
1215 | sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ | 1127 | sizeof(struct hpi_response_header) + sizeof(struct hpi_profile_res),\ |
1216 | sizeof(struct hpi_response_header) + sizeof(struct hpi_controlx_res),\ | 1128 | sizeof(struct hpi_response_header), /* controlx obj removed */ \ |
1217 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ | 1129 | sizeof(struct hpi_response_header) + sizeof(struct hpi_async_res) \ |
1218 | } | 1130 | } |
1219 | 1131 | ||
@@ -1308,6 +1220,30 @@ struct hpi_res_adapter_debug_read { | |||
1308 | u8 bytes[256]; | 1220 | u8 bytes[256]; |
1309 | }; | 1221 | }; |
1310 | 1222 | ||
1223 | struct hpi_msg_cobranet_hmi { | ||
1224 | u16 attribute; | ||
1225 | u16 padding; | ||
1226 | u32 hmi_address; | ||
1227 | u32 byte_count; | ||
1228 | }; | ||
1229 | |||
1230 | struct hpi_msg_cobranet_hmiwrite { | ||
1231 | struct hpi_message_header h; | ||
1232 | struct hpi_msg_cobranet_hmi p; | ||
1233 | u8 bytes[256]; | ||
1234 | }; | ||
1235 | |||
1236 | struct hpi_msg_cobranet_hmiread { | ||
1237 | struct hpi_message_header h; | ||
1238 | struct hpi_msg_cobranet_hmi p; | ||
1239 | }; | ||
1240 | |||
1241 | struct hpi_res_cobranet_hmiread { | ||
1242 | struct hpi_response_header h; | ||
1243 | u32 byte_count; | ||
1244 | u8 bytes[256]; | ||
1245 | }; | ||
1246 | |||
1311 | #if 1 | 1247 | #if 1 |
1312 | #define hpi_message_header_v1 hpi_message_header | 1248 | #define hpi_message_header_v1 hpi_message_header |
1313 | #define hpi_response_header_v1 hpi_response_header | 1249 | #define hpi_response_header_v1 hpi_response_header |
@@ -1338,7 +1274,6 @@ struct hpi_msg_payload_v0 { | |||
1338 | union hpi_mixerx_msg mx; | 1274 | union hpi_mixerx_msg mx; |
1339 | struct hpi_control_msg c; | 1275 | struct hpi_control_msg c; |
1340 | struct hpi_control_union_msg cu; | 1276 | struct hpi_control_union_msg cu; |
1341 | struct hpi_controlx_msg cx; | ||
1342 | struct hpi_nvmemory_msg n; | 1277 | struct hpi_nvmemory_msg n; |
1343 | struct hpi_gpio_msg l; | 1278 | struct hpi_gpio_msg l; |
1344 | struct hpi_watchdog_msg w; | 1279 | struct hpi_watchdog_msg w; |
@@ -1358,7 +1293,6 @@ struct hpi_res_payload_v0 { | |||
1358 | union hpi_mixerx_res mx; | 1293 | union hpi_mixerx_res mx; |
1359 | struct hpi_control_res c; | 1294 | struct hpi_control_res c; |
1360 | union hpi_control_union_res cu; | 1295 | union hpi_control_union_res cu; |
1361 | struct hpi_controlx_res cx; | ||
1362 | struct hpi_nvmemory_res n; | 1296 | struct hpi_nvmemory_res n; |
1363 | struct hpi_gpio_res l; | 1297 | struct hpi_gpio_res l; |
1364 | struct hpi_watchdog_res w; | 1298 | struct hpi_watchdog_res w; |
@@ -1493,12 +1427,6 @@ struct hpi_control_cache_microphone { | |||
1493 | char temp_padding[6]; | 1427 | char temp_padding[6]; |
1494 | }; | 1428 | }; |
1495 | 1429 | ||
1496 | struct hpi_control_cache_generic { | ||
1497 | struct hpi_control_cache_info i; | ||
1498 | u32 dw1; | ||
1499 | u32 dw2; | ||
1500 | }; | ||
1501 | |||
1502 | struct hpi_control_cache_single { | 1430 | struct hpi_control_cache_single { |
1503 | union { | 1431 | union { |
1504 | struct hpi_control_cache_info i; | 1432 | struct hpi_control_cache_info i; |
@@ -1514,7 +1442,6 @@ struct hpi_control_cache_single { | |||
1514 | struct hpi_control_cache_silencedetector silence; | 1442 | struct hpi_control_cache_silencedetector silence; |
1515 | struct hpi_control_cache_sampleclock clk; | 1443 | struct hpi_control_cache_sampleclock clk; |
1516 | struct hpi_control_cache_microphone microphone; | 1444 | struct hpi_control_cache_microphone microphone; |
1517 | struct hpi_control_cache_generic generic; | ||
1518 | } u; | 1445 | } u; |
1519 | }; | 1446 | }; |
1520 | 1447 | ||
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index b15a02e91f82..65b7ca13115b 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c | |||
@@ -57,7 +57,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | if (phr->function != phm->function) { | 59 | if (phr->function != phm->function) { |
60 | HPI_DEBUG_LOG(ERROR, "header type %d invalid\n", | 60 | HPI_DEBUG_LOG(ERROR, "header function %d invalid\n", |
61 | phr->function); | 61 | phr->function); |
62 | return HPI_ERROR_INVALID_RESPONSE; | 62 | return HPI_ERROR_INVALID_RESPONSE; |
63 | } | 63 | } |
@@ -315,8 +315,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, | |||
315 | short found = 1; | 315 | short found = 1; |
316 | struct hpi_control_cache_info *pI; | 316 | struct hpi_control_cache_info *pI; |
317 | struct hpi_control_cache_single *pC; | 317 | struct hpi_control_cache_single *pC; |
318 | struct hpi_control_cache_pad *p_pad; | 318 | size_t response_size; |
319 | |||
320 | if (!find_control(phm->obj_index, p_cache, &pI)) { | 319 | if (!find_control(phm->obj_index, p_cache, &pI)) { |
321 | HPI_DEBUG_LOG(VERBOSE, | 320 | HPI_DEBUG_LOG(VERBOSE, |
322 | "HPICMN find_control() failed for adap %d\n", | 321 | "HPICMN find_control() failed for adap %d\n", |
@@ -326,11 +325,15 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, | |||
326 | 325 | ||
327 | phr->error = 0; | 326 | phr->error = 0; |
328 | 327 | ||
328 | /* set the default response size */ | ||
329 | response_size = | ||
330 | sizeof(struct hpi_response_header) + | ||
331 | sizeof(struct hpi_control_res); | ||
332 | |||
329 | /* pC is the default cached control strucure. May be cast to | 333 | /* pC is the default cached control strucure. May be cast to |
330 | something else in the following switch statement. | 334 | something else in the following switch statement. |
331 | */ | 335 | */ |
332 | pC = (struct hpi_control_cache_single *)pI; | 336 | pC = (struct hpi_control_cache_single *)pI; |
333 | p_pad = (struct hpi_control_cache_pad *)pI; | ||
334 | 337 | ||
335 | switch (pI->control_type) { | 338 | switch (pI->control_type) { |
336 | 339 | ||
@@ -529,9 +532,7 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, | |||
529 | pI->control_index, pI->control_type, phm->u.c.attribute); | 532 | pI->control_index, pI->control_type, phm->u.c.attribute); |
530 | 533 | ||
531 | if (found) | 534 | if (found) |
532 | phr->size = | 535 | phr->size = (u16)response_size; |
533 | sizeof(struct hpi_response_header) + | ||
534 | sizeof(struct hpi_control_res); | ||
535 | 536 | ||
536 | return found; | 537 | return found; |
537 | } | 538 | } |
@@ -682,7 +683,7 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr) | |||
682 | void HPI_COMMON(struct hpi_message *phm, struct hpi_response *phr) | 683 | void HPI_COMMON(struct hpi_message *phm, struct hpi_response *phr) |
683 | { | 684 | { |
684 | switch (phm->type) { | 685 | switch (phm->type) { |
685 | case HPI_TYPE_MESSAGE: | 686 | case HPI_TYPE_REQUEST: |
686 | switch (phm->object) { | 687 | switch (phm->object) { |
687 | case HPI_OBJ_SUBSYSTEM: | 688 | case HPI_OBJ_SUBSYSTEM: |
688 | subsys_message(phm, phr); | 689 | subsys_message(phm, phr); |
diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c index 5c6ea113d219..3a7afa31c1d8 100644 --- a/sound/pci/asihpi/hpidspcd.c +++ b/sound/pci/asihpi/hpidspcd.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /***********************************************************************/ | 1 | /***********************************************************************/ |
2 | /*! | 2 | /** |
3 | 3 | ||
4 | AudioScience HPI driver | 4 | AudioScience HPI driver |
5 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 5 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of version 2 of the GNU General Public License as | 8 | it under the terms of version 2 of the GNU General Public License as |
@@ -18,90 +18,59 @@ | |||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | 19 | ||
20 | \file | 20 | \file |
21 | Functions for reading DSP code to load into DSP | 21 | Functions for reading DSP code using |
22 | |||
23 | (Linux only:) If DSPCODE_FIRMWARE_LOADER is defined, code is read using | ||
24 | hotplug firmware loader from individual dsp code files | 22 | hotplug firmware loader from individual dsp code files |
25 | 23 | */ | |
26 | If neither of the above is defined, code is read from linked arrays. | ||
27 | DSPCODE_ARRAY is defined. | ||
28 | |||
29 | HPI_INCLUDE_**** must be defined | ||
30 | and the appropriate hzz?????.c or hex?????.c linked in | ||
31 | |||
32 | */ | ||
33 | /***********************************************************************/ | 24 | /***********************************************************************/ |
34 | #define SOURCEFILE_NAME "hpidspcd.c" | 25 | #define SOURCEFILE_NAME "hpidspcd.c" |
35 | #include "hpidspcd.h" | 26 | #include "hpidspcd.h" |
36 | #include "hpidebug.h" | 27 | #include "hpidebug.h" |
37 | 28 | ||
38 | /** | 29 | struct dsp_code_private { |
39 | Header structure for binary dsp code file (see asidsp.doc) | 30 | /** Firmware descriptor */ |
40 | This structure must match that used in s2bin.c for generation of asidsp.bin | 31 | const struct firmware *firmware; |
41 | */ | 32 | struct pci_dev *dev; |
42 | |||
43 | #ifndef DISABLE_PRAGMA_PACK1 | ||
44 | #pragma pack(push, 1) | ||
45 | #endif | ||
46 | |||
47 | struct code_header { | ||
48 | u32 size; | ||
49 | char type[4]; | ||
50 | u32 adapter; | ||
51 | u32 version; | ||
52 | u32 crc; | ||
53 | }; | 33 | }; |
54 | 34 | ||
55 | #ifndef DISABLE_PRAGMA_PACK1 | ||
56 | #pragma pack(pop) | ||
57 | #endif | ||
58 | |||
59 | #define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ | 35 | #define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ |
60 | HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) | 36 | HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) |
61 | 37 | ||
62 | /***********************************************************************/ | ||
63 | #include <linux/pci.h> | ||
64 | /*-------------------------------------------------------------------*/ | 38 | /*-------------------------------------------------------------------*/ |
65 | short hpi_dsp_code_open(u32 adapter, struct dsp_code *ps_dsp_code, | 39 | short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, |
66 | u32 *pos_error_code) | 40 | u32 *os_error_code) |
67 | { | 41 | { |
68 | const struct firmware *ps_firmware = ps_dsp_code->ps_firmware; | 42 | const struct firmware *firmware; |
43 | struct pci_dev *dev = os_data; | ||
69 | struct code_header header; | 44 | struct code_header header; |
70 | char fw_name[20]; | 45 | char fw_name[20]; |
71 | int err; | 46 | int err; |
72 | 47 | ||
73 | sprintf(fw_name, "asihpi/dsp%04x.bin", adapter); | 48 | sprintf(fw_name, "asihpi/dsp%04x.bin", adapter); |
74 | 49 | ||
75 | err = request_firmware(&ps_firmware, fw_name, | 50 | err = request_firmware(&firmware, fw_name, &dev->dev); |
76 | &ps_dsp_code->ps_dev->dev); | ||
77 | 51 | ||
78 | if (err != 0) { | 52 | if (err || !firmware) { |
79 | dev_printk(KERN_ERR, &ps_dsp_code->ps_dev->dev, | 53 | dev_printk(KERN_ERR, &dev->dev, |
80 | "%d, request_firmware failed for %s\n", err, | 54 | "%d, request_firmware failed for %s\n", err, |
81 | fw_name); | 55 | fw_name); |
82 | goto error1; | 56 | goto error1; |
83 | } | 57 | } |
84 | if (ps_firmware->size < sizeof(header)) { | 58 | if (firmware->size < sizeof(header)) { |
85 | dev_printk(KERN_ERR, &ps_dsp_code->ps_dev->dev, | 59 | dev_printk(KERN_ERR, &dev->dev, "Header size too small %s\n", |
86 | "Header size too small %s\n", fw_name); | 60 | fw_name); |
87 | goto error2; | ||
88 | } | ||
89 | memcpy(&header, ps_firmware->data, sizeof(header)); | ||
90 | if (header.adapter != adapter) { | ||
91 | dev_printk(KERN_ERR, &ps_dsp_code->ps_dev->dev, | ||
92 | "Adapter type incorrect %4x != %4x\n", header.adapter, | ||
93 | adapter); | ||
94 | goto error2; | 61 | goto error2; |
95 | } | 62 | } |
96 | if (header.size != ps_firmware->size) { | 63 | memcpy(&header, firmware->data, sizeof(header)); |
97 | dev_printk(KERN_ERR, &ps_dsp_code->ps_dev->dev, | 64 | |
98 | "Code size wrong %d != %ld\n", header.size, | 65 | if ((header.type != 0x45444F43) || /* "CODE" */ |
99 | (unsigned long)ps_firmware->size); | 66 | (header.adapter != adapter) |
67 | || (header.size != firmware->size)) { | ||
68 | dev_printk(KERN_ERR, &dev->dev, "Invalid firmware file\n"); | ||
100 | goto error2; | 69 | goto error2; |
101 | } | 70 | } |
102 | 71 | ||
103 | if (header.version / 100 != HPI_VER_DECIMAL / 100) { | 72 | if ((header.version / 100 & ~1) != (HPI_VER_DECIMAL / 100 & ~1)) { |
104 | dev_printk(KERN_ERR, &ps_dsp_code->ps_dev->dev, | 73 | dev_printk(KERN_ERR, &dev->dev, |
105 | "Incompatible firmware version " | 74 | "Incompatible firmware version " |
106 | "DSP image %d != Driver %d\n", header.version, | 75 | "DSP image %d != Driver %d\n", header.version, |
107 | HPI_VER_DECIMAL); | 76 | HPI_VER_DECIMAL); |
@@ -109,67 +78,70 @@ short hpi_dsp_code_open(u32 adapter, struct dsp_code *ps_dsp_code, | |||
109 | } | 78 | } |
110 | 79 | ||
111 | if (header.version != HPI_VER_DECIMAL) { | 80 | if (header.version != HPI_VER_DECIMAL) { |
112 | dev_printk(KERN_WARNING, &ps_dsp_code->ps_dev->dev, | 81 | dev_printk(KERN_WARNING, &dev->dev, |
113 | "Firmware: release version mismatch DSP image %d != Driver %d\n", | 82 | "Firmware: release version mismatch DSP image %d != Driver %d\n", |
114 | header.version, HPI_VER_DECIMAL); | 83 | header.version, HPI_VER_DECIMAL); |
115 | } | 84 | } |
116 | 85 | ||
117 | HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); | 86 | HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); |
118 | ps_dsp_code->ps_firmware = ps_firmware; | 87 | dsp_code->pvt = kmalloc(sizeof(*dsp_code->pvt), GFP_KERNEL); |
119 | ps_dsp_code->block_length = header.size / sizeof(u32); | 88 | if (!dsp_code->pvt) |
120 | ps_dsp_code->word_count = sizeof(header) / sizeof(u32); | 89 | return HPI_ERROR_MEMORY_ALLOC; |
121 | ps_dsp_code->version = header.version; | 90 | |
122 | ps_dsp_code->crc = header.crc; | 91 | dsp_code->pvt->dev = dev; |
92 | dsp_code->pvt->firmware = firmware; | ||
93 | dsp_code->header = header; | ||
94 | dsp_code->block_length = header.size / sizeof(u32); | ||
95 | dsp_code->word_count = sizeof(header) / sizeof(u32); | ||
123 | return 0; | 96 | return 0; |
124 | 97 | ||
125 | error2: | 98 | error2: |
126 | release_firmware(ps_firmware); | 99 | release_firmware(firmware); |
127 | error1: | 100 | error1: |
128 | ps_dsp_code->ps_firmware = NULL; | 101 | dsp_code->block_length = 0; |
129 | ps_dsp_code->block_length = 0; | ||
130 | return HPI_ERROR_DSP_FILE_NOT_FOUND; | 102 | return HPI_ERROR_DSP_FILE_NOT_FOUND; |
131 | } | 103 | } |
132 | 104 | ||
133 | /*-------------------------------------------------------------------*/ | 105 | /*-------------------------------------------------------------------*/ |
134 | void hpi_dsp_code_close(struct dsp_code *ps_dsp_code) | 106 | void hpi_dsp_code_close(struct dsp_code *dsp_code) |
135 | { | 107 | { |
136 | if (ps_dsp_code->ps_firmware != NULL) { | 108 | if (dsp_code->pvt->firmware) { |
137 | HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); | 109 | HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); |
138 | release_firmware(ps_dsp_code->ps_firmware); | 110 | release_firmware(dsp_code->pvt->firmware); |
139 | ps_dsp_code->ps_firmware = NULL; | 111 | dsp_code->pvt->firmware = NULL; |
140 | } | 112 | } |
113 | kfree(dsp_code->pvt); | ||
141 | } | 114 | } |
142 | 115 | ||
143 | /*-------------------------------------------------------------------*/ | 116 | /*-------------------------------------------------------------------*/ |
144 | void hpi_dsp_code_rewind(struct dsp_code *ps_dsp_code) | 117 | void hpi_dsp_code_rewind(struct dsp_code *dsp_code) |
145 | { | 118 | { |
146 | /* Go back to start of data, after header */ | 119 | /* Go back to start of data, after header */ |
147 | ps_dsp_code->word_count = sizeof(struct code_header) / sizeof(u32); | 120 | dsp_code->word_count = sizeof(struct code_header) / sizeof(u32); |
148 | } | 121 | } |
149 | 122 | ||
150 | /*-------------------------------------------------------------------*/ | 123 | /*-------------------------------------------------------------------*/ |
151 | short hpi_dsp_code_read_word(struct dsp_code *ps_dsp_code, u32 *pword) | 124 | short hpi_dsp_code_read_word(struct dsp_code *dsp_code, u32 *pword) |
152 | { | 125 | { |
153 | if (ps_dsp_code->word_count + 1 > ps_dsp_code->block_length) | 126 | if (dsp_code->word_count + 1 > dsp_code->block_length) |
154 | return HPI_ERROR_DSP_FILE_FORMAT; | 127 | return HPI_ERROR_DSP_FILE_FORMAT; |
155 | 128 | ||
156 | *pword = ((u32 *)(ps_dsp_code->ps_firmware->data))[ps_dsp_code-> | 129 | *pword = ((u32 *)(dsp_code->pvt->firmware->data))[dsp_code-> |
157 | word_count]; | 130 | word_count]; |
158 | ps_dsp_code->word_count++; | 131 | dsp_code->word_count++; |
159 | return 0; | 132 | return 0; |
160 | } | 133 | } |
161 | 134 | ||
162 | /*-------------------------------------------------------------------*/ | 135 | /*-------------------------------------------------------------------*/ |
163 | short hpi_dsp_code_read_block(size_t words_requested, | 136 | short hpi_dsp_code_read_block(size_t words_requested, |
164 | struct dsp_code *ps_dsp_code, u32 **ppblock) | 137 | struct dsp_code *dsp_code, u32 **ppblock) |
165 | { | 138 | { |
166 | if (ps_dsp_code->word_count + words_requested > | 139 | if (dsp_code->word_count + words_requested > dsp_code->block_length) |
167 | ps_dsp_code->block_length) | ||
168 | return HPI_ERROR_DSP_FILE_FORMAT; | 140 | return HPI_ERROR_DSP_FILE_FORMAT; |
169 | 141 | ||
170 | *ppblock = | 142 | *ppblock = |
171 | ((u32 *)(ps_dsp_code->ps_firmware->data)) + | 143 | ((u32 *)(dsp_code->pvt->firmware->data)) + |
172 | ps_dsp_code->word_count; | 144 | dsp_code->word_count; |
173 | ps_dsp_code->word_count += words_requested; | 145 | dsp_code->word_count += words_requested; |
174 | return 0; | 146 | return 0; |
175 | } | 147 | } |
diff --git a/sound/pci/asihpi/hpidspcd.h b/sound/pci/asihpi/hpidspcd.h index 65f0ca732704..b22881122f19 100644 --- a/sound/pci/asihpi/hpidspcd.h +++ b/sound/pci/asihpi/hpidspcd.h | |||
@@ -2,7 +2,7 @@ | |||
2 | /** | 2 | /** |
3 | 3 | ||
4 | AudioScience HPI driver | 4 | AudioScience HPI driver |
5 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 5 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of version 2 of the GNU General Public License as | 8 | it under the terms of version 2 of the GNU General Public License as |
@@ -20,19 +20,6 @@ | |||
20 | \file | 20 | \file |
21 | Functions for reading DSP code to load into DSP | 21 | Functions for reading DSP code to load into DSP |
22 | 22 | ||
23 | hpi_dspcode_defines HPI DSP code loading method | ||
24 | Define exactly one of these to select how the DSP code is supplied to | ||
25 | the adapter. | ||
26 | |||
27 | End users writing applications that use the HPI interface do not have to | ||
28 | use any of the below defines; they are only necessary for building drivers | ||
29 | |||
30 | HPI_DSPCODE_FILE: | ||
31 | DSP code is supplied as a file that is opened and read from by the driver. | ||
32 | |||
33 | HPI_DSPCODE_FIRMWARE: | ||
34 | DSP code is read using the hotplug firmware loader module. | ||
35 | Only valid when compiling the HPI kernel driver under Linux. | ||
36 | */ | 23 | */ |
37 | /***********************************************************************/ | 24 | /***********************************************************************/ |
38 | #ifndef _HPIDSPCD_H_ | 25 | #ifndef _HPIDSPCD_H_ |
@@ -40,37 +27,56 @@ DSP code is read using the hotplug firmware loader module. | |||
40 | 27 | ||
41 | #include "hpi_internal.h" | 28 | #include "hpi_internal.h" |
42 | 29 | ||
43 | #ifndef DISABLE_PRAGMA_PACK1 | 30 | /** Code header version is decimal encoded e.g. 4.06.10 is 40601 */ |
44 | #pragma pack(push, 1) | 31 | #define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ |
45 | #endif | 32 | HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) |
33 | |||
34 | /** Header structure for dsp firmware file | ||
35 | This structure must match that used in s2bin.c for generation of asidsp.bin | ||
36 | */ | ||
37 | /*#ifndef DISABLE_PRAGMA_PACK1 */ | ||
38 | /*#pragma pack(push, 1) */ | ||
39 | /*#endif */ | ||
40 | struct code_header { | ||
41 | /** Size in bytes including header */ | ||
42 | u32 size; | ||
43 | /** File type tag "CODE" == 0x45444F43 */ | ||
44 | u32 type; | ||
45 | /** Adapter model number */ | ||
46 | u32 adapter; | ||
47 | /** Firmware version*/ | ||
48 | u32 version; | ||
49 | /** Data checksum */ | ||
50 | u32 checksum; | ||
51 | }; | ||
52 | /*#ifndef DISABLE_PRAGMA_PACK1 */ | ||
53 | /*#pragma pack(pop) */ | ||
54 | /*#endif */ | ||
55 | |||
56 | /*? Don't need the pragmas? */ | ||
57 | compile_time_assert((sizeof(struct code_header) == 20), code_header_size); | ||
46 | 58 | ||
47 | /** Descriptor for dspcode from firmware loader */ | 59 | /** Descriptor for dspcode from firmware loader */ |
48 | struct dsp_code { | 60 | struct dsp_code { |
49 | /** Firmware descriptor */ | 61 | /** copy of file header */ |
50 | const struct firmware *ps_firmware; | 62 | struct code_header header; |
51 | struct pci_dev *ps_dev; | ||
52 | /** Expected number of words in the whole dsp code,INCL header */ | 63 | /** Expected number of words in the whole dsp code,INCL header */ |
53 | long int block_length; | 64 | u32 block_length; |
54 | /** Number of words read so far */ | 65 | /** Number of words read so far */ |
55 | long int word_count; | 66 | u32 word_count; |
56 | /** Version read from dsp code file */ | ||
57 | u32 version; | ||
58 | /** CRC read from dsp code file */ | ||
59 | u32 crc; | ||
60 | }; | ||
61 | 67 | ||
62 | #ifndef DISABLE_PRAGMA_PACK1 | 68 | /** internal state of DSP code reader */ |
63 | #pragma pack(pop) | 69 | struct dsp_code_private *pvt; |
64 | #endif | 70 | }; |
65 | 71 | ||
66 | /** Prepare *psDspCode to refer to the requuested adapter. | 72 | /** Prepare *psDspCode to refer to the requested adapter's firmware. |
67 | Searches the file, or selects the appropriate linked array | 73 | Code file name is obtained from HpiOs_GetDspCodePath |
68 | 74 | ||
69 | \return 0 for success, or error code if requested code is not available | 75 | \return 0 for success, or error code if requested code is not available |
70 | */ | 76 | */ |
71 | short hpi_dsp_code_open( | 77 | short hpi_dsp_code_open( |
72 | /** Code identifier, usually adapter family */ | 78 | /** Code identifier, usually adapter family */ |
73 | u32 adapter, | 79 | u32 adapter, void *pci_dev, |
74 | /** Pointer to DSP code control structure */ | 80 | /** Pointer to DSP code control structure */ |
75 | struct dsp_code *ps_dsp_code, | 81 | struct dsp_code *ps_dsp_code, |
76 | /** Pointer to dword to receive OS specific error code */ | 82 | /** Pointer to dword to receive OS specific error code */ |
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c index 7397b169b89f..ebb568d695f1 100644 --- a/sound/pci/asihpi/hpifunc.c +++ b/sound/pci/asihpi/hpifunc.c | |||
@@ -1663,68 +1663,64 @@ u16 hpi_channel_mode_get(u32 h_control, u16 *mode) | |||
1663 | u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, | 1663 | u16 hpi_cobranet_hmi_write(u32 h_control, u32 hmi_address, u32 byte_count, |
1664 | u8 *pb_data) | 1664 | u8 *pb_data) |
1665 | { | 1665 | { |
1666 | struct hpi_message hm; | 1666 | struct hpi_msg_cobranet_hmiwrite hm; |
1667 | struct hpi_response hr; | 1667 | struct hpi_response_header hr; |
1668 | 1668 | ||
1669 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, | 1669 | hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr, sizeof(hr), |
1670 | HPI_CONTROL_SET_STATE); | 1670 | HPI_OBJ_CONTROL, HPI_CONTROL_SET_STATE); |
1671 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) | ||
1672 | return HPI_ERROR_INVALID_HANDLE; | ||
1673 | 1671 | ||
1674 | hm.u.cx.u.cobranet_data.byte_count = byte_count; | 1672 | if (hpi_handle_indexes(h_control, &hm.h.adapter_index, |
1675 | hm.u.cx.u.cobranet_data.hmi_address = hmi_address; | 1673 | &hm.h.obj_index)) |
1674 | return HPI_ERROR_INVALID_HANDLE; | ||
1676 | 1675 | ||
1677 | if (byte_count <= 8) { | 1676 | if (byte_count > sizeof(hm.bytes)) |
1678 | memcpy(hm.u.cx.u.cobranet_data.data, pb_data, byte_count); | 1677 | return HPI_ERROR_MESSAGE_BUFFER_TOO_SMALL; |
1679 | hm.u.cx.attribute = HPI_COBRANET_SET; | ||
1680 | } else { | ||
1681 | hm.u.cx.u.cobranet_bigdata.pb_data = pb_data; | ||
1682 | hm.u.cx.attribute = HPI_COBRANET_SET_DATA; | ||
1683 | } | ||
1684 | 1678 | ||
1685 | hpi_send_recv(&hm, &hr); | 1679 | hm.p.attribute = HPI_COBRANET_SET; |
1680 | hm.p.byte_count = byte_count; | ||
1681 | hm.p.hmi_address = hmi_address; | ||
1682 | memcpy(hm.bytes, pb_data, byte_count); | ||
1683 | hm.h.size = (u16)(sizeof(hm.h) + sizeof(hm.p) + byte_count); | ||
1686 | 1684 | ||
1685 | hpi_send_recvV1(&hm.h, &hr); | ||
1687 | return hr.error; | 1686 | return hr.error; |
1688 | } | 1687 | } |
1689 | 1688 | ||
1690 | u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count, | 1689 | u16 hpi_cobranet_hmi_read(u32 h_control, u32 hmi_address, u32 max_byte_count, |
1691 | u32 *pbyte_count, u8 *pb_data) | 1690 | u32 *pbyte_count, u8 *pb_data) |
1692 | { | 1691 | { |
1693 | struct hpi_message hm; | 1692 | struct hpi_msg_cobranet_hmiread hm; |
1694 | struct hpi_response hr; | 1693 | struct hpi_res_cobranet_hmiread hr; |
1695 | 1694 | ||
1696 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, | 1695 | hpi_init_message_responseV1(&hm.h, sizeof(hm), &hr.h, sizeof(hr), |
1697 | HPI_CONTROL_GET_STATE); | 1696 | HPI_OBJ_CONTROL, HPI_CONTROL_GET_STATE); |
1698 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) | 1697 | |
1698 | if (hpi_handle_indexes(h_control, &hm.h.adapter_index, | ||
1699 | &hm.h.obj_index)) | ||
1699 | return HPI_ERROR_INVALID_HANDLE; | 1700 | return HPI_ERROR_INVALID_HANDLE; |
1700 | 1701 | ||
1701 | hm.u.cx.u.cobranet_data.byte_count = max_byte_count; | 1702 | if (max_byte_count > sizeof(hr.bytes)) |
1702 | hm.u.cx.u.cobranet_data.hmi_address = hmi_address; | 1703 | return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL; |
1703 | 1704 | ||
1704 | if (max_byte_count <= 8) { | 1705 | hm.p.attribute = HPI_COBRANET_GET; |
1705 | hm.u.cx.attribute = HPI_COBRANET_GET; | 1706 | hm.p.byte_count = max_byte_count; |
1706 | } else { | 1707 | hm.p.hmi_address = hmi_address; |
1707 | hm.u.cx.u.cobranet_bigdata.pb_data = pb_data; | ||
1708 | hm.u.cx.attribute = HPI_COBRANET_GET_DATA; | ||
1709 | } | ||
1710 | 1708 | ||
1711 | hpi_send_recv(&hm, &hr); | 1709 | hpi_send_recvV1(&hm.h, &hr.h); |
1712 | if (!hr.error && pb_data) { | ||
1713 | 1710 | ||
1714 | *pbyte_count = hr.u.cx.u.cobranet_data.byte_count; | 1711 | if (!hr.h.error && pb_data) { |
1712 | if (hr.byte_count > sizeof(hr.bytes)) | ||
1715 | 1713 | ||
1716 | if (*pbyte_count < max_byte_count) | 1714 | return HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL; |
1717 | max_byte_count = *pbyte_count; | ||
1718 | 1715 | ||
1719 | if (hm.u.cx.attribute == HPI_COBRANET_GET) { | 1716 | *pbyte_count = hr.byte_count; |
1720 | memcpy(pb_data, hr.u.cx.u.cobranet_data.data, | ||
1721 | max_byte_count); | ||
1722 | } else { | ||
1723 | 1717 | ||
1724 | } | 1718 | if (hr.byte_count < max_byte_count) |
1719 | max_byte_count = *pbyte_count; | ||
1725 | 1720 | ||
1721 | memcpy(pb_data, hr.bytes, max_byte_count); | ||
1726 | } | 1722 | } |
1727 | return hr.error; | 1723 | return hr.h.error; |
1728 | } | 1724 | } |
1729 | 1725 | ||
1730 | u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, | 1726 | u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, |
@@ -1733,23 +1729,23 @@ u16 hpi_cobranet_hmi_get_status(u32 h_control, u32 *pstatus, | |||
1733 | struct hpi_message hm; | 1729 | struct hpi_message hm; |
1734 | struct hpi_response hr; | 1730 | struct hpi_response hr; |
1735 | 1731 | ||
1736 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, | 1732 | hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, |
1737 | HPI_CONTROL_GET_STATE); | 1733 | HPI_CONTROL_GET_STATE); |
1738 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) | 1734 | if (hpi_handle_indexes(h_control, &hm.adapter_index, &hm.obj_index)) |
1739 | return HPI_ERROR_INVALID_HANDLE; | 1735 | return HPI_ERROR_INVALID_HANDLE; |
1740 | 1736 | ||
1741 | hm.u.cx.attribute = HPI_COBRANET_GET_STATUS; | 1737 | hm.u.c.attribute = HPI_COBRANET_GET_STATUS; |
1742 | 1738 | ||
1743 | hpi_send_recv(&hm, &hr); | 1739 | hpi_send_recv(&hm, &hr); |
1744 | if (!hr.error) { | 1740 | if (!hr.error) { |
1745 | if (pstatus) | 1741 | if (pstatus) |
1746 | *pstatus = hr.u.cx.u.cobranet_status.status; | 1742 | *pstatus = hr.u.cu.cobranet.status.status; |
1747 | if (preadable_size) | 1743 | if (preadable_size) |
1748 | *preadable_size = | 1744 | *preadable_size = |
1749 | hr.u.cx.u.cobranet_status.readable_size; | 1745 | hr.u.cu.cobranet.status.readable_size; |
1750 | if (pwriteable_size) | 1746 | if (pwriteable_size) |
1751 | *pwriteable_size = | 1747 | *pwriteable_size = |
1752 | hr.u.cx.u.cobranet_status.writeable_size; | 1748 | hr.u.cu.cobranet.status.writeable_size; |
1753 | } | 1749 | } |
1754 | return hr.error; | 1750 | return hr.error; |
1755 | } | 1751 | } |
diff --git a/sound/pci/asihpi/hpimsginit.c b/sound/pci/asihpi/hpimsginit.c index 628376ce4a49..52400a6b5f15 100644 --- a/sound/pci/asihpi/hpimsginit.c +++ b/sound/pci/asihpi/hpimsginit.c | |||
@@ -46,7 +46,7 @@ static void hpi_init_message(struct hpi_message *phm, u16 object, | |||
46 | if (gwSSX2_bypass) | 46 | if (gwSSX2_bypass) |
47 | phm->type = HPI_TYPE_SSX2BYPASS_MESSAGE; | 47 | phm->type = HPI_TYPE_SSX2BYPASS_MESSAGE; |
48 | else | 48 | else |
49 | phm->type = HPI_TYPE_MESSAGE; | 49 | phm->type = HPI_TYPE_REQUEST; |
50 | phm->object = object; | 50 | phm->object = object; |
51 | phm->function = function; | 51 | phm->function = function; |
52 | phm->version = 0; | 52 | phm->version = 0; |
@@ -89,7 +89,7 @@ static void hpi_init_messageV1(struct hpi_message_header *phm, u16 size, | |||
89 | memset(phm, 0, sizeof(*phm)); | 89 | memset(phm, 0, sizeof(*phm)); |
90 | if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) { | 90 | if ((object > 0) && (object <= HPI_OBJ_MAXINDEX)) { |
91 | phm->size = size; | 91 | phm->size = size; |
92 | phm->type = HPI_TYPE_MESSAGE; | 92 | phm->type = HPI_TYPE_REQUEST; |
93 | phm->object = object; | 93 | phm->object = object; |
94 | phm->function = function; | 94 | phm->function = function; |
95 | phm->version = 1; | 95 | phm->version = 1; |
diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c index 7352a5f7b4f7..2e779421a618 100644 --- a/sound/pci/asihpi/hpimsgx.c +++ b/sound/pci/asihpi/hpimsgx.c | |||
@@ -16,7 +16,7 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | 18 | ||
19 | Extended Message Function With Response Cacheing | 19 | Extended Message Function With Response Caching |
20 | 20 | ||
21 | (C) Copyright AudioScience Inc. 2002 | 21 | (C) Copyright AudioScience Inc. 2002 |
22 | *****************************************************************************/ | 22 | *****************************************************************************/ |
@@ -186,7 +186,6 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr, | |||
186 | /* Initialize this module's internal state */ | 186 | /* Initialize this module's internal state */ |
187 | hpios_msgxlock_init(&msgx_lock); | 187 | hpios_msgxlock_init(&msgx_lock); |
188 | memset(&hpi_entry_points, 0, sizeof(hpi_entry_points)); | 188 | memset(&hpi_entry_points, 0, sizeof(hpi_entry_points)); |
189 | hpios_locked_mem_init(); | ||
190 | /* Init subsys_findadapters response to no-adapters */ | 189 | /* Init subsys_findadapters response to no-adapters */ |
191 | HPIMSGX__reset(HPIMSGX_ALLADAPTERS); | 190 | HPIMSGX__reset(HPIMSGX_ALLADAPTERS); |
192 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, | 191 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, |
@@ -197,7 +196,6 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr, | |||
197 | case HPI_SUBSYS_DRIVER_UNLOAD: | 196 | case HPI_SUBSYS_DRIVER_UNLOAD: |
198 | HPI_COMMON(phm, phr); | 197 | HPI_COMMON(phm, phr); |
199 | HPIMSGX__cleanup(HPIMSGX_ALLADAPTERS, h_owner); | 198 | HPIMSGX__cleanup(HPIMSGX_ALLADAPTERS, h_owner); |
200 | hpios_locked_mem_free_all(); | ||
201 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, | 199 | hpi_init_response(phr, HPI_OBJ_SUBSYSTEM, |
202 | HPI_SUBSYS_DRIVER_UNLOAD, 0); | 200 | HPI_SUBSYS_DRIVER_UNLOAD, 0); |
203 | return; | 201 | return; |
@@ -315,7 +313,7 @@ void hpi_send_recv_ex(struct hpi_message *phm, struct hpi_response *phr, | |||
315 | { | 313 | { |
316 | HPI_DEBUG_MESSAGE(DEBUG, phm); | 314 | HPI_DEBUG_MESSAGE(DEBUG, phm); |
317 | 315 | ||
318 | if (phm->type != HPI_TYPE_MESSAGE) { | 316 | if (phm->type != HPI_TYPE_REQUEST) { |
319 | hpi_init_response(phr, phm->object, phm->function, | 317 | hpi_init_response(phr, phm->object, phm->function, |
320 | HPI_ERROR_INVALID_TYPE); | 318 | HPI_ERROR_INVALID_TYPE); |
321 | return; | 319 | return; |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index d8e7047512f8..65fcf4770731 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | 2 | ||
3 | AudioScience HPI driver | 3 | AudioScience HPI driver |
4 | Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> | 4 | Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of version 2 of the GNU General Public License as | 7 | it under the terms of version 2 of the GNU General Public License as |
@@ -157,11 +157,6 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
157 | goto out; | 157 | goto out; |
158 | } | 158 | } |
159 | 159 | ||
160 | if (hm->h.adapter_index >= HPI_MAX_ADAPTERS) { | ||
161 | err = -EINVAL; | ||
162 | goto out; | ||
163 | } | ||
164 | |||
165 | switch (hm->h.function) { | 160 | switch (hm->h.function) { |
166 | case HPI_SUBSYS_CREATE_ADAPTER: | 161 | case HPI_SUBSYS_CREATE_ADAPTER: |
167 | case HPI_ADAPTER_DELETE: | 162 | case HPI_ADAPTER_DELETE: |
@@ -187,7 +182,6 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
187 | /* -1=no data 0=read from user mem, 1=write to user mem */ | 182 | /* -1=no data 0=read from user mem, 1=write to user mem */ |
188 | int wrflag = -1; | 183 | int wrflag = -1; |
189 | u32 adapter = hm->h.adapter_index; | 184 | u32 adapter = hm->h.adapter_index; |
190 | pa = &adapters[adapter]; | ||
191 | 185 | ||
192 | if ((adapter > HPI_MAX_ADAPTERS) || (!pa->type)) { | 186 | if ((adapter > HPI_MAX_ADAPTERS) || (!pa->type)) { |
193 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, | 187 | hpi_init_response(&hr->r0, HPI_OBJ_ADAPTER, |
@@ -203,6 +197,8 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
203 | goto out; | 197 | goto out; |
204 | } | 198 | } |
205 | 199 | ||
200 | pa = &adapters[adapter]; | ||
201 | |||
206 | if (mutex_lock_interruptible(&adapters[adapter].mutex)) { | 202 | if (mutex_lock_interruptible(&adapters[adapter].mutex)) { |
207 | err = -EINTR; | 203 | err = -EINTR; |
208 | goto out; | 204 | goto out; |
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c index 742ee12a9e17..ff2a19b544fa 100644 --- a/sound/pci/asihpi/hpios.c +++ b/sound/pci/asihpi/hpios.c | |||
@@ -39,10 +39,6 @@ void hpios_delay_micro_seconds(u32 num_micro_sec) | |||
39 | 39 | ||
40 | } | 40 | } |
41 | 41 | ||
42 | void hpios_locked_mem_init(void) | ||
43 | { | ||
44 | } | ||
45 | |||
46 | /** Allocated an area of locked memory for bus master DMA operations. | 42 | /** Allocated an area of locked memory for bus master DMA operations. |
47 | 43 | ||
48 | On error, return -ENOMEM, and *pMemArea.size = 0 | 44 | On error, return -ENOMEM, and *pMemArea.size = 0 |
@@ -85,7 +81,3 @@ u16 hpios_locked_mem_free(struct consistent_dma_area *p_mem_area) | |||
85 | return 1; | 81 | return 1; |
86 | } | 82 | } |
87 | } | 83 | } |
88 | |||
89 | void hpios_locked_mem_free_all(void) | ||
90 | { | ||
91 | } | ||
diff --git a/sound/pci/asihpi/hpios.h b/sound/pci/asihpi/hpios.h index 03273e729f99..2f605e34bad0 100644 --- a/sound/pci/asihpi/hpios.h +++ b/sound/pci/asihpi/hpios.h | |||
@@ -38,6 +38,7 @@ HPI Operating System Specific macros for Linux Kernel driver | |||
38 | #include <linux/firmware.h> | 38 | #include <linux/firmware.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
41 | #include <linux/mutex.h> | ||
41 | 42 | ||
42 | #define HPI_NO_OS_FILE_OPS | 43 | #define HPI_NO_OS_FILE_OPS |
43 | 44 | ||
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 3119cd97a217..537e0a2cc68a 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1624,7 +1624,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1624 | } | 1624 | } |
1625 | 1625 | ||
1626 | if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, | 1626 | if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, |
1627 | card->shortname, chip)) { | 1627 | KBUILD_MODNAME, chip)) { |
1628 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1628 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1629 | snd_atiixp_free(chip); | 1629 | snd_atiixp_free(chip); |
1630 | return -EBUSY; | 1630 | return -EBUSY; |
@@ -1701,7 +1701,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci) | |||
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | static struct pci_driver driver = { | 1703 | static struct pci_driver driver = { |
1704 | .name = "ATI IXP AC97 controller", | 1704 | .name = KBUILD_MODNAME, |
1705 | .id_table = snd_atiixp_ids, | 1705 | .id_table = snd_atiixp_ids, |
1706 | .probe = snd_atiixp_probe, | 1706 | .probe = snd_atiixp_probe, |
1707 | .remove = __devexit_p(snd_atiixp_remove), | 1707 | .remove = __devexit_p(snd_atiixp_remove), |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 2f74c2fdf1ea..45df275c8248 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -1260,7 +1260,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, | 1262 | if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED, |
1263 | card->shortname, chip)) { | 1263 | KBUILD_MODNAME, chip)) { |
1264 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1264 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1265 | snd_atiixp_free(chip); | 1265 | snd_atiixp_free(chip); |
1266 | return -EBUSY; | 1266 | return -EBUSY; |
@@ -1332,7 +1332,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci) | |||
1332 | } | 1332 | } |
1333 | 1333 | ||
1334 | static struct pci_driver driver = { | 1334 | static struct pci_driver driver = { |
1335 | .name = "ATI IXP MC97 controller", | 1335 | .name = KBUILD_MODNAME, |
1336 | .id_table = snd_atiixp_ids, | 1336 | .id_table = snd_atiixp_ids, |
1337 | .probe = snd_atiixp_probe, | 1337 | .probe = snd_atiixp_probe, |
1338 | .remove = __devexit_p(snd_atiixp_remove), | 1338 | .remove = __devexit_p(snd_atiixp_remove), |
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index 7b72c88e449d..a38469986885 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -196,7 +196,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | if ((err = request_irq(pci->irq, vortex_interrupt, | 198 | if ((err = request_irq(pci->irq, vortex_interrupt, |
199 | IRQF_SHARED, CARD_NAME_SHORT, | 199 | IRQF_SHARED, KBUILD_MODNAME, |
200 | chip)) != 0) { | 200 | chip)) != 0) { |
201 | printk(KERN_ERR "cannot grab irq\n"); | 201 | printk(KERN_ERR "cannot grab irq\n"); |
202 | goto irq_out; | 202 | goto irq_out; |
@@ -375,7 +375,7 @@ static void __devexit snd_vortex_remove(struct pci_dev *pci) | |||
375 | 375 | ||
376 | // pci_driver definition | 376 | // pci_driver definition |
377 | static struct pci_driver driver = { | 377 | static struct pci_driver driver = { |
378 | .name = CARD_NAME_SHORT, | 378 | .name = KBUILD_MODNAME, |
379 | .id_table = snd_vortex_ids, | 379 | .id_table = snd_vortex_ids, |
380 | .probe = snd_vortex_probe, | 380 | .probe = snd_vortex_probe, |
381 | .remove = __devexit_p(snd_vortex_remove), | 381 | .remove = __devexit_p(snd_vortex_remove), |
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index c15002242d98..f8569b11331b 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c | |||
@@ -171,7 +171,7 @@ MODULE_DEVICE_TABLE(pci, snd_aw2_ids); | |||
171 | 171 | ||
172 | /* pci_driver definition */ | 172 | /* pci_driver definition */ |
173 | static struct pci_driver driver = { | 173 | static struct pci_driver driver = { |
174 | .name = "Emagic Audiowerk 2", | 174 | .name = KBUILD_MODNAME, |
175 | .id_table = snd_aw2_ids, | 175 | .id_table = snd_aw2_ids, |
176 | .probe = snd_aw2_probe, | 176 | .probe = snd_aw2_probe, |
177 | .remove = __devexit_p(snd_aw2_remove), | 177 | .remove = __devexit_p(snd_aw2_remove), |
@@ -317,7 +317,7 @@ static int __devinit snd_aw2_create(struct snd_card *card, | |||
317 | snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt); | 317 | snd_aw2_saa7146_setup(&chip->saa7146, chip->iobase_virt); |
318 | 318 | ||
319 | if (request_irq(pci->irq, snd_aw2_saa7146_interrupt, | 319 | if (request_irq(pci->irq, snd_aw2_saa7146_interrupt, |
320 | IRQF_SHARED, "Audiowerk2", chip)) { | 320 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
321 | printk(KERN_ERR "aw2: Cannot grab irq %d\n", pci->irq); | 321 | printk(KERN_ERR "aw2: Cannot grab irq %d\n", pci->irq); |
322 | 322 | ||
323 | iounmap(chip->iobase_virt); | 323 | iounmap(chip->iobase_virt); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 9b7a6346037a..e4d76a270c9f 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -2559,7 +2559,7 @@ snd_azf3328_create(struct snd_card *card, | |||
2559 | codec_setup->name = "I2S_OUT"; | 2559 | codec_setup->name = "I2S_OUT"; |
2560 | 2560 | ||
2561 | if (request_irq(pci->irq, snd_azf3328_interrupt, | 2561 | if (request_irq(pci->irq, snd_azf3328_interrupt, |
2562 | IRQF_SHARED, card->shortname, chip)) { | 2562 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
2563 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2563 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2564 | err = -EBUSY; | 2564 | err = -EBUSY; |
2565 | goto out_err; | 2565 | goto out_err; |
@@ -2860,7 +2860,7 @@ snd_azf3328_resume(struct pci_dev *pci) | |||
2860 | 2860 | ||
2861 | 2861 | ||
2862 | static struct pci_driver driver = { | 2862 | static struct pci_driver driver = { |
2863 | .name = "AZF3328", | 2863 | .name = KBUILD_MODNAME, |
2864 | .id_table = snd_azf3328_ids, | 2864 | .id_table = snd_azf3328_ids, |
2865 | .probe = snd_azf3328_probe, | 2865 | .probe = snd_azf3328_probe, |
2866 | .remove = __devexit_p(snd_azf3328_remove), | 2866 | .remove = __devexit_p(snd_azf3328_remove), |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 2958a05b5293..39180335c237 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -760,7 +760,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card, | |||
760 | snd_bt87x_writel(chip, REG_INT_STAT, MY_INTERRUPTS); | 760 | snd_bt87x_writel(chip, REG_INT_STAT, MY_INTERRUPTS); |
761 | 761 | ||
762 | err = request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED, | 762 | err = request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED, |
763 | "Bt87x audio", chip); | 763 | KBUILD_MODNAME, chip); |
764 | if (err < 0) { | 764 | if (err < 0) { |
765 | snd_printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | 765 | snd_printk(KERN_ERR "cannot grab irq %d\n", pci->irq); |
766 | goto fail; | 766 | goto fail; |
@@ -965,7 +965,7 @@ static DEFINE_PCI_DEVICE_TABLE(snd_bt87x_default_ids) = { | |||
965 | }; | 965 | }; |
966 | 966 | ||
967 | static struct pci_driver driver = { | 967 | static struct pci_driver driver = { |
968 | .name = "Bt87x", | 968 | .name = KBUILD_MODNAME, |
969 | .id_table = snd_bt87x_ids, | 969 | .id_table = snd_bt87x_ids, |
970 | .probe = snd_bt87x_probe, | 970 | .probe = snd_bt87x_probe, |
971 | .remove = __devexit_p(snd_bt87x_remove), | 971 | .remove = __devexit_p(snd_bt87x_remove), |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 437759239694..061b7e654586 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -1666,7 +1666,7 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card, | |||
1666 | } | 1666 | } |
1667 | 1667 | ||
1668 | if (request_irq(pci->irq, snd_ca0106_interrupt, | 1668 | if (request_irq(pci->irq, snd_ca0106_interrupt, |
1669 | IRQF_SHARED, "snd_ca0106", chip)) { | 1669 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1670 | snd_ca0106_free(chip); | 1670 | snd_ca0106_free(chip); |
1671 | printk(KERN_ERR "cannot grab irq\n"); | 1671 | printk(KERN_ERR "cannot grab irq\n"); |
1672 | return -EBUSY; | 1672 | return -EBUSY; |
@@ -1933,7 +1933,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids); | |||
1933 | 1933 | ||
1934 | // pci_driver definition | 1934 | // pci_driver definition |
1935 | static struct pci_driver driver = { | 1935 | static struct pci_driver driver = { |
1936 | .name = "CA0106", | 1936 | .name = KBUILD_MODNAME, |
1937 | .id_table = snd_ca0106_ids, | 1937 | .id_table = snd_ca0106_ids, |
1938 | .probe = snd_ca0106_probe, | 1938 | .probe = snd_ca0106_probe, |
1939 | .remove = __devexit_p(snd_ca0106_remove), | 1939 | .remove = __devexit_p(snd_ca0106_remove), |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index f4e573555da3..9cf99fb7eb9c 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -3053,7 +3053,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc | |||
3053 | cm->iobase = pci_resource_start(pci, 0); | 3053 | cm->iobase = pci_resource_start(pci, 0); |
3054 | 3054 | ||
3055 | if (request_irq(pci->irq, snd_cmipci_interrupt, | 3055 | if (request_irq(pci->irq, snd_cmipci_interrupt, |
3056 | IRQF_SHARED, card->driver, cm)) { | 3056 | IRQF_SHARED, KBUILD_MODNAME, cm)) { |
3057 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 3057 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
3058 | snd_cmipci_free(cm); | 3058 | snd_cmipci_free(cm); |
3059 | return -EBUSY; | 3059 | return -EBUSY; |
@@ -3398,7 +3398,7 @@ static int snd_cmipci_resume(struct pci_dev *pci) | |||
3398 | #endif /* CONFIG_PM */ | 3398 | #endif /* CONFIG_PM */ |
3399 | 3399 | ||
3400 | static struct pci_driver driver = { | 3400 | static struct pci_driver driver = { |
3401 | .name = "C-Media PCI", | 3401 | .name = KBUILD_MODNAME, |
3402 | .id_table = snd_cmipci_ids, | 3402 | .id_table = snd_cmipci_ids, |
3403 | .probe = snd_cmipci_probe, | 3403 | .probe = snd_cmipci_probe, |
3404 | .remove = __devexit_p(snd_cmipci_remove), | 3404 | .remove = __devexit_p(snd_cmipci_remove), |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 6772070ed492..07f04e390aa1 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -1382,7 +1382,7 @@ static int __devinit snd_cs4281_create(struct snd_card *card, | |||
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_SHARED, | 1384 | if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_SHARED, |
1385 | "CS4281", chip)) { | 1385 | KBUILD_MODNAME, chip)) { |
1386 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1386 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1387 | snd_cs4281_free(chip); | 1387 | snd_cs4281_free(chip); |
1388 | return -ENOMEM; | 1388 | return -ENOMEM; |
@@ -2085,7 +2085,7 @@ static int cs4281_resume(struct pci_dev *pci) | |||
2085 | #endif /* CONFIG_PM */ | 2085 | #endif /* CONFIG_PM */ |
2086 | 2086 | ||
2087 | static struct pci_driver driver = { | 2087 | static struct pci_driver driver = { |
2088 | .name = "CS4281", | 2088 | .name = KBUILD_MODNAME, |
2089 | .id_table = snd_cs4281_ids, | 2089 | .id_table = snd_cs4281_ids, |
2090 | .probe = snd_cs4281_probe, | 2090 | .probe = snd_cs4281_probe, |
2091 | .remove = __devexit_p(snd_cs4281_remove), | 2091 | .remove = __devexit_p(snd_cs4281_remove), |
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 767fa7f06cd0..1af95559aaaa 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -162,7 +162,7 @@ static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci) | |||
162 | } | 162 | } |
163 | 163 | ||
164 | static struct pci_driver driver = { | 164 | static struct pci_driver driver = { |
165 | .name = "Sound Fusion CS46xx", | 165 | .name = KBUILD_MODNAME, |
166 | .id_table = snd_cs46xx_ids, | 166 | .id_table = snd_cs46xx_ids, |
167 | .probe = snd_card_cs46xx_probe, | 167 | .probe = snd_card_cs46xx_probe, |
168 | .remove = __devexit_p(snd_card_cs46xx_remove), | 168 | .remove = __devexit_p(snd_card_cs46xx_remove), |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index aad37082cb6e..9546bf07f0d1 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -3835,7 +3835,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card, | |||
3835 | } | 3835 | } |
3836 | 3836 | ||
3837 | if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED, | 3837 | if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED, |
3838 | "CS46XX", chip)) { | 3838 | KBUILD_MODNAME, chip)) { |
3839 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 3839 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
3840 | snd_cs46xx_free(chip); | 3840 | snd_cs46xx_free(chip); |
3841 | return -EBUSY; | 3841 | return -EBUSY; |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index bc07e275d4d4..a4669346d146 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -285,7 +285,7 @@ static int __devinit snd_cs5530_probe(struct pci_dev *pci, | |||
285 | } | 285 | } |
286 | 286 | ||
287 | static struct pci_driver driver = { | 287 | static struct pci_driver driver = { |
288 | .name = "CS5530_Audio", | 288 | .name = KBUILD_MODNAME, |
289 | .id_table = snd_cs5530_ids, | 289 | .id_table = snd_cs5530_ids, |
290 | .probe = snd_cs5530_probe, | 290 | .probe = snd_cs5530_probe, |
291 | .remove = __devexit_p(snd_cs5530_remove), | 291 | .remove = __devexit_p(snd_cs5530_remove), |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index afb803708416..10d22ed5fece 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -311,7 +311,7 @@ static int __devinit snd_cs5535audio_create(struct snd_card *card, | |||
311 | cs5535au->port = pci_resource_start(pci, 0); | 311 | cs5535au->port = pci_resource_start(pci, 0); |
312 | 312 | ||
313 | if (request_irq(pci->irq, snd_cs5535audio_interrupt, | 313 | if (request_irq(pci->irq, snd_cs5535audio_interrupt, |
314 | IRQF_SHARED, "CS5535 Audio", cs5535au)) { | 314 | IRQF_SHARED, KBUILD_MODNAME, cs5535au)) { |
315 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 315 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
316 | err = -EBUSY; | 316 | err = -EBUSY; |
317 | goto sndfail; | 317 | goto sndfail; |
@@ -395,7 +395,7 @@ static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) | |||
395 | } | 395 | } |
396 | 396 | ||
397 | static struct pci_driver driver = { | 397 | static struct pci_driver driver = { |
398 | .name = DRIVER_NAME, | 398 | .name = KBUILD_MODNAME, |
399 | .id_table = snd_cs5535audio_ids, | 399 | .id_table = snd_cs5535audio_ids, |
400 | .probe = snd_cs5535audio_probe, | 400 | .probe = snd_cs5535audio_probe, |
401 | .remove = __devexit_p(snd_cs5535audio_remove), | 401 | .remove = __devexit_p(snd_cs5535audio_remove), |
diff --git a/sound/pci/ctxfi/ct20k2reg.h b/sound/pci/ctxfi/ct20k2reg.h index e0394e3996e8..ca501ba03d64 100644 --- a/sound/pci/ctxfi/ct20k2reg.h +++ b/sound/pci/ctxfi/ct20k2reg.h | |||
@@ -55,6 +55,7 @@ | |||
55 | /* GPIO Registers */ | 55 | /* GPIO Registers */ |
56 | #define GPIO_DATA 0x1B7020 | 56 | #define GPIO_DATA 0x1B7020 |
57 | #define GPIO_CTRL 0x1B7024 | 57 | #define GPIO_CTRL 0x1B7024 |
58 | #define GPIO_EXT_DATA 0x1B70A0 | ||
58 | 59 | ||
59 | /* Virtual memory registers */ | 60 | /* Virtual memory registers */ |
60 | #define VMEM_PTPAL 0x1C6300 /* 0x1C6300 + (16 * Chn) */ | 61 | #define VMEM_PTPAL 0x1C6300 /* 0x1C6300 + (16 * Chn) */ |
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c index 13f33c0719d3..d8a4423539ce 100644 --- a/sound/pci/ctxfi/ctatc.c +++ b/sound/pci/ctxfi/ctatc.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include "ctatc.h" | 18 | #include "ctatc.h" |
19 | #include "ctpcm.h" | 19 | #include "ctpcm.h" |
20 | #include "ctmixer.h" | 20 | #include "ctmixer.h" |
21 | #include "cthardware.h" | ||
22 | #include "ctsrc.h" | 21 | #include "ctsrc.h" |
23 | #include "ctamixer.h" | 22 | #include "ctamixer.h" |
24 | #include "ctdaio.h" | 23 | #include "ctdaio.h" |
@@ -30,7 +29,6 @@ | |||
30 | #include <sound/asoundef.h> | 29 | #include <sound/asoundef.h> |
31 | 30 | ||
32 | #define MONO_SUM_SCALE 0x19a8 /* 2^(-0.5) in 14-bit floating format */ | 31 | #define MONO_SUM_SCALE 0x19a8 /* 2^(-0.5) in 14-bit floating format */ |
33 | #define DAIONUM 7 | ||
34 | #define MAX_MULTI_CHN 8 | 32 | #define MAX_MULTI_CHN 8 |
35 | 33 | ||
36 | #define IEC958_DEFAULT_CON ((IEC958_AES0_NONAUDIO \ | 34 | #define IEC958_DEFAULT_CON ((IEC958_AES0_NONAUDIO \ |
@@ -53,6 +51,8 @@ static struct snd_pci_quirk __devinitdata subsys_20k1_list[] = { | |||
53 | static struct snd_pci_quirk __devinitdata subsys_20k2_list[] = { | 51 | static struct snd_pci_quirk __devinitdata subsys_20k2_list[] = { |
54 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB0760, | 52 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB0760, |
55 | "SB0760", CTSB0760), | 53 | "SB0760", CTSB0760), |
54 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB1270, | ||
55 | "SB1270", CTSB1270), | ||
56 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08801, | 56 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08801, |
57 | "SB0880", CTSB0880), | 57 | "SB0880", CTSB0880), |
58 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08802, | 58 | SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB08802, |
@@ -75,6 +75,7 @@ static const char *ct_subsys_name[NUM_CTCARDS] = { | |||
75 | [CTSB0760] = "SB076x", | 75 | [CTSB0760] = "SB076x", |
76 | [CTHENDRIX] = "Hendrix", | 76 | [CTHENDRIX] = "Hendrix", |
77 | [CTSB0880] = "SB0880", | 77 | [CTSB0880] = "SB0880", |
78 | [CTSB1270] = "SB1270", | ||
78 | [CT20K2_UNKNOWN] = "Unknown", | 79 | [CT20K2_UNKNOWN] = "Unknown", |
79 | }; | 80 | }; |
80 | 81 | ||
@@ -459,12 +460,12 @@ static void setup_src_node_conf(struct ct_atc *atc, struct ct_atc_pcm *apcm, | |||
459 | apcm->substream->runtime->rate); | 460 | apcm->substream->runtime->rate); |
460 | *n_srcc = 0; | 461 | *n_srcc = 0; |
461 | 462 | ||
462 | if (1 == atc->msr) { | 463 | if (1 == atc->msr) { /* FIXME: do we really need SRC here if pitch==1 */ |
463 | *n_srcc = apcm->substream->runtime->channels; | 464 | *n_srcc = apcm->substream->runtime->channels; |
464 | conf[0].pitch = pitch; | 465 | conf[0].pitch = pitch; |
465 | conf[0].mix_msr = conf[0].imp_msr = conf[0].msr = 1; | 466 | conf[0].mix_msr = conf[0].imp_msr = conf[0].msr = 1; |
466 | conf[0].vo = 1; | 467 | conf[0].vo = 1; |
467 | } else if (2 == atc->msr) { | 468 | } else if (2 <= atc->msr) { |
468 | if (0x8000000 < pitch) { | 469 | if (0x8000000 < pitch) { |
469 | /* Need two-stage SRCs, SRCIMPs and | 470 | /* Need two-stage SRCs, SRCIMPs and |
470 | * AMIXERs for converting format */ | 471 | * AMIXERs for converting format */ |
@@ -970,11 +971,39 @@ static int atc_select_mic_in(struct ct_atc *atc) | |||
970 | return 0; | 971 | return 0; |
971 | } | 972 | } |
972 | 973 | ||
973 | static int atc_have_digit_io_switch(struct ct_atc *atc) | 974 | static struct capabilities atc_capabilities(struct ct_atc *atc) |
974 | { | 975 | { |
975 | struct hw *hw = atc->hw; | 976 | struct hw *hw = atc->hw; |
976 | 977 | ||
977 | return hw->have_digit_io_switch(hw); | 978 | return hw->capabilities(hw); |
979 | } | ||
980 | |||
981 | static int atc_output_switch_get(struct ct_atc *atc) | ||
982 | { | ||
983 | struct hw *hw = atc->hw; | ||
984 | |||
985 | return hw->output_switch_get(hw); | ||
986 | } | ||
987 | |||
988 | static int atc_output_switch_put(struct ct_atc *atc, int position) | ||
989 | { | ||
990 | struct hw *hw = atc->hw; | ||
991 | |||
992 | return hw->output_switch_put(hw, position); | ||
993 | } | ||
994 | |||
995 | static int atc_mic_source_switch_get(struct ct_atc *atc) | ||
996 | { | ||
997 | struct hw *hw = atc->hw; | ||
998 | |||
999 | return hw->mic_source_switch_get(hw); | ||
1000 | } | ||
1001 | |||
1002 | static int atc_mic_source_switch_put(struct ct_atc *atc, int position) | ||
1003 | { | ||
1004 | struct hw *hw = atc->hw; | ||
1005 | |||
1006 | return hw->mic_source_switch_put(hw, position); | ||
978 | } | 1007 | } |
979 | 1008 | ||
980 | static int atc_select_digit_io(struct ct_atc *atc) | 1009 | static int atc_select_digit_io(struct ct_atc *atc) |
@@ -1045,6 +1074,11 @@ static int atc_line_in_unmute(struct ct_atc *atc, unsigned char state) | |||
1045 | return atc_daio_unmute(atc, state, LINEIM); | 1074 | return atc_daio_unmute(atc, state, LINEIM); |
1046 | } | 1075 | } |
1047 | 1076 | ||
1077 | static int atc_mic_unmute(struct ct_atc *atc, unsigned char state) | ||
1078 | { | ||
1079 | return atc_daio_unmute(atc, state, MIC); | ||
1080 | } | ||
1081 | |||
1048 | static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state) | 1082 | static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state) |
1049 | { | 1083 | { |
1050 | return atc_daio_unmute(atc, state, SPDIFOO); | 1084 | return atc_daio_unmute(atc, state, SPDIFOO); |
@@ -1331,17 +1365,20 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1331 | struct srcimp_mgr *srcimp_mgr; | 1365 | struct srcimp_mgr *srcimp_mgr; |
1332 | struct sum_desc sum_dsc = {0}; | 1366 | struct sum_desc sum_dsc = {0}; |
1333 | struct sum_mgr *sum_mgr; | 1367 | struct sum_mgr *sum_mgr; |
1334 | int err, i; | 1368 | int err, i, num_srcs, num_daios; |
1335 | 1369 | ||
1336 | atc->daios = kzalloc(sizeof(void *)*(DAIONUM), GFP_KERNEL); | 1370 | num_daios = ((atc->model == CTSB1270) ? 8 : 7); |
1371 | num_srcs = ((atc->model == CTSB1270) ? 6 : 4); | ||
1372 | |||
1373 | atc->daios = kzalloc(sizeof(void *)*num_daios, GFP_KERNEL); | ||
1337 | if (!atc->daios) | 1374 | if (!atc->daios) |
1338 | return -ENOMEM; | 1375 | return -ENOMEM; |
1339 | 1376 | ||
1340 | atc->srcs = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL); | 1377 | atc->srcs = kzalloc(sizeof(void *)*num_srcs, GFP_KERNEL); |
1341 | if (!atc->srcs) | 1378 | if (!atc->srcs) |
1342 | return -ENOMEM; | 1379 | return -ENOMEM; |
1343 | 1380 | ||
1344 | atc->srcimps = kzalloc(sizeof(void *)*(2*2), GFP_KERNEL); | 1381 | atc->srcimps = kzalloc(sizeof(void *)*num_srcs, GFP_KERNEL); |
1345 | if (!atc->srcimps) | 1382 | if (!atc->srcimps) |
1346 | return -ENOMEM; | 1383 | return -ENOMEM; |
1347 | 1384 | ||
@@ -1351,8 +1388,9 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1351 | 1388 | ||
1352 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; | 1389 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; |
1353 | da_desc.msr = atc->msr; | 1390 | da_desc.msr = atc->msr; |
1354 | for (i = 0, atc->n_daio = 0; i < DAIONUM-1; i++) { | 1391 | for (i = 0, atc->n_daio = 0; i < num_daios; i++) { |
1355 | da_desc.type = i; | 1392 | da_desc.type = (atc->model != CTSB073X) ? i : |
1393 | ((i == SPDIFIO) ? SPDIFI1 : i); | ||
1356 | err = daio_mgr->get_daio(daio_mgr, &da_desc, | 1394 | err = daio_mgr->get_daio(daio_mgr, &da_desc, |
1357 | (struct daio **)&atc->daios[i]); | 1395 | (struct daio **)&atc->daios[i]); |
1358 | if (err) { | 1396 | if (err) { |
@@ -1362,23 +1400,12 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1362 | } | 1400 | } |
1363 | atc->n_daio++; | 1401 | atc->n_daio++; |
1364 | } | 1402 | } |
1365 | if (atc->model == CTSB073X) | ||
1366 | da_desc.type = SPDIFI1; | ||
1367 | else | ||
1368 | da_desc.type = SPDIFIO; | ||
1369 | err = daio_mgr->get_daio(daio_mgr, &da_desc, | ||
1370 | (struct daio **)&atc->daios[i]); | ||
1371 | if (err) { | ||
1372 | printk(KERN_ERR "ctxfi: Failed to get S/PDIF-in resource!!!\n"); | ||
1373 | return err; | ||
1374 | } | ||
1375 | atc->n_daio++; | ||
1376 | 1403 | ||
1377 | src_mgr = atc->rsc_mgrs[SRC]; | 1404 | src_mgr = atc->rsc_mgrs[SRC]; |
1378 | src_dsc.multi = 1; | 1405 | src_dsc.multi = 1; |
1379 | src_dsc.msr = atc->msr; | 1406 | src_dsc.msr = atc->msr; |
1380 | src_dsc.mode = ARCRW; | 1407 | src_dsc.mode = ARCRW; |
1381 | for (i = 0, atc->n_src = 0; i < (2*2); i++) { | 1408 | for (i = 0, atc->n_src = 0; i < num_srcs; i++) { |
1382 | err = src_mgr->get_src(src_mgr, &src_dsc, | 1409 | err = src_mgr->get_src(src_mgr, &src_dsc, |
1383 | (struct src **)&atc->srcs[i]); | 1410 | (struct src **)&atc->srcs[i]); |
1384 | if (err) | 1411 | if (err) |
@@ -1388,8 +1415,8 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1388 | } | 1415 | } |
1389 | 1416 | ||
1390 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; | 1417 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; |
1391 | srcimp_dsc.msr = 8; /* SRCIMPs for S/PDIFIn SRT */ | 1418 | srcimp_dsc.msr = 8; |
1392 | for (i = 0, atc->n_srcimp = 0; i < (2*1); i++) { | 1419 | for (i = 0, atc->n_srcimp = 0; i < num_srcs; i++) { |
1393 | err = srcimp_mgr->get_srcimp(srcimp_mgr, &srcimp_dsc, | 1420 | err = srcimp_mgr->get_srcimp(srcimp_mgr, &srcimp_dsc, |
1394 | (struct srcimp **)&atc->srcimps[i]); | 1421 | (struct srcimp **)&atc->srcimps[i]); |
1395 | if (err) | 1422 | if (err) |
@@ -1397,15 +1424,6 @@ static int atc_get_resources(struct ct_atc *atc) | |||
1397 | 1424 | ||
1398 | atc->n_srcimp++; | 1425 | atc->n_srcimp++; |
1399 | } | 1426 | } |
1400 | srcimp_dsc.msr = 8; /* SRCIMPs for LINE/MICIn SRT */ | ||
1401 | for (i = 0; i < (2*1); i++) { | ||
1402 | err = srcimp_mgr->get_srcimp(srcimp_mgr, &srcimp_dsc, | ||
1403 | (struct srcimp **)&atc->srcimps[2*1+i]); | ||
1404 | if (err) | ||
1405 | return err; | ||
1406 | |||
1407 | atc->n_srcimp++; | ||
1408 | } | ||
1409 | 1427 | ||
1410 | sum_mgr = atc->rsc_mgrs[SUM]; | 1428 | sum_mgr = atc->rsc_mgrs[SUM]; |
1411 | sum_dsc.msr = atc->msr; | 1429 | sum_dsc.msr = atc->msr; |
@@ -1488,6 +1506,18 @@ static void atc_connect_resources(struct ct_atc *atc) | |||
1488 | src = atc->srcs[3]; | 1506 | src = atc->srcs[3]; |
1489 | mixer->set_input_right(mixer, MIX_LINE_IN, &src->rsc); | 1507 | mixer->set_input_right(mixer, MIX_LINE_IN, &src->rsc); |
1490 | 1508 | ||
1509 | if (atc->model == CTSB1270) { | ||
1510 | /* Titanium HD has a dedicated ADC for the Mic. */ | ||
1511 | dai = container_of(atc->daios[MIC], struct dai, daio); | ||
1512 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, | ||
1513 | (struct src **)&atc->srcs[4], | ||
1514 | (struct srcimp **)&atc->srcimps[4]); | ||
1515 | src = atc->srcs[4]; | ||
1516 | mixer->set_input_left(mixer, MIX_MIC_IN, &src->rsc); | ||
1517 | src = atc->srcs[5]; | ||
1518 | mixer->set_input_right(mixer, MIX_MIC_IN, &src->rsc); | ||
1519 | } | ||
1520 | |||
1491 | dai = container_of(atc->daios[SPDIFIO], struct dai, daio); | 1521 | dai = container_of(atc->daios[SPDIFIO], struct dai, daio); |
1492 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, | 1522 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, |
1493 | (struct src **)&atc->srcs[0], | 1523 | (struct src **)&atc->srcs[0], |
@@ -1606,12 +1636,17 @@ static struct ct_atc atc_preset __devinitdata = { | |||
1606 | .line_clfe_unmute = atc_line_clfe_unmute, | 1636 | .line_clfe_unmute = atc_line_clfe_unmute, |
1607 | .line_rear_unmute = atc_line_rear_unmute, | 1637 | .line_rear_unmute = atc_line_rear_unmute, |
1608 | .line_in_unmute = atc_line_in_unmute, | 1638 | .line_in_unmute = atc_line_in_unmute, |
1639 | .mic_unmute = atc_mic_unmute, | ||
1609 | .spdif_out_unmute = atc_spdif_out_unmute, | 1640 | .spdif_out_unmute = atc_spdif_out_unmute, |
1610 | .spdif_in_unmute = atc_spdif_in_unmute, | 1641 | .spdif_in_unmute = atc_spdif_in_unmute, |
1611 | .spdif_out_get_status = atc_spdif_out_get_status, | 1642 | .spdif_out_get_status = atc_spdif_out_get_status, |
1612 | .spdif_out_set_status = atc_spdif_out_set_status, | 1643 | .spdif_out_set_status = atc_spdif_out_set_status, |
1613 | .spdif_out_passthru = atc_spdif_out_passthru, | 1644 | .spdif_out_passthru = atc_spdif_out_passthru, |
1614 | .have_digit_io_switch = atc_have_digit_io_switch, | 1645 | .capabilities = atc_capabilities, |
1646 | .output_switch_get = atc_output_switch_get, | ||
1647 | .output_switch_put = atc_output_switch_put, | ||
1648 | .mic_source_switch_get = atc_mic_source_switch_get, | ||
1649 | .mic_source_switch_put = atc_mic_source_switch_put, | ||
1615 | #ifdef CONFIG_PM | 1650 | #ifdef CONFIG_PM |
1616 | .suspend = atc_suspend, | 1651 | .suspend = atc_suspend, |
1617 | .resume = atc_resume, | 1652 | .resume = atc_resume, |
diff --git a/sound/pci/ctxfi/ctatc.h b/sound/pci/ctxfi/ctatc.h index 7167c0185d52..3a0def656af0 100644 --- a/sound/pci/ctxfi/ctatc.h +++ b/sound/pci/ctxfi/ctatc.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <sound/core.h> | 25 | #include <sound/core.h> |
26 | 26 | ||
27 | #include "ctvmem.h" | 27 | #include "ctvmem.h" |
28 | #include "cthardware.h" | ||
28 | #include "ctresource.h" | 29 | #include "ctresource.h" |
29 | 30 | ||
30 | enum CTALSADEVS { /* Types of alsa devices */ | 31 | enum CTALSADEVS { /* Types of alsa devices */ |
@@ -115,12 +116,17 @@ struct ct_atc { | |||
115 | int (*line_clfe_unmute)(struct ct_atc *atc, unsigned char state); | 116 | int (*line_clfe_unmute)(struct ct_atc *atc, unsigned char state); |
116 | int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state); | 117 | int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state); |
117 | int (*line_in_unmute)(struct ct_atc *atc, unsigned char state); | 118 | int (*line_in_unmute)(struct ct_atc *atc, unsigned char state); |
119 | int (*mic_unmute)(struct ct_atc *atc, unsigned char state); | ||
118 | int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state); | 120 | int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state); |
119 | int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state); | 121 | int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state); |
120 | int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status); | 122 | int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status); |
121 | int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status); | 123 | int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status); |
122 | int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state); | 124 | int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state); |
123 | int (*have_digit_io_switch)(struct ct_atc *atc); | 125 | struct capabilities (*capabilities)(struct ct_atc *atc); |
126 | int (*output_switch_get)(struct ct_atc *atc); | ||
127 | int (*output_switch_put)(struct ct_atc *atc, int position); | ||
128 | int (*mic_source_switch_get)(struct ct_atc *atc); | ||
129 | int (*mic_source_switch_put)(struct ct_atc *atc, int position); | ||
124 | 130 | ||
125 | /* Don't touch! Used for internal object. */ | 131 | /* Don't touch! Used for internal object. */ |
126 | void *rsc_mgrs[NUM_RSCTYP]; /* chip resource managers */ | 132 | void *rsc_mgrs[NUM_RSCTYP]; /* chip resource managers */ |
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c index 47d9ea97de02..0c00eb4088ef 100644 --- a/sound/pci/ctxfi/ctdaio.c +++ b/sound/pci/ctxfi/ctdaio.c | |||
@@ -22,20 +22,9 @@ | |||
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | 24 | ||
25 | #define DAIO_RESOURCE_NUM NUM_DAIOTYP | ||
26 | #define DAIO_OUT_MAX SPDIFOO | 25 | #define DAIO_OUT_MAX SPDIFOO |
27 | 26 | ||
28 | union daio_usage { | 27 | struct daio_usage { |
29 | struct { | ||
30 | unsigned short lineo1:1; | ||
31 | unsigned short lineo2:1; | ||
32 | unsigned short lineo3:1; | ||
33 | unsigned short lineo4:1; | ||
34 | unsigned short spdifoo:1; | ||
35 | unsigned short lineim:1; | ||
36 | unsigned short spdifio:1; | ||
37 | unsigned short spdifi1:1; | ||
38 | } bf; | ||
39 | unsigned short data; | 28 | unsigned short data; |
40 | }; | 29 | }; |
41 | 30 | ||
@@ -61,6 +50,7 @@ struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { | |||
61 | [LINEO3] = {.left = 0x50, .right = 0x51}, | 50 | [LINEO3] = {.left = 0x50, .right = 0x51}, |
62 | [LINEO4] = {.left = 0x70, .right = 0x71}, | 51 | [LINEO4] = {.left = 0x70, .right = 0x71}, |
63 | [LINEIM] = {.left = 0x45, .right = 0xc5}, | 52 | [LINEIM] = {.left = 0x45, .right = 0xc5}, |
53 | [MIC] = {.left = 0x55, .right = 0xd5}, | ||
64 | [SPDIFOO] = {.left = 0x00, .right = 0x01}, | 54 | [SPDIFOO] = {.left = 0x00, .right = 0x01}, |
65 | [SPDIFIO] = {.left = 0x05, .right = 0x85}, | 55 | [SPDIFIO] = {.left = 0x05, .right = 0x85}, |
66 | }; | 56 | }; |
@@ -138,6 +128,7 @@ static unsigned int daio_device_index(enum DAIOTYP type, struct hw *hw) | |||
138 | case LINEO3: return 5; | 128 | case LINEO3: return 5; |
139 | case LINEO4: return 6; | 129 | case LINEO4: return 6; |
140 | case LINEIM: return 4; | 130 | case LINEIM: return 4; |
131 | case MIC: return 5; | ||
141 | default: return -EINVAL; | 132 | default: return -EINVAL; |
142 | } | 133 | } |
143 | default: | 134 | default: |
@@ -519,17 +510,17 @@ static int dai_rsc_uninit(struct dai *dai) | |||
519 | 510 | ||
520 | static int daio_mgr_get_rsc(struct rsc_mgr *mgr, enum DAIOTYP type) | 511 | static int daio_mgr_get_rsc(struct rsc_mgr *mgr, enum DAIOTYP type) |
521 | { | 512 | { |
522 | if (((union daio_usage *)mgr->rscs)->data & (0x1 << type)) | 513 | if (((struct daio_usage *)mgr->rscs)->data & (0x1 << type)) |
523 | return -ENOENT; | 514 | return -ENOENT; |
524 | 515 | ||
525 | ((union daio_usage *)mgr->rscs)->data |= (0x1 << type); | 516 | ((struct daio_usage *)mgr->rscs)->data |= (0x1 << type); |
526 | 517 | ||
527 | return 0; | 518 | return 0; |
528 | } | 519 | } |
529 | 520 | ||
530 | static int daio_mgr_put_rsc(struct rsc_mgr *mgr, enum DAIOTYP type) | 521 | static int daio_mgr_put_rsc(struct rsc_mgr *mgr, enum DAIOTYP type) |
531 | { | 522 | { |
532 | ((union daio_usage *)mgr->rscs)->data &= ~(0x1 << type); | 523 | ((struct daio_usage *)mgr->rscs)->data &= ~(0x1 << type); |
533 | 524 | ||
534 | return 0; | 525 | return 0; |
535 | } | 526 | } |
@@ -712,7 +703,7 @@ int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr) | |||
712 | if (!daio_mgr) | 703 | if (!daio_mgr) |
713 | return -ENOMEM; | 704 | return -ENOMEM; |
714 | 705 | ||
715 | err = rsc_mgr_init(&daio_mgr->mgr, DAIO, DAIO_RESOURCE_NUM, hw); | 706 | err = rsc_mgr_init(&daio_mgr->mgr, DAIO, NUM_DAIOTYP, hw); |
716 | if (err) | 707 | if (err) |
717 | goto error1; | 708 | goto error1; |
718 | 709 | ||
diff --git a/sound/pci/ctxfi/ctdaio.h b/sound/pci/ctxfi/ctdaio.h index 0f52ce571ee8..85ccb6ee1ab4 100644 --- a/sound/pci/ctxfi/ctdaio.h +++ b/sound/pci/ctxfi/ctdaio.h | |||
@@ -33,6 +33,7 @@ enum DAIOTYP { | |||
33 | SPDIFOO, /* S/PDIF Out (Flexijack/Optical) */ | 33 | SPDIFOO, /* S/PDIF Out (Flexijack/Optical) */ |
34 | LINEIM, | 34 | LINEIM, |
35 | SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */ | 35 | SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */ |
36 | MIC, /* Dedicated mic on Titanium HD */ | ||
36 | SPDIFI1, /* S/PDIF In on internal Drive Bay */ | 37 | SPDIFI1, /* S/PDIF In on internal Drive Bay */ |
37 | NUM_DAIOTYP | 38 | NUM_DAIOTYP |
38 | }; | 39 | }; |
diff --git a/sound/pci/ctxfi/cthardware.h b/sound/pci/ctxfi/cthardware.h index af55405f5dec..908315bec3b4 100644 --- a/sound/pci/ctxfi/cthardware.h +++ b/sound/pci/ctxfi/cthardware.h | |||
@@ -39,6 +39,7 @@ enum CTCARDS { | |||
39 | CT20K2_MODEL_FIRST = CTSB0760, | 39 | CT20K2_MODEL_FIRST = CTSB0760, |
40 | CTHENDRIX, | 40 | CTHENDRIX, |
41 | CTSB0880, | 41 | CTSB0880, |
42 | CTSB1270, | ||
42 | CT20K2_UNKNOWN, | 43 | CT20K2_UNKNOWN, |
43 | NUM_CTCARDS /* This should always be the last */ | 44 | NUM_CTCARDS /* This should always be the last */ |
44 | }; | 45 | }; |
@@ -60,6 +61,13 @@ struct card_conf { | |||
60 | unsigned int msr; /* master sample rate in rsrs */ | 61 | unsigned int msr; /* master sample rate in rsrs */ |
61 | }; | 62 | }; |
62 | 63 | ||
64 | struct capabilities { | ||
65 | unsigned int digit_io_switch:1; | ||
66 | unsigned int dedicated_mic:1; | ||
67 | unsigned int output_switch:1; | ||
68 | unsigned int mic_source_switch:1; | ||
69 | }; | ||
70 | |||
63 | struct hw { | 71 | struct hw { |
64 | int (*card_init)(struct hw *hw, struct card_conf *info); | 72 | int (*card_init)(struct hw *hw, struct card_conf *info); |
65 | int (*card_stop)(struct hw *hw); | 73 | int (*card_stop)(struct hw *hw); |
@@ -70,7 +78,11 @@ struct hw { | |||
70 | #endif | 78 | #endif |
71 | int (*is_adc_source_selected)(struct hw *hw, enum ADCSRC source); | 79 | int (*is_adc_source_selected)(struct hw *hw, enum ADCSRC source); |
72 | int (*select_adc_source)(struct hw *hw, enum ADCSRC source); | 80 | int (*select_adc_source)(struct hw *hw, enum ADCSRC source); |
73 | int (*have_digit_io_switch)(struct hw *hw); | 81 | struct capabilities (*capabilities)(struct hw *hw); |
82 | int (*output_switch_get)(struct hw *hw); | ||
83 | int (*output_switch_put)(struct hw *hw, int position); | ||
84 | int (*mic_source_switch_get)(struct hw *hw); | ||
85 | int (*mic_source_switch_put)(struct hw *hw, int position); | ||
74 | 86 | ||
75 | /* SRC operations */ | 87 | /* SRC operations */ |
76 | int (*src_rsc_get_ctrl_blk)(void **rblk); | 88 | int (*src_rsc_get_ctrl_blk)(void **rblk); |
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index a5c957db5cea..a7df19791f5a 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c | |||
@@ -1777,10 +1777,17 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) | |||
1777 | return adc_init_SBx(hw, info->input, info->mic20db); | 1777 | return adc_init_SBx(hw, info->input, info->mic20db); |
1778 | } | 1778 | } |
1779 | 1779 | ||
1780 | static int hw_have_digit_io_switch(struct hw *hw) | 1780 | static struct capabilities hw_capabilities(struct hw *hw) |
1781 | { | 1781 | { |
1782 | struct capabilities cap; | ||
1783 | |||
1782 | /* SB073x and Vista compatible cards have no digit IO switch */ | 1784 | /* SB073x and Vista compatible cards have no digit IO switch */ |
1783 | return !(hw->model == CTSB073X || hw->model == CTUAA); | 1785 | cap.digit_io_switch = !(hw->model == CTSB073X || hw->model == CTUAA); |
1786 | cap.dedicated_mic = 0; | ||
1787 | cap.output_switch = 0; | ||
1788 | cap.mic_source_switch = 0; | ||
1789 | |||
1790 | return cap; | ||
1784 | } | 1791 | } |
1785 | 1792 | ||
1786 | #define CTLBITS(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) | 1793 | #define CTLBITS(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) |
@@ -1933,7 +1940,7 @@ static int hw_card_start(struct hw *hw) | |||
1933 | 1940 | ||
1934 | if (hw->irq < 0) { | 1941 | if (hw->irq < 0) { |
1935 | err = request_irq(pci->irq, ct_20k1_interrupt, IRQF_SHARED, | 1942 | err = request_irq(pci->irq, ct_20k1_interrupt, IRQF_SHARED, |
1936 | "ctxfi", hw); | 1943 | KBUILD_MODNAME, hw); |
1937 | if (err < 0) { | 1944 | if (err < 0) { |
1938 | printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); | 1945 | printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); |
1939 | goto error2; | 1946 | goto error2; |
@@ -2172,7 +2179,7 @@ static struct hw ct20k1_preset __devinitdata = { | |||
2172 | .pll_init = hw_pll_init, | 2179 | .pll_init = hw_pll_init, |
2173 | .is_adc_source_selected = hw_is_adc_input_selected, | 2180 | .is_adc_source_selected = hw_is_adc_input_selected, |
2174 | .select_adc_source = hw_adc_input_select, | 2181 | .select_adc_source = hw_adc_input_select, |
2175 | .have_digit_io_switch = hw_have_digit_io_switch, | 2182 | .capabilities = hw_capabilities, |
2176 | #ifdef CONFIG_PM | 2183 | #ifdef CONFIG_PM |
2177 | .suspend = hw_suspend, | 2184 | .suspend = hw_suspend, |
2178 | .resume = hw_resume, | 2185 | .resume = hw_resume, |
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 5364164674e4..d6c54b524bfa 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * @File cthw20k2.c | 8 | * @File cthw20k2.c |
9 | * | 9 | * |
10 | * @Brief | 10 | * @Brief |
11 | * This file contains the implementation of hardware access methord for 20k2. | 11 | * This file contains the implementation of hardware access method for 20k2. |
12 | * | 12 | * |
13 | * @Author Liu Chun | 13 | * @Author Liu Chun |
14 | * @Date May 14 2008 | 14 | * @Date May 14 2008 |
@@ -38,6 +38,8 @@ struct hw20k2 { | |||
38 | unsigned char dev_id; | 38 | unsigned char dev_id; |
39 | unsigned char addr_size; | 39 | unsigned char addr_size; |
40 | unsigned char data_size; | 40 | unsigned char data_size; |
41 | |||
42 | int mic_source; | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | static u32 hw_read_20kx(struct hw *hw, u32 reg); | 45 | static u32 hw_read_20kx(struct hw *hw, u32 reg); |
@@ -1163,7 +1165,12 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) | |||
1163 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x01010101); | 1165 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x01010101); |
1164 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); | 1166 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); |
1165 | } else if (2 == info->msr) { | 1167 | } else if (2 == info->msr) { |
1166 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x11111111); | 1168 | if (hw->model != CTSB1270) { |
1169 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x11111111); | ||
1170 | } else { | ||
1171 | /* PCM4220 on Titanium HD is different. */ | ||
1172 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x11011111); | ||
1173 | } | ||
1167 | /* Specify all playing 96khz | 1174 | /* Specify all playing 96khz |
1168 | * EA [0] - Enabled | 1175 | * EA [0] - Enabled |
1169 | * RTA [4:5] - 96kHz | 1176 | * RTA [4:5] - 96kHz |
@@ -1175,6 +1182,10 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) | |||
1175 | * RTD [28:29] - 96kHz */ | 1182 | * RTD [28:29] - 96kHz */ |
1176 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x11111111); | 1183 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x11111111); |
1177 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); | 1184 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); |
1185 | } else if ((4 == info->msr) && (hw->model == CTSB1270)) { | ||
1186 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21011111); | ||
1187 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121); | ||
1188 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); | ||
1178 | } else { | 1189 | } else { |
1179 | printk(KERN_ALERT "ctxfi: ERROR!!! Invalid sampling rate!!!\n"); | 1190 | printk(KERN_ALERT "ctxfi: ERROR!!! Invalid sampling rate!!!\n"); |
1180 | return -EINVAL; | 1191 | return -EINVAL; |
@@ -1182,6 +1193,8 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) | |||
1182 | 1193 | ||
1183 | for (i = 0; i < 8; i++) { | 1194 | for (i = 0; i < 8; i++) { |
1184 | if (i <= 3) { | 1195 | if (i <= 3) { |
1196 | /* This comment looks wrong since loop is over 4 */ | ||
1197 | /* channels and emu20k2 supports 4 spdif IOs. */ | ||
1185 | /* 1st 3 channels are SPDIFs (SB0960) */ | 1198 | /* 1st 3 channels are SPDIFs (SB0960) */ |
1186 | if (i == 3) | 1199 | if (i == 3) |
1187 | data = 0x1001001; | 1200 | data = 0x1001001; |
@@ -1206,12 +1219,16 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) | |||
1206 | 1219 | ||
1207 | hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_H+(0x40*i), 0x0B); | 1220 | hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_H+(0x40*i), 0x0B); |
1208 | } else { | 1221 | } else { |
1222 | /* Again, loop is over 4 channels not 5. */ | ||
1209 | /* Next 5 channels are I2S (SB0960) */ | 1223 | /* Next 5 channels are I2S (SB0960) */ |
1210 | data = 0x11; | 1224 | data = 0x11; |
1211 | hw_write_20kx(hw, AUDIO_IO_RX_CTL+(0x40*i), data); | 1225 | hw_write_20kx(hw, AUDIO_IO_RX_CTL+(0x40*i), data); |
1212 | if (2 == info->msr) { | 1226 | if (2 == info->msr) { |
1213 | /* Four channels per sample period */ | 1227 | /* Four channels per sample period */ |
1214 | data |= 0x1000; | 1228 | data |= 0x1000; |
1229 | } else if (4 == info->msr) { | ||
1230 | /* FIXME: check this against the chip spec */ | ||
1231 | data |= 0x2000; | ||
1215 | } | 1232 | } |
1216 | hw_write_20kx(hw, AUDIO_IO_TX_CTL+(0x40*i), data); | 1233 | hw_write_20kx(hw, AUDIO_IO_TX_CTL+(0x40*i), data); |
1217 | } | 1234 | } |
@@ -1299,21 +1316,18 @@ static int hw_pll_init(struct hw *hw, unsigned int rsr) | |||
1299 | 1316 | ||
1300 | pllenb = 0xB; | 1317 | pllenb = 0xB; |
1301 | hw_write_20kx(hw, PLL_ENB, pllenb); | 1318 | hw_write_20kx(hw, PLL_ENB, pllenb); |
1302 | pllctl = 0x20D00000; | 1319 | pllctl = 0x20C00000; |
1303 | set_field(&pllctl, PLLCTL_FD, 16 - 4); | 1320 | set_field(&pllctl, PLLCTL_B, 0); |
1321 | set_field(&pllctl, PLLCTL_FD, 48000 == rsr ? 16 - 4 : 147 - 4); | ||
1322 | set_field(&pllctl, PLLCTL_RD, 48000 == rsr ? 1 - 1 : 10 - 1); | ||
1304 | hw_write_20kx(hw, PLL_CTL, pllctl); | 1323 | hw_write_20kx(hw, PLL_CTL, pllctl); |
1305 | mdelay(40); | 1324 | mdelay(40); |
1325 | |||
1306 | pllctl = hw_read_20kx(hw, PLL_CTL); | 1326 | pllctl = hw_read_20kx(hw, PLL_CTL); |
1307 | set_field(&pllctl, PLLCTL_B, 0); | 1327 | set_field(&pllctl, PLLCTL_FD, 48000 == rsr ? 16 - 2 : 147 - 2); |
1308 | if (48000 == rsr) { | ||
1309 | set_field(&pllctl, PLLCTL_FD, 16 - 2); | ||
1310 | set_field(&pllctl, PLLCTL_RD, 1 - 1); /* 3000*16/1 = 48000 */ | ||
1311 | } else { /* 44100 */ | ||
1312 | set_field(&pllctl, PLLCTL_FD, 147 - 2); | ||
1313 | set_field(&pllctl, PLLCTL_RD, 10 - 1); /* 3000*147/10 = 44100 */ | ||
1314 | } | ||
1315 | hw_write_20kx(hw, PLL_CTL, pllctl); | 1328 | hw_write_20kx(hw, PLL_CTL, pllctl); |
1316 | mdelay(40); | 1329 | mdelay(40); |
1330 | |||
1317 | for (i = 0; i < 1000; i++) { | 1331 | for (i = 0; i < 1000; i++) { |
1318 | pllstat = hw_read_20kx(hw, PLL_STAT); | 1332 | pllstat = hw_read_20kx(hw, PLL_STAT); |
1319 | if (get_field(pllstat, PLLSTAT_PD)) | 1333 | if (get_field(pllstat, PLLSTAT_PD)) |
@@ -1557,7 +1571,7 @@ static int hw20k2_i2c_write(struct hw *hw, u16 addr, u32 data) | |||
1557 | 1571 | ||
1558 | hw_write_20kx(hw, I2C_IF_STATUS, i2c_status); | 1572 | hw_write_20kx(hw, I2C_IF_STATUS, i2c_status); |
1559 | hw20k2_i2c_wait_data_ready(hw); | 1573 | hw20k2_i2c_wait_data_ready(hw); |
1560 | /* Dummy write to trigger the write oprtation */ | 1574 | /* Dummy write to trigger the write operation */ |
1561 | hw_write_20kx(hw, I2C_IF_WDATA, 0); | 1575 | hw_write_20kx(hw, I2C_IF_WDATA, 0); |
1562 | hw20k2_i2c_wait_data_ready(hw); | 1576 | hw20k2_i2c_wait_data_ready(hw); |
1563 | 1577 | ||
@@ -1568,6 +1582,30 @@ static int hw20k2_i2c_write(struct hw *hw, u16 addr, u32 data) | |||
1568 | return 0; | 1582 | return 0; |
1569 | } | 1583 | } |
1570 | 1584 | ||
1585 | static void hw_dac_stop(struct hw *hw) | ||
1586 | { | ||
1587 | u32 data; | ||
1588 | data = hw_read_20kx(hw, GPIO_DATA); | ||
1589 | data &= 0xFFFFFFFD; | ||
1590 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1591 | mdelay(10); | ||
1592 | } | ||
1593 | |||
1594 | static void hw_dac_start(struct hw *hw) | ||
1595 | { | ||
1596 | u32 data; | ||
1597 | data = hw_read_20kx(hw, GPIO_DATA); | ||
1598 | data |= 0x2; | ||
1599 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1600 | mdelay(50); | ||
1601 | } | ||
1602 | |||
1603 | static void hw_dac_reset(struct hw *hw) | ||
1604 | { | ||
1605 | hw_dac_stop(hw); | ||
1606 | hw_dac_start(hw); | ||
1607 | } | ||
1608 | |||
1571 | static int hw_dac_init(struct hw *hw, const struct dac_conf *info) | 1609 | static int hw_dac_init(struct hw *hw, const struct dac_conf *info) |
1572 | { | 1610 | { |
1573 | int err; | 1611 | int err; |
@@ -1594,6 +1632,21 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info) | |||
1594 | 0x00000000 /* Vol Control B4 */ | 1632 | 0x00000000 /* Vol Control B4 */ |
1595 | }; | 1633 | }; |
1596 | 1634 | ||
1635 | if (hw->model == CTSB1270) { | ||
1636 | hw_dac_stop(hw); | ||
1637 | data = hw_read_20kx(hw, GPIO_DATA); | ||
1638 | data &= ~0x0600; | ||
1639 | if (1 == info->msr) | ||
1640 | data |= 0x0000; /* Single Speed Mode 0-50kHz */ | ||
1641 | else if (2 == info->msr) | ||
1642 | data |= 0x0200; /* Double Speed Mode 50-100kHz */ | ||
1643 | else | ||
1644 | data |= 0x0600; /* Quad Speed Mode 100-200kHz */ | ||
1645 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1646 | hw_dac_start(hw); | ||
1647 | return 0; | ||
1648 | } | ||
1649 | |||
1597 | /* Set DAC reset bit as output */ | 1650 | /* Set DAC reset bit as output */ |
1598 | data = hw_read_20kx(hw, GPIO_CTRL); | 1651 | data = hw_read_20kx(hw, GPIO_CTRL); |
1599 | data |= 0x02; | 1652 | data |= 0x02; |
@@ -1606,22 +1659,8 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info) | |||
1606 | for (i = 0; i < 2; i++) { | 1659 | for (i = 0; i < 2; i++) { |
1607 | /* Reset DAC twice just in-case the chip | 1660 | /* Reset DAC twice just in-case the chip |
1608 | * didn't initialized properly */ | 1661 | * didn't initialized properly */ |
1609 | data = hw_read_20kx(hw, GPIO_DATA); | 1662 | hw_dac_reset(hw); |
1610 | /* GPIO data bit 1 */ | 1663 | hw_dac_reset(hw); |
1611 | data &= 0xFFFFFFFD; | ||
1612 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1613 | mdelay(10); | ||
1614 | data |= 0x2; | ||
1615 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1616 | mdelay(50); | ||
1617 | |||
1618 | /* Reset the 2nd time */ | ||
1619 | data &= 0xFFFFFFFD; | ||
1620 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1621 | mdelay(10); | ||
1622 | data |= 0x2; | ||
1623 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1624 | mdelay(50); | ||
1625 | 1664 | ||
1626 | if (hw20k2_i2c_read(hw, CS4382_MC1, &cs_read.mode_control_1)) | 1665 | if (hw20k2_i2c_read(hw, CS4382_MC1, &cs_read.mode_control_1)) |
1627 | continue; | 1666 | continue; |
@@ -1725,7 +1764,11 @@ End: | |||
1725 | static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) | 1764 | static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) |
1726 | { | 1765 | { |
1727 | u32 data; | 1766 | u32 data; |
1728 | 1767 | if (hw->model == CTSB1270) { | |
1768 | /* Titanium HD has two ADC chips, one for line in and one */ | ||
1769 | /* for MIC. We don't need to switch the ADC input. */ | ||
1770 | return 1; | ||
1771 | } | ||
1729 | data = hw_read_20kx(hw, GPIO_DATA); | 1772 | data = hw_read_20kx(hw, GPIO_DATA); |
1730 | switch (type) { | 1773 | switch (type) { |
1731 | case ADC_MICIN: | 1774 | case ADC_MICIN: |
@@ -1742,35 +1785,47 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) | |||
1742 | 1785 | ||
1743 | #define MIC_BOOST_0DB 0xCF | 1786 | #define MIC_BOOST_0DB 0xCF |
1744 | #define MIC_BOOST_STEPS_PER_DB 2 | 1787 | #define MIC_BOOST_STEPS_PER_DB 2 |
1745 | #define MIC_BOOST_20DB (MIC_BOOST_0DB + 20 * MIC_BOOST_STEPS_PER_DB) | 1788 | |
1789 | static void hw_wm8775_input_select(struct hw *hw, u8 input, s8 gain_in_db) | ||
1790 | { | ||
1791 | u32 adcmc, gain; | ||
1792 | |||
1793 | if (input > 3) | ||
1794 | input = 3; | ||
1795 | |||
1796 | adcmc = ((u32)1 << input) | 0x100; /* Link L+R gain... */ | ||
1797 | |||
1798 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, adcmc), | ||
1799 | MAKE_WM8775_DATA(adcmc)); | ||
1800 | |||
1801 | if (gain_in_db < -103) | ||
1802 | gain_in_db = -103; | ||
1803 | if (gain_in_db > 24) | ||
1804 | gain_in_db = 24; | ||
1805 | |||
1806 | gain = gain_in_db * MIC_BOOST_STEPS_PER_DB + MIC_BOOST_0DB; | ||
1807 | |||
1808 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, gain), | ||
1809 | MAKE_WM8775_DATA(gain)); | ||
1810 | /* ...so there should be no need for the following. */ | ||
1811 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, gain), | ||
1812 | MAKE_WM8775_DATA(gain)); | ||
1813 | } | ||
1746 | 1814 | ||
1747 | static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) | 1815 | static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) |
1748 | { | 1816 | { |
1749 | u32 data; | 1817 | u32 data; |
1750 | |||
1751 | data = hw_read_20kx(hw, GPIO_DATA); | 1818 | data = hw_read_20kx(hw, GPIO_DATA); |
1752 | switch (type) { | 1819 | switch (type) { |
1753 | case ADC_MICIN: | 1820 | case ADC_MICIN: |
1754 | data |= (0x1 << 14); | 1821 | data |= (0x1 << 14); |
1755 | hw_write_20kx(hw, GPIO_DATA, data); | 1822 | hw_write_20kx(hw, GPIO_DATA, data); |
1756 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x101), | 1823 | hw_wm8775_input_select(hw, 0, 20); /* Mic, 20dB */ |
1757 | MAKE_WM8775_DATA(0x101)); /* Mic-in */ | ||
1758 | hw20k2_i2c_write(hw, | ||
1759 | MAKE_WM8775_ADDR(WM8775_AADCL, MIC_BOOST_20DB), | ||
1760 | MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */ | ||
1761 | hw20k2_i2c_write(hw, | ||
1762 | MAKE_WM8775_ADDR(WM8775_AADCR, MIC_BOOST_20DB), | ||
1763 | MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */ | ||
1764 | break; | 1824 | break; |
1765 | case ADC_LINEIN: | 1825 | case ADC_LINEIN: |
1766 | data &= ~(0x1 << 14); | 1826 | data &= ~(0x1 << 14); |
1767 | hw_write_20kx(hw, GPIO_DATA, data); | 1827 | hw_write_20kx(hw, GPIO_DATA, data); |
1768 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x102), | 1828 | hw_wm8775_input_select(hw, 1, 0); /* Line-in, 0dB */ |
1769 | MAKE_WM8775_DATA(0x102)); /* Line-in */ | ||
1770 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, 0xCF), | ||
1771 | MAKE_WM8775_DATA(0xCF)); /* No boost */ | ||
1772 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xCF), | ||
1773 | MAKE_WM8775_DATA(0xCF)); /* No boost */ | ||
1774 | break; | 1829 | break; |
1775 | default: | 1830 | default: |
1776 | break; | 1831 | break; |
@@ -1782,7 +1837,7 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) | |||
1782 | static int hw_adc_init(struct hw *hw, const struct adc_conf *info) | 1837 | static int hw_adc_init(struct hw *hw, const struct adc_conf *info) |
1783 | { | 1838 | { |
1784 | int err; | 1839 | int err; |
1785 | u32 mux = 2, data, ctl; | 1840 | u32 data, ctl; |
1786 | 1841 | ||
1787 | /* Set ADC reset bit as output */ | 1842 | /* Set ADC reset bit as output */ |
1788 | data = hw_read_20kx(hw, GPIO_CTRL); | 1843 | data = hw_read_20kx(hw, GPIO_CTRL); |
@@ -1796,19 +1851,42 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) | |||
1796 | goto error; | 1851 | goto error; |
1797 | } | 1852 | } |
1798 | 1853 | ||
1799 | /* Make ADC in normal operation */ | 1854 | /* Reset the ADC (reset is active low). */ |
1800 | data = hw_read_20kx(hw, GPIO_DATA); | 1855 | data = hw_read_20kx(hw, GPIO_DATA); |
1801 | data &= ~(0x1 << 15); | 1856 | data &= ~(0x1 << 15); |
1857 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1858 | |||
1859 | if (hw->model == CTSB1270) { | ||
1860 | /* Set up the PCM4220 ADC on Titanium HD */ | ||
1861 | data &= ~0x0C; | ||
1862 | if (1 == info->msr) | ||
1863 | data |= 0x00; /* Single Speed Mode 32-50kHz */ | ||
1864 | else if (2 == info->msr) | ||
1865 | data |= 0x08; /* Double Speed Mode 50-108kHz */ | ||
1866 | else | ||
1867 | data |= 0x04; /* Quad Speed Mode 108kHz-216kHz */ | ||
1868 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1869 | } | ||
1870 | |||
1802 | mdelay(10); | 1871 | mdelay(10); |
1872 | /* Return the ADC to normal operation. */ | ||
1803 | data |= (0x1 << 15); | 1873 | data |= (0x1 << 15); |
1804 | hw_write_20kx(hw, GPIO_DATA, data); | 1874 | hw_write_20kx(hw, GPIO_DATA, data); |
1805 | mdelay(50); | 1875 | mdelay(50); |
1806 | 1876 | ||
1877 | /* I2C write to register offset 0x0B to set ADC LRCLK polarity */ | ||
1878 | /* invert bit, interface format to I2S, word length to 24-bit, */ | ||
1879 | /* enable ADC high pass filter. Fixes bug 5323? */ | ||
1880 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_IC, 0x26), | ||
1881 | MAKE_WM8775_DATA(0x26)); | ||
1882 | |||
1807 | /* Set the master mode (256fs) */ | 1883 | /* Set the master mode (256fs) */ |
1808 | if (1 == info->msr) { | 1884 | if (1 == info->msr) { |
1885 | /* slave mode, 128x oversampling 256fs */ | ||
1809 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x02), | 1886 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x02), |
1810 | MAKE_WM8775_DATA(0x02)); | 1887 | MAKE_WM8775_DATA(0x02)); |
1811 | } else if (2 == info->msr) { | 1888 | } else if ((2 == info->msr) || (4 == info->msr)) { |
1889 | /* slave mode, 64x oversampling, 256fs */ | ||
1812 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x0A), | 1890 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x0A), |
1813 | MAKE_WM8775_DATA(0x0A)); | 1891 | MAKE_WM8775_DATA(0x0A)); |
1814 | } else { | 1892 | } else { |
@@ -1818,55 +1896,113 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) | |||
1818 | goto error; | 1896 | goto error; |
1819 | } | 1897 | } |
1820 | 1898 | ||
1821 | /* Configure GPIO bit 14 change to line-in/mic-in */ | 1899 | if (hw->model != CTSB1270) { |
1822 | ctl = hw_read_20kx(hw, GPIO_CTRL); | 1900 | /* Configure GPIO bit 14 change to line-in/mic-in */ |
1823 | ctl |= 0x1 << 14; | 1901 | ctl = hw_read_20kx(hw, GPIO_CTRL); |
1824 | hw_write_20kx(hw, GPIO_CTRL, ctl); | 1902 | ctl |= 0x1 << 14; |
1825 | 1903 | hw_write_20kx(hw, GPIO_CTRL, ctl); | |
1826 | /* Check using Mic-in or Line-in */ | 1904 | hw_adc_input_select(hw, ADC_LINEIN); |
1827 | data = hw_read_20kx(hw, GPIO_DATA); | ||
1828 | |||
1829 | if (mux == 1) { | ||
1830 | /* Configures GPIO data to select Mic-in */ | ||
1831 | data |= 0x1 << 14; | ||
1832 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1833 | |||
1834 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x101), | ||
1835 | MAKE_WM8775_DATA(0x101)); /* Mic-in */ | ||
1836 | hw20k2_i2c_write(hw, | ||
1837 | MAKE_WM8775_ADDR(WM8775_AADCL, MIC_BOOST_20DB), | ||
1838 | MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */ | ||
1839 | hw20k2_i2c_write(hw, | ||
1840 | MAKE_WM8775_ADDR(WM8775_AADCR, MIC_BOOST_20DB), | ||
1841 | MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */ | ||
1842 | } else if (mux == 2) { | ||
1843 | /* Configures GPIO data to select Line-in */ | ||
1844 | data &= ~(0x1 << 14); | ||
1845 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1846 | |||
1847 | /* Setup ADC */ | ||
1848 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x102), | ||
1849 | MAKE_WM8775_DATA(0x102)); /* Line-in */ | ||
1850 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, 0xCF), | ||
1851 | MAKE_WM8775_DATA(0xCF)); /* No boost */ | ||
1852 | hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xCF), | ||
1853 | MAKE_WM8775_DATA(0xCF)); /* No boost */ | ||
1854 | } else { | 1905 | } else { |
1855 | printk(KERN_ALERT "ctxfi: ERROR!!! Invalid input mux!!!\n"); | 1906 | hw_wm8775_input_select(hw, 0, 0); |
1856 | err = -EINVAL; | ||
1857 | goto error; | ||
1858 | } | 1907 | } |
1859 | 1908 | ||
1860 | return 0; | 1909 | return 0; |
1861 | |||
1862 | error: | 1910 | error: |
1863 | hw20k2_i2c_uninit(hw); | 1911 | hw20k2_i2c_uninit(hw); |
1864 | return err; | 1912 | return err; |
1865 | } | 1913 | } |
1866 | 1914 | ||
1867 | static int hw_have_digit_io_switch(struct hw *hw) | 1915 | static struct capabilities hw_capabilities(struct hw *hw) |
1868 | { | 1916 | { |
1869 | return 0; | 1917 | struct capabilities cap; |
1918 | |||
1919 | cap.digit_io_switch = 0; | ||
1920 | cap.dedicated_mic = hw->model == CTSB1270; | ||
1921 | cap.output_switch = hw->model == CTSB1270; | ||
1922 | cap.mic_source_switch = hw->model == CTSB1270; | ||
1923 | |||
1924 | return cap; | ||
1925 | } | ||
1926 | |||
1927 | static int hw_output_switch_get(struct hw *hw) | ||
1928 | { | ||
1929 | u32 data = hw_read_20kx(hw, GPIO_EXT_DATA); | ||
1930 | |||
1931 | switch (data & 0x30) { | ||
1932 | case 0x00: | ||
1933 | return 0; | ||
1934 | case 0x10: | ||
1935 | return 1; | ||
1936 | case 0x20: | ||
1937 | return 2; | ||
1938 | default: | ||
1939 | return 3; | ||
1940 | } | ||
1941 | } | ||
1942 | |||
1943 | static int hw_output_switch_put(struct hw *hw, int position) | ||
1944 | { | ||
1945 | u32 data; | ||
1946 | |||
1947 | if (position == hw_output_switch_get(hw)) | ||
1948 | return 0; | ||
1949 | |||
1950 | /* Mute line and headphones (intended for anti-pop). */ | ||
1951 | data = hw_read_20kx(hw, GPIO_DATA); | ||
1952 | data |= (0x03 << 11); | ||
1953 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1954 | |||
1955 | data = hw_read_20kx(hw, GPIO_EXT_DATA) & ~0x30; | ||
1956 | switch (position) { | ||
1957 | case 0: | ||
1958 | break; | ||
1959 | case 1: | ||
1960 | data |= 0x10; | ||
1961 | break; | ||
1962 | default: | ||
1963 | data |= 0x20; | ||
1964 | } | ||
1965 | hw_write_20kx(hw, GPIO_EXT_DATA, data); | ||
1966 | |||
1967 | /* Unmute line and headphones. */ | ||
1968 | data = hw_read_20kx(hw, GPIO_DATA); | ||
1969 | data &= ~(0x03 << 11); | ||
1970 | hw_write_20kx(hw, GPIO_DATA, data); | ||
1971 | |||
1972 | return 1; | ||
1973 | } | ||
1974 | |||
1975 | static int hw_mic_source_switch_get(struct hw *hw) | ||
1976 | { | ||
1977 | struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; | ||
1978 | |||
1979 | return hw20k2->mic_source; | ||
1980 | } | ||
1981 | |||
1982 | static int hw_mic_source_switch_put(struct hw *hw, int position) | ||
1983 | { | ||
1984 | struct hw20k2 *hw20k2 = (struct hw20k2 *)hw; | ||
1985 | |||
1986 | if (position == hw20k2->mic_source) | ||
1987 | return 0; | ||
1988 | |||
1989 | switch (position) { | ||
1990 | case 0: | ||
1991 | hw_wm8775_input_select(hw, 0, 0); /* Mic, 0dB */ | ||
1992 | break; | ||
1993 | case 1: | ||
1994 | hw_wm8775_input_select(hw, 1, 0); /* FP Mic, 0dB */ | ||
1995 | break; | ||
1996 | case 2: | ||
1997 | hw_wm8775_input_select(hw, 3, 0); /* Aux Ext, 0dB */ | ||
1998 | break; | ||
1999 | default: | ||
2000 | return 0; | ||
2001 | } | ||
2002 | |||
2003 | hw20k2->mic_source = position; | ||
2004 | |||
2005 | return 1; | ||
1870 | } | 2006 | } |
1871 | 2007 | ||
1872 | static irqreturn_t ct_20k2_interrupt(int irq, void *dev_id) | 2008 | static irqreturn_t ct_20k2_interrupt(int irq, void *dev_id) |
@@ -1925,7 +2061,7 @@ static int hw_card_start(struct hw *hw) | |||
1925 | 2061 | ||
1926 | if (hw->irq < 0) { | 2062 | if (hw->irq < 0) { |
1927 | err = request_irq(pci->irq, ct_20k2_interrupt, IRQF_SHARED, | 2063 | err = request_irq(pci->irq, ct_20k2_interrupt, IRQF_SHARED, |
1928 | "ctxfi", hw); | 2064 | KBUILD_MODNAME, hw); |
1929 | if (err < 0) { | 2065 | if (err < 0) { |
1930 | printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); | 2066 | printk(KERN_ERR "XFi: Cannot get irq %d\n", pci->irq); |
1931 | goto error2; | 2067 | goto error2; |
@@ -2023,13 +2159,16 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) | |||
2023 | /* Reset all SRC pending interrupts */ | 2159 | /* Reset all SRC pending interrupts */ |
2024 | hw_write_20kx(hw, SRC_IP, 0); | 2160 | hw_write_20kx(hw, SRC_IP, 0); |
2025 | 2161 | ||
2026 | /* TODO: detect the card ID and configure GPIO accordingly. */ | 2162 | if (hw->model != CTSB1270) { |
2027 | /* Configures GPIO (0xD802 0x98028) */ | 2163 | /* TODO: detect the card ID and configure GPIO accordingly. */ |
2028 | /*hw_write_20kx(hw, GPIO_CTRL, 0x7F07);*/ | 2164 | /* Configures GPIO (0xD802 0x98028) */ |
2029 | /* Configures GPIO (SB0880) */ | 2165 | /*hw_write_20kx(hw, GPIO_CTRL, 0x7F07);*/ |
2030 | /*hw_write_20kx(hw, GPIO_CTRL, 0xFF07);*/ | 2166 | /* Configures GPIO (SB0880) */ |
2031 | hw_write_20kx(hw, GPIO_CTRL, 0xD802); | 2167 | /*hw_write_20kx(hw, GPIO_CTRL, 0xFF07);*/ |
2032 | 2168 | hw_write_20kx(hw, GPIO_CTRL, 0xD802); | |
2169 | } else { | ||
2170 | hw_write_20kx(hw, GPIO_CTRL, 0x9E5F); | ||
2171 | } | ||
2033 | /* Enable audio ring */ | 2172 | /* Enable audio ring */ |
2034 | hw_write_20kx(hw, MIXER_AR_ENABLE, 0x01); | 2173 | hw_write_20kx(hw, MIXER_AR_ENABLE, 0x01); |
2035 | 2174 | ||
@@ -2106,7 +2245,11 @@ static struct hw ct20k2_preset __devinitdata = { | |||
2106 | .pll_init = hw_pll_init, | 2245 | .pll_init = hw_pll_init, |
2107 | .is_adc_source_selected = hw_is_adc_input_selected, | 2246 | .is_adc_source_selected = hw_is_adc_input_selected, |
2108 | .select_adc_source = hw_adc_input_select, | 2247 | .select_adc_source = hw_adc_input_select, |
2109 | .have_digit_io_switch = hw_have_digit_io_switch, | 2248 | .capabilities = hw_capabilities, |
2249 | .output_switch_get = hw_output_switch_get, | ||
2250 | .output_switch_put = hw_output_switch_put, | ||
2251 | .mic_source_switch_get = hw_mic_source_switch_get, | ||
2252 | .mic_source_switch_put = hw_mic_source_switch_put, | ||
2110 | #ifdef CONFIG_PM | 2253 | #ifdef CONFIG_PM |
2111 | .suspend = hw_suspend, | 2254 | .suspend = hw_suspend, |
2112 | .resume = hw_resume, | 2255 | .resume = hw_resume, |
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c index c3519ff42fbb..0cc13eeef8da 100644 --- a/sound/pci/ctxfi/ctmixer.c +++ b/sound/pci/ctxfi/ctmixer.c | |||
@@ -86,9 +86,7 @@ enum CTALSA_MIXER_CTL { | |||
86 | MIXER_LINEIN_C_S, | 86 | MIXER_LINEIN_C_S, |
87 | MIXER_MIC_C_S, | 87 | MIXER_MIC_C_S, |
88 | MIXER_SPDIFI_C_S, | 88 | MIXER_SPDIFI_C_S, |
89 | MIXER_LINEIN_P_S, | ||
90 | MIXER_SPDIFO_P_S, | 89 | MIXER_SPDIFO_P_S, |
91 | MIXER_SPDIFI_P_S, | ||
92 | MIXER_WAVEF_P_S, | 90 | MIXER_WAVEF_P_S, |
93 | MIXER_WAVER_P_S, | 91 | MIXER_WAVER_P_S, |
94 | MIXER_WAVEC_P_S, | 92 | MIXER_WAVEC_P_S, |
@@ -137,11 +135,11 @@ ct_kcontrol_init_table[NUM_CTALSA_MIXERS] = { | |||
137 | }, | 135 | }, |
138 | [MIXER_LINEIN_P] = { | 136 | [MIXER_LINEIN_P] = { |
139 | .ctl = 1, | 137 | .ctl = 1, |
140 | .name = "Line-in Playback Volume", | 138 | .name = "Line Playback Volume", |
141 | }, | 139 | }, |
142 | [MIXER_LINEIN_C] = { | 140 | [MIXER_LINEIN_C] = { |
143 | .ctl = 1, | 141 | .ctl = 1, |
144 | .name = "Line-in Capture Volume", | 142 | .name = "Line Capture Volume", |
145 | }, | 143 | }, |
146 | [MIXER_MIC_P] = { | 144 | [MIXER_MIC_P] = { |
147 | .ctl = 1, | 145 | .ctl = 1, |
@@ -153,15 +151,15 @@ ct_kcontrol_init_table[NUM_CTALSA_MIXERS] = { | |||
153 | }, | 151 | }, |
154 | [MIXER_SPDIFI_P] = { | 152 | [MIXER_SPDIFI_P] = { |
155 | .ctl = 1, | 153 | .ctl = 1, |
156 | .name = "S/PDIF-in Playback Volume", | 154 | .name = "IEC958 Playback Volume", |
157 | }, | 155 | }, |
158 | [MIXER_SPDIFI_C] = { | 156 | [MIXER_SPDIFI_C] = { |
159 | .ctl = 1, | 157 | .ctl = 1, |
160 | .name = "S/PDIF-in Capture Volume", | 158 | .name = "IEC958 Capture Volume", |
161 | }, | 159 | }, |
162 | [MIXER_SPDIFO_P] = { | 160 | [MIXER_SPDIFO_P] = { |
163 | .ctl = 1, | 161 | .ctl = 1, |
164 | .name = "S/PDIF-out Playback Volume", | 162 | .name = "Digital Playback Volume", |
165 | }, | 163 | }, |
166 | [MIXER_WAVEF_P] = { | 164 | [MIXER_WAVEF_P] = { |
167 | .ctl = 1, | 165 | .ctl = 1, |
@@ -179,14 +177,13 @@ ct_kcontrol_init_table[NUM_CTALSA_MIXERS] = { | |||
179 | .ctl = 1, | 177 | .ctl = 1, |
180 | .name = "Surround Playback Volume", | 178 | .name = "Surround Playback Volume", |
181 | }, | 179 | }, |
182 | |||
183 | [MIXER_PCM_C_S] = { | 180 | [MIXER_PCM_C_S] = { |
184 | .ctl = 1, | 181 | .ctl = 1, |
185 | .name = "PCM Capture Switch", | 182 | .name = "PCM Capture Switch", |
186 | }, | 183 | }, |
187 | [MIXER_LINEIN_C_S] = { | 184 | [MIXER_LINEIN_C_S] = { |
188 | .ctl = 1, | 185 | .ctl = 1, |
189 | .name = "Line-in Capture Switch", | 186 | .name = "Line Capture Switch", |
190 | }, | 187 | }, |
191 | [MIXER_MIC_C_S] = { | 188 | [MIXER_MIC_C_S] = { |
192 | .ctl = 1, | 189 | .ctl = 1, |
@@ -194,19 +191,11 @@ ct_kcontrol_init_table[NUM_CTALSA_MIXERS] = { | |||
194 | }, | 191 | }, |
195 | [MIXER_SPDIFI_C_S] = { | 192 | [MIXER_SPDIFI_C_S] = { |
196 | .ctl = 1, | 193 | .ctl = 1, |
197 | .name = "S/PDIF-in Capture Switch", | 194 | .name = "IEC958 Capture Switch", |
198 | }, | ||
199 | [MIXER_LINEIN_P_S] = { | ||
200 | .ctl = 1, | ||
201 | .name = "Line-in Playback Switch", | ||
202 | }, | 195 | }, |
203 | [MIXER_SPDIFO_P_S] = { | 196 | [MIXER_SPDIFO_P_S] = { |
204 | .ctl = 1, | 197 | .ctl = 1, |
205 | .name = "S/PDIF-out Playback Switch", | 198 | .name = "Digital Playback Switch", |
206 | }, | ||
207 | [MIXER_SPDIFI_P_S] = { | ||
208 | .ctl = 1, | ||
209 | .name = "S/PDIF-in Playback Switch", | ||
210 | }, | 199 | }, |
211 | [MIXER_WAVEF_P_S] = { | 200 | [MIXER_WAVEF_P_S] = { |
212 | .ctl = 1, | 201 | .ctl = 1, |
@@ -236,6 +225,8 @@ ct_mixer_recording_select(struct ct_mixer *mixer, enum CT_AMIXER_CTL type); | |||
236 | static void | 225 | static void |
237 | ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type); | 226 | ct_mixer_recording_unselect(struct ct_mixer *mixer, enum CT_AMIXER_CTL type); |
238 | 227 | ||
228 | /* FIXME: this static looks like it would fail if more than one card was */ | ||
229 | /* installed. */ | ||
239 | static struct snd_kcontrol *kctls[2] = {NULL}; | 230 | static struct snd_kcontrol *kctls[2] = {NULL}; |
240 | 231 | ||
241 | static enum CT_AMIXER_CTL get_amixer_index(enum CTALSA_MIXER_CTL alsa_index) | 232 | static enum CT_AMIXER_CTL get_amixer_index(enum CTALSA_MIXER_CTL alsa_index) |
@@ -420,6 +411,77 @@ static struct snd_kcontrol_new vol_ctl = { | |||
420 | .tlv = { .p = ct_vol_db_scale }, | 411 | .tlv = { .p = ct_vol_db_scale }, |
421 | }; | 412 | }; |
422 | 413 | ||
414 | static int output_switch_info(struct snd_kcontrol *kcontrol, | ||
415 | struct snd_ctl_elem_info *info) | ||
416 | { | ||
417 | static const char *const names[3] = { | ||
418 | "FP Headphones", "Headphones", "Speakers" | ||
419 | }; | ||
420 | |||
421 | return snd_ctl_enum_info(info, 1, 3, names); | ||
422 | } | ||
423 | |||
424 | static int output_switch_get(struct snd_kcontrol *kcontrol, | ||
425 | struct snd_ctl_elem_value *ucontrol) | ||
426 | { | ||
427 | struct ct_atc *atc = snd_kcontrol_chip(kcontrol); | ||
428 | ucontrol->value.enumerated.item[0] = atc->output_switch_get(atc); | ||
429 | return 0; | ||
430 | } | ||
431 | |||
432 | static int output_switch_put(struct snd_kcontrol *kcontrol, | ||
433 | struct snd_ctl_elem_value *ucontrol) | ||
434 | { | ||
435 | struct ct_atc *atc = snd_kcontrol_chip(kcontrol); | ||
436 | if (ucontrol->value.enumerated.item[0] > 2) | ||
437 | return -EINVAL; | ||
438 | return atc->output_switch_put(atc, ucontrol->value.enumerated.item[0]); | ||
439 | } | ||
440 | |||
441 | static struct snd_kcontrol_new output_ctl = { | ||
442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
443 | .name = "Analog Output Playback Enum", | ||
444 | .info = output_switch_info, | ||
445 | .get = output_switch_get, | ||
446 | .put = output_switch_put, | ||
447 | }; | ||
448 | |||
449 | static int mic_source_switch_info(struct snd_kcontrol *kcontrol, | ||
450 | struct snd_ctl_elem_info *info) | ||
451 | { | ||
452 | static const char *const names[3] = { | ||
453 | "Mic", "FP Mic", "Aux" | ||
454 | }; | ||
455 | |||
456 | return snd_ctl_enum_info(info, 1, 3, names); | ||
457 | } | ||
458 | |||
459 | static int mic_source_switch_get(struct snd_kcontrol *kcontrol, | ||
460 | struct snd_ctl_elem_value *ucontrol) | ||
461 | { | ||
462 | struct ct_atc *atc = snd_kcontrol_chip(kcontrol); | ||
463 | ucontrol->value.enumerated.item[0] = atc->mic_source_switch_get(atc); | ||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | static int mic_source_switch_put(struct snd_kcontrol *kcontrol, | ||
468 | struct snd_ctl_elem_value *ucontrol) | ||
469 | { | ||
470 | struct ct_atc *atc = snd_kcontrol_chip(kcontrol); | ||
471 | if (ucontrol->value.enumerated.item[0] > 2) | ||
472 | return -EINVAL; | ||
473 | return atc->mic_source_switch_put(atc, | ||
474 | ucontrol->value.enumerated.item[0]); | ||
475 | } | ||
476 | |||
477 | static struct snd_kcontrol_new mic_source_ctl = { | ||
478 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
479 | .name = "Mic Source Capture Enum", | ||
480 | .info = mic_source_switch_info, | ||
481 | .get = mic_source_switch_get, | ||
482 | .put = mic_source_switch_put, | ||
483 | }; | ||
484 | |||
423 | static void | 485 | static void |
424 | do_line_mic_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type) | 486 | do_line_mic_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type) |
425 | { | 487 | { |
@@ -465,6 +527,7 @@ do_digit_io_switch(struct ct_atc *atc, int state) | |||
465 | static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) | 527 | static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) |
466 | { | 528 | { |
467 | struct ct_mixer *mixer = atc->mixer; | 529 | struct ct_mixer *mixer = atc->mixer; |
530 | struct capabilities cap = atc->capabilities(atc); | ||
468 | 531 | ||
469 | /* Do changes in mixer. */ | 532 | /* Do changes in mixer. */ |
470 | if ((SWH_CAPTURE_START <= type) && (SWH_CAPTURE_END >= type)) { | 533 | if ((SWH_CAPTURE_START <= type) && (SWH_CAPTURE_END >= type)) { |
@@ -477,8 +540,17 @@ static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) | |||
477 | } | 540 | } |
478 | } | 541 | } |
479 | /* Do changes out of mixer. */ | 542 | /* Do changes out of mixer. */ |
480 | if (state && (MIXER_LINEIN_C_S == type || MIXER_MIC_C_S == type)) | 543 | if (!cap.dedicated_mic && |
481 | do_line_mic_switch(atc, type); | 544 | (MIXER_LINEIN_C_S == type || MIXER_MIC_C_S == type)) { |
545 | if (state) | ||
546 | do_line_mic_switch(atc, type); | ||
547 | atc->line_in_unmute(atc, state); | ||
548 | } else if (cap.dedicated_mic && (MIXER_LINEIN_C_S == type)) | ||
549 | atc->line_in_unmute(atc, state); | ||
550 | else if (cap.dedicated_mic && (MIXER_MIC_C_S == type)) | ||
551 | atc->mic_unmute(atc, state); | ||
552 | else if (MIXER_SPDIFI_C_S == type) | ||
553 | atc->spdif_in_unmute(atc, state); | ||
482 | else if (MIXER_WAVEF_P_S == type) | 554 | else if (MIXER_WAVEF_P_S == type) |
483 | atc->line_front_unmute(atc, state); | 555 | atc->line_front_unmute(atc, state); |
484 | else if (MIXER_WAVES_P_S == type) | 556 | else if (MIXER_WAVES_P_S == type) |
@@ -487,12 +559,8 @@ static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) | |||
487 | atc->line_clfe_unmute(atc, state); | 559 | atc->line_clfe_unmute(atc, state); |
488 | else if (MIXER_WAVER_P_S == type) | 560 | else if (MIXER_WAVER_P_S == type) |
489 | atc->line_rear_unmute(atc, state); | 561 | atc->line_rear_unmute(atc, state); |
490 | else if (MIXER_LINEIN_P_S == type) | ||
491 | atc->line_in_unmute(atc, state); | ||
492 | else if (MIXER_SPDIFO_P_S == type) | 562 | else if (MIXER_SPDIFO_P_S == type) |
493 | atc->spdif_out_unmute(atc, state); | 563 | atc->spdif_out_unmute(atc, state); |
494 | else if (MIXER_SPDIFI_P_S == type) | ||
495 | atc->spdif_in_unmute(atc, state); | ||
496 | else if (MIXER_DIGITAL_IO_S == type) | 564 | else if (MIXER_DIGITAL_IO_S == type) |
497 | do_digit_io_switch(atc, state); | 565 | do_digit_io_switch(atc, state); |
498 | 566 | ||
@@ -671,6 +739,7 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) | |||
671 | { | 739 | { |
672 | enum CTALSA_MIXER_CTL type; | 740 | enum CTALSA_MIXER_CTL type; |
673 | struct ct_atc *atc = mixer->atc; | 741 | struct ct_atc *atc = mixer->atc; |
742 | struct capabilities cap = atc->capabilities(atc); | ||
674 | int err; | 743 | int err; |
675 | 744 | ||
676 | /* Create snd kcontrol instances on demand */ | 745 | /* Create snd kcontrol instances on demand */ |
@@ -684,8 +753,8 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) | |||
684 | } | 753 | } |
685 | } | 754 | } |
686 | 755 | ||
687 | ct_kcontrol_init_table[MIXER_DIGITAL_IO_S].ctl = | 756 | ct_kcontrol_init_table[MIXER_DIGITAL_IO_S].ctl = cap.digit_io_switch; |
688 | atc->have_digit_io_switch(atc); | 757 | |
689 | for (type = SWH_MIXER_START; type <= SWH_MIXER_END; type++) { | 758 | for (type = SWH_MIXER_START; type <= SWH_MIXER_END; type++) { |
690 | if (ct_kcontrol_init_table[type].ctl) { | 759 | if (ct_kcontrol_init_table[type].ctl) { |
691 | swh_ctl.name = ct_kcontrol_init_table[type].name; | 760 | swh_ctl.name = ct_kcontrol_init_table[type].name; |
@@ -708,6 +777,17 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) | |||
708 | if (err) | 777 | if (err) |
709 | return err; | 778 | return err; |
710 | 779 | ||
780 | if (cap.output_switch) { | ||
781 | err = ct_mixer_kcontrol_new(mixer, &output_ctl); | ||
782 | if (err) | ||
783 | return err; | ||
784 | } | ||
785 | |||
786 | if (cap.mic_source_switch) { | ||
787 | err = ct_mixer_kcontrol_new(mixer, &mic_source_ctl); | ||
788 | if (err) | ||
789 | return err; | ||
790 | } | ||
711 | atc->line_front_unmute(atc, 1); | 791 | atc->line_front_unmute(atc, 1); |
712 | set_switch_state(mixer, MIXER_WAVEF_P_S, 1); | 792 | set_switch_state(mixer, MIXER_WAVEF_P_S, 1); |
713 | atc->line_surround_unmute(atc, 0); | 793 | atc->line_surround_unmute(atc, 0); |
@@ -719,13 +799,12 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) | |||
719 | atc->spdif_out_unmute(atc, 0); | 799 | atc->spdif_out_unmute(atc, 0); |
720 | set_switch_state(mixer, MIXER_SPDIFO_P_S, 0); | 800 | set_switch_state(mixer, MIXER_SPDIFO_P_S, 0); |
721 | atc->line_in_unmute(atc, 0); | 801 | atc->line_in_unmute(atc, 0); |
722 | set_switch_state(mixer, MIXER_LINEIN_P_S, 0); | 802 | if (cap.dedicated_mic) |
803 | atc->mic_unmute(atc, 0); | ||
723 | atc->spdif_in_unmute(atc, 0); | 804 | atc->spdif_in_unmute(atc, 0); |
724 | set_switch_state(mixer, MIXER_SPDIFI_P_S, 0); | 805 | set_switch_state(mixer, MIXER_PCM_C_S, 0); |
725 | 806 | set_switch_state(mixer, MIXER_LINEIN_C_S, 0); | |
726 | set_switch_state(mixer, MIXER_PCM_C_S, 1); | 807 | set_switch_state(mixer, MIXER_SPDIFI_C_S, 0); |
727 | set_switch_state(mixer, MIXER_LINEIN_C_S, 1); | ||
728 | set_switch_state(mixer, MIXER_SPDIFI_C_S, 1); | ||
729 | 808 | ||
730 | return 0; | 809 | return 0; |
731 | } | 810 | } |
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c index f42e7e1a1074..b259aa03a3a9 100644 --- a/sound/pci/ctxfi/xfi.c +++ b/sound/pci/ctxfi/xfi.c | |||
@@ -80,11 +80,11 @@ ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
80 | "are 48000 and 44100, Value 48000 is assumed.\n"); | 80 | "are 48000 and 44100, Value 48000 is assumed.\n"); |
81 | reference_rate = 48000; | 81 | reference_rate = 48000; |
82 | } | 82 | } |
83 | if ((multiple != 1) && (multiple != 2)) { | 83 | if ((multiple != 1) && (multiple != 2) && (multiple != 4)) { |
84 | printk(KERN_ERR "ctxfi: Invalid multiple value %u!!!\n", | 84 | printk(KERN_ERR "ctxfi: Invalid multiple value %u!!!\n", |
85 | multiple); | 85 | multiple); |
86 | printk(KERN_ERR "ctxfi: The valid values for multiple are " | 86 | printk(KERN_ERR "ctxfi: The valid values for multiple are " |
87 | "1 and 2, Value 2 is assumed.\n"); | 87 | "1, 2 and 4, Value 2 is assumed.\n"); |
88 | multiple = 2; | 88 | multiple = 2; |
89 | } | 89 | } |
90 | err = ct_atc_create(card, pci, reference_rate, multiple, | 90 | err = ct_atc_create(card, pci, reference_rate, multiple, |
@@ -143,7 +143,7 @@ static int ct_card_resume(struct pci_dev *pci) | |||
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | static struct pci_driver ct_driver = { | 145 | static struct pci_driver ct_driver = { |
146 | .name = "SB-XFi", | 146 | .name = KBUILD_MODNAME, |
147 | .id_table = ct_pci_dev_ids, | 147 | .id_table = ct_pci_dev_ids, |
148 | .probe = ct_card_probe, | 148 | .probe = ct_card_probe, |
149 | .remove = __devexit_p(ct_card_remove), | 149 | .remove = __devexit_p(ct_card_remove), |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 20763dd03fa0..d7306980d0f1 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -1995,7 +1995,7 @@ static __devinit int snd_echo_create(struct snd_card *card, | |||
1995 | ioremap_nocache(chip->dsp_registers_phys, sz); | 1995 | ioremap_nocache(chip->dsp_registers_phys, sz); |
1996 | 1996 | ||
1997 | if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, | 1997 | if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, |
1998 | ECHOCARD_NAME, chip)) { | 1998 | KBUILD_MODNAME, chip)) { |
1999 | snd_echo_free(chip); | 1999 | snd_echo_free(chip); |
2000 | snd_printk(KERN_ERR "cannot grab irq\n"); | 2000 | snd_printk(KERN_ERR "cannot grab irq\n"); |
2001 | return -EBUSY; | 2001 | return -EBUSY; |
@@ -2286,7 +2286,7 @@ static int snd_echo_resume(struct pci_dev *pci) | |||
2286 | kfree(commpage_bak); | 2286 | kfree(commpage_bak); |
2287 | 2287 | ||
2288 | if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, | 2288 | if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, |
2289 | ECHOCARD_NAME, chip)) { | 2289 | KBUILD_MODNAME, chip)) { |
2290 | snd_echo_free(chip); | 2290 | snd_echo_free(chip); |
2291 | snd_printk(KERN_ERR "cannot grab irq\n"); | 2291 | snd_printk(KERN_ERR "cannot grab irq\n"); |
2292 | return -EBUSY; | 2292 | return -EBUSY; |
@@ -2327,7 +2327,7 @@ static void __devexit snd_echo_remove(struct pci_dev *pci) | |||
2327 | 2327 | ||
2328 | /* pci_driver definition */ | 2328 | /* pci_driver definition */ |
2329 | static struct pci_driver driver = { | 2329 | static struct pci_driver driver = { |
2330 | .name = "Echoaudio " ECHOCARD_NAME, | 2330 | .name = KBUILD_MODNAME, |
2331 | .id_table = snd_echo_ids, | 2331 | .id_table = snd_echo_ids, |
2332 | .probe = snd_echo_probe, | 2332 | .probe = snd_echo_probe, |
2333 | .remove = __devexit_p(snd_echo_remove), | 2333 | .remove = __devexit_p(snd_echo_remove), |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index aff8387c45cf..a9c45d2cdb13 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -264,7 +264,7 @@ static int snd_emu10k1_resume(struct pci_dev *pci) | |||
264 | #endif | 264 | #endif |
265 | 265 | ||
266 | static struct pci_driver driver = { | 266 | static struct pci_driver driver = { |
267 | .name = "EMU10K1_Audigy", | 267 | .name = KBUILD_MODNAME, |
268 | .id_table = snd_emu10k1_ids, | 268 | .id_table = snd_emu10k1_ids, |
269 | .probe = snd_card_emu10k1_probe, | 269 | .probe = snd_card_emu10k1_probe, |
270 | .remove = __devexit_p(snd_card_emu10k1_remove), | 270 | .remove = __devexit_p(snd_card_emu10k1_remove), |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 15f0161ce4a2..fcd4935766b2 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -1912,7 +1912,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, | |||
1912 | 1912 | ||
1913 | /* irq handler must be registered after I/O ports are activated */ | 1913 | /* irq handler must be registered after I/O ports are activated */ |
1914 | if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED, | 1914 | if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED, |
1915 | "EMU10K1", emu)) { | 1915 | KBUILD_MODNAME, emu)) { |
1916 | err = -EBUSY; | 1916 | err = -EBUSY; |
1917 | goto error; | 1917 | goto error; |
1918 | } | 1918 | } |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 0c701e4ec8a5..d4fde1b4b093 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -925,7 +925,7 @@ static int __devinit snd_emu10k1x_create(struct snd_card *card, | |||
925 | } | 925 | } |
926 | 926 | ||
927 | if (request_irq(pci->irq, snd_emu10k1x_interrupt, | 927 | if (request_irq(pci->irq, snd_emu10k1x_interrupt, |
928 | IRQF_SHARED, "EMU10K1X", chip)) { | 928 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
929 | snd_printk(KERN_ERR "emu10k1x: cannot grab irq %d\n", pci->irq); | 929 | snd_printk(KERN_ERR "emu10k1x: cannot grab irq %d\n", pci->irq); |
930 | snd_emu10k1x_free(chip); | 930 | snd_emu10k1x_free(chip); |
931 | return -EBUSY; | 931 | return -EBUSY; |
@@ -1613,7 +1613,7 @@ MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids); | |||
1613 | 1613 | ||
1614 | // pci_driver definition | 1614 | // pci_driver definition |
1615 | static struct pci_driver driver = { | 1615 | static struct pci_driver driver = { |
1616 | .name = "EMU10K1X", | 1616 | .name = KBUILD_MODNAME, |
1617 | .id_table = snd_emu10k1x_ids, | 1617 | .id_table = snd_emu10k1x_ids, |
1618 | .probe = snd_emu10k1x_probe, | 1618 | .probe = snd_emu10k1x_probe, |
1619 | .remove = __devexit_p(snd_emu10k1x_remove), | 1619 | .remove = __devexit_p(snd_emu10k1x_remove), |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 863eafea691f..f02e2f8d7122 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -2120,7 +2120,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card, | |||
2120 | } | 2120 | } |
2121 | ensoniq->port = pci_resource_start(pci, 0); | 2121 | ensoniq->port = pci_resource_start(pci, 0); |
2122 | if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED, | 2122 | if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED, |
2123 | "Ensoniq AudioPCI", ensoniq)) { | 2123 | KBUILD_MODNAME, ensoniq)) { |
2124 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2124 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2125 | snd_ensoniq_free(ensoniq); | 2125 | snd_ensoniq_free(ensoniq); |
2126 | return -EBUSY; | 2126 | return -EBUSY; |
@@ -2489,7 +2489,7 @@ static void __devexit snd_audiopci_remove(struct pci_dev *pci) | |||
2489 | } | 2489 | } |
2490 | 2490 | ||
2491 | static struct pci_driver driver = { | 2491 | static struct pci_driver driver = { |
2492 | .name = DRIVER_NAME, | 2492 | .name = KBUILD_MODNAME, |
2493 | .id_table = snd_audiopci_ids, | 2493 | .id_table = snd_audiopci_ids, |
2494 | .probe = snd_audiopci_probe, | 2494 | .probe = snd_audiopci_probe, |
2495 | .remove = __devexit_p(snd_audiopci_remove), | 2495 | .remove = __devexit_p(snd_audiopci_remove), |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 553b75217259..26a5a2f25d4b 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -1514,7 +1514,7 @@ static int es1938_resume(struct pci_dev *pci) | |||
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | if (request_irq(pci->irq, snd_es1938_interrupt, | 1516 | if (request_irq(pci->irq, snd_es1938_interrupt, |
1517 | IRQF_SHARED, "ES1938", chip)) { | 1517 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1518 | printk(KERN_ERR "es1938: unable to grab IRQ %d, " | 1518 | printk(KERN_ERR "es1938: unable to grab IRQ %d, " |
1519 | "disabling device\n", pci->irq); | 1519 | "disabling device\n", pci->irq); |
1520 | snd_card_disconnect(card); | 1520 | snd_card_disconnect(card); |
@@ -1636,7 +1636,7 @@ static int __devinit snd_es1938_create(struct snd_card *card, | |||
1636 | chip->mpu_port = pci_resource_start(pci, 3); | 1636 | chip->mpu_port = pci_resource_start(pci, 3); |
1637 | chip->game_port = pci_resource_start(pci, 4); | 1637 | chip->game_port = pci_resource_start(pci, 4); |
1638 | if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED, | 1638 | if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED, |
1639 | "ES1938", chip)) { | 1639 | KBUILD_MODNAME, chip)) { |
1640 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1640 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1641 | snd_es1938_free(chip); | 1641 | snd_es1938_free(chip); |
1642 | return -EBUSY; | 1642 | return -EBUSY; |
@@ -1882,7 +1882,7 @@ static void __devexit snd_es1938_remove(struct pci_dev *pci) | |||
1882 | } | 1882 | } |
1883 | 1883 | ||
1884 | static struct pci_driver driver = { | 1884 | static struct pci_driver driver = { |
1885 | .name = "ESS ES1938 (Solo-1)", | 1885 | .name = KBUILD_MODNAME, |
1886 | .id_table = snd_es1938_ids, | 1886 | .id_table = snd_es1938_ids, |
1887 | .probe = snd_es1938_probe, | 1887 | .probe = snd_es1938_probe, |
1888 | .remove = __devexit_p(snd_es1938_remove), | 1888 | .remove = __devexit_p(snd_es1938_remove), |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index ab0a6156a704..99ea9320c6b5 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -554,9 +554,8 @@ struct es1968 { | |||
554 | #else | 554 | #else |
555 | struct snd_kcontrol *master_switch; /* for h/w volume control */ | 555 | struct snd_kcontrol *master_switch; /* for h/w volume control */ |
556 | struct snd_kcontrol *master_volume; | 556 | struct snd_kcontrol *master_volume; |
557 | spinlock_t ac97_lock; | ||
558 | struct tasklet_struct hwvol_tq; | ||
559 | #endif | 557 | #endif |
558 | struct work_struct hwvol_work; | ||
560 | 559 | ||
561 | #ifdef CONFIG_SND_ES1968_RADIO | 560 | #ifdef CONFIG_SND_ES1968_RADIO |
562 | struct snd_tea575x tea; | 561 | struct snd_tea575x tea; |
@@ -646,38 +645,23 @@ static int snd_es1968_ac97_wait_poll(struct es1968 *chip) | |||
646 | static void snd_es1968_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) | 645 | static void snd_es1968_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) |
647 | { | 646 | { |
648 | struct es1968 *chip = ac97->private_data; | 647 | struct es1968 *chip = ac97->private_data; |
649 | #ifndef CONFIG_SND_ES1968_INPUT | ||
650 | unsigned long flags; | ||
651 | #endif | ||
652 | 648 | ||
653 | snd_es1968_ac97_wait(chip); | 649 | snd_es1968_ac97_wait(chip); |
654 | 650 | ||
655 | /* Write the bus */ | 651 | /* Write the bus */ |
656 | #ifndef CONFIG_SND_ES1968_INPUT | ||
657 | spin_lock_irqsave(&chip->ac97_lock, flags); | ||
658 | #endif | ||
659 | outw(val, chip->io_port + ESM_AC97_DATA); | 652 | outw(val, chip->io_port + ESM_AC97_DATA); |
660 | /*msleep(1);*/ | 653 | /*msleep(1);*/ |
661 | outb(reg, chip->io_port + ESM_AC97_INDEX); | 654 | outb(reg, chip->io_port + ESM_AC97_INDEX); |
662 | /*msleep(1);*/ | 655 | /*msleep(1);*/ |
663 | #ifndef CONFIG_SND_ES1968_INPUT | ||
664 | spin_unlock_irqrestore(&chip->ac97_lock, flags); | ||
665 | #endif | ||
666 | } | 656 | } |
667 | 657 | ||
668 | static unsigned short snd_es1968_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | 658 | static unsigned short snd_es1968_ac97_read(struct snd_ac97 *ac97, unsigned short reg) |
669 | { | 659 | { |
670 | u16 data = 0; | 660 | u16 data = 0; |
671 | struct es1968 *chip = ac97->private_data; | 661 | struct es1968 *chip = ac97->private_data; |
672 | #ifndef CONFIG_SND_ES1968_INPUT | ||
673 | unsigned long flags; | ||
674 | #endif | ||
675 | 662 | ||
676 | snd_es1968_ac97_wait(chip); | 663 | snd_es1968_ac97_wait(chip); |
677 | 664 | ||
678 | #ifndef CONFIG_SND_ES1968_INPUT | ||
679 | spin_lock_irqsave(&chip->ac97_lock, flags); | ||
680 | #endif | ||
681 | outb(reg | 0x80, chip->io_port + ESM_AC97_INDEX); | 665 | outb(reg | 0x80, chip->io_port + ESM_AC97_INDEX); |
682 | /*msleep(1);*/ | 666 | /*msleep(1);*/ |
683 | 667 | ||
@@ -685,9 +669,6 @@ static unsigned short snd_es1968_ac97_read(struct snd_ac97 *ac97, unsigned short | |||
685 | data = inw(chip->io_port + ESM_AC97_DATA); | 669 | data = inw(chip->io_port + ESM_AC97_DATA); |
686 | /*msleep(1);*/ | 670 | /*msleep(1);*/ |
687 | } | 671 | } |
688 | #ifndef CONFIG_SND_ES1968_INPUT | ||
689 | spin_unlock_irqrestore(&chip->ac97_lock, flags); | ||
690 | #endif | ||
691 | 672 | ||
692 | return data; | 673 | return data; |
693 | } | 674 | } |
@@ -1904,13 +1885,10 @@ static void snd_es1968_update_pcm(struct es1968 *chip, struct esschan *es) | |||
1904 | (without wrap around) in response to volume button presses and then | 1885 | (without wrap around) in response to volume button presses and then |
1905 | generating an interrupt. The pair of counters is stored in bits 1-3 and 5-7 | 1886 | generating an interrupt. The pair of counters is stored in bits 1-3 and 5-7 |
1906 | of a byte wide register. The meaning of bits 0 and 4 is unknown. */ | 1887 | of a byte wide register. The meaning of bits 0 and 4 is unknown. */ |
1907 | static void es1968_update_hw_volume(unsigned long private_data) | 1888 | static void es1968_update_hw_volume(struct work_struct *work) |
1908 | { | 1889 | { |
1909 | struct es1968 *chip = (struct es1968 *) private_data; | 1890 | struct es1968 *chip = container_of(work, struct es1968, hwvol_work); |
1910 | int x, val; | 1891 | int x, val; |
1911 | #ifndef CONFIG_SND_ES1968_INPUT | ||
1912 | unsigned long flags; | ||
1913 | #endif | ||
1914 | 1892 | ||
1915 | /* Figure out which volume control button was pushed, | 1893 | /* Figure out which volume control button was pushed, |
1916 | based on differences from the default register | 1894 | based on differences from the default register |
@@ -1929,18 +1907,11 @@ static void es1968_update_hw_volume(unsigned long private_data) | |||
1929 | if (! chip->master_switch || ! chip->master_volume) | 1907 | if (! chip->master_switch || ! chip->master_volume) |
1930 | return; | 1908 | return; |
1931 | 1909 | ||
1932 | /* FIXME: we can't call snd_ac97_* functions since here is in tasklet. */ | 1910 | val = snd_ac97_read(chip->ac97, AC97_MASTER); |
1933 | spin_lock_irqsave(&chip->ac97_lock, flags); | ||
1934 | val = chip->ac97->regs[AC97_MASTER]; | ||
1935 | switch (x) { | 1911 | switch (x) { |
1936 | case 0x88: | 1912 | case 0x88: |
1937 | /* mute */ | 1913 | /* mute */ |
1938 | val ^= 0x8000; | 1914 | val ^= 0x8000; |
1939 | chip->ac97->regs[AC97_MASTER] = val; | ||
1940 | outw(val, chip->io_port + ESM_AC97_DATA); | ||
1941 | outb(AC97_MASTER, chip->io_port + ESM_AC97_INDEX); | ||
1942 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1943 | &chip->master_switch->id); | ||
1944 | break; | 1915 | break; |
1945 | case 0xaa: | 1916 | case 0xaa: |
1946 | /* volume up */ | 1917 | /* volume up */ |
@@ -1948,11 +1919,6 @@ static void es1968_update_hw_volume(unsigned long private_data) | |||
1948 | val--; | 1919 | val--; |
1949 | if ((val & 0x7f00) > 0) | 1920 | if ((val & 0x7f00) > 0) |
1950 | val -= 0x0100; | 1921 | val -= 0x0100; |
1951 | chip->ac97->regs[AC97_MASTER] = val; | ||
1952 | outw(val, chip->io_port + ESM_AC97_DATA); | ||
1953 | outb(AC97_MASTER, chip->io_port + ESM_AC97_INDEX); | ||
1954 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1955 | &chip->master_volume->id); | ||
1956 | break; | 1922 | break; |
1957 | case 0x66: | 1923 | case 0x66: |
1958 | /* volume down */ | 1924 | /* volume down */ |
@@ -1960,14 +1926,11 @@ static void es1968_update_hw_volume(unsigned long private_data) | |||
1960 | val++; | 1926 | val++; |
1961 | if ((val & 0x7f00) < 0x1f00) | 1927 | if ((val & 0x7f00) < 0x1f00) |
1962 | val += 0x0100; | 1928 | val += 0x0100; |
1963 | chip->ac97->regs[AC97_MASTER] = val; | ||
1964 | outw(val, chip->io_port + ESM_AC97_DATA); | ||
1965 | outb(AC97_MASTER, chip->io_port + ESM_AC97_INDEX); | ||
1966 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1967 | &chip->master_volume->id); | ||
1968 | break; | 1929 | break; |
1969 | } | 1930 | } |
1970 | spin_unlock_irqrestore(&chip->ac97_lock, flags); | 1931 | if (snd_ac97_update(chip->ac97, AC97_MASTER, val)) |
1932 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1933 | &chip->master_volume->id); | ||
1971 | #else | 1934 | #else |
1972 | if (!chip->input_dev) | 1935 | if (!chip->input_dev) |
1973 | return; | 1936 | return; |
@@ -2013,11 +1976,7 @@ static irqreturn_t snd_es1968_interrupt(int irq, void *dev_id) | |||
2013 | outw(inw(chip->io_port + 4) & 1, chip->io_port + 4); | 1976 | outw(inw(chip->io_port + 4) & 1, chip->io_port + 4); |
2014 | 1977 | ||
2015 | if (event & ESM_HWVOL_IRQ) | 1978 | if (event & ESM_HWVOL_IRQ) |
2016 | #ifdef CONFIG_SND_ES1968_INPUT | 1979 | schedule_work(&chip->hwvol_work); |
2017 | es1968_update_hw_volume((unsigned long)chip); | ||
2018 | #else | ||
2019 | tasklet_schedule(&chip->hwvol_tq); /* we'll do this later */ | ||
2020 | #endif | ||
2021 | 1980 | ||
2022 | /* else ack 'em all, i imagine */ | 1981 | /* else ack 'em all, i imagine */ |
2023 | outb(0xFF, chip->io_port + 0x1A); | 1982 | outb(0xFF, chip->io_port + 0x1A); |
@@ -2426,6 +2385,7 @@ static int es1968_suspend(struct pci_dev *pci, pm_message_t state) | |||
2426 | return 0; | 2385 | return 0; |
2427 | 2386 | ||
2428 | chip->in_suspend = 1; | 2387 | chip->in_suspend = 1; |
2388 | cancel_work_sync(&chip->hwvol_work); | ||
2429 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2389 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2430 | snd_pcm_suspend_all(chip->pcm); | 2390 | snd_pcm_suspend_all(chip->pcm); |
2431 | snd_ac97_suspend(chip->ac97); | 2391 | snd_ac97_suspend(chip->ac97); |
@@ -2638,6 +2598,7 @@ static struct snd_tea575x_ops snd_es1968_tea_ops = { | |||
2638 | 2598 | ||
2639 | static int snd_es1968_free(struct es1968 *chip) | 2599 | static int snd_es1968_free(struct es1968 *chip) |
2640 | { | 2600 | { |
2601 | cancel_work_sync(&chip->hwvol_work); | ||
2641 | #ifdef CONFIG_SND_ES1968_INPUT | 2602 | #ifdef CONFIG_SND_ES1968_INPUT |
2642 | if (chip->input_dev) | 2603 | if (chip->input_dev) |
2643 | input_unregister_device(chip->input_dev); | 2604 | input_unregister_device(chip->input_dev); |
@@ -2728,10 +2689,7 @@ static int __devinit snd_es1968_create(struct snd_card *card, | |||
2728 | INIT_LIST_HEAD(&chip->buf_list); | 2689 | INIT_LIST_HEAD(&chip->buf_list); |
2729 | INIT_LIST_HEAD(&chip->substream_list); | 2690 | INIT_LIST_HEAD(&chip->substream_list); |
2730 | mutex_init(&chip->memory_mutex); | 2691 | mutex_init(&chip->memory_mutex); |
2731 | #ifndef CONFIG_SND_ES1968_INPUT | 2692 | INIT_WORK(&chip->hwvol_work, es1968_update_hw_volume); |
2732 | spin_lock_init(&chip->ac97_lock); | ||
2733 | tasklet_init(&chip->hwvol_tq, es1968_update_hw_volume, (unsigned long)chip); | ||
2734 | #endif | ||
2735 | chip->card = card; | 2693 | chip->card = card; |
2736 | chip->pci = pci; | 2694 | chip->pci = pci; |
2737 | chip->irq = -1; | 2695 | chip->irq = -1; |
@@ -2746,7 +2704,7 @@ static int __devinit snd_es1968_create(struct snd_card *card, | |||
2746 | } | 2704 | } |
2747 | chip->io_port = pci_resource_start(pci, 0); | 2705 | chip->io_port = pci_resource_start(pci, 0); |
2748 | if (request_irq(pci->irq, snd_es1968_interrupt, IRQF_SHARED, | 2706 | if (request_irq(pci->irq, snd_es1968_interrupt, IRQF_SHARED, |
2749 | "ESS Maestro", chip)) { | 2707 | KBUILD_MODNAME, chip)) { |
2750 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2708 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2751 | snd_es1968_free(chip); | 2709 | snd_es1968_free(chip); |
2752 | return -EBUSY; | 2710 | return -EBUSY; |
@@ -2925,7 +2883,7 @@ static void __devexit snd_es1968_remove(struct pci_dev *pci) | |||
2925 | } | 2883 | } |
2926 | 2884 | ||
2927 | static struct pci_driver driver = { | 2885 | static struct pci_driver driver = { |
2928 | .name = "ES1968 (ESS Maestro)", | 2886 | .name = KBUILD_MODNAME, |
2929 | .id_table = snd_es1968_ids, | 2887 | .id_table = snd_es1968_ids, |
2930 | .probe = snd_es1968_probe, | 2888 | .probe = snd_es1968_probe, |
2931 | .remove = __devexit_p(snd_es1968_remove), | 2889 | .remove = __devexit_p(snd_es1968_remove), |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index a7ec7030cf87..f9123f09e83e 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -1199,7 +1199,7 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1199 | chip->port = pci_resource_start(pci, 0); | 1199 | chip->port = pci_resource_start(pci, 0); |
1200 | if ((tea575x_tuner & TUNER_ONLY) == 0) { | 1200 | if ((tea575x_tuner & TUNER_ONLY) == 0) { |
1201 | if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, | 1201 | if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, |
1202 | "FM801", chip)) { | 1202 | KBUILD_MODNAME, chip)) { |
1203 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); | 1203 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); |
1204 | snd_fm801_free(chip); | 1204 | snd_fm801_free(chip); |
1205 | return -EBUSY; | 1205 | return -EBUSY; |
@@ -1394,7 +1394,7 @@ static int snd_fm801_resume(struct pci_dev *pci) | |||
1394 | #endif | 1394 | #endif |
1395 | 1395 | ||
1396 | static struct pci_driver driver = { | 1396 | static struct pci_driver driver = { |
1397 | .name = "FM801", | 1397 | .name = KBUILD_MODNAME, |
1398 | .id_table = snd_fm801_ids, | 1398 | .id_table = snd_fm801_ids, |
1399 | .probe = snd_card_fm801_probe, | 1399 | .probe = snd_card_fm801_probe, |
1400 | .remove = __devexit_p(snd_card_fm801_remove), | 1400 | .remove = __devexit_p(snd_card_fm801_remove), |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 45b4a8d70e08..f26e487eca1c 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -4957,17 +4957,15 @@ void *snd_array_new(struct snd_array *array) | |||
4957 | { | 4957 | { |
4958 | if (array->used >= array->alloced) { | 4958 | if (array->used >= array->alloced) { |
4959 | int num = array->alloced + array->alloc_align; | 4959 | int num = array->alloced + array->alloc_align; |
4960 | int size = (num + 1) * array->elem_size; | ||
4961 | int oldsize = array->alloced * array->elem_size; | ||
4960 | void *nlist; | 4962 | void *nlist; |
4961 | if (snd_BUG_ON(num >= 4096)) | 4963 | if (snd_BUG_ON(num >= 4096)) |
4962 | return NULL; | 4964 | return NULL; |
4963 | nlist = kcalloc(num + 1, array->elem_size, GFP_KERNEL); | 4965 | nlist = krealloc(array->list, size, GFP_KERNEL); |
4964 | if (!nlist) | 4966 | if (!nlist) |
4965 | return NULL; | 4967 | return NULL; |
4966 | if (array->list) { | 4968 | memset(nlist + oldsize, 0, size - oldsize); |
4967 | memcpy(nlist, array->list, | ||
4968 | array->elem_size * array->alloced); | ||
4969 | kfree(array->list); | ||
4970 | } | ||
4971 | array->list = nlist; | 4969 | array->list = nlist; |
4972 | array->alloced = num; | 4970 | array->alloced = num; |
4973 | } | 4971 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 486f6deb3eee..5cc3d07f715f 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2149,7 +2149,7 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect) | |||
2149 | { | 2149 | { |
2150 | if (request_irq(chip->pci->irq, azx_interrupt, | 2150 | if (request_irq(chip->pci->irq, azx_interrupt, |
2151 | chip->msi ? 0 : IRQF_SHARED, | 2151 | chip->msi ? 0 : IRQF_SHARED, |
2152 | "hda_intel", chip)) { | 2152 | KBUILD_MODNAME, chip)) { |
2153 | printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " | 2153 | printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " |
2154 | "disabling device\n", chip->pci->irq); | 2154 | "disabling device\n", chip->pci->irq); |
2155 | if (do_disconnect) | 2155 | if (do_disconnect) |
@@ -2908,7 +2908,7 @@ MODULE_DEVICE_TABLE(pci, azx_ids); | |||
2908 | 2908 | ||
2909 | /* pci_driver definition */ | 2909 | /* pci_driver definition */ |
2910 | static struct pci_driver driver = { | 2910 | static struct pci_driver driver = { |
2911 | .name = "HDA Intel", | 2911 | .name = KBUILD_MODNAME, |
2912 | .id_table = azx_ids, | 2912 | .id_table = azx_ids, |
2913 | .probe = azx_probe, | 2913 | .probe = azx_probe, |
2914 | .remove = __devexit_p(azx_remove), | 2914 | .remove = __devexit_p(azx_remove), |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index f4594d76b6ea..be06fb3e45a1 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -2607,7 +2607,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
2607 | ice->profi_port = pci_resource_start(pci, 3); | 2607 | ice->profi_port = pci_resource_start(pci, 3); |
2608 | 2608 | ||
2609 | if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED, | 2609 | if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED, |
2610 | "ICE1712", ice)) { | 2610 | KBUILD_MODNAME, ice)) { |
2611 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2611 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2612 | snd_ice1712_free(ice); | 2612 | snd_ice1712_free(ice); |
2613 | return -EIO; | 2613 | return -EIO; |
@@ -2802,7 +2802,7 @@ static void __devexit snd_ice1712_remove(struct pci_dev *pci) | |||
2802 | } | 2802 | } |
2803 | 2803 | ||
2804 | static struct pci_driver driver = { | 2804 | static struct pci_driver driver = { |
2805 | .name = "ICE1712", | 2805 | .name = KBUILD_MODNAME, |
2806 | .id_table = snd_ice1712_ids, | 2806 | .id_table = snd_ice1712_ids, |
2807 | .probe = snd_ice1712_probe, | 2807 | .probe = snd_ice1712_probe, |
2808 | .remove = __devexit_p(snd_ice1712_remove), | 2808 | .remove = __devexit_p(snd_ice1712_remove), |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index c1498fa5545f..c2b7f8bc41e4 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2509,7 +2509,7 @@ static int __devinit snd_vt1724_create(struct snd_card *card, | |||
2509 | ice->profi_port = pci_resource_start(pci, 1); | 2509 | ice->profi_port = pci_resource_start(pci, 1); |
2510 | 2510 | ||
2511 | if (request_irq(pci->irq, snd_vt1724_interrupt, | 2511 | if (request_irq(pci->irq, snd_vt1724_interrupt, |
2512 | IRQF_SHARED, "ICE1724", ice)) { | 2512 | IRQF_SHARED, KBUILD_MODNAME, ice)) { |
2513 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2513 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2514 | snd_vt1724_free(ice); | 2514 | snd_vt1724_free(ice); |
2515 | return -EIO; | 2515 | return -EIO; |
@@ -2802,7 +2802,7 @@ static int snd_vt1724_resume(struct pci_dev *pci) | |||
2802 | #endif | 2802 | #endif |
2803 | 2803 | ||
2804 | static struct pci_driver driver = { | 2804 | static struct pci_driver driver = { |
2805 | .name = "ICE1724", | 2805 | .name = KBUILD_MODNAME, |
2806 | .id_table = snd_vt1724_ids, | 2806 | .id_table = snd_vt1724_ids, |
2807 | .probe = snd_vt1724_probe, | 2807 | .probe = snd_vt1724_probe, |
2808 | .remove = __devexit_p(snd_vt1724_remove), | 2808 | .remove = __devexit_p(snd_vt1724_remove), |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 6c896dbfd796..6a5b387b97fd 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -1884,6 +1884,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1884 | }, | 1884 | }, |
1885 | { | 1885 | { |
1886 | .subvendor = 0x1028, | 1886 | .subvendor = 0x1028, |
1887 | .subdevice = 0x0189, | ||
1888 | .name = "Dell Inspiron 9300", | ||
1889 | .type = AC97_TUNE_HP_MUTE_LED | ||
1890 | }, | ||
1891 | { | ||
1892 | .subvendor = 0x1028, | ||
1887 | .subdevice = 0x0191, | 1893 | .subdevice = 0x0191, |
1888 | .name = "Dell Inspiron 8600", | 1894 | .name = "Dell Inspiron 8600", |
1889 | .type = AC97_TUNE_HP_ONLY | 1895 | .type = AC97_TUNE_HP_ONLY |
@@ -2647,7 +2653,7 @@ static int intel8x0_resume(struct pci_dev *pci) | |||
2647 | pci_set_master(pci); | 2653 | pci_set_master(pci); |
2648 | snd_intel8x0_chip_init(chip, 0); | 2654 | snd_intel8x0_chip_init(chip, 0); |
2649 | if (request_irq(pci->irq, snd_intel8x0_interrupt, | 2655 | if (request_irq(pci->irq, snd_intel8x0_interrupt, |
2650 | IRQF_SHARED, card->shortname, chip)) { | 2656 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
2651 | printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " | 2657 | printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " |
2652 | "disabling device\n", pci->irq); | 2658 | "disabling device\n", pci->irq); |
2653 | snd_card_disconnect(card); | 2659 | snd_card_disconnect(card); |
@@ -3106,7 +3112,7 @@ static int __devinit snd_intel8x0_create(struct snd_card *card, | |||
3106 | 3112 | ||
3107 | /* request irq after initializaing int_sta_mask, etc */ | 3113 | /* request irq after initializaing int_sta_mask, etc */ |
3108 | if (request_irq(pci->irq, snd_intel8x0_interrupt, | 3114 | if (request_irq(pci->irq, snd_intel8x0_interrupt, |
3109 | IRQF_SHARED, card->shortname, chip)) { | 3115 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
3110 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 3116 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
3111 | snd_intel8x0_free(chip); | 3117 | snd_intel8x0_free(chip); |
3112 | return -EBUSY; | 3118 | return -EBUSY; |
@@ -3266,7 +3272,7 @@ static void __devexit snd_intel8x0_remove(struct pci_dev *pci) | |||
3266 | } | 3272 | } |
3267 | 3273 | ||
3268 | static struct pci_driver driver = { | 3274 | static struct pci_driver driver = { |
3269 | .name = "Intel ICH", | 3275 | .name = KBUILD_MODNAME, |
3270 | .id_table = snd_intel8x0_ids, | 3276 | .id_table = snd_intel8x0_ids, |
3271 | .probe = snd_intel8x0_probe, | 3277 | .probe = snd_intel8x0_probe, |
3272 | .remove = __devexit_p(snd_intel8x0_remove), | 3278 | .remove = __devexit_p(snd_intel8x0_remove), |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index f3353b49c785..7c161645d865 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -1047,7 +1047,7 @@ static int intel8x0m_resume(struct pci_dev *pci) | |||
1047 | } | 1047 | } |
1048 | pci_set_master(pci); | 1048 | pci_set_master(pci); |
1049 | if (request_irq(pci->irq, snd_intel8x0m_interrupt, | 1049 | if (request_irq(pci->irq, snd_intel8x0m_interrupt, |
1050 | IRQF_SHARED, card->shortname, chip)) { | 1050 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
1051 | printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, " | 1051 | printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, " |
1052 | "disabling device\n", pci->irq); | 1052 | "disabling device\n", pci->irq); |
1053 | snd_card_disconnect(card); | 1053 | snd_card_disconnect(card); |
@@ -1174,7 +1174,7 @@ static int __devinit snd_intel8x0m_create(struct snd_card *card, | |||
1174 | 1174 | ||
1175 | port_inited: | 1175 | port_inited: |
1176 | if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, | 1176 | if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED, |
1177 | card->shortname, chip)) { | 1177 | KBUILD_MODNAME, chip)) { |
1178 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1178 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1179 | snd_intel8x0m_free(chip); | 1179 | snd_intel8x0m_free(chip); |
1180 | return -EBUSY; | 1180 | return -EBUSY; |
@@ -1325,7 +1325,7 @@ static void __devexit snd_intel8x0m_remove(struct pci_dev *pci) | |||
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | static struct pci_driver driver = { | 1327 | static struct pci_driver driver = { |
1328 | .name = "Intel ICH Modem", | 1328 | .name = KBUILD_MODNAME, |
1329 | .id_table = snd_intel8x0m_ids, | 1329 | .id_table = snd_intel8x0m_ids, |
1330 | .probe = snd_intel8x0m_probe, | 1330 | .probe = snd_intel8x0m_probe, |
1331 | .remove = __devexit_p(snd_intel8x0m_remove), | 1331 | .remove = __devexit_p(snd_intel8x0m_remove), |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 6d795700be79..fc1d573cf306 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -2241,7 +2241,7 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev * | |||
2241 | 2241 | ||
2242 | err = request_irq(pci->irq, snd_korg1212_interrupt, | 2242 | err = request_irq(pci->irq, snd_korg1212_interrupt, |
2243 | IRQF_SHARED, | 2243 | IRQF_SHARED, |
2244 | "korg1212", korg1212); | 2244 | KBUILD_MODNAME, korg1212); |
2245 | 2245 | ||
2246 | if (err) { | 2246 | if (err) { |
2247 | snd_printk(KERN_ERR "korg1212: unable to grab IRQ %d\n", pci->irq); | 2247 | snd_printk(KERN_ERR "korg1212: unable to grab IRQ %d\n", pci->irq); |
@@ -2477,7 +2477,7 @@ static void __devexit snd_korg1212_remove(struct pci_dev *pci) | |||
2477 | } | 2477 | } |
2478 | 2478 | ||
2479 | static struct pci_driver driver = { | 2479 | static struct pci_driver driver = { |
2480 | .name = "korg1212", | 2480 | .name = KBUILD_MODNAME, |
2481 | .id_table = snd_korg1212_ids, | 2481 | .id_table = snd_korg1212_ids, |
2482 | .probe = snd_korg1212_probe, | 2482 | .probe = snd_korg1212_probe, |
2483 | .remove = __devexit_p(snd_korg1212_remove), | 2483 | .remove = __devexit_p(snd_korg1212_remove), |
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c index 2692e5ae5f2d..3e92e5b5ec3d 100644 --- a/sound/pci/lola/lola.c +++ b/sound/pci/lola/lola.c | |||
@@ -648,7 +648,7 @@ static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci, | |||
648 | goto errout; | 648 | goto errout; |
649 | 649 | ||
650 | if (request_irq(pci->irq, lola_interrupt, IRQF_SHARED, | 650 | if (request_irq(pci->irq, lola_interrupt, IRQF_SHARED, |
651 | DRVNAME, chip)) { | 651 | KBUILD_MODNAME, chip)) { |
652 | printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq); | 652 | printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq); |
653 | err = -EBUSY; | 653 | err = -EBUSY; |
654 | goto errout; | 654 | goto errout; |
@@ -771,7 +771,7 @@ MODULE_DEVICE_TABLE(pci, lola_ids); | |||
771 | 771 | ||
772 | /* pci_driver definition */ | 772 | /* pci_driver definition */ |
773 | static struct pci_driver driver = { | 773 | static struct pci_driver driver = { |
774 | .name = DRVNAME, | 774 | .name = KBUILD_MODNAME, |
775 | .id_table = lola_ids, | 775 | .id_table = lola_ids, |
776 | .probe = lola_probe, | 776 | .probe = lola_probe, |
777 | .remove = __devexit_p(lola_remove), | 777 | .remove = __devexit_p(lola_remove), |
diff --git a/sound/pci/lola/lola.h b/sound/pci/lola/lola.h index d5708e29b16d..f0b100059efd 100644 --- a/sound/pci/lola/lola.h +++ b/sound/pci/lola/lola.h | |||
@@ -480,7 +480,7 @@ struct lola { | |||
480 | 480 | ||
481 | /* count values in the Vendor Specific Mixer Widget's Audio Widget Capabilities */ | 481 | /* count values in the Vendor Specific Mixer Widget's Audio Widget Capabilities */ |
482 | #define LOLA_MIXER_SRC_INPUT_PLAY_SEPARATION(res) ((res >> 2) & 0x1f) | 482 | #define LOLA_MIXER_SRC_INPUT_PLAY_SEPARATION(res) ((res >> 2) & 0x1f) |
483 | #define LOLA_MIXER_DEST_REC_OUTPUT_SEPATATION(res) ((res >> 7) & 0x1f) | 483 | #define LOLA_MIXER_DEST_REC_OUTPUT_SEPARATION(res) ((res >> 7) & 0x1f) |
484 | 484 | ||
485 | int lola_codec_write(struct lola *chip, unsigned int nid, unsigned int verb, | 485 | int lola_codec_write(struct lola *chip, unsigned int nid, unsigned int verb, |
486 | unsigned int data, unsigned int extdata); | 486 | unsigned int data, unsigned int extdata); |
diff --git a/sound/pci/lola/lola_mixer.c b/sound/pci/lola/lola_mixer.c index 5d518f1a712c..6b8d64812951 100644 --- a/sound/pci/lola/lola_mixer.c +++ b/sound/pci/lola/lola_mixer.c | |||
@@ -144,40 +144,61 @@ int __devinit lola_init_mixer_widget(struct lola *chip, int nid) | |||
144 | chip->mixer.dest_stream_ins = chip->pcm[CAPT].num_streams; | 144 | chip->mixer.dest_stream_ins = chip->pcm[CAPT].num_streams; |
145 | chip->mixer.dest_phys_outs = chip->pin[PLAY].num_pins; | 145 | chip->mixer.dest_phys_outs = chip->pin[PLAY].num_pins; |
146 | 146 | ||
147 | /* mixer matrix can have unused areas between PhysIn and | 147 | /* mixer matrix may have unused areas between PhysIn and |
148 | * Play or Record and PhysOut zones | 148 | * Play or Record and PhysOut zones |
149 | */ | 149 | */ |
150 | chip->mixer.src_stream_out_ofs = chip->mixer.src_phys_ins + | 150 | chip->mixer.src_stream_out_ofs = chip->mixer.src_phys_ins + |
151 | LOLA_MIXER_SRC_INPUT_PLAY_SEPARATION(val); | 151 | LOLA_MIXER_SRC_INPUT_PLAY_SEPARATION(val); |
152 | chip->mixer.dest_phys_out_ofs = chip->mixer.dest_stream_ins + | 152 | chip->mixer.dest_phys_out_ofs = chip->mixer.dest_stream_ins + |
153 | LOLA_MIXER_DEST_REC_OUTPUT_SEPATATION(val); | 153 | LOLA_MIXER_DEST_REC_OUTPUT_SEPARATION(val); |
154 | 154 | ||
155 | /* example : MixerMatrix of LoLa881 | 155 | /* example : MixerMatrix of LoLa881 (LoLa16161 uses unused zones) |
156 | * 0-------8------16-------8------16 | 156 | * +-+ 0-------8------16-------8------16 |
157 | * | | | | | | 157 | * | | | | | | | |
158 | * | INPUT | | INPUT | | | 158 | * |s| | INPUT | | INPUT | | |
159 | * | -> |unused | -> |unused | | 159 | * | |->| -> |unused | -> |unused | |
160 | * | RECORD| | OUTPUT| | | 160 | * |r| |CAPTURE| | OUTPUT| | |
161 | * | | | | | | 161 | * | | | MIX | | MIX | | |
162 | * 8-------------------------------- | 162 | * |c| 8-------------------------------- |
163 | * | | | | | | 163 | * | | | | | | | |
164 | * | | | | | | 164 | * | | | | | | | |
165 | * |unused |unused |unused |unused | | 165 | * |g| |unused |unused |unused |unused | |
166 | * | | | | | | 166 | * | | | | | | | |
167 | * | | | | | | 167 | * |a| | | | | | |
168 | * 16------------------------------- | 168 | * | | 16------------------------------- |
169 | * | | | | | | 169 | * |i| | | | | | |
170 | * | PLAY | | PLAY | | | 170 | * | | | PLAYBK| | PLAYBK| | |
171 | * | -> |unused | -> |unused | | 171 | * |n|->| -> |unused | -> |unused | |
172 | * | RECORD| | OUTPUT| | | 172 | * | | |CAPTURE| | OUTPUT| | |
173 | * | | | | | | 173 | * | | | MIX | | MIX | | |
174 | * 8-------------------------------- | 174 | * |a| 8-------------------------------- |
175 | * | | | | | | 175 | * |r| | | | | | |
176 | * | | | | | | 176 | * |r| | | | | | |
177 | * |unused |unused |unused |unused | | 177 | * |a| |unused |unused |unused |unused | |
178 | * | | | | | | 178 | * |y| | | | | | |
179 | * | | | | | | 179 | * | | | | | | | |
180 | * 16------------------------------- | 180 | * +++ 16--|---------------|------------ |
181 | * +---V---------------V-----------+ | ||
182 | * | dest_mix_gain_enable array | | ||
183 | * +-------------------------------+ | ||
184 | */ | ||
185 | /* example : MixerMatrix of LoLa280 | ||
186 | * +-+ 0-------8-2 | ||
187 | * | | | | | | ||
188 | * |s| | INPUT | | INPUT | ||
189 | * |r|->| -> | | -> | ||
190 | * |c| |CAPTURE| | <- OUTPUT | ||
191 | * | | | MIX | | MIX | ||
192 | * |g| 8---------- | ||
193 | * |a| | | | | ||
194 | * |i| | PLAYBK| | PLAYBACK | ||
195 | * |n|->| -> | | -> | ||
196 | * | | |CAPTURE| | <- OUTPUT | ||
197 | * |a| | MIX | | MIX | ||
198 | * |r| 8---|----|- | ||
199 | * |r| +---V----V-------------------+ | ||
200 | * |a| | dest_mix_gain_enable array | | ||
201 | * |y| +----------------------------+ | ||
181 | */ | 202 | */ |
182 | if (chip->mixer.src_stream_out_ofs > MAX_AUDIO_INOUT_COUNT || | 203 | if (chip->mixer.src_stream_out_ofs > MAX_AUDIO_INOUT_COUNT || |
183 | chip->mixer.dest_phys_out_ofs > MAX_STREAM_IN_COUNT) { | 204 | chip->mixer.dest_phys_out_ofs > MAX_STREAM_IN_COUNT) { |
@@ -192,6 +213,9 @@ int __devinit lola_init_mixer_widget(struct lola *chip, int nid) | |||
192 | (((1U << chip->mixer.dest_phys_outs) - 1) | 213 | (((1U << chip->mixer.dest_phys_outs) - 1) |
193 | << chip->mixer.dest_phys_out_ofs); | 214 | << chip->mixer.dest_phys_out_ofs); |
194 | 215 | ||
216 | snd_printdd("Mixer src_mask=%x, dest_mask=%x\n", | ||
217 | chip->mixer.src_mask, chip->mixer.dest_mask); | ||
218 | |||
195 | return 0; | 219 | return 0; |
196 | } | 220 | } |
197 | 221 | ||
@@ -202,12 +226,19 @@ static int lola_mixer_set_src_gain(struct lola *chip, unsigned int id, | |||
202 | 226 | ||
203 | if (!(chip->mixer.src_mask & (1 << id))) | 227 | if (!(chip->mixer.src_mask & (1 << id))) |
204 | return -EINVAL; | 228 | return -EINVAL; |
205 | writew(gain, &chip->mixer.array->src_gain[id]); | ||
206 | oldval = val = readl(&chip->mixer.array->src_gain_enable); | 229 | oldval = val = readl(&chip->mixer.array->src_gain_enable); |
207 | if (on) | 230 | if (on) |
208 | val |= (1 << id); | 231 | val |= (1 << id); |
209 | else | 232 | else |
210 | val &= ~(1 << id); | 233 | val &= ~(1 << id); |
234 | /* test if values unchanged */ | ||
235 | if ((val == oldval) && | ||
236 | (gain == readw(&chip->mixer.array->src_gain[id]))) | ||
237 | return 0; | ||
238 | |||
239 | snd_printdd("lola_mixer_set_src_gain (id=%d, gain=%d) enable=%x\n", | ||
240 | id, gain, val); | ||
241 | writew(gain, &chip->mixer.array->src_gain[id]); | ||
211 | writel(val, &chip->mixer.array->src_gain_enable); | 242 | writel(val, &chip->mixer.array->src_gain_enable); |
212 | lola_codec_flush(chip); | 243 | lola_codec_flush(chip); |
213 | /* inform micro-controller about the new source gain */ | 244 | /* inform micro-controller about the new source gain */ |
@@ -269,6 +300,7 @@ static int lola_mixer_set_mapping_gain(struct lola *chip, | |||
269 | src, dest); | 300 | src, dest); |
270 | } | 301 | } |
271 | 302 | ||
303 | #if 0 /* not used */ | ||
272 | static int lola_mixer_set_dest_gains(struct lola *chip, unsigned int id, | 304 | static int lola_mixer_set_dest_gains(struct lola *chip, unsigned int id, |
273 | unsigned int mask, unsigned short *gains) | 305 | unsigned int mask, unsigned short *gains) |
274 | { | 306 | { |
@@ -289,6 +321,7 @@ static int lola_mixer_set_dest_gains(struct lola *chip, unsigned int id, | |||
289 | return lola_codec_write(chip, chip->mixer.nid, | 321 | return lola_codec_write(chip, chip->mixer.nid, |
290 | LOLA_VERB_SET_DESTINATION_GAIN, id, 0); | 322 | LOLA_VERB_SET_DESTINATION_GAIN, id, 0); |
291 | } | 323 | } |
324 | #endif /* not used */ | ||
292 | 325 | ||
293 | /* | 326 | /* |
294 | */ | 327 | */ |
@@ -376,6 +409,8 @@ static int set_analog_volume(struct lola *chip, int dir, | |||
376 | return 0; | 409 | return 0; |
377 | if (external_call) | 410 | if (external_call) |
378 | lola_codec_flush(chip); | 411 | lola_codec_flush(chip); |
412 | snd_printdd("set_analog_volume (dir=%d idx=%d, volume=%d)\n", | ||
413 | dir, idx, val); | ||
379 | err = lola_codec_write(chip, pin->nid, | 414 | err = lola_codec_write(chip, pin->nid, |
380 | LOLA_VERB_SET_AMP_GAIN_MUTE, val, 0); | 415 | LOLA_VERB_SET_AMP_GAIN_MUTE, val, 0); |
381 | if (err < 0) | 416 | if (err < 0) |
@@ -427,23 +462,40 @@ static int init_mixer_values(struct lola *chip) | |||
427 | { | 462 | { |
428 | int i; | 463 | int i; |
429 | 464 | ||
430 | /* all src on */ | 465 | /* all sample rate converters on */ |
431 | lola_set_src_config(chip, (1 << chip->pin[CAPT].num_pins) - 1, false); | 466 | lola_set_src_config(chip, (1 << chip->pin[CAPT].num_pins) - 1, false); |
432 | 467 | ||
433 | /* clear all matrix */ | 468 | /* clear all mixer matrix settings */ |
434 | memset_io(chip->mixer.array, 0, sizeof(*chip->mixer.array)); | 469 | memset_io(chip->mixer.array, 0, sizeof(*chip->mixer.array)); |
435 | /* set src gain to 0dB */ | 470 | /* inform firmware about all updated matrix columns - capture part */ |
471 | for (i = 0; i < chip->mixer.dest_stream_ins; i++) | ||
472 | lola_codec_write(chip, chip->mixer.nid, | ||
473 | LOLA_VERB_SET_DESTINATION_GAIN, | ||
474 | i, 0); | ||
475 | /* inform firmware about all updated matrix columns - output part */ | ||
476 | for (i = 0; i < chip->mixer.dest_phys_outs; i++) | ||
477 | lola_codec_write(chip, chip->mixer.nid, | ||
478 | LOLA_VERB_SET_DESTINATION_GAIN, | ||
479 | chip->mixer.dest_phys_out_ofs + i, 0); | ||
480 | |||
481 | /* set all digital input source (master) gains to 0dB */ | ||
436 | for (i = 0; i < chip->mixer.src_phys_ins; i++) | 482 | for (i = 0; i < chip->mixer.src_phys_ins; i++) |
437 | lola_mixer_set_src_gain(chip, i, 336, true); /* 0dB */ | 483 | lola_mixer_set_src_gain(chip, i, 336, true); /* 0dB */ |
484 | |||
485 | /* set all digital playback source (master) gains to 0dB */ | ||
438 | for (i = 0; i < chip->mixer.src_stream_outs; i++) | 486 | for (i = 0; i < chip->mixer.src_stream_outs; i++) |
439 | lola_mixer_set_src_gain(chip, | 487 | lola_mixer_set_src_gain(chip, |
440 | i + chip->mixer.src_stream_out_ofs, | 488 | i + chip->mixer.src_stream_out_ofs, |
441 | 336, true); /* 0dB */ | 489 | 336, true); /* 0dB */ |
442 | /* set 1:1 dest gain */ | 490 | /* set gain value 0dB diagonally in matrix - part INPUT -> CAPTURE */ |
443 | for (i = 0; i < chip->mixer.dest_stream_ins; i++) { | 491 | for (i = 0; i < chip->mixer.dest_stream_ins; i++) { |
444 | int src = i % chip->mixer.src_phys_ins; | 492 | int src = i % chip->mixer.src_phys_ins; |
445 | lola_mixer_set_mapping_gain(chip, src, i, 336, true); | 493 | lola_mixer_set_mapping_gain(chip, src, i, 336, true); |
446 | } | 494 | } |
495 | /* set gain value 0dB diagonally in matrix , part PLAYBACK -> OUTPUT | ||
496 | * (LoLa280 : playback channel 0,2,4,6 linked to output channel 0) | ||
497 | * (LoLa280 : playback channel 1,3,5,7 linked to output channel 1) | ||
498 | */ | ||
447 | for (i = 0; i < chip->mixer.src_stream_outs; i++) { | 499 | for (i = 0; i < chip->mixer.src_stream_outs; i++) { |
448 | int src = chip->mixer.src_stream_out_ofs + i; | 500 | int src = chip->mixer.src_stream_out_ofs + i; |
449 | int dst = chip->mixer.dest_phys_out_ofs + | 501 | int dst = chip->mixer.dest_phys_out_ofs + |
@@ -693,6 +745,7 @@ static int __devinit create_src_gain_mixer(struct lola *chip, | |||
693 | snd_ctl_new1(&lola_src_gain_mixer, chip)); | 745 | snd_ctl_new1(&lola_src_gain_mixer, chip)); |
694 | } | 746 | } |
695 | 747 | ||
748 | #if 0 /* not used */ | ||
696 | /* | 749 | /* |
697 | * destination gain (matrix-like) mixer | 750 | * destination gain (matrix-like) mixer |
698 | */ | 751 | */ |
@@ -781,6 +834,7 @@ static int __devinit create_dest_gain_mixer(struct lola *chip, | |||
781 | return snd_ctl_add(chip->card, | 834 | return snd_ctl_add(chip->card, |
782 | snd_ctl_new1(&lola_dest_gain_mixer, chip)); | 835 | snd_ctl_new1(&lola_dest_gain_mixer, chip)); |
783 | } | 836 | } |
837 | #endif /* not used */ | ||
784 | 838 | ||
785 | /* | 839 | /* |
786 | */ | 840 | */ |
@@ -798,14 +852,16 @@ int __devinit lola_create_mixer(struct lola *chip) | |||
798 | if (err < 0) | 852 | if (err < 0) |
799 | return err; | 853 | return err; |
800 | err = create_src_gain_mixer(chip, chip->mixer.src_phys_ins, 0, | 854 | err = create_src_gain_mixer(chip, chip->mixer.src_phys_ins, 0, |
801 | "Line Source Gain Volume"); | 855 | "Digital Capture Volume"); |
802 | if (err < 0) | 856 | if (err < 0) |
803 | return err; | 857 | return err; |
804 | err = create_src_gain_mixer(chip, chip->mixer.src_stream_outs, | 858 | err = create_src_gain_mixer(chip, chip->mixer.src_stream_outs, |
805 | chip->mixer.src_stream_out_ofs, | 859 | chip->mixer.src_stream_out_ofs, |
806 | "Stream Source Gain Volume"); | 860 | "Digital Playback Volume"); |
807 | if (err < 0) | 861 | if (err < 0) |
808 | return err; | 862 | return err; |
863 | #if 0 | ||
864 | /* FIXME: buggy mixer matrix handling */ | ||
809 | err = create_dest_gain_mixer(chip, | 865 | err = create_dest_gain_mixer(chip, |
810 | chip->mixer.src_phys_ins, 0, | 866 | chip->mixer.src_phys_ins, 0, |
811 | chip->mixer.dest_stream_ins, 0, | 867 | chip->mixer.dest_stream_ins, 0, |
@@ -834,6 +890,6 @@ int __devinit lola_create_mixer(struct lola *chip) | |||
834 | "Stream Playback Volume"); | 890 | "Stream Playback Volume"); |
835 | if (err < 0) | 891 | if (err < 0) |
836 | return err; | 892 | return err; |
837 | 893 | #endif /* FIXME */ | |
838 | return init_mixer_values(chip); | 894 | return init_mixer_values(chip); |
839 | } | 895 | } |
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 1bd7a540fd49..04ae84b2a107 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c | |||
@@ -762,7 +762,6 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran) | |||
762 | static int __devinit lx_init_dsp(struct lx6464es *chip) | 762 | static int __devinit lx_init_dsp(struct lx6464es *chip) |
763 | { | 763 | { |
764 | int err; | 764 | int err; |
765 | u8 mac_address[6]; | ||
766 | int i; | 765 | int i; |
767 | 766 | ||
768 | snd_printdd("->lx_init_dsp\n"); | 767 | snd_printdd("->lx_init_dsp\n"); |
@@ -787,11 +786,11 @@ static int __devinit lx_init_dsp(struct lx6464es *chip) | |||
787 | /** \todo the mac address should be ready by not, but it isn't, | 786 | /** \todo the mac address should be ready by not, but it isn't, |
788 | * so we wait for it */ | 787 | * so we wait for it */ |
789 | for (i = 0; i != 1000; ++i) { | 788 | for (i = 0; i != 1000; ++i) { |
790 | err = lx_dsp_get_mac(chip, mac_address); | 789 | err = lx_dsp_get_mac(chip); |
791 | if (err) | 790 | if (err) |
792 | return err; | 791 | return err; |
793 | if (mac_address[0] || mac_address[1] || mac_address[2] || | 792 | if (chip->mac_address[0] || chip->mac_address[1] || chip->mac_address[2] || |
794 | mac_address[3] || mac_address[4] || mac_address[5]) | 793 | chip->mac_address[3] || chip->mac_address[4] || chip->mac_address[5]) |
795 | goto mac_ready; | 794 | goto mac_ready; |
796 | msleep(1); | 795 | msleep(1); |
797 | } | 796 | } |
@@ -800,8 +799,8 @@ static int __devinit lx_init_dsp(struct lx6464es *chip) | |||
800 | mac_ready: | 799 | mac_ready: |
801 | snd_printd(LXP "mac address ready read after: %dms\n", i); | 800 | snd_printd(LXP "mac address ready read after: %dms\n", i); |
802 | snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n", | 801 | snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n", |
803 | mac_address[0], mac_address[1], mac_address[2], | 802 | chip->mac_address[0], chip->mac_address[1], chip->mac_address[2], |
804 | mac_address[3], mac_address[4], mac_address[5]); | 803 | chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]); |
805 | 804 | ||
806 | err = lx_init_get_version_features(chip); | 805 | err = lx_init_get_version_features(chip); |
807 | if (err) | 806 | if (err) |
@@ -1031,7 +1030,7 @@ static int __devinit snd_lx6464es_create(struct snd_card *card, | |||
1031 | chip->port_dsp_bar = pci_ioremap_bar(pci, 2); | 1030 | chip->port_dsp_bar = pci_ioremap_bar(pci, 2); |
1032 | 1031 | ||
1033 | err = request_irq(pci->irq, lx_interrupt, IRQF_SHARED, | 1032 | err = request_irq(pci->irq, lx_interrupt, IRQF_SHARED, |
1034 | card_name, chip); | 1033 | KBUILD_MODNAME, chip); |
1035 | if (err) { | 1034 | if (err) { |
1036 | snd_printk(KERN_ERR LXP "unable to grab IRQ %d\n", pci->irq); | 1035 | snd_printk(KERN_ERR LXP "unable to grab IRQ %d\n", pci->irq); |
1037 | goto request_irq_failed; | 1036 | goto request_irq_failed; |
@@ -1108,8 +1107,14 @@ static int __devinit snd_lx6464es_probe(struct pci_dev *pci, | |||
1108 | goto out_free; | 1107 | goto out_free; |
1109 | } | 1108 | } |
1110 | 1109 | ||
1111 | strcpy(card->driver, "lx6464es"); | 1110 | strcpy(card->driver, "LX6464ES"); |
1112 | strcpy(card->shortname, "Digigram LX6464ES"); | 1111 | sprintf(card->id, "LX6464ES_%02X%02X%02X", |
1112 | chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]); | ||
1113 | |||
1114 | sprintf(card->shortname, "LX6464ES %02X.%02X.%02X.%02X.%02X.%02X", | ||
1115 | chip->mac_address[0], chip->mac_address[1], chip->mac_address[2], | ||
1116 | chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]); | ||
1117 | |||
1113 | sprintf(card->longname, "%s at 0x%lx, 0x%p, irq %i", | 1118 | sprintf(card->longname, "%s at 0x%lx, 0x%p, irq %i", |
1114 | card->shortname, chip->port_plx, | 1119 | card->shortname, chip->port_plx, |
1115 | chip->port_dsp_bar, chip->irq); | 1120 | chip->port_dsp_bar, chip->irq); |
@@ -1137,7 +1142,7 @@ static void __devexit snd_lx6464es_remove(struct pci_dev *pci) | |||
1137 | 1142 | ||
1138 | 1143 | ||
1139 | static struct pci_driver driver = { | 1144 | static struct pci_driver driver = { |
1140 | .name = "Digigram LX6464ES", | 1145 | .name = KBUILD_MODNAME, |
1141 | .id_table = snd_lx6464es_ids, | 1146 | .id_table = snd_lx6464es_ids, |
1142 | .probe = snd_lx6464es_probe, | 1147 | .probe = snd_lx6464es_probe, |
1143 | .remove = __devexit_p(snd_lx6464es_remove), | 1148 | .remove = __devexit_p(snd_lx6464es_remove), |
diff --git a/sound/pci/lx6464es/lx6464es.h b/sound/pci/lx6464es/lx6464es.h index aea621eafbb5..e2a124ae27e8 100644 --- a/sound/pci/lx6464es/lx6464es.h +++ b/sound/pci/lx6464es/lx6464es.h | |||
@@ -69,6 +69,8 @@ struct lx6464es { | |||
69 | struct pci_dev *pci; | 69 | struct pci_dev *pci; |
70 | int irq; | 70 | int irq; |
71 | 71 | ||
72 | u8 mac_address[6]; | ||
73 | |||
72 | spinlock_t lock; /* interrupt spinlock */ | 74 | spinlock_t lock; /* interrupt spinlock */ |
73 | struct mutex setup_mutex; /* mutex used in hw_params, open | 75 | struct mutex setup_mutex; /* mutex used in hw_params, open |
74 | * and close */ | 76 | * and close */ |
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index 617f98b0cbae..5c8717e29eeb 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c | |||
@@ -424,7 +424,7 @@ int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq) | |||
424 | return ret; | 424 | return ret; |
425 | } | 425 | } |
426 | 426 | ||
427 | int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address) | 427 | int lx_dsp_get_mac(struct lx6464es *chip) |
428 | { | 428 | { |
429 | u32 macmsb, maclsb; | 429 | u32 macmsb, maclsb; |
430 | 430 | ||
@@ -432,12 +432,12 @@ int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address) | |||
432 | maclsb = lx_dsp_reg_read(chip, eReg_ADMACESLSB) & 0x00FFFFFF; | 432 | maclsb = lx_dsp_reg_read(chip, eReg_ADMACESLSB) & 0x00FFFFFF; |
433 | 433 | ||
434 | /* todo: endianess handling */ | 434 | /* todo: endianess handling */ |
435 | mac_address[5] = ((u8 *)(&maclsb))[0]; | 435 | chip->mac_address[5] = ((u8 *)(&maclsb))[0]; |
436 | mac_address[4] = ((u8 *)(&maclsb))[1]; | 436 | chip->mac_address[4] = ((u8 *)(&maclsb))[1]; |
437 | mac_address[3] = ((u8 *)(&maclsb))[2]; | 437 | chip->mac_address[3] = ((u8 *)(&maclsb))[2]; |
438 | mac_address[2] = ((u8 *)(&macmsb))[0]; | 438 | chip->mac_address[2] = ((u8 *)(&macmsb))[0]; |
439 | mac_address[1] = ((u8 *)(&macmsb))[1]; | 439 | chip->mac_address[1] = ((u8 *)(&macmsb))[1]; |
440 | mac_address[0] = ((u8 *)(&macmsb))[2]; | 440 | chip->mac_address[0] = ((u8 *)(&macmsb))[2]; |
441 | 441 | ||
442 | return 0; | 442 | return 0; |
443 | } | 443 | } |
diff --git a/sound/pci/lx6464es/lx_core.h b/sound/pci/lx6464es/lx_core.h index 6bd9cbbbc68d..1dd562980b6c 100644 --- a/sound/pci/lx6464es/lx_core.h +++ b/sound/pci/lx6464es/lx_core.h | |||
@@ -116,7 +116,7 @@ int __devinit lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version); | |||
116 | int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq); | 116 | int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq); |
117 | int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran); | 117 | int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran); |
118 | int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data); | 118 | int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data); |
119 | int lx_dsp_get_mac(struct lx6464es *chip, u8 *mac_address); | 119 | int lx_dsp_get_mac(struct lx6464es *chip); |
120 | 120 | ||
121 | 121 | ||
122 | /* low-level pipe handling */ | 122 | /* low-level pipe handling */ |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 3c40d726b46e..0378126e6272 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -850,11 +850,10 @@ struct snd_m3 { | |||
850 | struct input_dev *input_dev; | 850 | struct input_dev *input_dev; |
851 | char phys[64]; /* physical device path */ | 851 | char phys[64]; /* physical device path */ |
852 | #else | 852 | #else |
853 | spinlock_t ac97_lock; | ||
854 | struct snd_kcontrol *master_switch; | 853 | struct snd_kcontrol *master_switch; |
855 | struct snd_kcontrol *master_volume; | 854 | struct snd_kcontrol *master_volume; |
856 | struct tasklet_struct hwvol_tq; | ||
857 | #endif | 855 | #endif |
856 | struct work_struct hwvol_work; | ||
858 | 857 | ||
859 | unsigned int in_suspend; | 858 | unsigned int in_suspend; |
860 | 859 | ||
@@ -1609,13 +1608,10 @@ static void snd_m3_update_ptr(struct snd_m3 *chip, struct m3_dma *s) | |||
1609 | (without wrap around) in response to volume button presses and then | 1608 | (without wrap around) in response to volume button presses and then |
1610 | generating an interrupt. The pair of counters is stored in bits 1-3 and 5-7 | 1609 | generating an interrupt. The pair of counters is stored in bits 1-3 and 5-7 |
1611 | of a byte wide register. The meaning of bits 0 and 4 is unknown. */ | 1610 | of a byte wide register. The meaning of bits 0 and 4 is unknown. */ |
1612 | static void snd_m3_update_hw_volume(unsigned long private_data) | 1611 | static void snd_m3_update_hw_volume(struct work_struct *work) |
1613 | { | 1612 | { |
1614 | struct snd_m3 *chip = (struct snd_m3 *) private_data; | 1613 | struct snd_m3 *chip = container_of(work, struct snd_m3, hwvol_work); |
1615 | int x, val; | 1614 | int x, val; |
1616 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
1617 | unsigned long flags; | ||
1618 | #endif | ||
1619 | 1615 | ||
1620 | /* Figure out which volume control button was pushed, | 1616 | /* Figure out which volume control button was pushed, |
1621 | based on differences from the default register | 1617 | based on differences from the default register |
@@ -1645,21 +1641,13 @@ static void snd_m3_update_hw_volume(unsigned long private_data) | |||
1645 | if (!chip->master_switch || !chip->master_volume) | 1641 | if (!chip->master_switch || !chip->master_volume) |
1646 | return; | 1642 | return; |
1647 | 1643 | ||
1648 | /* FIXME: we can't call snd_ac97_* functions since here is in tasklet. */ | 1644 | val = snd_ac97_read(chip->ac97, AC97_MASTER); |
1649 | spin_lock_irqsave(&chip->ac97_lock, flags); | ||
1650 | |||
1651 | val = chip->ac97->regs[AC97_MASTER_VOL]; | ||
1652 | switch (x) { | 1645 | switch (x) { |
1653 | case 0x88: | 1646 | case 0x88: |
1654 | /* The counters have not changed, yet we've received a HV | 1647 | /* The counters have not changed, yet we've received a HV |
1655 | interrupt. According to tests run by various people this | 1648 | interrupt. According to tests run by various people this |
1656 | happens when pressing the mute button. */ | 1649 | happens when pressing the mute button. */ |
1657 | val ^= 0x8000; | 1650 | val ^= 0x8000; |
1658 | chip->ac97->regs[AC97_MASTER_VOL] = val; | ||
1659 | outw(val, chip->iobase + CODEC_DATA); | ||
1660 | outb(AC97_MASTER_VOL, chip->iobase + CODEC_COMMAND); | ||
1661 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1662 | &chip->master_switch->id); | ||
1663 | break; | 1651 | break; |
1664 | case 0xaa: | 1652 | case 0xaa: |
1665 | /* counters increased by 1 -> volume up */ | 1653 | /* counters increased by 1 -> volume up */ |
@@ -1667,11 +1655,6 @@ static void snd_m3_update_hw_volume(unsigned long private_data) | |||
1667 | val--; | 1655 | val--; |
1668 | if ((val & 0x7f00) > 0) | 1656 | if ((val & 0x7f00) > 0) |
1669 | val -= 0x0100; | 1657 | val -= 0x0100; |
1670 | chip->ac97->regs[AC97_MASTER_VOL] = val; | ||
1671 | outw(val, chip->iobase + CODEC_DATA); | ||
1672 | outb(AC97_MASTER_VOL, chip->iobase + CODEC_COMMAND); | ||
1673 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1674 | &chip->master_volume->id); | ||
1675 | break; | 1658 | break; |
1676 | case 0x66: | 1659 | case 0x66: |
1677 | /* counters decreased by 1 -> volume down */ | 1660 | /* counters decreased by 1 -> volume down */ |
@@ -1679,14 +1662,11 @@ static void snd_m3_update_hw_volume(unsigned long private_data) | |||
1679 | val++; | 1662 | val++; |
1680 | if ((val & 0x7f00) < 0x1f00) | 1663 | if ((val & 0x7f00) < 0x1f00) |
1681 | val += 0x0100; | 1664 | val += 0x0100; |
1682 | chip->ac97->regs[AC97_MASTER_VOL] = val; | ||
1683 | outw(val, chip->iobase + CODEC_DATA); | ||
1684 | outb(AC97_MASTER_VOL, chip->iobase + CODEC_COMMAND); | ||
1685 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1686 | &chip->master_volume->id); | ||
1687 | break; | 1665 | break; |
1688 | } | 1666 | } |
1689 | spin_unlock_irqrestore(&chip->ac97_lock, flags); | 1667 | if (snd_ac97_update(chip->ac97, AC97_MASTER, val)) |
1668 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
1669 | &chip->master_switch->id); | ||
1690 | #else | 1670 | #else |
1691 | if (!chip->input_dev) | 1671 | if (!chip->input_dev) |
1692 | return; | 1672 | return; |
@@ -1730,11 +1710,7 @@ static irqreturn_t snd_m3_interrupt(int irq, void *dev_id) | |||
1730 | return IRQ_NONE; | 1710 | return IRQ_NONE; |
1731 | 1711 | ||
1732 | if (status & HV_INT_PENDING) | 1712 | if (status & HV_INT_PENDING) |
1733 | #ifdef CONFIG_SND_MAESTRO3_INPUT | 1713 | schedule_work(&chip->hwvol_work); |
1734 | snd_m3_update_hw_volume((unsigned long)chip); | ||
1735 | #else | ||
1736 | tasklet_schedule(&chip->hwvol_tq); | ||
1737 | #endif | ||
1738 | 1714 | ||
1739 | /* | 1715 | /* |
1740 | * ack an assp int if its running | 1716 | * ack an assp int if its running |
@@ -2000,24 +1976,14 @@ static unsigned short | |||
2000 | snd_m3_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | 1976 | snd_m3_ac97_read(struct snd_ac97 *ac97, unsigned short reg) |
2001 | { | 1977 | { |
2002 | struct snd_m3 *chip = ac97->private_data; | 1978 | struct snd_m3 *chip = ac97->private_data; |
2003 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2004 | unsigned long flags; | ||
2005 | #endif | ||
2006 | unsigned short data = 0xffff; | 1979 | unsigned short data = 0xffff; |
2007 | 1980 | ||
2008 | if (snd_m3_ac97_wait(chip)) | 1981 | if (snd_m3_ac97_wait(chip)) |
2009 | goto fail; | 1982 | goto fail; |
2010 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2011 | spin_lock_irqsave(&chip->ac97_lock, flags); | ||
2012 | #endif | ||
2013 | snd_m3_outb(chip, 0x80 | (reg & 0x7f), CODEC_COMMAND); | 1983 | snd_m3_outb(chip, 0x80 | (reg & 0x7f), CODEC_COMMAND); |
2014 | if (snd_m3_ac97_wait(chip)) | 1984 | if (snd_m3_ac97_wait(chip)) |
2015 | goto fail_unlock; | 1985 | goto fail; |
2016 | data = snd_m3_inw(chip, CODEC_DATA); | 1986 | data = snd_m3_inw(chip, CODEC_DATA); |
2017 | fail_unlock: | ||
2018 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2019 | spin_unlock_irqrestore(&chip->ac97_lock, flags); | ||
2020 | #endif | ||
2021 | fail: | 1987 | fail: |
2022 | return data; | 1988 | return data; |
2023 | } | 1989 | } |
@@ -2026,20 +1992,11 @@ static void | |||
2026 | snd_m3_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) | 1992 | snd_m3_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) |
2027 | { | 1993 | { |
2028 | struct snd_m3 *chip = ac97->private_data; | 1994 | struct snd_m3 *chip = ac97->private_data; |
2029 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2030 | unsigned long flags; | ||
2031 | #endif | ||
2032 | 1995 | ||
2033 | if (snd_m3_ac97_wait(chip)) | 1996 | if (snd_m3_ac97_wait(chip)) |
2034 | return; | 1997 | return; |
2035 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2036 | spin_lock_irqsave(&chip->ac97_lock, flags); | ||
2037 | #endif | ||
2038 | snd_m3_outw(chip, val, CODEC_DATA); | 1998 | snd_m3_outw(chip, val, CODEC_DATA); |
2039 | snd_m3_outb(chip, reg & 0x7f, CODEC_COMMAND); | 1999 | snd_m3_outb(chip, reg & 0x7f, CODEC_COMMAND); |
2040 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2041 | spin_unlock_irqrestore(&chip->ac97_lock, flags); | ||
2042 | #endif | ||
2043 | } | 2000 | } |
2044 | 2001 | ||
2045 | 2002 | ||
@@ -2458,6 +2415,7 @@ static int snd_m3_free(struct snd_m3 *chip) | |||
2458 | struct m3_dma *s; | 2415 | struct m3_dma *s; |
2459 | int i; | 2416 | int i; |
2460 | 2417 | ||
2418 | cancel_work_sync(&chip->hwvol_work); | ||
2461 | #ifdef CONFIG_SND_MAESTRO3_INPUT | 2419 | #ifdef CONFIG_SND_MAESTRO3_INPUT |
2462 | if (chip->input_dev) | 2420 | if (chip->input_dev) |
2463 | input_unregister_device(chip->input_dev); | 2421 | input_unregister_device(chip->input_dev); |
@@ -2511,6 +2469,7 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state) | |||
2511 | return 0; | 2469 | return 0; |
2512 | 2470 | ||
2513 | chip->in_suspend = 1; | 2471 | chip->in_suspend = 1; |
2472 | cancel_work_sync(&chip->hwvol_work); | ||
2514 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2473 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2515 | snd_pcm_suspend_all(chip->pcm); | 2474 | snd_pcm_suspend_all(chip->pcm); |
2516 | snd_ac97_suspend(chip->ac97); | 2475 | snd_ac97_suspend(chip->ac97); |
@@ -2667,9 +2626,6 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2667 | } | 2626 | } |
2668 | 2627 | ||
2669 | spin_lock_init(&chip->reg_lock); | 2628 | spin_lock_init(&chip->reg_lock); |
2670 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2671 | spin_lock_init(&chip->ac97_lock); | ||
2672 | #endif | ||
2673 | 2629 | ||
2674 | switch (pci->device) { | 2630 | switch (pci->device) { |
2675 | case PCI_DEVICE_ID_ESS_ALLEGRO: | 2631 | case PCI_DEVICE_ID_ESS_ALLEGRO: |
@@ -2683,6 +2639,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2683 | chip->card = card; | 2639 | chip->card = card; |
2684 | chip->pci = pci; | 2640 | chip->pci = pci; |
2685 | chip->irq = -1; | 2641 | chip->irq = -1; |
2642 | INIT_WORK(&chip->hwvol_work, snd_m3_update_hw_volume); | ||
2686 | 2643 | ||
2687 | chip->external_amp = enable_amp; | 2644 | chip->external_amp = enable_amp; |
2688 | if (amp_gpio >= 0 && amp_gpio <= 0x0f) | 2645 | if (amp_gpio >= 0 && amp_gpio <= 0x0f) |
@@ -2752,12 +2709,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2752 | 2709 | ||
2753 | snd_m3_hv_init(chip); | 2710 | snd_m3_hv_init(chip); |
2754 | 2711 | ||
2755 | #ifndef CONFIG_SND_MAESTRO3_INPUT | ||
2756 | tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); | ||
2757 | #endif | ||
2758 | |||
2759 | if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED, | 2712 | if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED, |
2760 | card->driver, chip)) { | 2713 | KBUILD_MODNAME, chip)) { |
2761 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2714 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2762 | snd_m3_free(chip); | 2715 | snd_m3_free(chip); |
2763 | return -ENOMEM; | 2716 | return -ENOMEM; |
@@ -2885,7 +2838,7 @@ static void __devexit snd_m3_remove(struct pci_dev *pci) | |||
2885 | } | 2838 | } |
2886 | 2839 | ||
2887 | static struct pci_driver driver = { | 2840 | static struct pci_driver driver = { |
2888 | .name = "Maestro3", | 2841 | .name = KBUILD_MODNAME, |
2889 | .id_table = snd_m3_ids, | 2842 | .id_table = snd_m3_ids, |
2890 | .probe = snd_m3_probe, | 2843 | .probe = snd_m3_probe, |
2891 | .remove = __devexit_p(snd_m3_remove), | 2844 | .remove = __devexit_p(snd_m3_remove), |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 6c3fd4d1c49d..dbee59906ae1 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1268,7 +1268,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED, | 1270 | if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED, |
1271 | CARD_NAME, mgr)) { | 1271 | KBUILD_MODNAME, mgr)) { |
1272 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1272 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1273 | snd_mixart_free(mgr); | 1273 | snd_mixart_free(mgr); |
1274 | return -EBUSY; | 1274 | return -EBUSY; |
@@ -1381,7 +1381,7 @@ static void __devexit snd_mixart_remove(struct pci_dev *pci) | |||
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | static struct pci_driver driver = { | 1383 | static struct pci_driver driver = { |
1384 | .name = "Digigram miXart", | 1384 | .name = KBUILD_MODNAME, |
1385 | .id_table = snd_mixart_ids, | 1385 | .id_table = snd_mixart_ids, |
1386 | .probe = snd_mixart_probe, | 1386 | .probe = snd_mixart_probe, |
1387 | .remove = __devexit_p(snd_mixart_remove), | 1387 | .remove = __devexit_p(snd_mixart_remove), |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 5a60492ac7b3..83ea7a7d3eec 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -465,7 +465,7 @@ static int snd_nm256_acquire_irq(struct nm256 *chip) | |||
465 | mutex_lock(&chip->irq_mutex); | 465 | mutex_lock(&chip->irq_mutex); |
466 | if (chip->irq < 0) { | 466 | if (chip->irq < 0) { |
467 | if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED, | 467 | if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED, |
468 | chip->card->driver, chip)) { | 468 | KBUILD_MODNAME, chip)) { |
469 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); | 469 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); |
470 | mutex_unlock(&chip->irq_mutex); | 470 | mutex_unlock(&chip->irq_mutex); |
471 | return -EBUSY; | 471 | return -EBUSY; |
@@ -1743,7 +1743,7 @@ static void __devexit snd_nm256_remove(struct pci_dev *pci) | |||
1743 | 1743 | ||
1744 | 1744 | ||
1745 | static struct pci_driver driver = { | 1745 | static struct pci_driver driver = { |
1746 | .name = "NeoMagic 256", | 1746 | .name = KBUILD_MODNAME, |
1747 | .id_table = snd_nm256_ids, | 1747 | .id_table = snd_nm256_ids, |
1748 | .probe = snd_nm256_probe, | 1748 | .probe = snd_nm256_probe, |
1749 | .remove = __devexit_p(snd_nm256_remove), | 1749 | .remove = __devexit_p(snd_nm256_remove), |
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index d7e8ddd9a67b..218d9854e5cb 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c | |||
@@ -859,7 +859,7 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci, | |||
859 | } | 859 | } |
860 | 860 | ||
861 | static struct pci_driver oxygen_driver = { | 861 | static struct pci_driver oxygen_driver = { |
862 | .name = "CMI8788", | 862 | .name = KBUILD_MODNAME, |
863 | .id_table = oxygen_ids, | 863 | .id_table = oxygen_ids, |
864 | .probe = generic_oxygen_probe, | 864 | .probe = generic_oxygen_probe, |
865 | .remove = __devexit_p(oxygen_pci_remove), | 865 | .remove = __devexit_p(oxygen_pci_remove), |
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 70b739816fcc..82311fcb86f6 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -655,7 +655,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | |||
655 | chip->model.init(chip); | 655 | chip->model.init(chip); |
656 | 656 | ||
657 | err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, | 657 | err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, |
658 | DRIVER, chip); | 658 | KBUILD_MODNAME, chip); |
659 | if (err < 0) { | 659 | if (err < 0) { |
660 | snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq); | 660 | snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq); |
661 | goto err_card; | 661 | goto err_card; |
diff --git a/sound/pci/oxygen/oxygen_pcm.c b/sound/pci/oxygen/oxygen_pcm.c index d5533e34ece9..cc0bcd9f3350 100644 --- a/sound/pci/oxygen/oxygen_pcm.c +++ b/sound/pci/oxygen/oxygen_pcm.c | |||
@@ -168,12 +168,6 @@ static int oxygen_open(struct snd_pcm_substream *substream, | |||
168 | if (err < 0) | 168 | if (err < 0) |
169 | return err; | 169 | return err; |
170 | } | 170 | } |
171 | if (channel == PCM_MULTICH) { | ||
172 | err = snd_pcm_hw_constraint_minmax | ||
173 | (runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 0, 8192000); | ||
174 | if (err < 0) | ||
175 | return err; | ||
176 | } | ||
177 | snd_pcm_set_sync(substream); | 171 | snd_pcm_set_sync(substream); |
178 | chip->streams[channel] = substream; | 172 | chip->streams[channel] = substream; |
179 | 173 | ||
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 469010a8b849..773db794b43f 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -88,7 +88,7 @@ static int __devinit xonar_probe(struct pci_dev *pci, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | static struct pci_driver xonar_driver = { | 90 | static struct pci_driver xonar_driver = { |
91 | .name = "AV200", | 91 | .name = KBUILD_MODNAME, |
92 | .id_table = xonar_ids, | 92 | .id_table = xonar_ids, |
93 | .probe = xonar_probe, | 93 | .probe = xonar_probe, |
94 | .remove = __devexit_p(oxygen_pci_remove), | 94 | .remove = __devexit_p(oxygen_pci_remove), |
diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c index 54cad38ec30a..32d096c98f5b 100644 --- a/sound/pci/oxygen/xonar_pcm179x.c +++ b/sound/pci/oxygen/xonar_pcm179x.c | |||
@@ -327,8 +327,10 @@ static void pcm1796_init(struct oxygen *chip) | |||
327 | { | 327 | { |
328 | struct xonar_pcm179x *data = chip->model_data; | 328 | struct xonar_pcm179x *data = chip->model_data; |
329 | 329 | ||
330 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] = PCM1796_MUTE | | 330 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] = |
331 | PCM1796_DMF_DISABLED | PCM1796_FMT_24_I2S | PCM1796_ATLD; | 331 | PCM1796_DMF_DISABLED | PCM1796_FMT_24_I2S | PCM1796_ATLD; |
332 | if (!data->broken_i2c) | ||
333 | data->pcm1796_regs[0][18 - PCM1796_REG_BASE] |= PCM1796_MUTE; | ||
332 | data->pcm1796_regs[0][19 - PCM1796_REG_BASE] = | 334 | data->pcm1796_regs[0][19 - PCM1796_REG_BASE] = |
333 | PCM1796_FLT_SHARP | PCM1796_ATS_1; | 335 | PCM1796_FLT_SHARP | PCM1796_ATS_1; |
334 | data->pcm1796_regs[0][20 - PCM1796_REG_BASE] = | 336 | data->pcm1796_regs[0][20 - PCM1796_REG_BASE] = |
@@ -1123,6 +1125,7 @@ int __devinit get_xonar_pcm179x_model(struct oxygen *chip, | |||
1123 | chip->model.control_filter = xonar_st_h6_control_filter; | 1125 | chip->model.control_filter = xonar_st_h6_control_filter; |
1124 | chip->model.dac_channels_pcm = 8; | 1126 | chip->model.dac_channels_pcm = 8; |
1125 | chip->model.dac_channels_mixer = 8; | 1127 | chip->model.dac_channels_mixer = 8; |
1128 | chip->model.dac_volume_min = 255; | ||
1126 | chip->model.dac_mclks = OXYGEN_MCLKS(256, 128, 128); | 1129 | chip->model.dac_mclks = OXYGEN_MCLKS(256, 128, 128); |
1127 | break; | 1130 | break; |
1128 | } | 1131 | } |
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 95cfde27d25c..046578d26f98 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -1501,7 +1501,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, | |||
1501 | mgr->irq = -1; | 1501 | mgr->irq = -1; |
1502 | 1502 | ||
1503 | if (request_irq(pci->irq, pcxhr_interrupt, IRQF_SHARED, | 1503 | if (request_irq(pci->irq, pcxhr_interrupt, IRQF_SHARED, |
1504 | card_name, mgr)) { | 1504 | KBUILD_MODNAME, mgr)) { |
1505 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1505 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1506 | pcxhr_free(mgr); | 1506 | pcxhr_free(mgr); |
1507 | return -EBUSY; | 1507 | return -EBUSY; |
@@ -1608,7 +1608,7 @@ static void __devexit pcxhr_remove(struct pci_dev *pci) | |||
1608 | } | 1608 | } |
1609 | 1609 | ||
1610 | static struct pci_driver driver = { | 1610 | static struct pci_driver driver = { |
1611 | .name = "Digigram pcxhr", | 1611 | .name = KBUILD_MODNAME, |
1612 | .id_table = pcxhr_ids, | 1612 | .id_table = pcxhr_ids, |
1613 | .probe = pcxhr_probe, | 1613 | .probe = pcxhr_probe, |
1614 | .remove = __devexit_p(pcxhr_remove), | 1614 | .remove = __devexit_p(pcxhr_remove), |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index ad5202efd7a9..e34ae14908b3 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1890,7 +1890,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci, | |||
1890 | UNSET_AIE(hwport); | 1890 | UNSET_AIE(hwport); |
1891 | 1891 | ||
1892 | if (request_irq(pci->irq, snd_riptide_interrupt, IRQF_SHARED, | 1892 | if (request_irq(pci->irq, snd_riptide_interrupt, IRQF_SHARED, |
1893 | "RIPTIDE", chip)) { | 1893 | KBUILD_MODNAME, chip)) { |
1894 | snd_printk(KERN_ERR "Riptide: unable to grab IRQ %d\n", | 1894 | snd_printk(KERN_ERR "Riptide: unable to grab IRQ %d\n", |
1895 | pci->irq); | 1895 | pci->irq); |
1896 | snd_riptide_free(chip); | 1896 | snd_riptide_free(chip); |
@@ -2176,7 +2176,7 @@ static void __devexit snd_card_riptide_remove(struct pci_dev *pci) | |||
2176 | } | 2176 | } |
2177 | 2177 | ||
2178 | static struct pci_driver driver = { | 2178 | static struct pci_driver driver = { |
2179 | .name = "RIPTIDE", | 2179 | .name = KBUILD_MODNAME, |
2180 | .id_table = snd_riptide_ids, | 2180 | .id_table = snd_riptide_ids, |
2181 | .probe = snd_card_riptide_probe, | 2181 | .probe = snd_card_riptide_probe, |
2182 | .remove = __devexit_p(snd_card_riptide_remove), | 2182 | .remove = __devexit_p(snd_card_riptide_remove), |
@@ -2188,7 +2188,7 @@ static struct pci_driver driver = { | |||
2188 | 2188 | ||
2189 | #ifdef SUPPORT_JOYSTICK | 2189 | #ifdef SUPPORT_JOYSTICK |
2190 | static struct pci_driver joystick_driver = { | 2190 | static struct pci_driver joystick_driver = { |
2191 | .name = "Riptide Joystick", | 2191 | .name = KBUILD_MODNAME "-joystick", |
2192 | .id_table = snd_riptide_joystick_ids, | 2192 | .id_table = snd_riptide_joystick_ids, |
2193 | .probe = snd_riptide_joystick_probe, | 2193 | .probe = snd_riptide_joystick_probe, |
2194 | .remove = __devexit_p(snd_riptide_joystick_remove), | 2194 | .remove = __devexit_p(snd_riptide_joystick_remove), |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 3c04524de37c..6be77a264d47 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -1355,7 +1355,7 @@ static int __devinit snd_rme32_create(struct rme32 * rme32) | |||
1355 | } | 1355 | } |
1356 | 1356 | ||
1357 | if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_SHARED, | 1357 | if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_SHARED, |
1358 | "RME32", rme32)) { | 1358 | KBUILD_MODNAME, rme32)) { |
1359 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1359 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1360 | return -EBUSY; | 1360 | return -EBUSY; |
1361 | } | 1361 | } |
@@ -1985,7 +1985,7 @@ static void __devexit snd_rme32_remove(struct pci_dev *pci) | |||
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | static struct pci_driver driver = { | 1987 | static struct pci_driver driver = { |
1988 | .name = "RME Digi32", | 1988 | .name = KBUILD_MODNAME, |
1989 | .id_table = snd_rme32_ids, | 1989 | .id_table = snd_rme32_ids, |
1990 | .probe = snd_rme32_probe, | 1990 | .probe = snd_rme32_probe, |
1991 | .remove = __devexit_p(snd_rme32_remove), | 1991 | .remove = __devexit_p(snd_rme32_remove), |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 9ff247fc8871..409e5b89519d 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -1561,7 +1561,7 @@ snd_rme96_create(struct rme96 *rme96) | |||
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_SHARED, | 1563 | if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_SHARED, |
1564 | "RME96", rme96)) { | 1564 | KBUILD_MODNAME, rme96)) { |
1565 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1565 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1566 | return -EBUSY; | 1566 | return -EBUSY; |
1567 | } | 1567 | } |
@@ -2396,7 +2396,7 @@ static void __devexit snd_rme96_remove(struct pci_dev *pci) | |||
2396 | } | 2396 | } |
2397 | 2397 | ||
2398 | static struct pci_driver driver = { | 2398 | static struct pci_driver driver = { |
2399 | .name = "RME Digi96", | 2399 | .name = KBUILD_MODNAME, |
2400 | .id_table = snd_rme96_ids, | 2400 | .id_table = snd_rme96_ids, |
2401 | .probe = snd_rme96_probe, | 2401 | .probe = snd_rme96_probe, |
2402 | .remove = __devexit_p(snd_rme96_remove), | 2402 | .remove = __devexit_p(snd_rme96_remove), |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 2d8332416c83..1c6d1e1c27c1 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -5482,7 +5482,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5482 | } | 5482 | } |
5483 | 5483 | ||
5484 | if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED, | 5484 | if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED, |
5485 | "hdsp", hdsp)) { | 5485 | KBUILD_MODNAME, hdsp)) { |
5486 | snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); | 5486 | snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); |
5487 | return -EBUSY; | 5487 | return -EBUSY; |
5488 | } | 5488 | } |
@@ -5637,7 +5637,7 @@ static void __devexit snd_hdsp_remove(struct pci_dev *pci) | |||
5637 | } | 5637 | } |
5638 | 5638 | ||
5639 | static struct pci_driver driver = { | 5639 | static struct pci_driver driver = { |
5640 | .name = "RME Hammerfall DSP", | 5640 | .name = KBUILD_MODNAME, |
5641 | .id_table = snd_hdsp_ids, | 5641 | .id_table = snd_hdsp_ids, |
5642 | .probe = snd_hdsp_probe, | 5642 | .probe = snd_hdsp_probe, |
5643 | .remove = __devexit_p(snd_hdsp_remove), | 5643 | .remove = __devexit_p(snd_hdsp_remove), |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index c8e402fc3782..af130ee0c45d 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -6441,7 +6441,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card, | |||
6441 | hdspm->port + io_extent - 1); | 6441 | hdspm->port + io_extent - 1); |
6442 | 6442 | ||
6443 | if (request_irq(pci->irq, snd_hdspm_interrupt, | 6443 | if (request_irq(pci->irq, snd_hdspm_interrupt, |
6444 | IRQF_SHARED, "hdspm", hdspm)) { | 6444 | IRQF_SHARED, KBUILD_MODNAME, hdspm)) { |
6445 | snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq); | 6445 | snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq); |
6446 | return -EBUSY; | 6446 | return -EBUSY; |
6447 | } | 6447 | } |
@@ -6779,7 +6779,7 @@ static void __devexit snd_hdspm_remove(struct pci_dev *pci) | |||
6779 | } | 6779 | } |
6780 | 6780 | ||
6781 | static struct pci_driver driver = { | 6781 | static struct pci_driver driver = { |
6782 | .name = "RME Hammerfall DSP MADI", | 6782 | .name = KBUILD_MODNAME, |
6783 | .id_table = snd_hdspm_ids, | 6783 | .id_table = snd_hdspm_ids, |
6784 | .probe = snd_hdspm_probe, | 6784 | .probe = snd_hdspm_probe, |
6785 | .remove = __devexit_p(snd_hdspm_remove), | 6785 | .remove = __devexit_p(snd_hdspm_remove), |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index c492af5b25f3..1c7bc1ef8186 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -2479,7 +2479,7 @@ static int __devinit snd_rme9652_create(struct snd_card *card, | |||
2479 | } | 2479 | } |
2480 | 2480 | ||
2481 | if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_SHARED, | 2481 | if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_SHARED, |
2482 | "rme9652", rme9652)) { | 2482 | KBUILD_MODNAME, rme9652)) { |
2483 | snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq); | 2483 | snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq); |
2484 | return -EBUSY; | 2484 | return -EBUSY; |
2485 | } | 2485 | } |
@@ -2632,7 +2632,7 @@ static void __devexit snd_rme9652_remove(struct pci_dev *pci) | |||
2632 | } | 2632 | } |
2633 | 2633 | ||
2634 | static struct pci_driver driver = { | 2634 | static struct pci_driver driver = { |
2635 | .name = "RME Digi9652 (Hammerfall)", | 2635 | .name = KBUILD_MODNAME, |
2636 | .id_table = snd_rme9652_ids, | 2636 | .id_table = snd_rme9652_ids, |
2637 | .probe = snd_rme9652_probe, | 2637 | .probe = snd_rme9652_probe, |
2638 | .remove = __devexit_p(snd_rme9652_remove), | 2638 | .remove = __devexit_p(snd_rme9652_remove), |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 2b5c7a95ae1f..bcf61524a13f 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -1235,7 +1235,7 @@ static int sis_resume(struct pci_dev *pci) | |||
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | if (request_irq(pci->irq, sis_interrupt, IRQF_DISABLED|IRQF_SHARED, | 1237 | if (request_irq(pci->irq, sis_interrupt, IRQF_DISABLED|IRQF_SHARED, |
1238 | card->shortname, sis)) { | 1238 | KBUILD_MODNAME, sis)) { |
1239 | printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq); | 1239 | printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq); |
1240 | goto error; | 1240 | goto error; |
1241 | } | 1241 | } |
@@ -1341,7 +1341,7 @@ static int __devinit sis_chip_create(struct snd_card *card, | |||
1341 | goto error_out_cleanup; | 1341 | goto error_out_cleanup; |
1342 | 1342 | ||
1343 | if (request_irq(pci->irq, sis_interrupt, IRQF_DISABLED|IRQF_SHARED, | 1343 | if (request_irq(pci->irq, sis_interrupt, IRQF_DISABLED|IRQF_SHARED, |
1344 | card->shortname, sis)) { | 1344 | KBUILD_MODNAME, sis)) { |
1345 | printk(KERN_ERR "unable to allocate irq %d\n", sis->irq); | 1345 | printk(KERN_ERR "unable to allocate irq %d\n", sis->irq); |
1346 | goto error_out_cleanup; | 1346 | goto error_out_cleanup; |
1347 | } | 1347 | } |
@@ -1436,7 +1436,7 @@ static void __devexit snd_sis7019_remove(struct pci_dev *pci) | |||
1436 | } | 1436 | } |
1437 | 1437 | ||
1438 | static struct pci_driver sis7019_driver = { | 1438 | static struct pci_driver sis7019_driver = { |
1439 | .name = "SiS7019", | 1439 | .name = KBUILD_MODNAME, |
1440 | .id_table = snd_sis7019_ids, | 1440 | .id_table = snd_sis7019_ids, |
1441 | .probe = snd_sis7019_probe, | 1441 | .probe = snd_sis7019_probe, |
1442 | .remove = __devexit_p(snd_sis7019_remove), | 1442 | .remove = __devexit_p(snd_sis7019_remove), |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 337b9facadfd..2571a67b389a 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -1294,7 +1294,7 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card, | |||
1294 | sonic->game_port = pci_resource_start(pci, 4); | 1294 | sonic->game_port = pci_resource_start(pci, 4); |
1295 | 1295 | ||
1296 | if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED, | 1296 | if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED, |
1297 | "S3 SonicVibes", sonic)) { | 1297 | KBUILD_MODNAME, sonic)) { |
1298 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1298 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1299 | snd_sonicvibes_free(sonic); | 1299 | snd_sonicvibes_free(sonic); |
1300 | return -EBUSY; | 1300 | return -EBUSY; |
@@ -1530,7 +1530,7 @@ static void __devexit snd_sonic_remove(struct pci_dev *pci) | |||
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | static struct pci_driver driver = { | 1532 | static struct pci_driver driver = { |
1533 | .name = "S3 SonicVibes", | 1533 | .name = KBUILD_MODNAME, |
1534 | .id_table = snd_sonic_ids, | 1534 | .id_table = snd_sonic_ids, |
1535 | .probe = snd_sonic_probe, | 1535 | .probe = snd_sonic_probe, |
1536 | .remove = __devexit_p(snd_sonic_remove), | 1536 | .remove = __devexit_p(snd_sonic_remove), |
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index 6d0581841d7a..d8a128f6fc02 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -172,7 +172,7 @@ static void __devexit snd_trident_remove(struct pci_dev *pci) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | static struct pci_driver driver = { | 174 | static struct pci_driver driver = { |
175 | .name = "Trident4DWaveAudio", | 175 | .name = KBUILD_MODNAME, |
176 | .id_table = snd_trident_ids, | 176 | .id_table = snd_trident_ids, |
177 | .probe = snd_trident_probe, | 177 | .probe = snd_trident_probe, |
178 | .remove = __devexit_p(snd_trident_remove), | 178 | .remove = __devexit_p(snd_trident_remove), |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 2870a4fdc130..5bd57a7c52d2 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -3598,7 +3598,7 @@ int __devinit snd_trident_create(struct snd_card *card, | |||
3598 | trident->port = pci_resource_start(pci, 0); | 3598 | trident->port = pci_resource_start(pci, 0); |
3599 | 3599 | ||
3600 | if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED, | 3600 | if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED, |
3601 | "Trident Audio", trident)) { | 3601 | KBUILD_MODNAME, trident)) { |
3602 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 3602 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
3603 | snd_trident_free(trident); | 3603 | snd_trident_free(trident); |
3604 | return -EBUSY; | 3604 | return -EBUSY; |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 8c5f8b5a59f0..f03fd620a2a0 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -2377,7 +2377,7 @@ static int __devinit snd_via82xx_create(struct snd_card *card, | |||
2377 | chip_type == TYPE_VIA8233 ? | 2377 | chip_type == TYPE_VIA8233 ? |
2378 | snd_via8233_interrupt : snd_via686_interrupt, | 2378 | snd_via8233_interrupt : snd_via686_interrupt, |
2379 | IRQF_SHARED, | 2379 | IRQF_SHARED, |
2380 | card->driver, chip)) { | 2380 | KBUILD_MODNAME, chip)) { |
2381 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2381 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2382 | snd_via82xx_free(chip); | 2382 | snd_via82xx_free(chip); |
2383 | return -EBUSY; | 2383 | return -EBUSY; |
@@ -2611,7 +2611,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci) | |||
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | static struct pci_driver driver = { | 2613 | static struct pci_driver driver = { |
2614 | .name = "VIA 82xx Audio", | 2614 | .name = KBUILD_MODNAME, |
2615 | .id_table = snd_via82xx_ids, | 2615 | .id_table = snd_via82xx_ids, |
2616 | .probe = snd_via82xx_probe, | 2616 | .probe = snd_via82xx_probe, |
2617 | .remove = __devexit_p(snd_via82xx_remove), | 2617 | .remove = __devexit_p(snd_via82xx_remove), |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index f7e8bbbe3953..a386dd9f6732 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -1129,7 +1129,7 @@ static int __devinit snd_via82xx_create(struct snd_card *card, | |||
1129 | } | 1129 | } |
1130 | chip->port = pci_resource_start(pci, 0); | 1130 | chip->port = pci_resource_start(pci, 0); |
1131 | if (request_irq(pci->irq, snd_via82xx_interrupt, IRQF_SHARED, | 1131 | if (request_irq(pci->irq, snd_via82xx_interrupt, IRQF_SHARED, |
1132 | card->driver, chip)) { | 1132 | KBUILD_MODNAME, chip)) { |
1133 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 1133 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1134 | snd_via82xx_free(chip); | 1134 | snd_via82xx_free(chip); |
1135 | return -EBUSY; | 1135 | return -EBUSY; |
@@ -1224,7 +1224,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci) | |||
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | static struct pci_driver driver = { | 1226 | static struct pci_driver driver = { |
1227 | .name = "VIA 82xx Modem", | 1227 | .name = KBUILD_MODNAME, |
1228 | .id_table = snd_via82xx_modem_ids, | 1228 | .id_table = snd_via82xx_modem_ids, |
1229 | .probe = snd_via82xx_probe, | 1229 | .probe = snd_via82xx_probe, |
1230 | .remove = __devexit_p(snd_via82xx_remove), | 1230 | .remove = __devexit_p(snd_via82xx_remove), |
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index 99a9a814be0b..5342d5e1366a 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c | |||
@@ -169,7 +169,7 @@ static int __devinit snd_vx222_create(struct snd_card *card, struct pci_dev *pci | |||
169 | vx->port[i] = pci_resource_start(pci, i + 1); | 169 | vx->port[i] = pci_resource_start(pci, i + 1); |
170 | 170 | ||
171 | if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_SHARED, | 171 | if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_SHARED, |
172 | CARD_NAME, chip)) { | 172 | KBUILD_MODNAME, chip)) { |
173 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 173 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
174 | snd_vx222_free(chip); | 174 | snd_vx222_free(chip); |
175 | return -EBUSY; | 175 | return -EBUSY; |
@@ -290,7 +290,7 @@ static int snd_vx222_resume(struct pci_dev *pci) | |||
290 | #endif | 290 | #endif |
291 | 291 | ||
292 | static struct pci_driver driver = { | 292 | static struct pci_driver driver = { |
293 | .name = "Digigram VX222", | 293 | .name = KBUILD_MODNAME, |
294 | .id_table = snd_vx222_ids, | 294 | .id_table = snd_vx222_ids, |
295 | .probe = snd_vx222_probe, | 295 | .probe = snd_vx222_probe, |
296 | .remove = __devexit_p(snd_vx222_remove), | 296 | .remove = __devexit_p(snd_vx222_remove), |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 80c682113381..511d57653124 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -345,7 +345,7 @@ static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci) | |||
345 | } | 345 | } |
346 | 346 | ||
347 | static struct pci_driver driver = { | 347 | static struct pci_driver driver = { |
348 | .name = "Yamaha DS-1 PCI", | 348 | .name = KBUILD_MODNAME, |
349 | .id_table = snd_ymfpci_ids, | 349 | .id_table = snd_ymfpci_ids, |
350 | .probe = snd_card_ymfpci_probe, | 350 | .probe = snd_card_ymfpci_probe, |
351 | .remove = __devexit_p(snd_card_ymfpci_remove), | 351 | .remove = __devexit_p(snd_card_ymfpci_remove), |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index c94c051ad0c8..f3260e658b8a 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -2380,7 +2380,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card, | |||
2380 | return -EBUSY; | 2380 | return -EBUSY; |
2381 | } | 2381 | } |
2382 | if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED, | 2382 | if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED, |
2383 | "YMFPCI", chip)) { | 2383 | KBUILD_MODNAME, chip)) { |
2384 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2384 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2385 | snd_ymfpci_free(chip); | 2385 | snd_ymfpci_free(chip); |
2386 | return -EBUSY; | 2386 | return -EBUSY; |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index ce33be0e4e98..66488a7a5706 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c | |||
@@ -223,7 +223,7 @@ static int pdacf_config(struct pcmcia_device *link) | |||
223 | if (ret) | 223 | if (ret) |
224 | goto failed; | 224 | goto failed; |
225 | 225 | ||
226 | ret = pcmcia_request_exclusive_irq(link, pdacf_interrupt); | 226 | ret = pcmcia_request_irq(link, pdacf_interrupt); |
227 | if (ret) | 227 | if (ret) |
228 | goto failed; | 228 | goto failed; |
229 | 229 | ||
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index d9ef21d8fa73..31777d1ea49f 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c | |||
@@ -229,7 +229,7 @@ static int vxpocket_config(struct pcmcia_device *link) | |||
229 | if (ret) | 229 | if (ret) |
230 | goto failed; | 230 | goto failed; |
231 | 231 | ||
232 | ret = pcmcia_request_exclusive_irq(link, snd_vx_irq_handler); | 232 | ret = pcmcia_request_irq(link, snd_vx_irq_handler); |
233 | if (ret) | 233 | if (ret) |
234 | goto failed; | 234 | goto failed; |
235 | 235 | ||
diff --git a/sound/usb/card.c b/sound/usb/card.c index 220c6167dd86..781d9e61adfb 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -433,9 +433,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
433 | * only at the first time. the successive calls of this function will | 433 | * only at the first time. the successive calls of this function will |
434 | * append the pcm interface to the corresponding card. | 434 | * append the pcm interface to the corresponding card. |
435 | */ | 435 | */ |
436 | static void *snd_usb_audio_probe(struct usb_device *dev, | 436 | static struct snd_usb_audio * |
437 | struct usb_interface *intf, | 437 | snd_usb_audio_probe(struct usb_device *dev, |
438 | const struct usb_device_id *usb_id) | 438 | struct usb_interface *intf, |
439 | const struct usb_device_id *usb_id) | ||
439 | { | 440 | { |
440 | const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info; | 441 | const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info; |
441 | int i, err; | 442 | int i, err; |
@@ -540,16 +541,15 @@ static void *snd_usb_audio_probe(struct usb_device *dev, | |||
540 | * we need to take care of counter, since disconnection can be called also | 541 | * we need to take care of counter, since disconnection can be called also |
541 | * many times as well as usb_audio_probe(). | 542 | * many times as well as usb_audio_probe(). |
542 | */ | 543 | */ |
543 | static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | 544 | static void snd_usb_audio_disconnect(struct usb_device *dev, |
545 | struct snd_usb_audio *chip) | ||
544 | { | 546 | { |
545 | struct snd_usb_audio *chip; | ||
546 | struct snd_card *card; | 547 | struct snd_card *card; |
547 | struct list_head *p; | 548 | struct list_head *p; |
548 | 549 | ||
549 | if (ptr == (void *)-1L) | 550 | if (chip == (void *)-1L) |
550 | return; | 551 | return; |
551 | 552 | ||
552 | chip = ptr; | ||
553 | card = chip->card; | 553 | card = chip->card; |
554 | mutex_lock(®ister_mutex); | 554 | mutex_lock(®ister_mutex); |
555 | mutex_lock(&chip->shutdown_mutex); | 555 | mutex_lock(&chip->shutdown_mutex); |
@@ -585,7 +585,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
585 | static int usb_audio_probe(struct usb_interface *intf, | 585 | static int usb_audio_probe(struct usb_interface *intf, |
586 | const struct usb_device_id *id) | 586 | const struct usb_device_id *id) |
587 | { | 587 | { |
588 | void *chip; | 588 | struct snd_usb_audio *chip; |
589 | chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); | 589 | chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); |
590 | if (chip) { | 590 | if (chip) { |
591 | usb_set_intfdata(intf, chip); | 591 | usb_set_intfdata(intf, chip); |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index b0ef9f501896..7c0d21ecd821 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -408,6 +408,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
408 | /* doesn't set the sample rate attribute, but supports it */ | 408 | /* doesn't set the sample rate attribute, but supports it */ |
409 | fp->attributes |= UAC_EP_CS_ATTR_SAMPLE_RATE; | 409 | fp->attributes |= UAC_EP_CS_ATTR_SAMPLE_RATE; |
410 | break; | 410 | break; |
411 | case USB_ID(0x0763, 0x2001): /* M-Audio Quattro USB */ | ||
412 | case USB_ID(0x0763, 0x2012): /* M-Audio Fast Track Pro USB */ | ||
411 | case USB_ID(0x047f, 0x0ca1): /* plantronics headset */ | 413 | case USB_ID(0x047f, 0x0ca1): /* plantronics headset */ |
412 | case USB_ID(0x077d, 0x07af): /* Griffin iMic (note that there is | 414 | case USB_ID(0x077d, 0x07af): /* Griffin iMic (note that there is |
413 | an older model 77d:223) */ | 415 | an older model 77d:223) */ |
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c index fb5d68fa7ff4..67bec7612442 100644 --- a/sound/usb/misc/ua101.c +++ b/sound/usb/misc/ua101.c | |||
@@ -645,7 +645,7 @@ static int set_stream_hw(struct ua101 *ua, struct snd_pcm_substream *substream, | |||
645 | err = snd_pcm_hw_constraint_minmax(substream->runtime, | 645 | err = snd_pcm_hw_constraint_minmax(substream->runtime, |
646 | SNDRV_PCM_HW_PARAM_PERIOD_TIME, | 646 | SNDRV_PCM_HW_PARAM_PERIOD_TIME, |
647 | 1500000 / ua->packets_per_second, | 647 | 1500000 / ua->packets_per_second, |
648 | 8192000); | 648 | UINT_MAX); |
649 | if (err < 0) | 649 | if (err < 0) |
650 | return err; | 650 | return err; |
651 | err = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24); | 651 | err = snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24); |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 0b2ae8e1c02d..dba0b7f11c54 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -1677,6 +1677,36 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1677 | } | 1677 | } |
1678 | } | 1678 | } |
1679 | }, | 1679 | }, |
1680 | { | ||
1681 | USB_DEVICE(0x0582, 0x011e), | ||
1682 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1683 | /* .vendor_name = "BOSS", */ | ||
1684 | /* .product_name = "BR-800", */ | ||
1685 | .ifnum = QUIRK_ANY_INTERFACE, | ||
1686 | .type = QUIRK_COMPOSITE, | ||
1687 | .data = (const struct snd_usb_audio_quirk[]) { | ||
1688 | { | ||
1689 | .ifnum = 0, | ||
1690 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
1691 | }, | ||
1692 | { | ||
1693 | .ifnum = 1, | ||
1694 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
1695 | }, | ||
1696 | { | ||
1697 | .ifnum = 2, | ||
1698 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1699 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1700 | .out_cables = 0x0001, | ||
1701 | .in_cables = 0x0001 | ||
1702 | } | ||
1703 | }, | ||
1704 | { | ||
1705 | .ifnum = -1 | ||
1706 | } | ||
1707 | } | ||
1708 | } | ||
1709 | }, | ||
1680 | 1710 | ||
1681 | /* Guillemot devices */ | 1711 | /* Guillemot devices */ |
1682 | { | 1712 | { |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 090e1930dfdc..77762c99afbe 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -369,6 +369,30 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) | |||
369 | return 0; | 369 | return 0; |
370 | } | 370 | } |
371 | 371 | ||
372 | static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev) | ||
373 | { | ||
374 | int err; | ||
375 | |||
376 | if (dev->actconfig->desc.bConfigurationValue == 1) { | ||
377 | snd_printk(KERN_INFO "usb-audio: " | ||
378 | "Fast Track Pro switching to config #2\n"); | ||
379 | /* This function has to be available by the usb core module. | ||
380 | * if it is not avialable the boot quirk has to be left out | ||
381 | * and the configuration has to be set by udev or hotplug | ||
382 | * rules | ||
383 | */ | ||
384 | err = usb_driver_set_configuration(dev, 2); | ||
385 | if (err < 0) { | ||
386 | snd_printdd("error usb_driver_set_configuration: %d\n", | ||
387 | err); | ||
388 | return -ENODEV; | ||
389 | } | ||
390 | } else | ||
391 | snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); | ||
392 | |||
393 | return 0; | ||
394 | } | ||
395 | |||
372 | /* | 396 | /* |
373 | * C-Media CM106/CM106+ have four 16-bit internal registers that are nicely | 397 | * C-Media CM106/CM106+ have four 16-bit internal registers that are nicely |
374 | * documented in the device's data sheet. | 398 | * documented in the device's data sheet. |
@@ -471,16 +495,49 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev) | |||
471 | /* | 495 | /* |
472 | * Setup quirks | 496 | * Setup quirks |
473 | */ | 497 | */ |
474 | #define AUDIOPHILE_SET 0x01 /* if set, parse device_setup */ | 498 | #define MAUDIO_SET 0x01 /* parse device_setup */ |
475 | #define AUDIOPHILE_SET_DTS 0x02 /* if set, enable DTS Digital Output */ | 499 | #define MAUDIO_SET_COMPATIBLE 0x80 /* use only "win-compatible" interfaces */ |
476 | #define AUDIOPHILE_SET_96K 0x04 /* 48-96KHz rate if set, 8-48KHz otherwise */ | 500 | #define MAUDIO_SET_DTS 0x02 /* enable DTS Digital Output */ |
477 | #define AUDIOPHILE_SET_24B 0x08 /* 24bits sample if set, 16bits otherwise */ | 501 | #define MAUDIO_SET_96K 0x04 /* 48-96KHz rate if set, 8-48KHz otherwise */ |
478 | #define AUDIOPHILE_SET_DI 0x10 /* if set, enable Digital Input */ | 502 | #define MAUDIO_SET_24B 0x08 /* 24bits sample if set, 16bits otherwise */ |
479 | #define AUDIOPHILE_SET_MASK 0x1F /* bit mask for setup value */ | 503 | #define MAUDIO_SET_DI 0x10 /* enable Digital Input */ |
480 | #define AUDIOPHILE_SET_24B_48K_DI 0x19 /* value for 24bits+48KHz+Digital Input */ | 504 | #define MAUDIO_SET_MASK 0x1f /* bit mask for setup value */ |
481 | #define AUDIOPHILE_SET_24B_48K_NOTDI 0x09 /* value for 24bits+48KHz+No Digital Input */ | 505 | #define MAUDIO_SET_24B_48K_DI 0x19 /* 24bits+48KHz+Digital Input */ |
482 | #define AUDIOPHILE_SET_16B_48K_DI 0x11 /* value for 16bits+48KHz+Digital Input */ | 506 | #define MAUDIO_SET_24B_48K_NOTDI 0x09 /* 24bits+48KHz+No Digital Input */ |
483 | #define AUDIOPHILE_SET_16B_48K_NOTDI 0x01 /* value for 16bits+48KHz+No Digital Input */ | 507 | #define MAUDIO_SET_16B_48K_DI 0x11 /* 16bits+48KHz+Digital Input */ |
508 | #define MAUDIO_SET_16B_48K_NOTDI 0x01 /* 16bits+48KHz+No Digital Input */ | ||
509 | |||
510 | static int quattro_skip_setting_quirk(struct snd_usb_audio *chip, | ||
511 | int iface, int altno) | ||
512 | { | ||
513 | /* Reset ALL ifaces to 0 altsetting. | ||
514 | * Call it for every possible altsetting of every interface. | ||
515 | */ | ||
516 | usb_set_interface(chip->dev, iface, 0); | ||
517 | if (chip->setup & MAUDIO_SET) { | ||
518 | if (chip->setup & MAUDIO_SET_COMPATIBLE) { | ||
519 | if (iface != 1 && iface != 2) | ||
520 | return 1; /* skip all interfaces but 1 and 2 */ | ||
521 | } else { | ||
522 | unsigned int mask; | ||
523 | if (iface == 1 || iface == 2) | ||
524 | return 1; /* skip interfaces 1 and 2 */ | ||
525 | if ((chip->setup & MAUDIO_SET_96K) && altno != 1) | ||
526 | return 1; /* skip this altsetting */ | ||
527 | mask = chip->setup & MAUDIO_SET_MASK; | ||
528 | if (mask == MAUDIO_SET_24B_48K_DI && altno != 2) | ||
529 | return 1; /* skip this altsetting */ | ||
530 | if (mask == MAUDIO_SET_24B_48K_NOTDI && altno != 3) | ||
531 | return 1; /* skip this altsetting */ | ||
532 | if (mask == MAUDIO_SET_16B_48K_NOTDI && altno != 4) | ||
533 | return 1; /* skip this altsetting */ | ||
534 | } | ||
535 | } | ||
536 | snd_printdd(KERN_INFO | ||
537 | "using altsetting %d for interface %d config %d\n", | ||
538 | altno, iface, chip->setup); | ||
539 | return 0; /* keep this altsetting */ | ||
540 | } | ||
484 | 541 | ||
485 | static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | 542 | static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, |
486 | int iface, | 543 | int iface, |
@@ -491,30 +548,65 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | |||
491 | */ | 548 | */ |
492 | usb_set_interface(chip->dev, iface, 0); | 549 | usb_set_interface(chip->dev, iface, 0); |
493 | 550 | ||
494 | if (chip->setup & AUDIOPHILE_SET) { | 551 | if (chip->setup & MAUDIO_SET) { |
495 | if ((chip->setup & AUDIOPHILE_SET_DTS) | 552 | unsigned int mask; |
496 | && altno != 6) | 553 | if ((chip->setup & MAUDIO_SET_DTS) && altno != 6) |
497 | return 1; /* skip this altsetting */ | 554 | return 1; /* skip this altsetting */ |
498 | if ((chip->setup & AUDIOPHILE_SET_96K) | 555 | if ((chip->setup & MAUDIO_SET_96K) && altno != 1) |
499 | && altno != 1) | ||
500 | return 1; /* skip this altsetting */ | 556 | return 1; /* skip this altsetting */ |
501 | if ((chip->setup & AUDIOPHILE_SET_MASK) == | 557 | mask = chip->setup & MAUDIO_SET_MASK; |
502 | AUDIOPHILE_SET_24B_48K_DI && altno != 2) | 558 | if (mask == MAUDIO_SET_24B_48K_DI && altno != 2) |
503 | return 1; /* skip this altsetting */ | 559 | return 1; /* skip this altsetting */ |
504 | if ((chip->setup & AUDIOPHILE_SET_MASK) == | 560 | if (mask == MAUDIO_SET_24B_48K_NOTDI && altno != 3) |
505 | AUDIOPHILE_SET_24B_48K_NOTDI && altno != 3) | ||
506 | return 1; /* skip this altsetting */ | 561 | return 1; /* skip this altsetting */ |
507 | if ((chip->setup & AUDIOPHILE_SET_MASK) == | 562 | if (mask == MAUDIO_SET_16B_48K_DI && altno != 4) |
508 | AUDIOPHILE_SET_16B_48K_DI && altno != 4) | ||
509 | return 1; /* skip this altsetting */ | 563 | return 1; /* skip this altsetting */ |
510 | if ((chip->setup & AUDIOPHILE_SET_MASK) == | 564 | if (mask == MAUDIO_SET_16B_48K_NOTDI && altno != 5) |
511 | AUDIOPHILE_SET_16B_48K_NOTDI && altno != 5) | ||
512 | return 1; /* skip this altsetting */ | 565 | return 1; /* skip this altsetting */ |
513 | } | 566 | } |
514 | 567 | ||
515 | return 0; /* keep this altsetting */ | 568 | return 0; /* keep this altsetting */ |
516 | } | 569 | } |
517 | 570 | ||
571 | |||
572 | static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, | ||
573 | int iface, int altno) | ||
574 | { | ||
575 | /* Reset ALL ifaces to 0 altsetting. | ||
576 | * Call it for every possible altsetting of every interface. | ||
577 | */ | ||
578 | usb_set_interface(chip->dev, iface, 0); | ||
579 | |||
580 | /* possible configuration where both inputs and only one output is | ||
581 | *used is not supported by the current setup | ||
582 | */ | ||
583 | if (chip->setup & (MAUDIO_SET | MAUDIO_SET_24B)) { | ||
584 | if (chip->setup & MAUDIO_SET_96K) { | ||
585 | if (altno != 3 && altno != 6) | ||
586 | return 1; | ||
587 | } else if (chip->setup & MAUDIO_SET_DI) { | ||
588 | if (iface == 4) | ||
589 | return 1; /* no analog input */ | ||
590 | if (altno != 2 && altno != 5) | ||
591 | return 1; /* enable only altsets 2 and 5 */ | ||
592 | } else { | ||
593 | if (iface == 5) | ||
594 | return 1; /* disable digialt input */ | ||
595 | if (altno != 2 && altno != 5) | ||
596 | return 1; /* enalbe only altsets 2 and 5 */ | ||
597 | } | ||
598 | } else { | ||
599 | /* keep only 16-Bit mode */ | ||
600 | if (altno != 1) | ||
601 | return 1; | ||
602 | } | ||
603 | |||
604 | snd_printdd(KERN_INFO | ||
605 | "using altsetting %d for interface %d config %d\n", | ||
606 | altno, iface, chip->setup); | ||
607 | return 0; /* keep this altsetting */ | ||
608 | } | ||
609 | |||
518 | int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip, | 610 | int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip, |
519 | int iface, | 611 | int iface, |
520 | int altno) | 612 | int altno) |
@@ -522,6 +614,12 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip, | |||
522 | /* audiophile usb: skip altsets incompatible with device_setup */ | 614 | /* audiophile usb: skip altsets incompatible with device_setup */ |
523 | if (chip->usb_id == USB_ID(0x0763, 0x2003)) | 615 | if (chip->usb_id == USB_ID(0x0763, 0x2003)) |
524 | return audiophile_skip_setting_quirk(chip, iface, altno); | 616 | return audiophile_skip_setting_quirk(chip, iface, altno); |
617 | /* quattro usb: skip altsets incompatible with device_setup */ | ||
618 | if (chip->usb_id == USB_ID(0x0763, 0x2001)) | ||
619 | return quattro_skip_setting_quirk(chip, iface, altno); | ||
620 | /* fasttrackpro usb: skip altsets incompatible with device_setup */ | ||
621 | if (chip->usb_id == USB_ID(0x0763, 0x2012)) | ||
622 | return fasttrackpro_skip_setting_quirk(chip, iface, altno); | ||
525 | 623 | ||
526 | return 0; | 624 | return 0; |
527 | } | 625 | } |
@@ -560,6 +658,8 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
560 | case USB_ID(0x17cc, 0x1010): /* Traktor Audio 6 */ | 658 | case USB_ID(0x17cc, 0x1010): /* Traktor Audio 6 */ |
561 | case USB_ID(0x17cc, 0x1020): /* Traktor Audio 10 */ | 659 | case USB_ID(0x17cc, 0x1020): /* Traktor Audio 10 */ |
562 | return snd_usb_nativeinstruments_boot_quirk(dev); | 660 | return snd_usb_nativeinstruments_boot_quirk(dev); |
661 | case USB_ID(0x0763, 0x2012): /* M-Audio Fast Track Pro USB */ | ||
662 | return snd_usb_fasttrackpro_boot_quirk(dev); | ||
563 | } | 663 | } |
564 | 664 | ||
565 | return 0; | 665 | return 0; |
@@ -570,15 +670,24 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
570 | */ | 670 | */ |
571 | int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp) | 671 | int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp) |
572 | { | 672 | { |
673 | /* it depends on altsetting wether the device is big-endian or not */ | ||
573 | switch (chip->usb_id) { | 674 | switch (chip->usb_id) { |
574 | case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */ | 675 | case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */ |
575 | if (fp->endpoint & USB_DIR_IN) | 676 | if (fp->altsetting == 2 || fp->altsetting == 3 || |
677 | fp->altsetting == 5 || fp->altsetting == 6) | ||
576 | return 1; | 678 | return 1; |
577 | break; | 679 | break; |
578 | case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */ | 680 | case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */ |
579 | if (chip->setup == 0x00 || | 681 | if (chip->setup == 0x00 || |
580 | fp->altsetting==1 || fp->altsetting==2 || fp->altsetting==3) | 682 | fp->altsetting == 1 || fp->altsetting == 2 || |
683 | fp->altsetting == 3) | ||
684 | return 1; | ||
685 | break; | ||
686 | case USB_ID(0x0763, 0x2012): /* M-Audio Fast Track Pro */ | ||
687 | if (fp->altsetting == 2 || fp->altsetting == 3 || | ||
688 | fp->altsetting == 5 || fp->altsetting == 6) | ||
581 | return 1; | 689 | return 1; |
690 | break; | ||
582 | } | 691 | } |
583 | return 0; | 692 | return 0; |
584 | } | 693 | } |