aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/sb/sb8_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/sb/sb8_main.c')
-rw-r--r--sound/isa/sb/sb8_main.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c
index 28d8afdf6891..aea9e5ec7b36 100644
--- a/sound/isa/sb/sb8_main.c
+++ b/sound/isa/sb/sb8_main.c
@@ -46,19 +46,19 @@ MODULE_LICENSE("GPL");
46#define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v)) 46#define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v))
47#define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v)) 47#define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v))
48 48
49static ratnum_t clock = { 49static struct snd_ratnum clock = {
50 .num = SB8_CLOCK, 50 .num = SB8_CLOCK,
51 .den_min = 1, 51 .den_min = 1,
52 .den_max = 256, 52 .den_max = 256,
53 .den_step = 1, 53 .den_step = 1,
54}; 54};
55 55
56static snd_pcm_hw_constraint_ratnums_t hw_constraints_clock = { 56static struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = {
57 .nrats = 1, 57 .nrats = 1,
58 .rats = &clock, 58 .rats = &clock,
59}; 59};
60 60
61static ratnum_t stereo_clocks[] = { 61static struct snd_ratnum stereo_clocks[] = {
62 { 62 {
63 .num = SB8_CLOCK, 63 .num = SB8_CLOCK,
64 .den_min = SB8_DEN(22050), 64 .den_min = SB8_DEN(22050),
@@ -73,10 +73,10 @@ static ratnum_t stereo_clocks[] = {
73 } 73 }
74}; 74};
75 75
76static int snd_sb8_hw_constraint_rate_channels(snd_pcm_hw_params_t *params, 76static int snd_sb8_hw_constraint_rate_channels(struct snd_pcm_hw_params *params,
77 snd_pcm_hw_rule_t *rule) 77 struct snd_pcm_hw_rule *rule)
78{ 78{
79 snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 79 struct snd_interval *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
80 if (c->min > 1) { 80 if (c->min > 1) {
81 unsigned int num = 0, den = 0; 81 unsigned int num = 0, den = 0;
82 int err = snd_interval_ratnum(hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE), 82 int err = snd_interval_ratnum(hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE),
@@ -90,22 +90,22 @@ static int snd_sb8_hw_constraint_rate_channels(snd_pcm_hw_params_t *params,
90 return 0; 90 return 0;
91} 91}
92 92
93static int snd_sb8_hw_constraint_channels_rate(snd_pcm_hw_params_t *params, 93static int snd_sb8_hw_constraint_channels_rate(struct snd_pcm_hw_params *params,
94 snd_pcm_hw_rule_t *rule) 94 struct snd_pcm_hw_rule *rule)
95{ 95{
96 snd_interval_t *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); 96 struct snd_interval *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
97 if (r->min > SB8_RATE(22050) || r->max <= SB8_RATE(11025)) { 97 if (r->min > SB8_RATE(22050) || r->max <= SB8_RATE(11025)) {
98 snd_interval_t t = { .min = 1, .max = 1 }; 98 struct snd_interval t = { .min = 1, .max = 1 };
99 return snd_interval_refine(hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS), &t); 99 return snd_interval_refine(hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS), &t);
100 } 100 }
101 return 0; 101 return 0;
102} 102}
103 103
104static int snd_sb8_playback_prepare(snd_pcm_substream_t * substream) 104static int snd_sb8_playback_prepare(struct snd_pcm_substream *substream)
105{ 105{
106 unsigned long flags; 106 unsigned long flags;
107 sb_t *chip = snd_pcm_substream_chip(substream); 107 struct snd_sb *chip = snd_pcm_substream_chip(substream);
108 snd_pcm_runtime_t *runtime = substream->runtime; 108 struct snd_pcm_runtime *runtime = substream->runtime;
109 unsigned int mixreg, rate, size, count; 109 unsigned int mixreg, rate, size, count;
110 110
111 rate = runtime->rate; 111 rate = runtime->rate;
@@ -178,11 +178,11 @@ static int snd_sb8_playback_prepare(snd_pcm_substream_t * substream)
178 return 0; 178 return 0;
179} 179}
180 180
181static int snd_sb8_playback_trigger(snd_pcm_substream_t * substream, 181static int snd_sb8_playback_trigger(struct snd_pcm_substream *substream,
182 int cmd) 182 int cmd)
183{ 183{
184 unsigned long flags; 184 unsigned long flags;
185 sb_t *chip = snd_pcm_substream_chip(substream); 185 struct snd_sb *chip = snd_pcm_substream_chip(substream);
186 unsigned int count; 186 unsigned int count;
187 187
188 spin_lock_irqsave(&chip->reg_lock, flags); 188 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -197,7 +197,7 @@ static int snd_sb8_playback_trigger(snd_pcm_substream_t * substream,
197 break; 197 break;
198 case SNDRV_PCM_TRIGGER_STOP: 198 case SNDRV_PCM_TRIGGER_STOP:
199 if (chip->playback_format == SB_DSP_HI_OUTPUT_AUTO) { 199 if (chip->playback_format == SB_DSP_HI_OUTPUT_AUTO) {
200 snd_pcm_runtime_t *runtime = substream->runtime; 200 struct snd_pcm_runtime *runtime = substream->runtime;
201 snd_sbdsp_reset(chip); 201 snd_sbdsp_reset(chip);
202 if (runtime->channels > 1) { 202 if (runtime->channels > 1) {
203 spin_lock(&chip->mixer_lock); 203 spin_lock(&chip->mixer_lock);
@@ -215,23 +215,23 @@ static int snd_sb8_playback_trigger(snd_pcm_substream_t * substream,
215 return 0; 215 return 0;
216} 216}
217 217
218static int snd_sb8_hw_params(snd_pcm_substream_t * substream, 218static int snd_sb8_hw_params(struct snd_pcm_substream *substream,
219 snd_pcm_hw_params_t * hw_params) 219 struct snd_pcm_hw_params *hw_params)
220{ 220{
221 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 221 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
222} 222}
223 223
224static int snd_sb8_hw_free(snd_pcm_substream_t * substream) 224static int snd_sb8_hw_free(struct snd_pcm_substream *substream)
225{ 225{
226 snd_pcm_lib_free_pages(substream); 226 snd_pcm_lib_free_pages(substream);
227 return 0; 227 return 0;
228} 228}
229 229
230static int snd_sb8_capture_prepare(snd_pcm_substream_t * substream) 230static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream)
231{ 231{
232 unsigned long flags; 232 unsigned long flags;
233 sb_t *chip = snd_pcm_substream_chip(substream); 233 struct snd_sb *chip = snd_pcm_substream_chip(substream);
234 snd_pcm_runtime_t *runtime = substream->runtime; 234 struct snd_pcm_runtime *runtime = substream->runtime;
235 unsigned int mixreg, rate, size, count; 235 unsigned int mixreg, rate, size, count;
236 236
237 rate = runtime->rate; 237 rate = runtime->rate;
@@ -290,11 +290,11 @@ static int snd_sb8_capture_prepare(snd_pcm_substream_t * substream)
290 return 0; 290 return 0;
291} 291}
292 292
293static int snd_sb8_capture_trigger(snd_pcm_substream_t * substream, 293static int snd_sb8_capture_trigger(struct snd_pcm_substream *substream,
294 int cmd) 294 int cmd)
295{ 295{
296 unsigned long flags; 296 unsigned long flags;
297 sb_t *chip = snd_pcm_substream_chip(substream); 297 struct snd_sb *chip = snd_pcm_substream_chip(substream);
298 unsigned int count; 298 unsigned int count;
299 299
300 spin_lock_irqsave(&chip->reg_lock, flags); 300 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -309,7 +309,7 @@ static int snd_sb8_capture_trigger(snd_pcm_substream_t * substream,
309 break; 309 break;
310 case SNDRV_PCM_TRIGGER_STOP: 310 case SNDRV_PCM_TRIGGER_STOP:
311 if (chip->capture_format == SB_DSP_HI_INPUT_AUTO) { 311 if (chip->capture_format == SB_DSP_HI_INPUT_AUTO) {
312 snd_pcm_runtime_t *runtime = substream->runtime; 312 struct snd_pcm_runtime *runtime = substream->runtime;
313 snd_sbdsp_reset(chip); 313 snd_sbdsp_reset(chip);
314 if (runtime->channels > 1) { 314 if (runtime->channels > 1) {
315 /* restore input filter status */ 315 /* restore input filter status */
@@ -329,10 +329,10 @@ static int snd_sb8_capture_trigger(snd_pcm_substream_t * substream,
329 return 0; 329 return 0;
330} 330}
331 331
332irqreturn_t snd_sb8dsp_interrupt(sb_t *chip) 332irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip)
333{ 333{
334 snd_pcm_substream_t *substream; 334 struct snd_pcm_substream *substream;
335 snd_pcm_runtime_t *runtime; 335 struct snd_pcm_runtime *runtime;
336 336
337 snd_sb_ack_8bit(chip); 337 snd_sb_ack_8bit(chip);
338 switch (chip->mode) { 338 switch (chip->mode) {
@@ -354,9 +354,9 @@ irqreturn_t snd_sb8dsp_interrupt(sb_t *chip)
354 return IRQ_HANDLED; 354 return IRQ_HANDLED;
355} 355}
356 356
357static snd_pcm_uframes_t snd_sb8_playback_pointer(snd_pcm_substream_t * substream) 357static snd_pcm_uframes_t snd_sb8_playback_pointer(struct snd_pcm_substream *substream)
358{ 358{
359 sb_t *chip = snd_pcm_substream_chip(substream); 359 struct snd_sb *chip = snd_pcm_substream_chip(substream);
360 size_t ptr; 360 size_t ptr;
361 361
362 if (chip->mode != SB_MODE_PLAYBACK_8) 362 if (chip->mode != SB_MODE_PLAYBACK_8)
@@ -365,9 +365,9 @@ static snd_pcm_uframes_t snd_sb8_playback_pointer(snd_pcm_substream_t * substrea
365 return bytes_to_frames(substream->runtime, ptr); 365 return bytes_to_frames(substream->runtime, ptr);
366} 366}
367 367
368static snd_pcm_uframes_t snd_sb8_capture_pointer(snd_pcm_substream_t * substream) 368static snd_pcm_uframes_t snd_sb8_capture_pointer(struct snd_pcm_substream *substream)
369{ 369{
370 sb_t *chip = snd_pcm_substream_chip(substream); 370 struct snd_sb *chip = snd_pcm_substream_chip(substream);
371 size_t ptr; 371 size_t ptr;
372 372
373 if (chip->mode != SB_MODE_CAPTURE_8) 373 if (chip->mode != SB_MODE_CAPTURE_8)
@@ -380,7 +380,7 @@ static snd_pcm_uframes_t snd_sb8_capture_pointer(snd_pcm_substream_t * substream
380 380
381 */ 381 */
382 382
383static snd_pcm_hardware_t snd_sb8_playback = 383static struct snd_pcm_hardware snd_sb8_playback =
384{ 384{
385 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 385 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
386 SNDRV_PCM_INFO_MMAP_VALID), 386 SNDRV_PCM_INFO_MMAP_VALID),
@@ -399,7 +399,7 @@ static snd_pcm_hardware_t snd_sb8_playback =
399 .fifo_size = 0, 399 .fifo_size = 0,
400}; 400};
401 401
402static snd_pcm_hardware_t snd_sb8_capture = 402static struct snd_pcm_hardware snd_sb8_capture =
403{ 403{
404 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 404 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
405 SNDRV_PCM_INFO_MMAP_VALID), 405 SNDRV_PCM_INFO_MMAP_VALID),
@@ -422,10 +422,10 @@ static snd_pcm_hardware_t snd_sb8_capture =
422 * 422 *
423 */ 423 */
424 424
425static int snd_sb8_open(snd_pcm_substream_t *substream) 425static int snd_sb8_open(struct snd_pcm_substream *substream)
426{ 426{
427 sb_t *chip = snd_pcm_substream_chip(substream); 427 struct snd_sb *chip = snd_pcm_substream_chip(substream);
428 snd_pcm_runtime_t *runtime = substream->runtime; 428 struct snd_pcm_runtime *runtime = substream->runtime;
429 unsigned long flags; 429 unsigned long flags;
430 430
431 spin_lock_irqsave(&chip->open_lock, flags); 431 spin_lock_irqsave(&chip->open_lock, flags);
@@ -468,10 +468,10 @@ static int snd_sb8_open(snd_pcm_substream_t *substream)
468 return 0; 468 return 0;
469} 469}
470 470
471static int snd_sb8_close(snd_pcm_substream_t *substream) 471static int snd_sb8_close(struct snd_pcm_substream *substream)
472{ 472{
473 unsigned long flags; 473 unsigned long flags;
474 sb_t *chip = snd_pcm_substream_chip(substream); 474 struct snd_sb *chip = snd_pcm_substream_chip(substream);
475 475
476 chip->playback_substream = NULL; 476 chip->playback_substream = NULL;
477 chip->capture_substream = NULL; 477 chip->capture_substream = NULL;
@@ -485,7 +485,7 @@ static int snd_sb8_close(snd_pcm_substream_t *substream)
485 * Initialization part 485 * Initialization part
486 */ 486 */
487 487
488static snd_pcm_ops_t snd_sb8_playback_ops = { 488static struct snd_pcm_ops snd_sb8_playback_ops = {
489 .open = snd_sb8_open, 489 .open = snd_sb8_open,
490 .close = snd_sb8_close, 490 .close = snd_sb8_close,
491 .ioctl = snd_pcm_lib_ioctl, 491 .ioctl = snd_pcm_lib_ioctl,
@@ -496,7 +496,7 @@ static snd_pcm_ops_t snd_sb8_playback_ops = {
496 .pointer = snd_sb8_playback_pointer, 496 .pointer = snd_sb8_playback_pointer,
497}; 497};
498 498
499static snd_pcm_ops_t snd_sb8_capture_ops = { 499static struct snd_pcm_ops snd_sb8_capture_ops = {
500 .open = snd_sb8_open, 500 .open = snd_sb8_open,
501 .close = snd_sb8_close, 501 .close = snd_sb8_close,
502 .ioctl = snd_pcm_lib_ioctl, 502 .ioctl = snd_pcm_lib_ioctl,
@@ -507,10 +507,10 @@ static snd_pcm_ops_t snd_sb8_capture_ops = {
507 .pointer = snd_sb8_capture_pointer, 507 .pointer = snd_sb8_capture_pointer,
508}; 508};
509 509
510int snd_sb8dsp_pcm(sb_t *chip, int device, snd_pcm_t ** rpcm) 510int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm)
511{ 511{
512 snd_card_t *card = chip->card; 512 struct snd_card *card = chip->card;
513 snd_pcm_t *pcm; 513 struct snd_pcm *pcm;
514 int err; 514 int err;
515 515
516 if (rpcm) 516 if (rpcm)