Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 2 | /* |
| 3 | * als300.c - driver for Avance Logic ALS300/ALS300+ soundcards. |
| 4 | * Copyright (C) 2005 by Ash Willis <ashwillis@programmer.net> |
| 5 | * |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 6 | * TODO |
| 7 | * 4 channel playback for ALS300+ |
| 8 | * gameport |
| 9 | * mpu401 |
| 10 | * opl3 |
| 11 | * |
| 12 | * NOTES |
| 13 | * The BLOCK_COUNTER registers for the ALS300(+) return a figure related to |
| 14 | * the position in the current period, NOT the whole buffer. It is important |
| 15 | * to know which period we are in so we can calculate the correct pointer. |
| 16 | * This is why we always use 2 periods. We can then use a flip-flop variable |
| 17 | * to keep track of what period we are in. |
| 18 | */ |
| 19 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 20 | #include <linux/delay.h> |
| 21 | #include <linux/init.h> |
Paul Gortmaker | 65a7721 | 2011-07-15 13:13:37 -0400 | [diff] [blame] | 22 | #include <linux/module.h> |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 23 | #include <linux/pci.h> |
Tobias Klauser | 56b146d | 2006-04-10 22:54:21 -0700 | [diff] [blame] | 24 | #include <linux/dma-mapping.h> |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/slab.h> |
Takashi Iwai | 6cbbfe1 | 2015-01-28 16:49:33 +0100 | [diff] [blame] | 27 | #include <linux/io.h> |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 28 | |
| 29 | #include <sound/core.h> |
| 30 | #include <sound/control.h> |
| 31 | #include <sound/initval.h> |
| 32 | #include <sound/pcm.h> |
| 33 | #include <sound/pcm_params.h> |
| 34 | #include <sound/ac97_codec.h> |
| 35 | #include <sound/opl3.h> |
| 36 | |
| 37 | /* snd_als300_set_irq_flag */ |
| 38 | #define IRQ_DISABLE 0 |
| 39 | #define IRQ_ENABLE 1 |
| 40 | |
| 41 | /* I/O port layout */ |
| 42 | #define AC97_ACCESS 0x00 |
| 43 | #define AC97_READ 0x04 |
| 44 | #define AC97_STATUS 0x06 |
| 45 | #define AC97_DATA_AVAIL (1<<6) |
| 46 | #define AC97_BUSY (1<<7) |
| 47 | #define ALS300_IRQ_STATUS 0x07 /* ALS300 Only */ |
| 48 | #define IRQ_PLAYBACK (1<<3) |
| 49 | #define IRQ_CAPTURE (1<<2) |
| 50 | #define GCR_DATA 0x08 |
| 51 | #define GCR_INDEX 0x0C |
| 52 | #define ALS300P_DRAM_IRQ_STATUS 0x0D /* ALS300+ Only */ |
| 53 | #define MPU_IRQ_STATUS 0x0E /* ALS300 Rev. E+, ALS300+ */ |
| 54 | #define ALS300P_IRQ_STATUS 0x0F /* ALS300+ Only */ |
| 55 | |
| 56 | /* General Control Registers */ |
| 57 | #define PLAYBACK_START 0x80 |
| 58 | #define PLAYBACK_END 0x81 |
| 59 | #define PLAYBACK_CONTROL 0x82 |
| 60 | #define TRANSFER_START (1<<16) |
| 61 | #define FIFO_PAUSE (1<<17) |
| 62 | #define RECORD_START 0x83 |
| 63 | #define RECORD_END 0x84 |
| 64 | #define RECORD_CONTROL 0x85 |
| 65 | #define DRAM_WRITE_CONTROL 0x8B |
| 66 | #define WRITE_TRANS_START (1<<16) |
| 67 | #define DRAM_MODE_2 (1<<17) |
| 68 | #define MISC_CONTROL 0x8C |
| 69 | #define IRQ_SET_BIT (1<<15) |
| 70 | #define VMUTE_NORMAL (1<<20) |
| 71 | #define MMUTE_NORMAL (1<<21) |
| 72 | #define MUS_VOC_VOL 0x8E |
| 73 | #define PLAYBACK_BLOCK_COUNTER 0x9A |
| 74 | #define RECORD_BLOCK_COUNTER 0x9B |
| 75 | |
Ash Willis | 65ff235 | 2007-05-29 14:34:17 +0200 | [diff] [blame] | 76 | #define DEBUG_PLAY_REC 0 |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 77 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 78 | #if DEBUG_PLAY_REC |
| 79 | #define snd_als300_dbgplay(format, args...) printk(KERN_ERR format, ##args) |
| 80 | #else |
| 81 | #define snd_als300_dbgplay(format, args...) |
| 82 | #endif |
| 83 | |
| 84 | enum {DEVICE_ALS300, DEVICE_ALS300_PLUS}; |
| 85 | |
| 86 | MODULE_AUTHOR("Ash Willis <ashwillis@programmer.net>"); |
| 87 | MODULE_DESCRIPTION("Avance Logic ALS300"); |
| 88 | MODULE_LICENSE("GPL"); |
| 89 | MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS300},{Avance Logic,ALS300+}}"); |
| 90 | |
| 91 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
| 92 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; |
Takashi Iwai | cde9448 | 2011-12-19 10:32:48 +0100 | [diff] [blame] | 93 | static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; |
| 94 | |
| 95 | module_param_array(index, int, NULL, 0444); |
| 96 | MODULE_PARM_DESC(index, "Index value for ALS300 sound card."); |
| 97 | module_param_array(id, charp, NULL, 0444); |
| 98 | MODULE_PARM_DESC(id, "ID string for ALS300 sound card."); |
| 99 | module_param_array(enable, bool, NULL, 0444); |
| 100 | MODULE_PARM_DESC(enable, "Enable ALS300 sound card."); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 101 | |
| 102 | struct snd_als300 { |
| 103 | unsigned long port; |
| 104 | spinlock_t reg_lock; |
| 105 | struct snd_card *card; |
| 106 | struct pci_dev *pci; |
| 107 | |
| 108 | struct snd_pcm *pcm; |
| 109 | struct snd_pcm_substream *playback_substream; |
| 110 | struct snd_pcm_substream *capture_substream; |
| 111 | |
| 112 | struct snd_ac97 *ac97; |
| 113 | struct snd_opl3 *opl3; |
| 114 | |
| 115 | struct resource *res_port; |
| 116 | |
| 117 | int irq; |
| 118 | |
| 119 | int chip_type; /* ALS300 or ALS300+ */ |
| 120 | |
| 121 | char revision; |
| 122 | }; |
| 123 | |
| 124 | struct snd_als300_substream_data { |
| 125 | int period_flipflop; |
| 126 | int control_register; |
| 127 | int block_counter_register; |
| 128 | }; |
| 129 | |
Benoit Taine | 9baa3c3 | 2014-08-08 15:56:03 +0200 | [diff] [blame] | 130 | static const struct pci_device_id snd_als300_ids[] = { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 131 | { 0x4005, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALS300 }, |
| 132 | { 0x4005, 0x0308, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_ALS300_PLUS }, |
| 133 | { 0, } |
| 134 | }; |
| 135 | |
| 136 | MODULE_DEVICE_TABLE(pci, snd_als300_ids); |
| 137 | |
| 138 | static inline u32 snd_als300_gcr_read(unsigned long port, unsigned short reg) |
| 139 | { |
| 140 | outb(reg, port+GCR_INDEX); |
| 141 | return inl(port+GCR_DATA); |
| 142 | } |
| 143 | |
| 144 | static inline void snd_als300_gcr_write(unsigned long port, |
| 145 | unsigned short reg, u32 val) |
| 146 | { |
| 147 | outb(reg, port+GCR_INDEX); |
| 148 | outl(val, port+GCR_DATA); |
| 149 | } |
| 150 | |
| 151 | /* Enable/Disable Interrupts */ |
| 152 | static void snd_als300_set_irq_flag(struct snd_als300 *chip, int cmd) |
| 153 | { |
| 154 | u32 tmp = snd_als300_gcr_read(chip->port, MISC_CONTROL); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 155 | |
| 156 | /* boolean XOR check, since old vs. new hardware have |
| 157 | directly reversed bit setting for ENABLE and DISABLE. |
| 158 | ALS300+ acts like newer versions of ALS300 */ |
| 159 | if (((chip->revision > 5 || chip->chip_type == DEVICE_ALS300_PLUS) ^ |
| 160 | (cmd == IRQ_ENABLE)) == 0) |
| 161 | tmp |= IRQ_SET_BIT; |
| 162 | else |
| 163 | tmp &= ~IRQ_SET_BIT; |
| 164 | snd_als300_gcr_write(chip->port, MISC_CONTROL, tmp); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | static int snd_als300_free(struct snd_als300 *chip) |
| 168 | { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 169 | snd_als300_set_irq_flag(chip, IRQ_DISABLE); |
| 170 | if (chip->irq >= 0) |
Takashi Iwai | 437a5a4 | 2006-11-21 12:14:23 +0100 | [diff] [blame] | 171 | free_irq(chip->irq, chip); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 172 | pci_release_regions(chip->pci); |
| 173 | pci_disable_device(chip->pci); |
| 174 | kfree(chip); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 175 | return 0; |
| 176 | } |
| 177 | |
| 178 | static int snd_als300_dev_free(struct snd_device *device) |
| 179 | { |
| 180 | struct snd_als300 *chip = device->device_data; |
| 181 | return snd_als300_free(chip); |
| 182 | } |
| 183 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 184 | static irqreturn_t snd_als300_interrupt(int irq, void *dev_id) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 185 | { |
| 186 | u8 status; |
| 187 | struct snd_als300 *chip = dev_id; |
| 188 | struct snd_als300_substream_data *data; |
| 189 | |
| 190 | status = inb(chip->port+ALS300_IRQ_STATUS); |
| 191 | if (!status) /* shared IRQ, for different device?? Exit ASAP! */ |
| 192 | return IRQ_NONE; |
| 193 | |
| 194 | /* ACK everything ASAP */ |
| 195 | outb(status, chip->port+ALS300_IRQ_STATUS); |
| 196 | if (status & IRQ_PLAYBACK) { |
| 197 | if (chip->pcm && chip->playback_substream) { |
| 198 | data = chip->playback_substream->runtime->private_data; |
| 199 | data->period_flipflop ^= 1; |
| 200 | snd_pcm_period_elapsed(chip->playback_substream); |
| 201 | snd_als300_dbgplay("IRQ_PLAYBACK\n"); |
| 202 | } |
| 203 | } |
| 204 | if (status & IRQ_CAPTURE) { |
| 205 | if (chip->pcm && chip->capture_substream) { |
| 206 | data = chip->capture_substream->runtime->private_data; |
| 207 | data->period_flipflop ^= 1; |
| 208 | snd_pcm_period_elapsed(chip->capture_substream); |
| 209 | snd_als300_dbgplay("IRQ_CAPTURE\n"); |
| 210 | } |
| 211 | } |
| 212 | return IRQ_HANDLED; |
| 213 | } |
| 214 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 215 | static irqreturn_t snd_als300plus_interrupt(int irq, void *dev_id) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 216 | { |
| 217 | u8 general, mpu, dram; |
| 218 | struct snd_als300 *chip = dev_id; |
| 219 | struct snd_als300_substream_data *data; |
| 220 | |
| 221 | general = inb(chip->port+ALS300P_IRQ_STATUS); |
| 222 | mpu = inb(chip->port+MPU_IRQ_STATUS); |
| 223 | dram = inb(chip->port+ALS300P_DRAM_IRQ_STATUS); |
| 224 | |
| 225 | /* shared IRQ, for different device?? Exit ASAP! */ |
| 226 | if ((general == 0) && ((mpu & 0x80) == 0) && ((dram & 0x01) == 0)) |
| 227 | return IRQ_NONE; |
| 228 | |
| 229 | if (general & IRQ_PLAYBACK) { |
| 230 | if (chip->pcm && chip->playback_substream) { |
| 231 | outb(IRQ_PLAYBACK, chip->port+ALS300P_IRQ_STATUS); |
| 232 | data = chip->playback_substream->runtime->private_data; |
| 233 | data->period_flipflop ^= 1; |
| 234 | snd_pcm_period_elapsed(chip->playback_substream); |
| 235 | snd_als300_dbgplay("IRQ_PLAYBACK\n"); |
| 236 | } |
| 237 | } |
| 238 | if (general & IRQ_CAPTURE) { |
| 239 | if (chip->pcm && chip->capture_substream) { |
| 240 | outb(IRQ_CAPTURE, chip->port+ALS300P_IRQ_STATUS); |
| 241 | data = chip->capture_substream->runtime->private_data; |
| 242 | data->period_flipflop ^= 1; |
| 243 | snd_pcm_period_elapsed(chip->capture_substream); |
| 244 | snd_als300_dbgplay("IRQ_CAPTURE\n"); |
| 245 | } |
| 246 | } |
| 247 | /* FIXME: Ack other interrupt types. Not important right now as |
| 248 | * those other devices aren't enabled. */ |
| 249 | return IRQ_HANDLED; |
| 250 | } |
| 251 | |
Bill Pemberton | e23e7a1 | 2012-12-06 12:35:10 -0500 | [diff] [blame] | 252 | static void snd_als300_remove(struct pci_dev *pci) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 253 | { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 254 | snd_card_free(pci_get_drvdata(pci)); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | static unsigned short snd_als300_ac97_read(struct snd_ac97 *ac97, |
| 258 | unsigned short reg) |
| 259 | { |
| 260 | int i; |
| 261 | struct snd_als300 *chip = ac97->private_data; |
| 262 | |
| 263 | for (i = 0; i < 1000; i++) { |
| 264 | if ((inb(chip->port+AC97_STATUS) & (AC97_BUSY)) == 0) |
| 265 | break; |
| 266 | udelay(10); |
| 267 | } |
| 268 | outl((reg << 24) | (1 << 31), chip->port+AC97_ACCESS); |
| 269 | |
| 270 | for (i = 0; i < 1000; i++) { |
| 271 | if ((inb(chip->port+AC97_STATUS) & (AC97_DATA_AVAIL)) != 0) |
| 272 | break; |
| 273 | udelay(10); |
| 274 | } |
| 275 | return inw(chip->port+AC97_READ); |
| 276 | } |
| 277 | |
| 278 | static void snd_als300_ac97_write(struct snd_ac97 *ac97, |
| 279 | unsigned short reg, unsigned short val) |
| 280 | { |
| 281 | int i; |
| 282 | struct snd_als300 *chip = ac97->private_data; |
| 283 | |
| 284 | for (i = 0; i < 1000; i++) { |
| 285 | if ((inb(chip->port+AC97_STATUS) & (AC97_BUSY)) == 0) |
| 286 | break; |
| 287 | udelay(10); |
| 288 | } |
| 289 | outl((reg << 24) | val, chip->port+AC97_ACCESS); |
| 290 | } |
| 291 | |
| 292 | static int snd_als300_ac97(struct snd_als300 *chip) |
| 293 | { |
| 294 | struct snd_ac97_bus *bus; |
| 295 | struct snd_ac97_template ac97; |
| 296 | int err; |
Takashi Iwai | 51055da | 2020-01-03 09:16:43 +0100 | [diff] [blame^] | 297 | static const struct snd_ac97_bus_ops ops = { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 298 | .write = snd_als300_ac97_write, |
| 299 | .read = snd_als300_ac97_read, |
| 300 | }; |
| 301 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 302 | if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus)) < 0) |
| 303 | return err; |
| 304 | |
| 305 | memset(&ac97, 0, sizeof(ac97)); |
| 306 | ac97.private_data = chip; |
| 307 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 308 | return snd_ac97_mixer(bus, &ac97, &chip->ac97); |
| 309 | } |
| 310 | |
| 311 | /* hardware definition |
| 312 | * |
| 313 | * In AC97 mode, we always use 48k/16bit/stereo. |
| 314 | * Any request to change data type is ignored by |
| 315 | * the card when it is running outside of legacy |
| 316 | * mode. |
| 317 | */ |
Bhumika Goyal | dee4989 | 2017-08-12 21:01:28 +0530 | [diff] [blame] | 318 | static const struct snd_pcm_hardware snd_als300_playback_hw = |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 319 | { |
| 320 | .info = (SNDRV_PCM_INFO_MMAP | |
| 321 | SNDRV_PCM_INFO_INTERLEAVED | |
| 322 | SNDRV_PCM_INFO_PAUSE | |
| 323 | SNDRV_PCM_INFO_MMAP_VALID), |
| 324 | .formats = SNDRV_PCM_FMTBIT_S16, |
| 325 | .rates = SNDRV_PCM_RATE_48000, |
| 326 | .rate_min = 48000, |
| 327 | .rate_max = 48000, |
| 328 | .channels_min = 2, |
| 329 | .channels_max = 2, |
| 330 | .buffer_bytes_max = 64 * 1024, |
| 331 | .period_bytes_min = 64, |
| 332 | .period_bytes_max = 32 * 1024, |
| 333 | .periods_min = 2, |
| 334 | .periods_max = 2, |
| 335 | }; |
| 336 | |
Bhumika Goyal | dee4989 | 2017-08-12 21:01:28 +0530 | [diff] [blame] | 337 | static const struct snd_pcm_hardware snd_als300_capture_hw = |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 338 | { |
| 339 | .info = (SNDRV_PCM_INFO_MMAP | |
| 340 | SNDRV_PCM_INFO_INTERLEAVED | |
| 341 | SNDRV_PCM_INFO_PAUSE | |
| 342 | SNDRV_PCM_INFO_MMAP_VALID), |
| 343 | .formats = SNDRV_PCM_FMTBIT_S16, |
| 344 | .rates = SNDRV_PCM_RATE_48000, |
| 345 | .rate_min = 48000, |
| 346 | .rate_max = 48000, |
| 347 | .channels_min = 2, |
| 348 | .channels_max = 2, |
| 349 | .buffer_bytes_max = 64 * 1024, |
| 350 | .period_bytes_min = 64, |
| 351 | .period_bytes_max = 32 * 1024, |
| 352 | .periods_min = 2, |
| 353 | .periods_max = 2, |
| 354 | }; |
| 355 | |
| 356 | static int snd_als300_playback_open(struct snd_pcm_substream *substream) |
| 357 | { |
| 358 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 359 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 360 | struct snd_als300_substream_data *data = kzalloc(sizeof(*data), |
| 361 | GFP_KERNEL); |
| 362 | |
Denis Kirjanov | 21b3de8 | 2012-10-22 17:05:53 +0400 | [diff] [blame] | 363 | if (!data) |
| 364 | return -ENOMEM; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 365 | chip->playback_substream = substream; |
| 366 | runtime->hw = snd_als300_playback_hw; |
| 367 | runtime->private_data = data; |
| 368 | data->control_register = PLAYBACK_CONTROL; |
| 369 | data->block_counter_register = PLAYBACK_BLOCK_COUNTER; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 370 | return 0; |
| 371 | } |
| 372 | |
| 373 | static int snd_als300_playback_close(struct snd_pcm_substream *substream) |
| 374 | { |
| 375 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 376 | struct snd_als300_substream_data *data; |
| 377 | |
| 378 | data = substream->runtime->private_data; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 379 | kfree(data); |
| 380 | chip->playback_substream = NULL; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | static int snd_als300_capture_open(struct snd_pcm_substream *substream) |
| 385 | { |
| 386 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 387 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 388 | struct snd_als300_substream_data *data = kzalloc(sizeof(*data), |
| 389 | GFP_KERNEL); |
| 390 | |
Denis Kirjanov | 21b3de8 | 2012-10-22 17:05:53 +0400 | [diff] [blame] | 391 | if (!data) |
| 392 | return -ENOMEM; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 393 | chip->capture_substream = substream; |
| 394 | runtime->hw = snd_als300_capture_hw; |
| 395 | runtime->private_data = data; |
| 396 | data->control_register = RECORD_CONTROL; |
| 397 | data->block_counter_register = RECORD_BLOCK_COUNTER; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 398 | return 0; |
| 399 | } |
| 400 | |
| 401 | static int snd_als300_capture_close(struct snd_pcm_substream *substream) |
| 402 | { |
| 403 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 404 | struct snd_als300_substream_data *data; |
| 405 | |
| 406 | data = substream->runtime->private_data; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 407 | kfree(data); |
| 408 | chip->capture_substream = NULL; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 409 | return 0; |
| 410 | } |
| 411 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 412 | static int snd_als300_playback_prepare(struct snd_pcm_substream *substream) |
| 413 | { |
| 414 | u32 tmp; |
| 415 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 416 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 417 | unsigned short period_bytes = snd_pcm_lib_period_bytes(substream); |
| 418 | unsigned short buffer_bytes = snd_pcm_lib_buffer_bytes(substream); |
| 419 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 420 | spin_lock_irq(&chip->reg_lock); |
| 421 | tmp = snd_als300_gcr_read(chip->port, PLAYBACK_CONTROL); |
| 422 | tmp &= ~TRANSFER_START; |
| 423 | |
| 424 | snd_als300_dbgplay("Period bytes: %d Buffer bytes %d\n", |
| 425 | period_bytes, buffer_bytes); |
| 426 | |
| 427 | /* set block size */ |
| 428 | tmp &= 0xffff0000; |
| 429 | tmp |= period_bytes - 1; |
| 430 | snd_als300_gcr_write(chip->port, PLAYBACK_CONTROL, tmp); |
| 431 | |
| 432 | /* set dma area */ |
| 433 | snd_als300_gcr_write(chip->port, PLAYBACK_START, |
| 434 | runtime->dma_addr); |
| 435 | snd_als300_gcr_write(chip->port, PLAYBACK_END, |
| 436 | runtime->dma_addr + buffer_bytes - 1); |
| 437 | spin_unlock_irq(&chip->reg_lock); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 438 | return 0; |
| 439 | } |
| 440 | |
| 441 | static int snd_als300_capture_prepare(struct snd_pcm_substream *substream) |
| 442 | { |
| 443 | u32 tmp; |
| 444 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 445 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 446 | unsigned short period_bytes = snd_pcm_lib_period_bytes(substream); |
| 447 | unsigned short buffer_bytes = snd_pcm_lib_buffer_bytes(substream); |
| 448 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 449 | spin_lock_irq(&chip->reg_lock); |
| 450 | tmp = snd_als300_gcr_read(chip->port, RECORD_CONTROL); |
| 451 | tmp &= ~TRANSFER_START; |
| 452 | |
| 453 | snd_als300_dbgplay("Period bytes: %d Buffer bytes %d\n", period_bytes, |
| 454 | buffer_bytes); |
| 455 | |
| 456 | /* set block size */ |
| 457 | tmp &= 0xffff0000; |
| 458 | tmp |= period_bytes - 1; |
| 459 | |
| 460 | /* set dma area */ |
| 461 | snd_als300_gcr_write(chip->port, RECORD_CONTROL, tmp); |
| 462 | snd_als300_gcr_write(chip->port, RECORD_START, |
| 463 | runtime->dma_addr); |
| 464 | snd_als300_gcr_write(chip->port, RECORD_END, |
| 465 | runtime->dma_addr + buffer_bytes - 1); |
| 466 | spin_unlock_irq(&chip->reg_lock); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 467 | return 0; |
| 468 | } |
| 469 | |
| 470 | static int snd_als300_trigger(struct snd_pcm_substream *substream, int cmd) |
| 471 | { |
| 472 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 473 | u32 tmp; |
| 474 | struct snd_als300_substream_data *data; |
| 475 | unsigned short reg; |
| 476 | int ret = 0; |
| 477 | |
| 478 | data = substream->runtime->private_data; |
| 479 | reg = data->control_register; |
| 480 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 481 | spin_lock(&chip->reg_lock); |
| 482 | switch (cmd) { |
| 483 | case SNDRV_PCM_TRIGGER_START: |
| 484 | case SNDRV_PCM_TRIGGER_RESUME: |
| 485 | tmp = snd_als300_gcr_read(chip->port, reg); |
| 486 | data->period_flipflop = 1; |
| 487 | snd_als300_gcr_write(chip->port, reg, tmp | TRANSFER_START); |
| 488 | snd_als300_dbgplay("TRIGGER START\n"); |
| 489 | break; |
| 490 | case SNDRV_PCM_TRIGGER_STOP: |
| 491 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| 492 | tmp = snd_als300_gcr_read(chip->port, reg); |
| 493 | snd_als300_gcr_write(chip->port, reg, tmp & ~TRANSFER_START); |
| 494 | snd_als300_dbgplay("TRIGGER STOP\n"); |
| 495 | break; |
| 496 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
| 497 | tmp = snd_als300_gcr_read(chip->port, reg); |
| 498 | snd_als300_gcr_write(chip->port, reg, tmp | FIFO_PAUSE); |
| 499 | snd_als300_dbgplay("TRIGGER PAUSE\n"); |
| 500 | break; |
| 501 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
| 502 | tmp = snd_als300_gcr_read(chip->port, reg); |
| 503 | snd_als300_gcr_write(chip->port, reg, tmp & ~FIFO_PAUSE); |
| 504 | snd_als300_dbgplay("TRIGGER RELEASE\n"); |
| 505 | break; |
| 506 | default: |
| 507 | snd_als300_dbgplay("TRIGGER INVALID\n"); |
| 508 | ret = -EINVAL; |
| 509 | } |
| 510 | spin_unlock(&chip->reg_lock); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 511 | return ret; |
| 512 | } |
| 513 | |
| 514 | static snd_pcm_uframes_t snd_als300_pointer(struct snd_pcm_substream *substream) |
| 515 | { |
| 516 | u16 current_ptr; |
| 517 | struct snd_als300 *chip = snd_pcm_substream_chip(substream); |
| 518 | struct snd_als300_substream_data *data; |
| 519 | unsigned short period_bytes; |
| 520 | |
| 521 | data = substream->runtime->private_data; |
| 522 | period_bytes = snd_pcm_lib_period_bytes(substream); |
| 523 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 524 | spin_lock(&chip->reg_lock); |
| 525 | current_ptr = (u16) snd_als300_gcr_read(chip->port, |
| 526 | data->block_counter_register) + 4; |
| 527 | spin_unlock(&chip->reg_lock); |
| 528 | if (current_ptr > period_bytes) |
| 529 | current_ptr = 0; |
| 530 | else |
| 531 | current_ptr = period_bytes - current_ptr; |
| 532 | |
| 533 | if (data->period_flipflop == 0) |
| 534 | current_ptr += period_bytes; |
| 535 | snd_als300_dbgplay("Pointer (bytes): %d\n", current_ptr); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 536 | return bytes_to_frames(substream->runtime, current_ptr); |
| 537 | } |
| 538 | |
Julia Lawall | 6769e988 | 2016-09-02 00:13:10 +0200 | [diff] [blame] | 539 | static const struct snd_pcm_ops snd_als300_playback_ops = { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 540 | .open = snd_als300_playback_open, |
| 541 | .close = snd_als300_playback_close, |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 542 | .prepare = snd_als300_playback_prepare, |
| 543 | .trigger = snd_als300_trigger, |
| 544 | .pointer = snd_als300_pointer, |
| 545 | }; |
| 546 | |
Julia Lawall | 6769e988 | 2016-09-02 00:13:10 +0200 | [diff] [blame] | 547 | static const struct snd_pcm_ops snd_als300_capture_ops = { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 548 | .open = snd_als300_capture_open, |
| 549 | .close = snd_als300_capture_close, |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 550 | .prepare = snd_als300_capture_prepare, |
| 551 | .trigger = snd_als300_trigger, |
| 552 | .pointer = snd_als300_pointer, |
| 553 | }; |
| 554 | |
Bill Pemberton | e23e7a1 | 2012-12-06 12:35:10 -0500 | [diff] [blame] | 555 | static int snd_als300_new_pcm(struct snd_als300 *chip) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 556 | { |
| 557 | struct snd_pcm *pcm; |
| 558 | int err; |
| 559 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 560 | err = snd_pcm_new(chip->card, "ALS300", 0, 1, 1, &pcm); |
| 561 | if (err < 0) |
| 562 | return err; |
| 563 | pcm->private_data = chip; |
| 564 | strcpy(pcm->name, "ALS300"); |
| 565 | chip->pcm = pcm; |
| 566 | |
| 567 | /* set operators */ |
| 568 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
| 569 | &snd_als300_playback_ops); |
| 570 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
| 571 | &snd_als300_capture_ops); |
| 572 | |
| 573 | /* pre-allocation of buffers */ |
Takashi Iwai | 909c7d2 | 2019-12-09 10:48:53 +0100 | [diff] [blame] | 574 | snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
| 575 | 64*1024, 64*1024); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 576 | return 0; |
| 577 | } |
| 578 | |
| 579 | static void snd_als300_init(struct snd_als300 *chip) |
| 580 | { |
| 581 | unsigned long flags; |
| 582 | u32 tmp; |
| 583 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 584 | spin_lock_irqsave(&chip->reg_lock, flags); |
| 585 | chip->revision = (snd_als300_gcr_read(chip->port, MISC_CONTROL) >> 16) |
| 586 | & 0x0000000F; |
| 587 | /* Setup DRAM */ |
| 588 | tmp = snd_als300_gcr_read(chip->port, DRAM_WRITE_CONTROL); |
| 589 | snd_als300_gcr_write(chip->port, DRAM_WRITE_CONTROL, |
| 590 | (tmp | DRAM_MODE_2) |
| 591 | & ~WRITE_TRANS_START); |
| 592 | |
| 593 | /* Enable IRQ output */ |
| 594 | snd_als300_set_irq_flag(chip, IRQ_ENABLE); |
| 595 | |
| 596 | /* Unmute hardware devices so their outputs get routed to |
| 597 | * the onboard mixer */ |
| 598 | tmp = snd_als300_gcr_read(chip->port, MISC_CONTROL); |
| 599 | snd_als300_gcr_write(chip->port, MISC_CONTROL, |
| 600 | tmp | VMUTE_NORMAL | MMUTE_NORMAL); |
| 601 | |
| 602 | /* Reset volumes */ |
| 603 | snd_als300_gcr_write(chip->port, MUS_VOC_VOL, 0); |
| 604 | |
| 605 | /* Make sure playback transfer is stopped */ |
| 606 | tmp = snd_als300_gcr_read(chip->port, PLAYBACK_CONTROL); |
| 607 | snd_als300_gcr_write(chip->port, PLAYBACK_CONTROL, |
| 608 | tmp & ~TRANSFER_START); |
| 609 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 610 | } |
| 611 | |
Bill Pemberton | e23e7a1 | 2012-12-06 12:35:10 -0500 | [diff] [blame] | 612 | static int snd_als300_create(struct snd_card *card, |
| 613 | struct pci_dev *pci, int chip_type, |
| 614 | struct snd_als300 **rchip) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 615 | { |
| 616 | struct snd_als300 *chip; |
| 617 | void *irq_handler; |
| 618 | int err; |
| 619 | |
Takashi Iwai | efb0ad2 | 2020-01-03 09:16:25 +0100 | [diff] [blame] | 620 | static const struct snd_device_ops ops = { |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 621 | .dev_free = snd_als300_dev_free, |
| 622 | }; |
| 623 | *rchip = NULL; |
| 624 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 625 | if ((err = pci_enable_device(pci)) < 0) |
| 626 | return err; |
| 627 | |
Quentin Lambert | 412b979 | 2015-04-15 16:10:17 +0200 | [diff] [blame] | 628 | if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 || |
| 629 | dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) { |
Takashi Iwai | c778f7e | 2014-02-25 12:48:27 +0100 | [diff] [blame] | 630 | dev_err(card->dev, "error setting 28bit DMA mask\n"); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 631 | pci_disable_device(pci); |
| 632 | return -ENXIO; |
| 633 | } |
| 634 | pci_set_master(pci); |
| 635 | |
| 636 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
| 637 | if (chip == NULL) { |
| 638 | pci_disable_device(pci); |
| 639 | return -ENOMEM; |
| 640 | } |
| 641 | |
| 642 | chip->card = card; |
| 643 | chip->pci = pci; |
| 644 | chip->irq = -1; |
| 645 | chip->chip_type = chip_type; |
| 646 | spin_lock_init(&chip->reg_lock); |
| 647 | |
| 648 | if ((err = pci_request_regions(pci, "ALS300")) < 0) { |
| 649 | kfree(chip); |
| 650 | pci_disable_device(pci); |
| 651 | return err; |
| 652 | } |
| 653 | chip->port = pci_resource_start(pci, 0); |
| 654 | |
| 655 | if (chip->chip_type == DEVICE_ALS300_PLUS) |
| 656 | irq_handler = snd_als300plus_interrupt; |
| 657 | else |
| 658 | irq_handler = snd_als300_interrupt; |
| 659 | |
Takashi Iwai | 437a5a4 | 2006-11-21 12:14:23 +0100 | [diff] [blame] | 660 | if (request_irq(pci->irq, irq_handler, IRQF_SHARED, |
Takashi Iwai | 934c2b6 | 2011-06-10 16:36:37 +0200 | [diff] [blame] | 661 | KBUILD_MODNAME, chip)) { |
Takashi Iwai | c778f7e | 2014-02-25 12:48:27 +0100 | [diff] [blame] | 662 | dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 663 | snd_als300_free(chip); |
| 664 | return -EBUSY; |
| 665 | } |
| 666 | chip->irq = pci->irq; |
Takashi Iwai | ea2eab5 | 2019-12-10 07:34:02 +0100 | [diff] [blame] | 667 | card->sync_irq = chip->irq; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 668 | |
| 669 | snd_als300_init(chip); |
| 670 | |
Ash Willis | 65ff235 | 2007-05-29 14:34:17 +0200 | [diff] [blame] | 671 | err = snd_als300_ac97(chip); |
| 672 | if (err < 0) { |
Takashi Iwai | c778f7e | 2014-02-25 12:48:27 +0100 | [diff] [blame] | 673 | dev_err(card->dev, "Could not create ac97\n"); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 674 | snd_als300_free(chip); |
| 675 | return err; |
| 676 | } |
| 677 | |
| 678 | if ((err = snd_als300_new_pcm(chip)) < 0) { |
Takashi Iwai | c778f7e | 2014-02-25 12:48:27 +0100 | [diff] [blame] | 679 | dev_err(card->dev, "Could not create PCM\n"); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 680 | snd_als300_free(chip); |
| 681 | return err; |
| 682 | } |
| 683 | |
| 684 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, |
| 685 | chip, &ops)) < 0) { |
| 686 | snd_als300_free(chip); |
| 687 | return err; |
| 688 | } |
| 689 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 690 | *rchip = chip; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 691 | return 0; |
| 692 | } |
| 693 | |
Takashi Iwai | c7561cd | 2012-08-14 18:12:04 +0200 | [diff] [blame] | 694 | #ifdef CONFIG_PM_SLEEP |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 695 | static int snd_als300_suspend(struct device *dev) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 696 | { |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 697 | struct snd_card *card = dev_get_drvdata(dev); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 698 | struct snd_als300 *chip = card->private_data; |
| 699 | |
| 700 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 701 | snd_ac97_suspend(chip->ac97); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 702 | return 0; |
| 703 | } |
| 704 | |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 705 | static int snd_als300_resume(struct device *dev) |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 706 | { |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 707 | struct snd_card *card = dev_get_drvdata(dev); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 708 | struct snd_als300 *chip = card->private_data; |
| 709 | |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 710 | snd_als300_init(chip); |
| 711 | snd_ac97_resume(chip->ac97); |
| 712 | |
| 713 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
| 714 | return 0; |
| 715 | } |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 716 | |
| 717 | static SIMPLE_DEV_PM_OPS(snd_als300_pm, snd_als300_suspend, snd_als300_resume); |
| 718 | #define SND_ALS300_PM_OPS &snd_als300_pm |
| 719 | #else |
| 720 | #define SND_ALS300_PM_OPS NULL |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 721 | #endif |
| 722 | |
Bill Pemberton | e23e7a1 | 2012-12-06 12:35:10 -0500 | [diff] [blame] | 723 | static int snd_als300_probe(struct pci_dev *pci, |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 724 | const struct pci_device_id *pci_id) |
| 725 | { |
| 726 | static int dev; |
| 727 | struct snd_card *card; |
| 728 | struct snd_als300 *chip; |
| 729 | int err, chip_type; |
| 730 | |
| 731 | if (dev >= SNDRV_CARDS) |
| 732 | return -ENODEV; |
| 733 | if (!enable[dev]) { |
| 734 | dev++; |
| 735 | return -ENOENT; |
| 736 | } |
| 737 | |
Takashi Iwai | 60c5772 | 2014-01-29 14:20:19 +0100 | [diff] [blame] | 738 | err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, |
| 739 | 0, &card); |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 740 | |
Takashi Iwai | e58de7b | 2008-12-28 16:44:30 +0100 | [diff] [blame] | 741 | if (err < 0) |
| 742 | return err; |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 743 | |
| 744 | chip_type = pci_id->driver_data; |
| 745 | |
| 746 | if ((err = snd_als300_create(card, pci, chip_type, &chip)) < 0) { |
| 747 | snd_card_free(card); |
| 748 | return err; |
| 749 | } |
| 750 | card->private_data = chip; |
| 751 | |
| 752 | strcpy(card->driver, "ALS300"); |
| 753 | if (chip->chip_type == DEVICE_ALS300_PLUS) |
| 754 | /* don't know much about ALS300+ yet |
| 755 | * print revision number for now */ |
| 756 | sprintf(card->shortname, "ALS300+ (Rev. %d)", chip->revision); |
| 757 | else |
| 758 | sprintf(card->shortname, "ALS300 (Rev. %c)", 'A' + |
| 759 | chip->revision - 1); |
| 760 | sprintf(card->longname, "%s at 0x%lx irq %i", |
| 761 | card->shortname, chip->port, chip->irq); |
| 762 | |
| 763 | if ((err = snd_card_register(card)) < 0) { |
| 764 | snd_card_free(card); |
| 765 | return err; |
| 766 | } |
| 767 | pci_set_drvdata(pci, card); |
| 768 | dev++; |
| 769 | return 0; |
| 770 | } |
| 771 | |
Takashi Iwai | e9f66d9 | 2012-04-24 12:25:00 +0200 | [diff] [blame] | 772 | static struct pci_driver als300_driver = { |
Takashi Iwai | 3733e42 | 2011-06-10 16:20:20 +0200 | [diff] [blame] | 773 | .name = KBUILD_MODNAME, |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 774 | .id_table = snd_als300_ids, |
| 775 | .probe = snd_als300_probe, |
Bill Pemberton | e23e7a1 | 2012-12-06 12:35:10 -0500 | [diff] [blame] | 776 | .remove = snd_als300_remove, |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 777 | .driver = { |
| 778 | .pm = SND_ALS300_PM_OPS, |
| 779 | }, |
Ash Willis | b3a70d5 | 2006-03-27 13:20:40 +0200 | [diff] [blame] | 780 | }; |
| 781 | |
Takashi Iwai | e9f66d9 | 2012-04-24 12:25:00 +0200 | [diff] [blame] | 782 | module_pci_driver(als300_driver); |