2010-01-04 08:35:48 Sport, AC97, AD1980 equalizer problem
victor nikonov (BELARUS)
Message: 84170
Hi.
I have some problem on BF537 with AD1980.
We've add into driver of AD1980 code to use hardware equalizer(eq.diff attached), but have some corrupted result when we try to test it by eq_test.sh(attached) - sound like overrun load in low frequencies.
I've add mutex into sound/soc/blackfin/bf5xx-sport.c and sound/soc/blackfin/bf5xx-ac97.c(mutex.diff attached):
Index: bf5xx-sport.c
===================================================================
--- bf5xx-sport.c (revision 7056)
+++ bf5xx-sport.c (working copy)
@@ -42,6 +42,8 @@
/* delay between frame sync pulse and first data bit in multichannel mode */
#define FRAME_DELAY (1<<12)
+extern struct mutex cmd_mutex;
+
struct sport_device *sport_handle;
EXPORT_SYMBOL(sport_handle);
/* note: multichannel is in units of 8 channels,
@@ -358,6 +360,7 @@
sport->tx_run, sport->rx_run);
if (sport->tx_run)
return -EBUSY;
+ mutex_lock(&cmd_mutex);
if (sport->rx_run) {
BUG_ON(sport->dma_tx_desc == NULL);
BUG_ON(sport->curr_tx_desc != sport->dummy_tx_desc);
@@ -377,6 +380,7 @@
sport_start(sport);
}
sport->tx_run = 1;
+ mutex_unlock(&cmd_mutex);
return 0;
}
EXPORT_SYMBOL(sport_tx_start);
Index: bf5xx-ac97.c
===================================================================
--- bf5xx-ac97.c (revision 7056)
+++ bf5xx-ac97.c (working copy)
@@ -84,6 +84,8 @@
#endif
};
+DEFINE_MUTEX(cmd_mutex);
+
void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src,
size_t count, unsigned int chan_mask)
{
@@ -193,6 +195,7 @@
enqueue_cmd(ac97, (reg << 8), val); /* write */
enqueue_cmd(ac97, (reg << 8) | 0x8000, 0); /* read back */
} else {
+ mutex_lock(&cmd_mutex);
struct ac97_frame frame;
memset(&frame, 0, sizeof(struct ac97_frame));
frame.ac97_tag = TAG_VALID | TAG_CMD;
@@ -200,6 +203,7 @@
frame.ac97_data = val;
sport_send_and_recv(sport_handle, (unsigned char *)&frame, \
NULL, sizeof(struct ac97_frame));
+ mutex_unlock(&cmd_mutex);
}
}
to make sure that sport dma routine will not start in other thread when we call sport_send_and_recv() function.
Now I've got right sound and equalizer work properly. Is that solution ok or we have to use somthing else instead of mutex?
Best Regards
mutex.diff
QuoteReplyEditDelete
2010-01-04 08:41:13 Re: Sport, AC97, AD1980 equalizer problem
victor nikonov (BELARUS)
Message: 84171
I use uclinux kernel revision 7889.
eq_test.sh
eq.diff
QuoteReplyEditDelete
2010-01-04 10:49:42 Re: Sport, AC97, AD1980 equalizer problem
Robin Getz (UNITED STATES)
Message: 84173
Victor:
The EQ in the AD1980 is known to be pretty picky about the values put in the EQ. (i.e. it has stabily issues). Trying to do anything while the codec is playing is asking for problems.
-Robin
QuoteReplyEditDelete
2010-01-05 00:26:25 Re: Sport, AC97, AD1980 equalizer problem
Cliff Cai (CHINA)
Message: 84178
Victor,
Your patch looks fine to me,but we are not going to support ad1980 driver in trunk head now,So,you can apply it to 2009r1.
Cliff