git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
sound
/
pci
/
mixart
/
mixart_core.c
diff --git
a/sound/pci/mixart/mixart_core.c
b/sound/pci/mixart/mixart_core.c
index
1f588ee
..
406ac3a
100644
(file)
--- a/
sound/pci/mixart/mixart_core.c
+++ b/
sound/pci/mixart/mixart_core.c
@@
-22,6
+22,8
@@
#include <sound/driver.h>
#include <linux/interrupt.h>
#include <sound/driver.h>
#include <linux/interrupt.h>
+#include <linux/mutex.h>
+
#include <asm/io.h>
#include <sound/core.h>
#include "mixart.h"
#include <asm/io.h>
#include <sound/core.h>
#include "mixart.h"
@@
-44,7
+46,7
@@
#define MSG_CANCEL_NOTIFY_MASK 0x80000000 /* this bit is set for a notification that has been canceled */
#define MSG_CANCEL_NOTIFY_MASK 0x80000000 /* this bit is set for a notification that has been canceled */
-static int retrieve_msg_frame(
mixart_mgr_t
*mgr, u32 *msg_frame)
+static int retrieve_msg_frame(
struct mixart_mgr
*mgr, u32 *msg_frame)
{
/* read the message frame fifo */
u32 headptr, tailptr;
{
/* read the message frame fifo */
u32 headptr, tailptr;
@@
-69,12
+71,16
@@
static int retrieve_msg_frame(mixart_mgr_t *mgr, u32 *msg_frame)
return 1;
}
return 1;
}
-static int get_msg(mixart_mgr_t *mgr, mixart_msg_t *resp, u32 msg_frame_address )
+static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
+ u32 msg_frame_address )
{
unsigned long flags;
{
unsigned long flags;
- u32 headptr
, i
;
+ u32 headptr;
u32 size;
int err;
u32 size;
int err;
+#ifndef __BIG_ENDIAN
+ unsigned int i;
+#endif
spin_lock_irqsave(&mgr->msg_lock, flags);
err = 0;
spin_lock_irqsave(&mgr->msg_lock, flags);
err = 0;
@@
-92,7
+98,7
@@
static int get_msg(mixart_mgr_t *mgr, mixart_msg_t *resp, u32 msg_frame_address
}
size -= MSG_DESCRIPTOR_SIZE;
}
size -= MSG_DESCRIPTOR_SIZE;
- memcpy_fromio(resp->data,
(void *)
MIXART_MEM(mgr, msg_frame_address + MSG_HEADER_SIZE ), size);
+ memcpy_fromio(resp->data, MIXART_MEM(mgr, msg_frame_address + MSG_HEADER_SIZE ), size);
resp->size = size;
/* swap if necessary */
resp->size = size;
/* swap if necessary */
@@
-134,8
+140,8
@@
static int get_msg(mixart_mgr_t *mgr, mixart_msg_t *resp, u32 msg_frame_address
* send a message to miXart. return: the msg_frame used for this message
*/
/* call with mgr->msg_lock held! */
* send a message to miXart. return: the msg_frame used for this message
*/
/* call with mgr->msg_lock held! */
-static int send_msg(
mixart_mgr_t
*mgr,
-
mixart_msg_t
*msg,
+static int send_msg(
struct mixart_mgr
*mgr,
+
struct mixart_msg
*msg,
int max_answersize,
int mark_pending,
u32 *msg_event)
int max_answersize,
int mark_pending,
u32 *msg_event)
@@
-227,15
+233,15
@@
static int send_msg( mixart_mgr_t *mgr,
}
}
-int snd_mixart_send_msg(
mixart_mgr_t *mgr, mixart_msg_t
*request, int max_resp_size, void *resp_data)
+int snd_mixart_send_msg(
struct mixart_mgr *mgr, struct mixart_msg
*request, int max_resp_size, void *resp_data)
{
{
-
mixart_msg_t
resp;
+
struct mixart_msg
resp;
u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */
int err;
wait_queue_t wait;
long timeout;
u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */
int err;
wait_queue_t wait;
long timeout;
-
down
(&mgr->msg_mutex);
+
mutex_lock
(&mgr->msg_mutex);
init_waitqueue_entry(&wait, current);
init_waitqueue_entry(&wait, current);
@@
-244,7
+250,7
@@
int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_s
err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */
if (err) {
spin_unlock_irq(&mgr->msg_lock);
err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */
if (err) {
spin_unlock_irq(&mgr->msg_lock);
-
up
(&mgr->msg_mutex);
+
mutex_unlock
(&mgr->msg_mutex);
return err;
}
return err;
}
@@
-256,14
+262,14
@@
int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_s
if (! timeout) {
/* error - no ack */
if (! timeout) {
/* error - no ack */
-
up
(&mgr->msg_mutex);
+
mutex_unlock
(&mgr->msg_mutex);
snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame);
return -EIO;
}
snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame);
return -EIO;
}
- /* retrieve the answer into the same
mixart_msg_t
*/
+ /* retrieve the answer into the same
struct mixart_msg
*/
resp.message_id = 0;
resp.message_id = 0;
- resp.uid = (
mixart_uid_t
){0,0};
+ resp.uid = (
struct mixart_uid
){0,0};
resp.data = resp_data;
resp.size = max_resp_size;
resp.data = resp_data;
resp.size = max_resp_size;
@@
-272,12
+278,13
@@
int snd_mixart_send_msg(mixart_mgr_t *mgr, mixart_msg_t *request, int max_resp_s
if( request->message_id != resp.message_id )
snd_printk(KERN_ERR "REPONSE ERROR!\n");
if( request->message_id != resp.message_id )
snd_printk(KERN_ERR "REPONSE ERROR!\n");
-
up
(&mgr->msg_mutex);
+
mutex_unlock
(&mgr->msg_mutex);
return err;
}
return err;
}
-int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32 notif_event)
+int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
+ struct mixart_msg *request, u32 notif_event)
{
int err;
wait_queue_t wait;
{
int err;
wait_queue_t wait;
@@
-287,7
+294,7
@@
int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32
snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL);
snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL);
snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL);
snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL);
-
down
(&mgr->msg_mutex);
+
mutex_lock
(&mgr->msg_mutex);
init_waitqueue_entry(&wait, current);
init_waitqueue_entry(&wait, current);
@@
-296,7
+303,7
@@
int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32
err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, ¬if_event); /* send and mark the notification event pending */
if(err) {
spin_unlock_irq(&mgr->msg_lock);
err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, ¬if_event); /* send and mark the notification event pending */
if(err) {
spin_unlock_irq(&mgr->msg_lock);
-
up
(&mgr->msg_mutex);
+
mutex_unlock
(&mgr->msg_mutex);
return err;
}
return err;
}
@@
-308,17
+315,17
@@
int snd_mixart_send_msg_wait_notif(mixart_mgr_t *mgr, mixart_msg_t *request, u32
if (! timeout) {
/* error - no ack */
if (! timeout) {
/* error - no ack */
-
up
(&mgr->msg_mutex);
+
mutex_unlock
(&mgr->msg_mutex);
snd_printk(KERN_ERR "error: notification %x not received\n", notif_event);
return -EIO;
}
snd_printk(KERN_ERR "error: notification %x not received\n", notif_event);
return -EIO;
}
-
up
(&mgr->msg_mutex);
+
mutex_unlock
(&mgr->msg_mutex);
return 0;
}
return 0;
}
-int snd_mixart_send_msg_nonblock(
mixart_mgr_t *mgr, mixart_msg_t
*request)
+int snd_mixart_send_msg_nonblock(
struct mixart_mgr *mgr, struct mixart_msg
*request)
{
u32 message_frame;
unsigned long flags;
{
u32 message_frame;
unsigned long flags;
@@
-329,7
+336,7
@@
int snd_mixart_send_msg_nonblock(mixart_mgr_t *mgr, mixart_msg_t *request)
err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 0, &message_frame);
spin_unlock_irqrestore(&mgr->msg_lock, flags);
err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 0, &message_frame);
spin_unlock_irqrestore(&mgr->msg_lock, flags);
- /* the answer will be handled by snd_
mixart_msg_t
asklet() */
+ /* the answer will be handled by snd_
struct mixart_msg
asklet() */
atomic_inc(&mgr->msg_processed);
return err;
atomic_inc(&mgr->msg_processed);
return err;
@@
-340,10
+347,10
@@
int snd_mixart_send_msg_nonblock(mixart_mgr_t *mgr, mixart_msg_t *request)
static u32 mixart_msg_data[MSG_DEFAULT_SIZE / 4];
static u32 mixart_msg_data[MSG_DEFAULT_SIZE / 4];
-void snd_mixart_msg_tasklet(
unsigned long arg)
+void snd_mixart_msg_tasklet(unsigned long arg)
{
{
-
mixart_mgr_t *mgr = ( mixart_mgr_t
*)(arg);
-
mixart_msg_t
resp;
+
struct mixart_mgr *mgr = ( struct mixart_mgr
*)(arg);
+
struct mixart_msg
resp;
u32 msg, addr, type;
int err;
u32 msg, addr, type;
int err;
@@
-403,9
+410,9
@@
void snd_mixart_msg_tasklet( unsigned long arg)
irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
-
mixart_mgr_t
*mgr = dev_id;
+
struct mixart_mgr
*mgr = dev_id;
int err;
int err;
-
mixart_msg_t
resp;
+
struct mixart_msg
resp;
u32 msg;
u32 it_reg;
u32 msg;
u32 it_reg;
@@
-445,7
+452,8
@@
irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if(resp.message_id == MSG_SERVICES_TIMER_NOTIFY) {
int i;
if(resp.message_id == MSG_SERVICES_TIMER_NOTIFY) {
int i;
- mixart_timer_notify_t *notify = (mixart_timer_notify_t*)mixart_msg_data;
+ struct mixart_timer_notify *notify;
+ notify = (struct mixart_timer_notify *)mixart_msg_data;
for(i=0; i<notify->stream_count; i++) {
for(i=0; i<notify->stream_count; i++) {
@@
-455,8
+463,8
@@
irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned int sub_number = buffer_id & MIXART_NOTIFY_SUBS_MASK; /* 0 to MIXART_PLAYBACK_STREAMS */
unsigned int is_capture = ((buffer_id & MIXART_NOTIFY_CAPT_MASK) != 0); /* playback == 0 / capture == 1 */
unsigned int sub_number = buffer_id & MIXART_NOTIFY_SUBS_MASK; /* 0 to MIXART_PLAYBACK_STREAMS */
unsigned int is_capture = ((buffer_id & MIXART_NOTIFY_CAPT_MASK) != 0); /* playback == 0 / capture == 1 */
-
mixart_
t *chip = mgr->chip[chip_number];
-
mixart_stream_t
*stream;
+
struct snd_mixar
t *chip = mgr->chip[chip_number];
+
struct mixart_stream
*stream;
if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) {
snd_printk(KERN_ERR "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n",
if ((chip_number >= mgr->num_cards) || (pcm_number >= MIXART_PCM_TOTAL) || (sub_number >= MIXART_PLAYBACK_STREAMS)) {
snd_printk(KERN_ERR "error MSG_SERVICES_TIMER_NOTIFY buffer_id (%x) pos(%d)\n",
@@
-470,7
+478,7
@@
irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
stream = &chip->playback_stream[pcm_number][sub_number];
if (stream->substream && (stream->status == MIXART_STREAM_STATUS_RUNNING)) {
stream = &chip->playback_stream[pcm_number][sub_number];
if (stream->substream && (stream->status == MIXART_STREAM_STATUS_RUNNING)) {
- s
nd_pcm_runtime_t
*runtime = stream->substream->runtime;
+ s
truct snd_pcm_runtime
*runtime = stream->substream->runtime;
int elapsed = 0;
u64 sample_count = ((u64)notify->streams[i].sample_pos_high_part) << 32;
sample_count |= notify->streams[i].sample_pos_low_part;
int elapsed = 0;
u64 sample_count = ((u64)notify->streams[i].sample_pos_high_part) << 32;
sample_count |= notify->streams[i].sample_pos_low_part;
@@
-558,7
+566,7
@@
irqreturn_t snd_mixart_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
}
-void snd_mixart_init_mailbox(
mixart_mgr_t
*mgr)
+void snd_mixart_init_mailbox(
struct mixart_mgr
*mgr)
{
writel( 0, MIXART_MEM( mgr, MSG_HOST_RSC_PROTECTION ) );
writel( 0, MIXART_MEM( mgr, MSG_AGENT_RSC_PROTECTION ) );
{
writel( 0, MIXART_MEM( mgr, MSG_HOST_RSC_PROTECTION ) );
writel( 0, MIXART_MEM( mgr, MSG_AGENT_RSC_PROTECTION ) );
@@
-570,14
+578,14
@@
void snd_mixart_init_mailbox(mixart_mgr_t *mgr)
return;
}
return;
}
-void snd_mixart_exit_mailbox(
mixart_mgr_t
*mgr)
+void snd_mixart_exit_mailbox(
struct mixart_mgr
*mgr)
{
/* no more interrupts on outbound messagebox */
writel_le( MIXART_HOST_ALL_INTERRUPT_MASKED, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET));
return;
}
{
/* no more interrupts on outbound messagebox */
writel_le( MIXART_HOST_ALL_INTERRUPT_MASKED, MIXART_REG( mgr, MIXART_PCI_OMIMR_OFFSET));
return;
}
-void snd_mixart_reset_board(
mixart_mgr_t
*mgr)
+void snd_mixart_reset_board(
struct mixart_mgr
*mgr)
{
/* reset miXart */
writel_be( 1, MIXART_REG(mgr, MIXART_BA1_BRUTAL_RESET_OFFSET) );
{
/* reset miXart */
writel_be( 1, MIXART_REG(mgr, MIXART_BA1_BRUTAL_RESET_OFFSET) );