aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/mixart/mixart_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/mixart/mixart_core.c')
-rw-r--r--sound/pci/mixart/mixart_core.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index ba0027f50944..07c707d7ebbf 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -44,7 +44,7 @@
44#define MSG_CANCEL_NOTIFY_MASK 0x80000000 /* this bit is set for a notification that has been canceled */ 44#define MSG_CANCEL_NOTIFY_MASK 0x80000000 /* this bit is set for a notification that has been canceled */
45 45
46 46
47static int retrieve_msg_frame(mixart_mgr_t *mgr, u32 *msg_frame) 47static int retrieve_msg_frame(struct mixart_mgr *mgr, u32 *msg_frame)
48{ 48{
49 /* read the message frame fifo */ 49 /* read the message frame fifo */
50 u32 headptr, tailptr; 50 u32 headptr, tailptr;
@@ -69,7 +69,8 @@ static int retrieve_msg_frame(mixart_mgr_t *mgr, u32 *msg_frame)
69 return 1; 69 return 1;
70} 70}
71 71
72static int get_msg(mixart_mgr_t *mgr, mixart_msg_t *resp, u32 msg_frame_address ) 72static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
73 u32 msg_frame_address )
73{ 74{
74 unsigned long flags; 75 unsigned long flags;
75 u32 headptr; 76 u32 headptr;
@@ -137,8 +138,8 @@ static int get_msg(mixart_mgr_t *mgr, mixart_msg_t *resp, u32 msg_frame_address
137 * send a message to miXart. return: the msg_frame used for this message 138 * send a message to miXart. return: the msg_frame used for this message
138 */ 139 */
139/* call with mgr->msg_lock held! */ 140/* call with mgr->msg_lock held! */
140static int send_msg( mixart_mgr_t *mgr, 141static int send_msg( struct mixart_mgr *mgr,
141 mixart_msg_t *msg, 142 struct mixart_msg *msg,
142 int max_answersize, 143 int max_answersize,
143 int mark_pending, 144 int mark_pending,
144 u32 *msg_event) 145 u32 *msg_event)
@@ -230,9 +231,9 @@ static int send_msg( mixart_mgr_t *mgr,
230} 231}
231 232
232 233
233int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_size, void *resp_data) 234int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int max_resp_size, void *resp_data)
234{ 235{
235 mixart_msg_t resp; 236 struct mixart_msg resp;
236 u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */ 237 u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */
237 int err; 238 int err;
238 wait_queue_t wait; 239 wait_queue_t wait;
@@ -264,9 +265,9 @@ int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_s
264 return -EIO; 265 return -EIO;
265 } 266 }
266 267
267 /* retrieve the answer into the same mixart_msg_t */ 268 /* retrieve the answer into the same struct mixart_msg */
268 resp.message_id = 0; 269 resp.message_id = 0;
269 resp.uid = (mixart_uid_t){0,0}; 270 resp.uid = (struct mixart_uid){0,0};
270 resp.data = resp_data; 271 resp.data = resp_data;
271 resp.size = max_resp_size; 272 resp.size = max_resp_size;
272 273
@@ -280,7 +281,8 @@ int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_s
280} 281}
281 282
282 283
283int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32 notif_event) 284int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
285 struct mixart_msg *request, u32 notif_event)
284{ 286{
285 int err; 287 int err;
286 wait_queue_t wait; 288 wait_queue_t wait;
@@ -321,7 +323,7 @@ int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32
321} 323}
322 324
323 325
324int snd_mixart_send_msg_nonblock(mixart_mgr_t *mgr, mixart_msg_t *request) 326int snd_mixart_send_msg_nonblock(struct mixart_mgr *mgr, struct mixart_msg *request)
325{ 327{
326 u32 message_frame; 328 u32 message_frame;
327 unsigned long flags; 329 unsigned long flags;
@@ -332,7 +334,7 @@ int snd_mixart_send_msg_nonblock(mixart_mgr_t *mgr, mixart_msg_t *request)
332 err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 0, &message_frame); 334 err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 0, &message_frame);
333 spin_unlock_irqrestore(&mgr->msg_lock, flags); 335 spin_unlock_irqrestore(&mgr->msg_lock, flags);
334 336
335 /* the answer will be handled by snd_mixart_msg_tasklet() */ 337 /* the answer will be handled by snd_struct mixart_msgasklet() */
336 atomic_inc(&mgr->msg_processed); 338 atomic_inc(&mgr->msg_processed);
337 339
338 return err; 340 return err;
@@ -343,10 +345,10 @@ int snd_mixart_send_msg_nonblock(mixart_mgr_t *mgr, mixart_msg_t *request)
343static u32 mixart_msg_data[MSG_DEFAULT_SIZE / 4]; 345static u32 mixart_msg_data[MSG_DEFAULT_SIZE / 4];
344 346
345 347
346void snd_mixart_msg_tasklet( unsigned long arg) 348void snd_mixart_msg_tasklet(unsigned long arg)
347{ 349{
348 mixart_mgr_t *mgr = ( mixart_mgr_t*)(arg); 350 struct mixart_mgr *mgr = ( struct mixart_mgr*)(arg);
349 mixart_msg_t resp; 351 struct mixart_msg resp;
350 u32 msg, addr, type; 352 u32 msg, addr, type;
351 int err; 353 int err;
352 354
@@ -406,9 +408,9 @@ void snd_mixart_msg_tasklet( unsigned long arg)
406 408
407irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs) 409irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
408{ 410{
409 mixart_mgr_t *mgr = dev_id; 411 struct mixart_mgr *mgr = dev_id;
410 int err; 412 int err;
411 mixart_msg_t resp; 413 struct mixart_msg resp;
412 414
413 u32 msg; 415 u32 msg;
414 u32 it_reg; 416 u32 it_reg;
@@ -448,7 +450,8 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
448 450
449 if(resp.message_id == MSG_SERVICES_TIMER_NOTIFY) { 451 if(resp.message_id == MSG_SERVICES_TIMER_NOTIFY) {
450 int i; 452 int i;
451 mixart_timer_notify_t *notify = (mixart_timer_notify_t*)mixart_msg_data; 453 struct mixart_timer_notify *notify;
454 notify = (struct mixart_timer_notify *)mixart_msg_data;
452 455
453 for(i=0; i<notify->stream_count; i++) { 456 for(i=0; i<notify->stream_count; i++) {
454 457
@@ -458,8 +461,8 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
458 unsigned int sub_number = buffer_id & MIXART_NOTIFY_SUBS_MASK; /* 0 to MIXART_PLAYBACK_STREAMS */ 461 unsigned int sub_number = buffer_id & MIXART_NOTIFY_SUBS_MASK; /* 0 to MIXART_PLAYBACK_STREAMS */
459 unsigned int is_capture = ((buffer_id & MIXART_NOTIFY_CAPT_MASK) != 0); /* playback == 0 / capture == 1 */ 462 unsigned int is_capture = ((buffer_id & MIXART_NOTIFY_CAPT_MASK) != 0); /* playback == 0 / capture == 1 */
460 463
461 mixart_t *chip = mgr->chip[chip_number]; 464 struct snd_mixart *chip = mgr->chip[chip_number];
462 mixart_stream_t *stream; 465 struct mixart_stream *stream;
463 466
464 if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) { 467 if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) {
465 snd_printk(KERN_ERR "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n", 468 snd_printk(KERN_ERR "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n",
@@ -473,7 +476,7 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
473 stream = &chip->playback_stream[pcm_number][sub_number]; 476 stream = &chip->playback_stream[pcm_number][sub_number];
474 477
475 if (stream->substream && (stream->status == MIXART_STREAM_STATUS_RUNNING)) { 478 if (stream->substream && (stream->status == MIXART_STREAM_STATUS_RUNNING)) {
476 snd_pcm_runtime_t *runtime = stream->substream->runtime; 479 struct snd_pcm_runtime *runtime = stream->substream->runtime;
477 int elapsed = 0; 480 int elapsed = 0;
478 u64 sample_count = ((u64)notify->streams[i].sample_pos_high_part) << 32; 481 u64 sample_count = ((u64)notify->streams[i].sample_pos_high_part) << 32;
479 sample_count |= notify->streams[i].sample_pos_low_part; 482 sample_count |= notify->streams[i].sample_pos_low_part;
@@ -561,7 +564,7 @@ irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
561} 564}
562 565
563 566
564void snd_mixart_init_mailbox(mixart_mgr_t *mgr) 567void snd_mixart_init_mailbox(struct mixart_mgr *mgr)
565{ 568{
566 writel( 0, MIXART_MEM( mgr, MSG_HOST_RSC_PROTECTION ) ); 569 writel( 0, MIXART_MEM( mgr, MSG_HOST_RSC_PROTECTION ) );
567 writel( 0, MIXART_MEM( mgr, MSG_AGENT_RSC_PROTECTION ) ); 570 writel( 0, MIXART_MEM( mgr, MSG_AGENT_RSC_PROTECTION ) );
@@ -573,14 +576,14 @@ void snd_mixart_init_mailbox(mixart_mgr_t *mgr)
573 return; 576 return;
574} 577}
575 578
576void snd_mixart_exit_mailbox(mixart_mgr_t *mgr) 579void snd_mixart_exit_mailbox(struct mixart_mgr *mgr)
577{ 580{
578 /* no more interrupts on outbound messagebox */ 581 /* no more interrupts on outbound messagebox */
579 writel_le( MIXART_HOST_ALL_INTERRUPT_MASKED, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET)); 582 writel_le( MIXART_HOST_ALL_INTERRUPT_MASKED, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET));
580 return; 583 return;
581} 584}
582 585
583void snd_mixart_reset_board(mixart_mgr_t *mgr) 586void snd_mixart_reset_board(struct mixart_mgr *mgr)
584{ 587{
585 /* reset miXart */ 588 /* reset miXart */
586 writel_be( 1, MIXART_REG(mgr, MIXART_BA1_BRUTAL_RESET_OFFSET) ); 589 writel_be( 1, MIXART_REG(mgr, MIXART_BA1_BRUTAL_RESET_OFFSET) );