linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Fix for PPC audio devices that can't reendianize samples
@ 2001-08-10 15:45 Derrik Pates
  0 siblings, 0 replies; 9+ messages in thread
From: Derrik Pates @ 2001-08-10 15:45 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 316 bytes --]

The attached patch adds code to drivers/sound/dmasound/trans_16.c to
byteswap little-endian audio samples for hardware that needs it (like the
DACA audio chip in the iBook and iBook FireWire), and also marks the DACA
in the iBook FireWire as being unable to handle little-endian audio
samples (in dmasound_awacs.c).

[-- Attachment #2: Type: TEXT/PLAIN, Size: 12342 bytes --]

--- /home/linux-2.4-benh.dist/drivers/sound/dmasound/dmasound_awacs.c	Thu Aug  9 07:12:02 2001
+++ drivers/sound/dmasound/dmasound_awacs.c	Thu Aug  9 12:35:14 2001
@@ -2004,6 +2004,10 @@
 		is_ibook = 1 ;
 		return ;
 	}
+	if (machine_is_compatible("PowerBook2,2")) {	/* ibook 2 (firewire) */
+		is_ibook = 1 ;
+		return ;
+	}
 }
 
 /* Get the OF node that tells us about the registers, interrupts etc. to use
@@ -2258,10 +2262,10 @@
 			break;
 		}
 	}
-	if (rev == 2) {
+	if (rev >= 2) {
 		hw_can_byteswap = 0;
 #ifdef DEBUG_DMASOUND
-printk("dmasound_pmac: found Keylargo rev 2 - H/W byte-swap disabled\n") ;
+printk("dmasound_pmac: found Keylargo rev 2 or later - H/W byte-swap disabled\n") ;
 #endif
 	}
 }
--- /home/linux-2.4-benh.dist/drivers/sound/dmasound/trans_16.c	Thu Aug  9 07:12:01 2001
+++ drivers/sound/dmasound/trans_16.c	Thu Aug  9 12:33:01 2001
@@ -12,6 +12,7 @@
 
 #include <linux/soundcard.h>
 #include <asm/uaccess.h>
+#include <asm/byteorder.h>
 #include "dmasound.h"
 
 static short dmasound_alaw2dma16[] ;
@@ -26,10 +27,16 @@
 static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
 			  u_char frame[], ssize_t *frameUsed,
 			  ssize_t frameLeft);
-static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_s16le(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft);
-static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_s16be(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ct_u16le(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ct_u16be(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft);
 
@@ -42,17 +49,29 @@
 static ssize_t pmac_ctx_u8(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft);
-static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ctx_s16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t pmac_ctx_s16be(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft);
+static ssize_t pmac_ctx_u16le(const u_char *userPtr, size_t userCount,
 			    u_char frame[], ssize_t *frameUsed,
 			    ssize_t frameLeft);
-static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ctx_u16be(const u_char *userPtr, size_t userCount,
 			    u_char frame[], ssize_t *frameUsed,
 			    ssize_t frameLeft);
 
-static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_s16le_read(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ct_s16be_read(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft);
-static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_u16le_read(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft);
+static ssize_t pmac_ct_u16be_read(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft);
 
@@ -156,7 +175,37 @@
 }
 
 
-static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_s16le(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
+{
+	ssize_t count, used;
+	int stereo = dmasound.soft.stereo;
+	short *fp = (short *) &frame[*frameUsed];
+	short *up = (short *) userPtr;
+
+	frameLeft >>= 2;
+	userCount >>= (stereo? 2: 1);
+	used = count = min(userCount, frameLeft);
+	while (count > 0) {
+		short data;
+		if (get_user(data, up++))
+			return -EFAULT;
+		__arch__swab16s(&data);
+		*fp++ = data;
+		if (stereo) {
+			if (get_user(data, up++))
+				return -EFAULT;
+			__arch__swab16s(&data);
+		}
+		*fp++ = data;
+		count--;
+	}
+	*frameUsed += used * 4;
+	return stereo? used * 4: used * 2;
+}
+
+static ssize_t pmac_ct_s16be(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft)
 {
@@ -185,7 +234,40 @@
 	return stereo? used * 4: used * 2;
 }
 
-static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_u16le(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
+{
+	ssize_t count, used;
+	int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
+	int stereo = dmasound.soft.stereo;
+	short *fp = (short *) &frame[*frameUsed];
+	short *up = (short *) userPtr;
+
+	frameLeft >>= 2;
+	userCount >>= (stereo? 2: 1);
+	used = count = min(userCount, frameLeft);
+	while (count > 0) {
+		short data;
+		if (get_user(data, up++))
+			return -EFAULT;
+		data ^= mask;
+		__arch__swab16s(&data);
+		*fp++ = data;
+		if (stereo) {
+			if (get_user(data, up++))
+				return -EFAULT;
+			data ^= mask;
+			__arch__swab16s(&data);
+		}
+		*fp++ = data;
+		count--;
+	}
+	*frameUsed += used * 4;
+	return stereo? used * 4: used * 2;
+}
+
+static ssize_t pmac_ct_u16be(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft)
 {
@@ -354,7 +436,53 @@
 }
 
 
-static ssize_t pmac_ctx_s16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ctx_s16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
+{
+	unsigned int *p = (unsigned int *) &frame[*frameUsed];
+	unsigned int data = expand_data;
+	unsigned short *up = (unsigned short *) userPtr;
+	int bal = expand_bal;
+	int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
+	int stereo = dmasound.soft.stereo;
+	int utotal, ftotal;
+
+	frameLeft >>= 2;
+	userCount >>= (stereo? 2: 1);
+	ftotal = frameLeft;
+	utotal = userCount;
+	while (frameLeft) {
+		unsigned short c;
+		if (bal < 0) {
+			if (userCount == 0)
+				break;
+			if (get_user(data, up++))
+				return -EFAULT;
+			if (stereo) {
+				if (get_user(c, up++))
+					return -EFAULT;
+				data = (data << 16) + c;
+			} else
+				data = (data << 16) + data;
+			userCount--;
+			bal += hSpeed;
+		}
+		__arch__swab16s((short *)&data);
+		__arch__swab16s(((short *)&data + 1));
+		*p++ = data;
+		frameLeft--;
+		bal -= sSpeed;
+	}
+	expand_bal = bal;
+	expand_data = data;
+	*frameUsed += (ftotal - frameLeft) * 4;
+	utotal -= userCount;
+	return stereo? utotal * 4: utotal * 2;
+}
+
+
+static ssize_t pmac_ctx_s16be(const u_char *userPtr, size_t userCount,
 			    u_char frame[], ssize_t *frameUsed,
 			    ssize_t frameLeft)
 {
@@ -398,7 +526,55 @@
 }
 
 
-static ssize_t pmac_ctx_u16(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ctx_u16le(const u_char *userPtr, size_t userCount,
+			    u_char frame[], ssize_t *frameUsed,
+			    ssize_t frameLeft)
+{
+	int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
+	unsigned int *p = (unsigned int *) &frame[*frameUsed];
+	unsigned int data = expand_data;
+	unsigned short *up = (unsigned short *) userPtr;
+	int bal = expand_bal;
+	int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
+	int stereo = dmasound.soft.stereo;
+	int utotal, ftotal;
+
+	frameLeft >>= 2;
+	userCount >>= (stereo? 2: 1);
+	ftotal = frameLeft;
+	utotal = userCount;
+	while (frameLeft) {
+		unsigned short c;
+		if (bal < 0) {
+			if (userCount == 0)
+				break;
+			if (get_user(data, up++))
+				return -EFAULT;
+			data ^= mask;
+			if (stereo) {
+				if (get_user(c, up++))
+					return -EFAULT;
+				data = (data << 16) + (c ^ mask);
+			} else
+				data = (data << 16) + data;
+			userCount--;
+			bal += hSpeed;
+		}
+		__arch__swab16s((short *)&data);
+		__arch__swab16s(((short *)&data + 1));
+		*p++ = data;
+		frameLeft--;
+		bal -= sSpeed;
+	}
+	expand_bal = bal;
+	expand_data = data;
+	*frameUsed += (ftotal - frameLeft) * 4;
+	utotal -= userCount;
+	return stereo? utotal * 4: utotal * 2;
+}
+
+
+static ssize_t pmac_ctx_u16be(const u_char *userPtr, size_t userCount,
 			    u_char frame[], ssize_t *frameUsed,
 			    ssize_t frameLeft)
 {
@@ -510,7 +686,38 @@
 	return stereo? used * 2: used;
 }
 
-static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_s16le_read(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
+{
+	ssize_t count, used;
+	int stereo = dmasound.soft.stereo;
+	short *fp = (short *) &frame[*frameUsed];
+	short *up = (short *) userPtr;
+
+	frameLeft >>= 2;
+	userCount >>= (stereo? 2: 1);
+	used = count = min(userCount, frameLeft);
+	while (count > 0) {
+		short data;
+		data = *fp++;
+		__arch__swab16s(&data);
+		if (put_user(data, up++))
+			return -EFAULT;
+		if (stereo) {
+			data = *fp;
+			__arch__swab16s(&data);
+			if (put_user(data, up++))
+				return -EFAULT;
+		}
+		fp++;
+		count--;
+	}
+	*frameUsed += used * 4;
+	return stereo? used * 4: used * 2;
+}
+
+static ssize_t pmac_ct_s16be_read(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft)
 {
@@ -539,12 +746,47 @@
 	return stereo? used * 4: used * 2;
 }
 
-static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
+static ssize_t pmac_ct_u16le_read(const u_char *userPtr, size_t userCount,
 			   u_char frame[], ssize_t *frameUsed,
 			   ssize_t frameLeft)
 {
 	ssize_t count, used;
-	int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
+	int mask = 0x0080;
+	int stereo = dmasound.soft.stereo;
+	short *fp = (short *) &frame[*frameUsed];
+	short *up = (short *) userPtr;
+
+	frameLeft >>= 2;
+	userCount >>= (stereo? 2: 1);
+	used = count = min(userCount, frameLeft);
+	while (count > 0) {
+		short data;
+
+		data = *fp++;
+		data ^= mask;
+		__arch__swab16s(&data);
+		if (put_user(data, up++))
+			return -EFAULT;
+		if (stereo) {
+			data = *fp;
+			data ^= mask;
+			__arch__swab16s(&data);
+			if (put_user(data, up++))
+				return -EFAULT;
+		}
+		fp++;
+		count--;
+	}
+	*frameUsed += used * 4;
+	return stereo? used * 4: used * 2;
+}
+
+static ssize_t pmac_ct_u16be_read(const u_char *userPtr, size_t userCount,
+			   u_char frame[], ssize_t *frameUsed,
+			   ssize_t frameLeft)
+{
+	ssize_t count, used;
+	int mask = 0x8000;
 	int stereo = dmasound.soft.stereo;
 	short *fp = (short *) &frame[*frameUsed];
 	short *up = (short *) userPtr;
@@ -553,7 +795,7 @@
 	userCount >>= (stereo? 2: 1);
 	used = count = min(userCount, frameLeft);
 	while (count > 0) {
-		int data;
+		short data;
 
 		data = *fp++;
 		data ^= mask;
@@ -577,10 +819,10 @@
 	ct_alaw:	pmac_ct_law,
 	ct_s8:		pmac_ct_s8,
 	ct_u8:		pmac_ct_u8,
-	ct_s16be:	pmac_ct_s16,
-	ct_u16be:	pmac_ct_u16,
-	ct_s16le:	pmac_ct_s16,
-	ct_u16le:	pmac_ct_u16,
+	ct_s16be:	pmac_ct_s16be,
+	ct_u16be:	pmac_ct_u16be,
+	ct_s16le:	pmac_ct_s16le,
+	ct_u16le:	pmac_ct_u16le,
 };
 
 TRANS transAwacsExpand = {
@@ -588,19 +830,19 @@
 	ct_alaw:	pmac_ctx_law,
 	ct_s8:		pmac_ctx_s8,
 	ct_u8:		pmac_ctx_u8,
-	ct_s16be:	pmac_ctx_s16,
-	ct_u16be:	pmac_ctx_u16,
-	ct_s16le:	pmac_ctx_s16,
-	ct_u16le:	pmac_ctx_u16,
+	ct_s16be:	pmac_ctx_s16be,
+	ct_u16be:	pmac_ctx_u16be,
+	ct_s16le:	pmac_ctx_s16le,
+	ct_u16le:	pmac_ctx_u16le,
 };
 
 TRANS transAwacsNormalRead = {
 	ct_s8:		pmac_ct_s8_read,
 	ct_u8:		pmac_ct_u8_read,
-	ct_s16be:	pmac_ct_s16_read,
-	ct_u16be:	pmac_ct_u16_read,
-	ct_s16le:	pmac_ct_s16_read,
-	ct_u16le:	pmac_ct_u16_read,
+	ct_s16be:	pmac_ct_s16be_read,
+	ct_u16be:	pmac_ct_u16be_read,
+	ct_s16le:	pmac_ct_s16le_read,
+	ct_u16le:	pmac_ct_u16le_read,
 };
 
 /* translation tables */

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
@ 2001-08-10 18:28 Iain Sandoe
  2001-08-11 17:46 ` Geert Uytterhoeven
  0 siblings, 1 reply; 9+ messages in thread
From: Iain Sandoe @ 2001-08-10 18:28 UTC (permalink / raw)
  To: Derrik Pates, linuxppc-dev


> The attached patch adds code to drivers/sound/dmasound/trans_16.c to
> byteswap little-endian audio samples for hardware that needs it (like the
> DACA audio chip in the iBook and iBook FireWire), and also marks the DACA
> in the iBook FireWire as being unable to handle little-endian audio
> samples (in dmasound_awacs.c).

we've been round this loop ;-)))

the reason that the byte-swap code was taken out of trans_16.c is that it
will never be allowed into the kernel.

The way to solve the problem is to:

(a) as you've done, mark the DACA and so on as BE-only (which, I thought was
already done in the latest patches - barring the Keylargo rev.3 detection).

(b) if applications don't work properly with BE-only devs then bang on the
app maintainer (or send patches) to fix it.

Otherise you end up with having to maintain a never-to-be-merged patch
against dmasound (and believe me, that's a PITA).

ciao,
Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
  2001-08-10 18:28 Fix for PPC audio devices that can't reendianize samples Iain Sandoe
@ 2001-08-11 17:46 ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2001-08-11 17:46 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: Derrik Pates, linuxppc-dev


On Fri, 10 Aug 2001, Iain Sandoe wrote:
> > The attached patch adds code to drivers/sound/dmasound/trans_16.c to
> > byteswap little-endian audio samples for hardware that needs it (like the
> > DACA audio chip in the iBook and iBook FireWire), and also marks the DACA
> > in the iBook FireWire as being unable to handle little-endian audio
> > samples (in dmasound_awacs.c).
>
> we've been round this loop ;-)))
>
> the reason that the byte-swap code was taken out of trans_16.c is that it
> will never be allowed into the kernel.

And we'll have to remove the current byteswap code in the kernel (there still
is some).

> (b) if applications don't work properly with BE-only devs then bang on the
> app maintainer (or send patches) to fix it.

And since Debian has a nice bug tracking system: try the Debian version of the
app, if that one doesn't work, file a Debian bug report.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
@ 2001-08-11 23:21 Iain Sandoe
  2001-08-12  8:47 ` Geert Uytterhoeven
  2001-08-13 14:08 ` Derrik Pates
  0 siblings, 2 replies; 9+ messages in thread
From: Iain Sandoe @ 2001-08-11 23:21 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Derrik Pates, linuxppc-dev


On Sat, Aug 11, 2001,  Geert Uytterhoeven wrote:
> On Fri, 10 Aug 2001, Iain Sandoe wrote:
>> > The attached patch adds code to drivers/sound/dmasound/trans_16.c to
>> > byteswap little-endian audio samples for hardware that needs it (like the
>> > DACA audio chip in the iBook and iBook FireWire), and also marks the DACA
>> > in the iBook FireWire as being unable to handle little-endian audio
>> > samples (in dmasound_awacs.c).
>>
>> we've been round this loop ;-)))
>>
>> the reason that the byte-swap code was taken out of trans_16.c is that it
>> will never be allowed into the kernel.
>
> And we'll have to remove the current byteswap code in the kernel (there still
> is some).

Well, actually, I'd like to lose all the translation stuff (rate conversion,
format conversion etc.).  This belongs in User-Land and is preventing me
from implementing mmio (which would be useful for the more serious
applications).

My main problems atm are:

(a) working out what to do about mksound() - this is messy as it is and
needs fixing in order to deal with DACA & Tumbler (it fiddles with the H/W
which makes it chip-specific at present)...

(b) wondering if losing all that stuff is going to be acceptable to the m68k
ports (or whether we will end up having a PPC-specific driver).

(c) not having any time ... (but that's an old problem) ...

ciao,
Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
  2001-08-11 23:21 Iain Sandoe
@ 2001-08-12  8:47 ` Geert Uytterhoeven
  2001-08-13 14:08 ` Derrik Pates
  1 sibling, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2001-08-12  8:47 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: Derrik Pates, linuxppc-dev


On Sun, 12 Aug 2001, Iain Sandoe wrote:
> On Sat, Aug 11, 2001,  Geert Uytterhoeven wrote:
> > On Fri, 10 Aug 2001, Iain Sandoe wrote:
> >> > The attached patch adds code to drivers/sound/dmasound/trans_16.c to
> >> > byteswap little-endian audio samples for hardware that needs it (like the
> >> > DACA audio chip in the iBook and iBook FireWire), and also marks the DACA
> >> > in the iBook FireWire as being unable to handle little-endian audio
> >> > samples (in dmasound_awacs.c).
> >>
> >> we've been round this loop ;-)))
> >>
> >> the reason that the byte-swap code was taken out of trans_16.c is that it
> >> will never be allowed into the kernel.
> >
> > And we'll have to remove the current byteswap code in the kernel (there still
> > is some).
>
> Well, actually, I'd like to lose all the translation stuff (rate conversion,
> format conversion etc.).  This belongs in User-Land and is preventing me
> from implementing mmio (which would be useful for the more serious
> applications).

Sorry, that's what I meant: all translation code.

> My main problems atm are:
>
> (a) working out what to do about mksound() - this is messy as it is and
> needs fixing in order to deal with DACA & Tumbler (it fiddles with the H/W
> which makes it chip-specific at present)...

Yes, mksound() messes with the sound hardware on most m68k boxes too.

Perhaps we should make it more generic, and move it to dmasound?
The disadvantage is that you can't get system beep anymore without dmasound.

> (b) wondering if losing all that stuff is going to be acceptable to the m68k
> ports (or whether we will end up having a PPC-specific driver).

If the removal of the translation stuff is imposed from upstream (Linus/Alan),
we must comply. Once user space is fixed, it should work everywhere. So m68k
will benefit from the work done on PPC (once in a time it was vice versa :-)

> (c) not having any time ... (but that's an old problem) ...

Idem ditto.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
@ 2001-08-12 10:59 Iain Sandoe
  0 siblings, 0 replies; 9+ messages in thread
From: Iain Sandoe @ 2001-08-12 10:59 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linuxppc-dev


On  Sun, Aug 12, 2001,  Geert Uytterhoeven wrote:
> On Sun, 12 Aug 2001, Iain Sandoe wrote:
>> On Sat, Aug 11, 2001,  Geert Uytterhoeven wrote:
>> > On Fri, 10 Aug 2001, Iain Sandoe wrote:
>> (a) working out what to do about mksound() - this is messy as it is and
>> needs fixing in order to deal with DACA & Tumbler (it fiddles with the H/W
>> which makes it chip-specific at present)...
>
> Yes, mksound() messes with the sound hardware on most m68k boxes too.

right.

> Perhaps we should make it more generic, and move it to dmasound?

My thoughts of the last few weeks are along these lines...

At the moment we (PPC/PMac) have a wavetable synthesis of the beep in
dmasound_awacs.c.  Unfortunately, it changes sample-rate and AFMT settings
in a way that is quite AWACS/Screamer/Burgundy - specific... this must
altered to implement DACA & Tumbler drivers properly (we have temporary
separate hacks for these at the moment).

What I was thinking of doing is moving the WT synthesis into dmasound_core.c
and implementing it by mixing the beep into the incoming sound stream.  The
the wavetable parameters would be driven by current AFMT/sample rate
settings (rather than changing them to-and-fro 'behind the back' of
dmasound_core.c).

Of course, that works for any Low-Level driver backed onto dmasound_core.c
(including all the m68k ones)...  and we can lose all the chip-specific
mksound code from the LL drivers.

there are two objections to this:

(a) This is not quite 'zero-kernel-code' (the mixing will require some
arithmetic in a per-sample loop)

- it would be better (and more flexible) if the mksound beep was generated
by User-land code and mixed via something like aRtsd ... but, of course,
that imposes a requirement to have such a thing running to have console beep
(at least on PMac PPC)... which might not suit everyone.

(b) it would mean that mksound would cease to function if mmio is
implemented and that mode is in use.  However, AFAICT this second point is
pretty un-solvable...

> The disadvantage is that you can't get system beep anymore without dmasound.

well, PPC/PMac doesn't have mksound without dmasound anyway.

ciao,
Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
  2001-08-11 23:21 Iain Sandoe
  2001-08-12  8:47 ` Geert Uytterhoeven
@ 2001-08-13 14:08 ` Derrik Pates
  2001-08-13 14:58   ` Geert Uytterhoeven
  1 sibling, 1 reply; 9+ messages in thread
From: Derrik Pates @ 2001-08-13 14:08 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: Geert Uytterhoeven, Derrik Pates, linuxppc-dev


On Sun, 12 Aug 2001, Iain Sandoe wrote:

> Well, actually, I'd like to lose all the translation stuff (rate conversion,
> format conversion etc.).  This belongs in User-Land and is preventing me
> from implementing mmio (which would be useful for the more serious
> applications).

Ok, so why not just take it out, and have the driver printk() a message if
userspace tries to force it to accept an audio format it doesn't know,
saying basically, "Please ask the developers of the software to properly
query the OSS device for supported formats"? If that's really the way
you'd prefer it to be, really nothing else is going to make people sit up
and pay attention other than just saying "Ok, this behavior is now broken,
not just deprecated, but BROKEN".

Derrik Pates      |   Sysadmin, Douglas School   |    #linuxOS on EFnet
dpates@dsdk12.net |     District (dsdk12.net)    |    #linuxOS on OPN


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
@ 2001-08-13 14:28 Iain Sandoe
  0 siblings, 0 replies; 9+ messages in thread
From: Iain Sandoe @ 2001-08-13 14:28 UTC (permalink / raw)
  To: Derrik Pates; +Cc: linuxppc-dev


On Mon, Aug 13, 2001,  Derrik Pates wrote:
> On Sun, 12 Aug 2001, Iain Sandoe wrote:
>> Well, actually, I'd like to lose all the translation stuff (rate conversion,
>> format conversion etc.).  This belongs in User-Land and is preventing me
>> from implementing mmio (which would be useful for the more serious
>> applications).
> Ok, so why not just take it out, and have the driver printk() a message if
> userspace tries to force it to accept an audio format it doesn't know,
> saying basically, "Please ask the developers of the software to properly
> query the OSS device for supported formats"?

OK.  This is maybe a way forward.

However, at the moment, I'm thinking about a bigger restructuring of the
driver to handle all the newer hardware types.  Depending on how Ben H sees
this - it may be left 'till 2.5 - rather than breaking existing 2.4.x
behaviour.  (not to mention the fact that it's not happening ATM owing to
lack of time ;-)

>If that's really the way you'd prefer it to be,

errm ... I went round the loop you did ...

- it's the way that Linus & co. want it to be ... and, of course, once one
looks at it a little harder, makes perfect sense.

ciao,
Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fix for PPC audio devices that can't reendianize samples
  2001-08-13 14:08 ` Derrik Pates
@ 2001-08-13 14:58   ` Geert Uytterhoeven
  0 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2001-08-13 14:58 UTC (permalink / raw)
  To: Derrik Pates; +Cc: Iain Sandoe, Derrik Pates, linuxppc-dev


On Mon, 13 Aug 2001, Derrik Pates wrote:
> On Sun, 12 Aug 2001, Iain Sandoe wrote:
> > Well, actually, I'd like to lose all the translation stuff (rate conversion,
> > format conversion etc.).  This belongs in User-Land and is preventing me
> > from implementing mmio (which would be useful for the more serious
> > applications).
>
> Ok, so why not just take it out, and have the driver printk() a message if
> userspace tries to force it to accept an audio format it doesn't know,
> saying basically, "Please ask the developers of the software to properly
                                                  ^^^^^^^^^^^^
You can even printk() the name of the program.

> query the OSS device for supported formats"? If that's really the way
> you'd prefer it to be, really nothing else is going to make people sit up
> and pay attention other than just saying "Ok, this behavior is now broken,
> not just deprecated, but BROKEN".

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-08-13 14:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-10 18:28 Fix for PPC audio devices that can't reendianize samples Iain Sandoe
2001-08-11 17:46 ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2001-08-13 14:28 Iain Sandoe
2001-08-12 10:59 Iain Sandoe
2001-08-11 23:21 Iain Sandoe
2001-08-12  8:47 ` Geert Uytterhoeven
2001-08-13 14:08 ` Derrik Pates
2001-08-13 14:58   ` Geert Uytterhoeven
2001-08-10 15:45 Derrik Pates

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).