Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2002 01:12:08 +0900
From:      Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/45679: Cannot record except 8bit-mono with CS4231A & newpcm (half-duplex mode)
Message-ID:  <200211241621.BAA13362@ums509.nifty.ne.jp>

next in thread | raw e-mail | index | archive | help

>Number:         45679
>Category:       kern
>Synopsis:       Cannot record except 8bit-mono with CS4231A & newpcm (half-duplex mode)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 24 08:30:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Watanabe Kazuhiro
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
>Environment:
System: FreeBSD aries.zodiac.org 4.5-RELEASE FreeBSD 4.5-RELEASE #13: Sun Nov
 24 15:30:52 JST 2002     nabe@aries.zodiac.org:/usr/src/sys/compile/LEFTEYE
 i386

dmesg:
 pcm0: <CS4231A> at port 0xf40-0xf47 irq 10 drq 1 flags 0x1a100 on isa0
 drq/irq conf 1a

I'm tested on NEC PC-9821Xa9 and applied a patch posted below:

>Description:
With newpcm driver that probed CS4231A on half-duplex mode, only record
8bit-mono. Other formats (16bit and/or stereo) cannot record exactly.

The problem is happened in any sample rate.

OSS/Free driver work fine.


In newpcm driver, CS4231A is set to Mode2 (enhanced mode). In Mode2,
recording format should be set to a register I28.

But newpcm driver is not set the I28 in half-duplex mode.

The problem is always happened in NEC PC98's internal CS4231A, which
support half-duplex only.

>How-To-Repeat:
Wavrec is a part of ports/audio/wavplay.

cat /dev/sndstat
 FreeBSD Audio Driver (newpcm) Oct 15 2002 22:36:30
 Installed devices:
 pcm0: <CS4231A> at io 0xf40 irq 10 drq 1 (1p/1r/0v channels)
# it's not full-duplex.

/usr/bin/time wavrec -M -b 8 -t 5 foo.wav   # mono/8bit/5sec.
      5.28 real         0.01 user         0.28 sys
# work fine.

/usr/bin/time wavrec -S -b 16 -t 5 bar.wav  # stereo/16bit/5sec.
     20.27 real         0.00 user         0.40 sys
# four times as many as five seconds.

/usr/bin/time wavplay bar.wav
Pathname:       test.wav
Device:         /dev/audio
Sampling Rate:  22050 Hz
Mode:           Stereo
Samples:        110250
Bits:           16
      5.22 real         0.02 user         0.29 sys
# sounds like a tongle twister.

>Fix:
In OSS/Free driver, the I28 register is set unconditionally.
I don't know what a modification is the best way.

--- mss.c.orig	Sun Nov 24 23:40:02 2002
+++ mss.c	Sun Nov 24 23:40:08 2002
@@ -998,7 +998,9 @@
     	arg <<= 4;
     	ad_enter_MCE(mss);
     	ad_write(mss, 8, (ad_read(mss, 8) & 0x0f) | arg);
-    	if (FULL_DUPLEX(mss)) ad_write(mss, 28, arg); /* capture mode */
+	if (ad_read(mss, 12) & 0x40) {  /* mode2 ? */
+		ad_write(mss, 28, arg); /* capture mode */
+	}
     	ad_leave_MCE(mss);
     	return format;
 }
>Release-Note:
>Audit-Trail:
>Unformatted:
 >> "PC98 internal CS4231A is mis-detected to OPTi chip (newpcm)"
 >> http://www.freebsd.org/cgi/query-pr.cgi?pr=45673
 
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211241621.BAA13362>