* [PATCH] sparc dbri: hardware constrains added
@ 2006-08-22 17:52 Krzysztof Helt
2006-08-23 9:39 ` Takashi Iwai
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-22 17:52 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
From: Krzysztof Helt (krzysztof.h1@wp.pl)
This patch adds ALSA hardware constrains so stereo is possible
only with 16-bit format. It contains small cleanups to ring
buffered code as well.
Signed-off-by: Krzysztof Helt (krzysztof.h1@wp.pl)
----------------------------------------------------
Najlepsze siatkarki plażowe świata w Warszawie!
Międzynarodowy turniej GE Money Bank Warsaw Open 2006
Agrykola 30.08-03.09.2006 -> Wstęp wolny -> Szczegóły:
http://klik.wp.pl/?adr=www.warsaw-beachvolley.pl&sid=850
[-- Attachment #2: dbri-patch10.diff --]
[-- Type: application/octet-stream, Size: 5688 bytes --]
--- alsa-driver-1.0.12rc2/alsa-kernel/sparc/dbri.c 2006-08-21 20:02:32.000000000 +0200
+++ linux-2.6.17a/sound/sparc/dbri.c 2006-08-21 21:33:04.000000000 +0200
@@ -85,7 +85,7 @@ MODULE_PARM_DESC(id, "ID string for Sun
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard.");
-#define DBRI_DEBUG
+#undef DBRI_DEBUG
#define D_INT (1<<0)
#define D_GEN (1<<1)
@@ -160,7 +160,7 @@ static struct {
/* { NA, (1 << 4), (5 << 3) }, */
{ 48000, (1 << 4), (6 << 3) },
{ 9600, (1 << 4), (7 << 3) },
- { 5513, (2 << 4), (0 << 3) }, /* Actually 5512.5 */
+ { 5512, (2 << 4), (0 << 3) }, /* Actually 5512.5 */
{ 11025, (2 << 4), (1 << 3) },
{ 18900, (2 << 4), (2 << 3) },
{ 22050, (2 << 4), (3 << 3) },
@@ -628,8 +628,6 @@ to send them to the DBRI.
*/
-static void dbri_process_interrupt_buffer(struct snd_dbri * dbri);
-
#define MAXLOOPS 10
/*
* Wait for the current command string to execute
@@ -669,15 +667,15 @@ static s32 *dbri_cmdlock(struct snd_dbri
}
/*
- * Send prepared cmd string. It works by writting a JMP cmd into
+ * Send prepared cmd string. It works by writting a JUMP cmd into
* the last WAIT cmd and force DBRI to reread the cmd.
- * The JMP cmd points to the new cmd string.
+ * The JUMP cmd points to the new cmd string.
* It also releases the cmdlock spinlock.
*/
static void dbri_cmdsend(struct snd_dbri * dbri, s32 * cmd,int len)
{
- s32 *ptr;
s32 tmp, addr;
+ unsigned long flags;
static int wait_id = 0;
wait_id++;
@@ -692,13 +690,16 @@ static void dbri_cmdsend(struct snd_dbri
#ifdef DBRI_DEBUG
if (cmd > dbri->cmdptr )
+ s32 *ptr;
+
for (ptr = dbri->cmdptr; ptr < cmd+2; ptr++) {
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
}
else {
- ptr = dbri->cmdptr;
+ s32 *ptr = dbri->cmdptr;
+
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
- ptr = dbri->cmdptr+1;
+ ptr++;
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
for (ptr = dbri->dma->cmd; ptr < cmd+2; ptr++) {
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
@@ -706,10 +707,12 @@ static void dbri_cmdsend(struct snd_dbri
}
#endif
+ spin_lock_irqsave(&dbri->lock, flags);
/* Reread the last command */
tmp = sbus_readl(dbri->regs + REG0);
tmp |= D_P;
sbus_writel(tmp, dbri->regs + REG0);
+ spin_unlock_irqrestore(&dbri->lock, flags);
dbri->cmdptr = cmd;
spin_unlock(&dbri->cmdlock);
@@ -1549,8 +1552,7 @@ static int cs4215_prepare(struct snd_dbr
CS4215_BSEL_128 | CS4215_FREQ[freq_idx].xtal;
dbri->mm.channels = channels;
- /* Stereo bit: 8 bit stereo not working yet. */
- if ((channels > 1) && (dbri->mm.precision == 16))
+ if (channels == 2)
dbri->mm.ctrl[1] |= CS4215_DFR_STEREO;
ret = cs4215_setctrl(dbri);
@@ -1624,7 +1626,7 @@ interrupts are disabled.
/* xmit_descs()
*
- * Transmit the current TD's for recording/playing, if needed.
+ * Starts transmiting the current TD's for recording/playing.
* For playback, ALSA has filled the DMA memory with new data (we hope).
*/
static void xmit_descs(struct snd_dbri *dbri)
@@ -1699,9 +1701,9 @@ play:
* them as available. Stops when the first descriptor is found without
* TBC (Transmit Buffer Complete) set, or we've run through them all.
*
- * The DMA buffers are not released, but re-used. Since the transmit buffer
- * descriptors are not clobbered, they can be re-submitted as is. This is
- * done by the xmit_descs() tasklet above since that could take longer.
+ * The DMA buffers are not released. They form a ring buffer and
+ * they are filled by ALSA while others are transmitted by DMA.
+ *
*/
static void transmission_complete_intr(struct snd_dbri * dbri, int pipe)
@@ -1944,8 +1946,8 @@ static struct snd_pcm_hardware snd_dbri_
SNDRV_PCM_FMTBIT_A_LAW |
SNDRV_PCM_FMTBIT_U8 |
SNDRV_PCM_FMTBIT_S16_BE,
- .rates = SNDRV_PCM_RATE_8000_48000,
- .rate_min = 8000,
+ .rates = SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_5512,
+ .rate_min = 5512,
.rate_max = 48000,
.channels_min = 1,
.channels_max = 2,
@@ -1956,6 +1958,39 @@ static struct snd_pcm_hardware snd_dbri_
.periods_max = 1024,
};
+static int snd_hw_rule_format(struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
+{
+ struct snd_interval *c = hw_param_interval(params,
+ SNDRV_PCM_HW_PARAM_CHANNELS);
+ struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
+ struct snd_mask fmt;
+
+ snd_mask_any(&fmt);
+ if (c->min > 1) {
+ fmt.bits[0] &= SNDRV_PCM_FMTBIT_S16_BE;
+ return snd_mask_refine(f, &fmt);
+ }
+ return 0;
+}
+
+static int snd_hw_rule_channels(struct snd_pcm_hw_params *params,
+ struct snd_pcm_hw_rule *rule)
+{
+ struct snd_interval *c = hw_param_interval(params,
+ SNDRV_PCM_HW_PARAM_CHANNELS);
+ struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
+ struct snd_interval ch;
+
+ snd_interval_any(&ch);
+ if (!(f->bits[0] & SNDRV_PCM_FMTBIT_S16_BE)) {
+ ch.min = ch.max = 1;
+ ch.integer = 1;
+ return snd_interval_refine(c, &ch);
+ }
+ return 0;
+}
+
static int snd_dbri_open(struct snd_pcm_substream *substream)
{
struct snd_dbri *dbri = snd_pcm_substream_chip(substream);
@@ -1973,6 +2008,14 @@ static int snd_dbri_open(struct snd_pcm_
info->pipe = -1;
spin_unlock_irqrestore(&dbri->lock, flags);
+ snd_pcm_hw_rule_add(runtime,0,SNDRV_PCM_HW_PARAM_CHANNELS,
+ snd_hw_rule_format, 0, SNDRV_PCM_HW_PARAM_FORMAT,
+ -1);
+ snd_pcm_hw_rule_add(runtime,0,SNDRV_PCM_HW_PARAM_FORMAT,
+ snd_hw_rule_channels, 0,
+ SNDRV_PCM_HW_PARAM_CHANNELS,
+ -1);
+
cs4215_open(dbri);
return 0;
[-- Attachment #3: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #4: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sparc dbri: hardware constrains added
2006-08-22 17:52 [PATCH] sparc dbri: hardware constrains added Krzysztof Helt
@ 2006-08-23 9:39 ` Takashi Iwai
2006-08-23 10:53 ` Krzysztof Helt
2006-08-24 6:14 ` Krzysztof Helt
2006-08-24 19:05 ` Krzysztof Helt
2 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2006-08-23 9:39 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: alsa-devel
At Tue, 22 Aug 2006 19:52:17 +0200,
Krzysztof Helt wrote:
>
> From: Krzysztof Helt (krzysztof.h1@wp.pl)
>
> This patch adds ALSA hardware constrains so stereo is possible
> only with 16-bit format. It contains small cleanups to ring
> buffered code as well.
>
> Signed-off-by: Krzysztof Helt (krzysztof.h1@wp.pl)
Missing braces in debug prints of dbri_cmdsend(), but others look
fine. I queued the fixed patch on my tree. Will be committed to the
upstream soon.
BTW, dprintk() should use "do { } while (0)" so that it can be used
safely without extra blocks.
Thanks,
Takashi
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sparc dbri: hardware constrains added
2006-08-23 9:39 ` Takashi Iwai
@ 2006-08-23 10:53 ` Krzysztof Helt
2006-08-23 18:18 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-23 10:53 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
Dnia 23-08-2006 o godz. 11:39 Takashi Iwai napisał(a):
> Missing braces in debug prints of dbri_cmdsend(), but others look
> fine. I queued the fixed patch on my tree. Will be committed
to the
> upstream soon.
>
> BTW, dprintk() should use "do { } while (0)" so that it can be
used
> safely without extra blocks.
>
I haven't catched it because debug prints are disabled by the
patch. It will be fixed in the next one.
I started testing the OSS layer and it does not work on sparc32.
Is it something broken in the OSS layer for sparc or it is likely
a driver issue?
Before my series of patches, I got no sound through the OSS
layer. With the patches I got sound but it is played too fast and
deformed (random jumps in music play). I found the OSS layer
works by continously starting and stoping sound after each block
to send. Is it normal behaviour?
There is no problem with the same file played through the aplay.
Regards,
Krzysztof
----------------------------------------------------
Games Convention Lipsk 23-27.08.2006 - Nie możesz tam być?
Zobacz relacje na żywo:
http://klik.wp.pl/?adr=www.gc2006.gry.wp.pl&sid=852
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] sparc dbri: hardware constrains added
2006-08-23 10:53 ` Krzysztof Helt
@ 2006-08-23 18:18 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2006-08-23 18:18 UTC (permalink / raw)
To: Krzysztof Helt; +Cc: alsa-devel
At Wed, 23 Aug 2006 12:53:48 +0200,
Krzysztof Helt wrote:
>
> Dnia 23-08-2006 o godz. 11:39 Takashi Iwai napisał(a):
> > Missing braces in debug prints of dbri_cmdsend(), but others look
> > fine. I queued the fixed patch on my tree. Will be committed
> to the
> > upstream soon.
> >
> > BTW, dprintk() should use "do { } while (0)" so that it can be
> used
> > safely without extra blocks.
> >
>
> I haven't catched it because debug prints are disabled by the
> patch. It will be fixed in the next one.
>
> I started testing the OSS layer and it does not work on sparc32.
> Is it something broken in the OSS layer for sparc or it is likely
> a driver issue?
>
> Before my series of patches, I got no sound through the OSS
> layer. With the patches I got sound but it is played too fast and
> deformed (random jumps in music play). I found the OSS layer
> works by continously starting and stoping sound after each block
> to send. Is it normal behaviour?
Doesn't look so.
Perhaps the PCM middle layer detected XRUN (e.g. due to invalid DMA
pointer) and automatically restarted?
Is prepare called between the frequent triggers?
Takashi
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sparc dbri: hardware constrains added
2006-08-22 17:52 [PATCH] sparc dbri: hardware constrains added Krzysztof Helt
2006-08-23 9:39 ` Takashi Iwai
@ 2006-08-24 6:14 ` Krzysztof Helt
2006-08-24 19:05 ` Krzysztof Helt
2 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-24 6:14 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]
<s5hhd03ssdo.wl%tiwai@suse.de>
<44ec33bc0f4e0@wp.pl> <s5hhd03wc1p.wl%tiwai@suse.de>
In-reply-to: <44eb445108302@wp.pl>
<s5hhd03ssdo.wl%tiwai@suse.de>
<44ec33bc0f4e0@wp.pl> <s5hhd03wc1p.wl%tiwai@suse.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
X-Mailer: Interfejs WWW poczty Wirtualnej Polski
Organization: Poczta Wirtualnej Polski S.A. http://www.wp.pl/
X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
X-WP-IP: 83.17.101.58
X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A.
X-WP-SPAM: NO AS1=NO AS2=NO(0.500016) AS3=NO AS4=NO AS5=NO
Dnia 23-08-2006 o godz. 20:18 Takashi Iwai napisa³(a):
> Perhaps the PCM middle layer detected XRUN (e.g. due to invalid DMA
> pointer) and automatically restarted?
I will chekc this. The returned values I saw were 0 or the 1
period length (much smaller then the buffer size).
> Is prepare called between the frequent triggers?
>
Yes, it is called between triggers.
Regards,
Krzysztof
----------------------------------------------------
Za³ó¿ konto. Przelewy - 0z³. Darmowe konto oszczêdno¶ciowe - 3,25%!
Sprawd¼ i wygraj Toyotê Aygo! >> Kliknij:
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fing22.html&sid=854
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] sparc dbri: hardware constrains added
2006-08-22 17:52 [PATCH] sparc dbri: hardware constrains added Krzysztof Helt
2006-08-23 9:39 ` Takashi Iwai
2006-08-24 6:14 ` Krzysztof Helt
@ 2006-08-24 19:05 ` Krzysztof Helt
2 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-24 19:05 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]
<s5hhd03ssdo.wl%tiwai@suse.de>
<44ec33bc0f4e0@wp.pl> <s5hhd03wc1p.wl%tiwai@suse.de>
In-reply-to: <44eb445108302@wp.pl>
<s5hhd03ssdo.wl%tiwai@suse.de>
<44ec33bc0f4e0@wp.pl> <s5hhd03wc1p.wl%tiwai@suse.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-2
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
X-Mailer: Interfejs WWW poczty Wirtualnej Polski
Organization: Poczta Wirtualnej Polski S.A. http://www.wp.pl/
X-User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4a) Gecko/20030401
X-WP-IP: 213.76.88.67
X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A.
X-WP-SPAM: NO AS1=NO AS2=NO(0.500004) AS3=NO AS4=NO AS5=NO
Dnia 23-08-2006 o godz. 20:18 Takashi Iwai napisa³(a):
> At Wed, 23 Aug 2006 12:53:48 +0200,
> Krzysztof Helt wrote:
> > I started testing the OSS layer and it does not work on sparc32.
> > Is it something broken in the OSS layer for sparc or it is likely
> > a driver issue?
> >
> > Before my series of patches, I got no sound through the OSS
> > layer. With the patches I got sound but it is played too fast and
> > deformed (random jumps in music play). I found the OSS layer
> > works by continously starting and stoping sound after each block
> > to send. Is it normal behaviour?
>
> Doesn't look so.
>
> Perhaps the PCM middle layer detected XRUN (e.g. due to invalid DMA
> pointer) and automatically restarted?
> Is prepare called between the frequent triggers?
>
>
With the patch I have posted today it is easy to find the pattern
with OSS layer:
1. prepare is called.
2. sound start trigger is called.
3. The driver issues a proper command to a DMA controller.
4. The intterrupt comes which says that DMA controller processed
the sent command.
5. pointer is called and return 0
6. sound stop trigger is called
7. The driver issues a command to stop the DMA controller.
8. The step 1 repeats.
The only difference using the aplay command is that it ignores 0
pointer returned in step 5 and a moment later an interrupt comes
which reports the first period sent by the DMA controller.
Any thoughts whats is wrong with the OSS layer or driver?
Regards,
Krzysztof
----------------------------------------------------
Najlepsze siatkarki pla¿owe ¶wiata w Warszawie!
Miêdzynarodowy turniej GE Money Bank Warsaw Open 2006
Agrykola 30.08-03.09.2006 -> Wstêp wolny -> Szczegó³y:
http://klik.wp.pl/?adr=www.warsaw-beachvolley.pl&sid=850
[-- Attachment #2: Type: text/plain, Size: 373 bytes --]
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-08-24 19:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-22 17:52 [PATCH] sparc dbri: hardware constrains added Krzysztof Helt
2006-08-23 9:39 ` Takashi Iwai
2006-08-23 10:53 ` Krzysztof Helt
2006-08-23 18:18 ` Takashi Iwai
2006-08-24 6:14 ` Krzysztof Helt
2006-08-24 19:05 ` Krzysztof Helt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.