1 /* 2 * Driver for Digigram miXart soundcards 3 * 4 * low level interface with interrupt handling and mail box implementation 5 * 6 * Copyright (c) 2003 by Digigram <alsa@digigram.com> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 #include <sound/driver.h> 24 #include <linux/interrupt.h> 25 #include <asm/io.h> 26 #include <sound/core.h> 27 #include "mixart.h" 28 #include "mixart_hwdep.h" 29 #include "mixart_core.h" 30 31 32 #define MSG_TIMEOUT_JIFFIES (400 * HZ) / 1000 /* 400 ms */ 33 34 #define MSG_DESCRIPTOR_SIZE 0x24 35 #define MSG_HEADER_SIZE (MSG_DESCRIPTOR_SIZE + 4) 36 37 #define MSG_DEFAULT_SIZE 512 38 39 #define MSG_TYPE_MASK 0x00000003 /* mask for following types */ 40 #define MSG_TYPE_NOTIFY 0 /* embedded -> driver (only notification, do not get_msg() !) */ 41 #define MSG_TYPE_COMMAND 1 /* driver <-> embedded (a command has no answer) */ 42 #define MSG_TYPE_REQUEST 2 /* driver -> embedded (request will get an answer back) */ 43 #define MSG_TYPE_ANSWER 3 /* embedded -> driver */ 44 #define MSG_CANCEL_NOTIFY_MASK 0x80000000 /* this bit is set for a notification that has been canceled */ 45 46 47 static int retrieve_msg_frame(mixart_mgr_t *mgr, u32 *msg_frame) 48 { 49 /* read the message frame fifo */ 50 u32 headptr, tailptr; 51 52 tailptr = readl_be(MIXART_MEM(mgr, MSG_OUTBOUND_POST_TAIL)); 53 headptr = readl_be(MIXART_MEM(mgr, MSG_OUTBOUND_POST_HEAD)); 54 55 if (tailptr == headptr) 56 return 0; /* no message posted */ 57 58 snd_assert( tailptr >= MSG_OUTBOUND_POST_STACK, return 0); /* error */ 59 snd_assert( tailptr < (MSG_OUTBOUND_POST_STACK+MSG_BOUND_STACK_SIZE), return 0); /* error */ 60 61 *msg_frame = readl_be(MIXART_MEM(mgr, tailptr)); 62 63 /* increment the tail index */ 64 tailptr += 4; 65 if( tailptr >= (MSG_OUTBOUND_POST_STACK+MSG_BOUND_STACK_SIZE) ) 66 tailptr = MSG_OUTBOUND_POST_STACK; 67 writel_be(tailptr, MIXART_MEM(mgr, MSG_OUTBOUND_POST_TAIL)); 68 69 return 1; 70 } 71 72 static int get_msg(mixart_mgr_t *mgr, mixart_msg_t *resp, u32 msg_frame_address ) 73 { 74 unsigned long flags; 75 u32 headptr; 76 u32 size; 77 int err; 78 #ifndef __BIG_ENDIAN 79 unsigned int i; 80 #endif 81 82 spin_lock_irqsave(&mgr->msg_lock, flags); 83 err = 0; 84 85 /* copy message descriptor from miXart to driver */ 86 size = readl_be(MIXART_MEM(mgr, msg_frame_address)); /* size of descriptor + response */ 87 resp->message_id = readl_be(MIXART_MEM(mgr, msg_frame_address + 4)); /* dwMessageID */ 88 resp->uid.object_id = readl_be(MIXART_MEM(mgr, msg_frame_address + 8)); /* uidDest */ 89 resp->uid.desc = readl_be(MIXART_MEM(mgr, msg_frame_address + 12)); /* */ 90 91 if( (size < MSG_DESCRIPTOR_SIZE) || (resp->size < (size - MSG_DESCRIPTOR_SIZE))) { 92 err = -EINVAL; 93 snd_printk(KERN_ERR "problem with response size = %d\n", size); 94 goto _clean_exit; 95 } 96 size -= MSG_DESCRIPTOR_SIZE; 97 98 memcpy_fromio(resp->data, MIXART_MEM(mgr, msg_frame_address + MSG_HEADER_SIZE ), size); 99 resp->size = size; 100 101 /* swap if necessary */ 102 #ifndef __BIG_ENDIAN 103 size /= 4; /* u32 size */ 104 for(i=0; i < size; i++) { 105 ((u32*)resp->data)[i] = be32_to_cpu(((u32*)resp->data)[i]); 106 } 107 #endif 108 109 /* 110 * free message frame address 111 */ 112 headptr = readl_be(MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD)); 113 114 if( (headptr < MSG_OUTBOUND_FREE_STACK) || ( headptr >= (MSG_OUTBOUND_FREE_STACK+MSG_BOUND_STACK_SIZE))) { 115 err = -EINVAL; 116 goto _clean_exit; 117 } 118 119 /* give address back to outbound fifo */ 120 writel_be(msg_frame_address, MIXART_MEM(mgr, headptr)); 121 122 /* increment the outbound free head */ 123 headptr += 4; 124 if( headptr >= (MSG_OUTBOUND_FREE_STACK+MSG_BOUND_STACK_SIZE) ) 125 headptr = MSG_OUTBOUND_FREE_STACK; 126 127 writel_be(headptr, MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD)); 128 129 _clean_exit: 130 spin_unlock_irqrestore(&mgr->msg_lock, flags); 131 132 return err; 133 } 134 135 136 /* 137 * send a message to miXart. return: the msg_frame used for this message 138 */ 139 /* call with mgr->msg_lock held! */ 140 static int send_msg( mixart_mgr_t *mgr, 141 mixart_msg_t *msg, 142 int max_answersize, 143 int mark_pending, 144 u32 *msg_event) 145 { 146 u32 headptr, tailptr; 147 u32 msg_frame_address; 148 int err, i; 149 150 snd_assert(msg->size % 4 == 0, return -EINVAL); 151 152 err = 0; 153 154 /* get message frame address */ 155 tailptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_TAIL)); 156 headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_FREE_HEAD)); 157 158 if (tailptr == headptr) { 159 snd_printk(KERN_ERR "error: no message frame available\n"); 160 return -EBUSY; 161 } 162 163 if( (tailptr < MSG_INBOUND_FREE_STACK) || (tailptr >= (MSG_INBOUND_FREE_STACK+MSG_BOUND_STACK_SIZE))) { 164 return -EINVAL; 165 } 166 167 msg_frame_address = readl_be(MIXART_MEM(mgr, tailptr)); 168 writel(0, MIXART_MEM(mgr, tailptr)); /* set address to zero on this fifo position */ 169 170 /* increment the inbound free tail */ 171 tailptr += 4; 172 if( tailptr >= (MSG_INBOUND_FREE_STACK+MSG_BOUND_STACK_SIZE) ) 173 tailptr = MSG_INBOUND_FREE_STACK; 174 175 writel_be(tailptr, MIXART_MEM(mgr, MSG_INBOUND_FREE_TAIL)); 176 177 /* TODO : use memcpy_toio() with intermediate buffer to copy the message */ 178 179 /* copy message descriptor to card memory */ 180 writel_be( msg->size + MSG_DESCRIPTOR_SIZE, MIXART_MEM(mgr, msg_frame_address) ); /* size of descriptor + request */ 181 writel_be( msg->message_id , MIXART_MEM(mgr, msg_frame_address + 4) ); /* dwMessageID */ 182 writel_be( msg->uid.object_id, MIXART_MEM(mgr, msg_frame_address + 8) ); /* uidDest */ 183 writel_be( msg->uid.desc, MIXART_MEM(mgr, msg_frame_address + 12) ); /* */ 184 writel_be( MSG_DESCRIPTOR_SIZE, MIXART_MEM(mgr, msg_frame_address + 16) ); /* SizeHeader */ 185 writel_be( MSG_DESCRIPTOR_SIZE, MIXART_MEM(mgr, msg_frame_address + 20) ); /* OffsetDLL_T16 */ 186 writel_be( msg->size, MIXART_MEM(mgr, msg_frame_address + 24) ); /* SizeDLL_T16 */ 187 writel_be( MSG_DESCRIPTOR_SIZE, MIXART_MEM(mgr, msg_frame_address + 28) ); /* OffsetDLL_DRV */ 188 writel_be( 0, MIXART_MEM(mgr, msg_frame_address + 32) ); /* SizeDLL_DRV */ 189 writel_be( MSG_DESCRIPTOR_SIZE + max_answersize, MIXART_MEM(mgr, msg_frame_address + 36) ); /* dwExpectedAnswerSize */ 190 191 /* copy message data to card memory */ 192 for( i=0; i < msg->size; i+=4 ) { 193 writel_be( *(u32*)(msg->data + i), MIXART_MEM(mgr, MSG_HEADER_SIZE + msg_frame_address + i) ); 194 } 195 196 if( mark_pending ) { 197 if( *msg_event ) { 198 /* the pending event is the notification we wait for ! */ 199 mgr->pending_event = *msg_event; 200 } 201 else { 202 /* the pending event is the answer we wait for (same address than the request)! */ 203 mgr->pending_event = msg_frame_address; 204 205 /* copy address back to caller */ 206 *msg_event = msg_frame_address; 207 } 208 } 209 210 /* mark the frame as a request (will have an answer) */ 211 msg_frame_address |= MSG_TYPE_REQUEST; 212 213 /* post the frame */ 214 headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_POST_HEAD)); 215 216 if( (headptr < MSG_INBOUND_POST_STACK) || (headptr >= (MSG_INBOUND_POST_STACK+MSG_BOUND_STACK_SIZE))) { 217 return -EINVAL; 218 } 219 220 writel_be(msg_frame_address, MIXART_MEM(mgr, headptr)); 221 222 /* increment the inbound post head */ 223 headptr += 4; 224 if( headptr >= (MSG_INBOUND_POST_STACK+MSG_BOUND_STACK_SIZE) ) 225 headptr = MSG_INBOUND_POST_STACK; 226 227 writel_be(headptr, MIXART_MEM(mgr, MSG_INBOUND_POST_HEAD)); 228 229 return 0; 230 } 231 232 233 int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_size, void *resp_data) 234 { 235 mixart_msg_t resp; 236 u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */ 237 int err; 238 wait_queue_t wait; 239 long timeout; 240 241 down(&mgr->msg_mutex); 242 243 init_waitqueue_entry(&wait, current); 244 245 spin_lock_irq(&mgr->msg_lock); 246 /* send the message */ 247 err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */ 248 if (err) { 249 spin_unlock_irq(&mgr->msg_lock); 250 up(&mgr->msg_mutex); 251 return err; 252 } 253 254 set_current_state(TASK_UNINTERRUPTIBLE); 255 add_wait_queue(&mgr->msg_sleep, &wait); 256 spin_unlock_irq(&mgr->msg_lock); 257 timeout = schedule_timeout(MSG_TIMEOUT_JIFFIES); 258 remove_wait_queue(&mgr->msg_sleep, &wait); 259 260 if (! timeout) { 261 /* error - no ack */ 262 up(&mgr->msg_mutex); 263 snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame); 264 return -EIO; 265 } 266 267 /* retrieve the answer into the same mixart_msg_t */ 268 resp.message_id = 0; 269 resp.uid = (mixart_uid_t){0,0}; 270 resp.data = resp_data; 271 resp.size = max_resp_size; 272 273 err = get_msg(mgr, &resp, msg_frame); 274 275 if( request->message_id != resp.message_id ) 276 snd_printk(KERN_ERR "REPONSE ERROR!\n"); 277 278 up(&mgr->msg_mutex); 279 return err; 280 } 281 282 283 int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32 notif_event) 284 { 285 int err; 286 wait_queue_t wait; 287 long timeout; 288 289 snd_assert(notif_event != 0, return -EINVAL); 290 snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL); 291 snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL); 292 293 down(&mgr->msg_mutex); 294 295 init_waitqueue_entry(&wait, current); 296 297 spin_lock_irq(&mgr->msg_lock); 298 /* send the message */ 299 err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, ¬if_event); /* send and mark the notification event pending */ 300 if(err) { 301 spin_unlock_irq(&mgr->msg_lock); 302 up(&mgr->msg_mutex); 303 return err; 304 } 305 306 set_current_state(TASK_UNINTERRUPTIBLE); 307 add_wait_queue(&mgr->msg_sleep, &wait); 308 spin_unlock_irq(&mgr->msg_lock); 309 timeout = schedule_timeout(MSG_TIMEOUT_JIFFIES); 310 remove_wait_queue(&mgr->msg_sleep, &wait); 311 312 if (! timeout) { 313 /* error - no ack */ 314 up(&mgr->msg_mutex); 315 snd_printk(KERN_ERR "error: notification %x not received\n", notif_event); 316 return -EIO; 317 } 318 319 up(&mgr->msg_mutex); 320 return 0; 321 } 322 323 324 int snd_mixart_send_msg_nonblock(mixart_mgr_t *mgr, mixart_msg_t *request) 325 { 326 u32 message_frame; 327 unsigned long flags; 328 int err; 329 330 /* just send the message (do not mark it as a pending one) */ 331 spin_lock_irqsave(&mgr->msg_lock, flags); 332 err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 0, &message_frame); 333 spin_unlock_irqrestore(&mgr->msg_lock, flags); 334 335 /* the answer will be handled by snd_mixart_msg_tasklet() */ 336 atomic_inc(&mgr->msg_processed); 337 338 return err; 339 } 340 341 342 /* common buffer of tasklet and interrupt to send/receive messages */ 343 static u32 mixart_msg_data[MSG_DEFAULT_SIZE / 4]; 344 345 346 void snd_mixart_msg_tasklet( unsigned long arg) 347 { 348 mixart_mgr_t *mgr = ( mixart_mgr_t*)(arg); 349 mixart_msg_t resp; 350 u32 msg, addr, type; 351 int err; 352 353 spin_lock(&mgr->lock); 354 355 while (mgr->msg_fifo_readptr != mgr->msg_fifo_writeptr) { 356 msg = mgr->msg_fifo[mgr->msg_fifo_readptr]; 357 mgr->msg_fifo_readptr++; 358 mgr->msg_fifo_readptr %= MSG_FIFO_SIZE; 359 360 /* process the message ... */ 361 addr = msg & ~MSG_TYPE_MASK; 362 type = msg & MSG_TYPE_MASK; 363 364 switch (type) { 365 case MSG_TYPE_ANSWER: 366 /* answer to a message on that we did not wait for (send_msg_nonblock) */ 367 resp.message_id = 0; 368 resp.data = mixart_msg_data; 369 resp.size = sizeof(mixart_msg_data); 370 err = get_msg(mgr, &resp, addr); 371 if( err < 0 ) { 372 snd_printk(KERN_ERR "tasklet: error(%d) reading mf %x\n", err, msg); 373 break; 374 } 375 376 switch(resp.message_id) { 377 case MSG_STREAM_START_INPUT_STAGE_PACKET: 378 case MSG_STREAM_START_OUTPUT_STAGE_PACKET: 379 case MSG_STREAM_STOP_INPUT_STAGE_PACKET: 380 case MSG_STREAM_STOP_OUTPUT_STAGE_PACKET: 381 if(mixart_msg_data[0]) 382 snd_printk(KERN_ERR "tasklet : error MSG_STREAM_ST***_***PUT_STAGE_PACKET status=%x\n", mixart_msg_data[0]); 383 break; 384 default: 385 snd_printdd("tasklet received mf(%x) : msg_id(%x) uid(%x, %x) size(%zd)\n", 386 msg, resp.message_id, resp.uid.object_id, resp.uid.desc, resp.size); 387 break; 388 } 389 break; 390 case MSG_TYPE_NOTIFY: 391 /* msg contains no address ! do not get_msg() ! */ 392 case MSG_TYPE_COMMAND: 393 /* get_msg() necessary */ 394 default: 395 snd_printk(KERN_ERR "tasklet doesn't know what to do with message %x\n", msg); 396 } /* switch type */ 397 398 /* decrement counter */ 399 atomic_dec(&mgr->msg_processed); 400 401 } /* while there is a msg in fifo */ 402 403 spin_unlock(&mgr->lock); 404 } 405 406 407 irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs) 408 { 409 mixart_mgr_t *mgr = dev_id; 410 int err; 411 mixart_msg_t resp; 412 413 u32 msg; 414 u32 it_reg; 415 416 spin_lock(&mgr->lock); 417 418 it_reg = readl_le(MIXART_REG(mgr, MIXART_PCI_OMISR_OFFSET)); 419 if( !(it_reg & MIXART_OIDI) ) { 420 /* this device did not cause the interrupt */ 421 spin_unlock(&mgr->lock); 422 return IRQ_NONE; 423 } 424 425 /* mask all interrupts */ 426 writel_le(MIXART_HOST_ALL_INTERRUPT_MASKED, MIXART_REG(mgr, MIXART_PCI_OMIMR_OFFSET)); 427 428 /* outdoorbell register clear */ 429 it_reg = readl(MIXART_REG(mgr, MIXART_PCI_ODBR_OFFSET)); 430 writel(it_reg, MIXART_REG(mgr, MIXART_PCI_ODBR_OFFSET)); 431 432 /* clear interrupt */ 433 writel_le( MIXART_OIDI, MIXART_REG(mgr, MIXART_PCI_OMISR_OFFSET) ); 434 435 /* process interrupt */ 436 while (retrieve_msg_frame(mgr, &msg)) { 437 438 switch (msg & MSG_TYPE_MASK) { 439 case MSG_TYPE_COMMAND: 440 resp.message_id = 0; 441 resp.data = mixart_msg_data; 442 resp.size = sizeof(mixart_msg_data); 443 err = get_msg(mgr, &resp, msg & ~MSG_TYPE_MASK); 444 if( err < 0 ) { 445 snd_printk(KERN_ERR "interrupt: error(%d) reading mf %x\n", err, msg); 446 break; 447 } 448 449 if(resp.message_id == MSG_SERVICES_TIMER_NOTIFY) { 450 int i; 451 mixart_timer_notify_t *notify = (mixart_timer_notify_t*)mixart_msg_data; 452 453 for(i=0; i<notify->stream_count; i++) { 454 455 u32 buffer_id = notify->streams[i].buffer_id; 456 unsigned int chip_number = (buffer_id & MIXART_NOTIFY_CARD_MASK) >> MIXART_NOTIFY_CARD_OFFSET; /* card0 to 3 */ 457 unsigned int pcm_number = (buffer_id & MIXART_NOTIFY_PCM_MASK ) >> MIXART_NOTIFY_PCM_OFFSET; /* pcm0 to 3 */ 458 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 */ 460 461 mixart_t *chip = mgr->chip[chip_number]; 462 mixart_stream_t *stream; 463 464 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", 466 buffer_id, notify->streams[i].sample_pos_low_part); 467 break; 468 } 469 470 if (is_capture) 471 stream = &chip->capture_stream[pcm_number]; 472 else 473 stream = &chip->playback_stream[pcm_number][sub_number]; 474 475 if (stream->substream && (stream->status == MIXART_STREAM_STATUS_RUNNING)) { 476 snd_pcm_runtime_t *runtime = stream->substream->runtime; 477 int elapsed = 0; 478 u64 sample_count = ((u64)notify->streams[i].sample_pos_high_part) << 32; 479 sample_count |= notify->streams[i].sample_pos_low_part; 480 481 while (1) { 482 u64 new_elapse_pos = stream->abs_period_elapsed + runtime->period_size; 483 484 if (new_elapse_pos > sample_count) { 485 break; /* while */ 486 } 487 else { 488 elapsed = 1; 489 stream->buf_periods++; 490 if (stream->buf_periods >= runtime->periods) 491 stream->buf_periods = 0; 492 493 stream->abs_period_elapsed = new_elapse_pos; 494 } 495 } 496 stream->buf_period_frag = (u32)( sample_count - stream->abs_period_elapsed ); 497 498 if(elapsed) { 499 spin_unlock(&mgr->lock); 500 snd_pcm_period_elapsed(stream->substream); 501 spin_lock(&mgr->lock); 502 } 503 } 504 } 505 break; 506 } 507 if(resp.message_id == MSG_SERVICES_REPORT_TRACES) { 508 if(resp.size > 1) { 509 #ifndef __BIG_ENDIAN 510 /* Traces are text: the swapped msg_data has to be swapped back ! */ 511 int i; 512 for(i=0; i<(resp.size/4); i++) { 513 (mixart_msg_data)[i] = cpu_to_be32((mixart_msg_data)[i]); 514 } 515 #endif 516 ((char*)mixart_msg_data)[resp.size - 1] = 0; 517 snd_printdd("MIXART TRACE : %s\n", (char*)mixart_msg_data); 518 } 519 break; 520 } 521 522 snd_printdd("command %x not handled\n", resp.message_id); 523 break; 524 525 case MSG_TYPE_NOTIFY: 526 if(msg & MSG_CANCEL_NOTIFY_MASK) { 527 msg &= ~MSG_CANCEL_NOTIFY_MASK; 528 snd_printk(KERN_ERR "canceled notification %x !\n", msg); 529 } 530 /* no break, continue ! */ 531 case MSG_TYPE_ANSWER: 532 /* answer or notification to a message we are waiting for*/ 533 spin_lock(&mgr->msg_lock); 534 if( (msg & ~MSG_TYPE_MASK) == mgr->pending_event ) { 535 wake_up(&mgr->msg_sleep); 536 mgr->pending_event = 0; 537 } 538 /* answer to a message we did't want to wait for */ 539 else { 540 mgr->msg_fifo[mgr->msg_fifo_writeptr] = msg; 541 mgr->msg_fifo_writeptr++; 542 mgr->msg_fifo_writeptr %= MSG_FIFO_SIZE; 543 tasklet_hi_schedule(&mgr->msg_taskq); 544 } 545 spin_unlock(&mgr->msg_lock); 546 break; 547 case MSG_TYPE_REQUEST: 548 default: 549 snd_printdd("interrupt received request %x\n", msg); 550 /* TODO : are there things to do here ? */ 551 break; 552 } /* switch on msg type */ 553 } /* while there are msgs */ 554 555 /* allow interrupt again */ 556 writel_le( MIXART_ALLOW_OUTBOUND_DOORBELL, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET)); 557 558 spin_unlock(&mgr->lock); 559 560 return IRQ_HANDLED; 561 } 562 563 564 void snd_mixart_init_mailbox(mixart_mgr_t *mgr) 565 { 566 writel( 0, MIXART_MEM( mgr, MSG_HOST_RSC_PROTECTION ) ); 567 writel( 0, MIXART_MEM( mgr, MSG_AGENT_RSC_PROTECTION ) ); 568 569 /* allow outbound messagebox to generate interrupts */ 570 if(mgr->irq >= 0) { 571 writel_le( MIXART_ALLOW_OUTBOUND_DOORBELL, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET)); 572 } 573 return; 574 } 575 576 void snd_mixart_exit_mailbox(mixart_mgr_t *mgr) 577 { 578 /* no more interrupts on outbound messagebox */ 579 writel_le( MIXART_HOST_ALL_INTERRUPT_MASKED, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET)); 580 return; 581 } 582 583 void snd_mixart_reset_board(mixart_mgr_t *mgr) 584 { 585 /* reset miXart */ 586 writel_be( 1, MIXART_REG(mgr, MIXART_BA1_BRUTAL_RESET_OFFSET) ); 587 return; 588 } 589