Linmodems Mailing list Archives
Return-Path: <bernhard.kaindl@gmx.de>
Mailing-List: contact discuss-help@linmodems.org; run by ezmlm
Delivered-To: mailing list discuss@linmodems.org
Received: (qmail 5704 invoked from network); 9 Jan 2003 17:22:52 -0000
Received: from mail.gmx.net (213.165.64.20)
by www.linmodems.org with SMTP; 9 Jan 2003 17:22:52 -0000
Received: (qmail 1140 invoked by uid 0); 9 Jan 2003 17:22:08 -0000
Received: from dis212067236018.vie.telering.at (HELO Sat) (212.67.236.18)
by mail.gmx.net (mp016-rz3) with SMTP; 9 Jan 2003 17:22:08 -0000
Message-ID: <02d401c2b803$c6b15bc0$12ec43d4@Sat>
From: "Bernhard Kaindl" <bernhard.kaindl@gmx.de>
To: "Sasha Khapyorsky" <sashak@smlink.com>,
"Marvin Stodolsky" <stodolsk@rcn.com>,
<mail@thorstenhaas.de>
Cc: <discuss@linmodems.org>,
"Petr Srajer" <psrajer@ais.cz>
Subject: Re: AMR
Date: Thu, 9 Jan 2003 18:20:55 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_02BC_01C2B80B.D9944880"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
This is a multi-part message in MIME format.
------=_NextPart_000_02BC_01C2B80B.D9944880
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi,
I've attached a patch for yestderday's showamr.tgz which checks
the extended modem status register and extracts the capabilities
of the modem from it.
It also tries to powerup the ADC/DAC for the 1st modem line,
progam it to a rate near 19200 samples per second, tries to unmute
and activate the ADC/DAC amplifier for line 1 and tries to enable remote
analog loopback mode for checking the codec's responses to these
settings.
This only works with ac97 modem codecs conforming to the AC'97
Component Specification Revision 2.1 or so.
This is not anywhere near to getting the modem working but it shows some
simple things. Getting the DAA (Data Access Arrangement, if I remember
correcty) which connects the modem to the phone working is another needed
part (which would be modem specifice and possibly not easy) and the other
part is getting the DMA to/from the DAC/ADC in the codec working is the
other to take up the hook and listen to the line and talk to it (e.g. with
just
voice audio sent to/from the audio card, may be nice to have thing too)
<disclaimer>
Note that this code tries to activate the modem codec which may
result in electric power to circuits which were not under power
before, which means higher power consumption as in standby and
if the AMR does not reject programming it does not support, it
and it's environment may even get seriously damaged, so be warned,
I've only tested this myself on a Toshiba Satelite 1110-z16.
</disclaimer>
ac97 modem codecs conforming to the original (1.0 / pre 2.0)
ac97 specs which ac97 rev 2 conforming codecs must not implement
should be detected by this patch also but it does not more than
say that this seems to be an modem possibly conforming to the
old spec.
If you are interested to know more about AC'97 get the newest
AC'97 Component Specification Revision 2.3 from:
http://www.intel.com/labs/media/audio/index.htm
ftp://download.intel.com/labs/media/audio/download/ac97_r23.pdf
There is some introduction into the AC'97 Architecture and pictures
in the pdf, so you quickly get an image how it works and what an
AC'97 codec and an AC'97 contoller actually is.
Then you understand also why a generic ac97 audio codec library
and an ac97 controller driver can support many different ac97
sound cards, you can think of ac97 as of a bus standard which
defines common ways to get detailed capabilities information
about the connected devices and supports also common interfaces
to use these capabilites.
From reading the spec it seems to be technically possible to
use a common open source kernel layer (which could be pre-
compiled by Linux Vendors for their kernels) which could give
userspace drivers running with real-time priority an interface to
program AMR Modems and these userspace drivers could be
accessed over ptys(instead of serial driver interfaces) for example
like it has been done by userspace solutions for ADSL(e.g. rp-pppoe).
As a further special possibiliy, the userspace driver could implement
a pppd plugin which could be loaded and accessed directly by pppd
without going over a pseudo tty, pipe or socket.
rp-pppoe has been converted to a pppd plugin which handles connection
bringup and shutdown as well as data encapsulation for the transmitted
data.
For a start, this could also be based on the OSS or ALSA AC'97
sound driver code, from the perspective at this layer, the AMR
looks just like a soundcard with different programming interface.
I've looked into this also, it's easy to change the i810_audio driver
to not attach to the ICH3 audio PCI resources but to the ICH3 Modem
PCI resources (just changing 0x2485 to 0x2486) and adapt the modem
checks to not try to set the ac97 audio mixer and continue with an
valid ac97 exteneded modem id instead (skip the audo codec and
use the modem codec on the AC-link)
Then the ADC/DAC start/stop code must be changed from the primary
codec to the codec where the modem codec and maybe /dev/dsp could
read/write modem ADC/DAC data then.
Bernd
Thanks:
- Ian D. Steward for showing the AC'97 spec existance (could not
download from his ftp server but found it on Intel's site)
- I also want to thank for the explanations about the AC'97 Vendor
IDs on this list, especially the last helped me to undestand these better.
I've not added the data from the findAMR2.sh yet, but this cleared
things for me now and I can add it.
PS: I've tried showamr on a Gericom notebook with SiS chipset
(PCTel modem, lspci says Smartlink HMR 5600 compatible) and
failed, it looks like it needs some fixes for it. Maybe one of the problems
is the use the Audio PCI resources while it should be using the Modem
PCI resources. This could have worked on the Toshiba because of a
common Primary/Secorndary AC-Link, but maybe not on the
Gericom/SiS because of possibly splitted Audio/Modem AC-Links.
PPS: I also guess that some AMR drivers dont work on some computers
because they may be expectin the Modem to be the Primary or the
Secondary codec while it's the other, but this is just one possibilty.
> ----- Original Message -----
> From: "Bernhard Kaindl" <bernhard.kaindl@gmx.de>
> To: "Bernhard Kaindl" <bernhard.kaindl@gmx.de>; "Marvin Stodolsky"
> <stodolsk@rcn.com>; <mail@thorstenhaas.de>
> Cc: <discuss@linmodems.org>
> Sent: Monday, January 06, 2003 7:04 PM
> Subject: Re: AMR
>
>
> > Ok, here is my first attempt for Intel ICH chipsets only so far and the
> BIOS
> > needs to register an supported AC'97 Audio Codec which is on the same
> > AC-Link in the PCI table.
> >
> > This is not much but it's an initial release which should show the AC'97
> > Vendor
> > IDs of AMR/MDC Modems which work with an AC'97 Audio codec on the
> > same AC-Link which is often the Case for Laptops and Mainboards having
> > sound and Modem on board, I guess.
> >
> > It's completetly GPL code, no propreitary code included, you can
download
> > the inital source from:
> > http://members.telering.at/kaindl/downloads/showamr.tgz
> >
> > The tarball extracts to a subdirectory showamr, see showamr/README for
> > more info and instructions to compile and load. It builds two kernel
> modules
> > which write the info they gather to dmesg.
> >
> > BTW, for my AMR, it reports vendor id is 53494c, device id 27,
> > the vendor id is resolved by the ALSA code this is based in to
> > Silicon Laboratory, the findAMR script found the same number
> > in the OSS module dmesg and resolved this number to an Lucent AMR,
> > and the LT
> >
> > Win Modemlog has this info:
> >
> > Modem type: TOSHIBA Software Modem AMR
> > Modem info: oem3.inf
> > Section: INTEL_AMR.Modem
> > HW: pcien_8086&dev_2486&subsys_00011179
> >
> > Win Diagnose gives:
> >
> > AT+GMM - H.324 video-ready rev. 1.0
> > ATI3 - TOSHIBA V.90 Data+Fax Software Modem Version 3.1.100
> > ATI4 - Built on 09/26/2001 20:12:19
> > ATI5 - 3.1.100, AMR Intel MB, AC97 ID:SIL REV:0x27, 06
> > ATI7 - AMR Intel MB
> >
> > It uses an LTSM.SYS, the same name as the Lucent driver so I assume
> > it's at least similar to a Lucent modem, maybe the Angere People can see
> > more based in the info below. I've not tried the Lucent STSM.SYS yet,
> > but trying it should be the final check if it's compatible to Lucent or
> not.
> >
> > Bernhard Kaindl
> >
> > PS: Parts from the README:
> >
> > The showamr modules, first public release, use at your own risk!
> >
> > I was the only person who tested it, so take care and backup your data
> > before using(anyway, regardless of using these modules), they may cause
> > lockup of your system.
> >
> > This release can only work with Intel ICH and similar chipsets, not with
> > other chipsets (like VIA (yet)) and it needs an known AC'97 audio codec
> > registered in the PCI table as well(will be fixed to work without it)
> >
> > It should work with these chipsets(in theory):
> >
> > Vendor Chipset
> >
> > Intel 82801AA-ICH
> > Intel 82901AB-ICH0
> > Intel 82801BA-ICH2
> > Intel 82801CA-ICH3
> > Intel 82801DB-ICH4
> > Intel MX440
> > SiS SI7012
> > NVidia NForce
> > AMD AMD768
> > AMD AMD8111
> > ALI M5455
> >
> > Tested using an Intel 82801CA-ICH3
> >
> > The dmesg output should look like this:
> >
> > PCI: Found IRQ 10 for device 00:1f.5
> > PCI: Sharing IRQ 10 with 00:1f.3
> > PCI: Sharing IRQ 10 with 00:1f.6
> > Intel 82801CA-ICH3 at 0x1c00
> > Global control : 0x00000002
> > Global status : 0x00300300
> > AC'97 codecs ready : primary secondary
> > Primary Codec:
> > codec is an audio codec. extended id: 607
> > The ac97 vendor id is 414c47, device id 40
> > resolves to Avance Logic ALC202 rev 0
> > Secondary Codec:
> > codec is a softmodem/AMR/MDC. extended modem id: 4001 Registers:
> > r 00 02 04 06 08 0a 0c 0e 10 12 14 16 18 1a
> 1c
> > 1e
> > 0 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
> 0000
> > 0000
> > 2 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
> 4001
> > ff00
> > 4 0000 0000 0000 8080 0000 0000 003f ffff 0000 0000 0000 0000 0000 0003
> f010
> > 0000
> > 6 0000 7000 0000 0008 0008 0000 0000 0000 0000 0000 0000 0000 0000 0000
> 5349
> > 4c27
> > The ac97 vendor id is 53494c, device id 27
> > resolves to Silicon Laboratory with unknown device id 27.
> >
> > ----- Original Message -----
> > From: "Bernhard Kaindl" <bernhard.kaindl@gmx.de>
> > To: "Marvin Stodolsky" <stodolsk@rcn.com>; <mail@thorstenhaas.de>
> > Cc: <discuss@linmodems.org>
> > Sent: Sunday, January 05, 2003 11:56 PM
> > Subject: Re: AMR
> >
> >
> > > It looks like quite doable to do the same what findAMR tries to do by
> > > grepping
> > > directly in a kernel module which does exactly the probings which we
> want
> > it
> > > to
> > > do.
> > >
> > > The ALSA 0.9 ac97_codec driver gives such information in
> > /proc/asound/card0
> > > in my case because it thinks the secondary codec is also an audio
codec
> > but
> > > it's
> > > a modem codec(the OSS i810_audio shows this with it's Modem Test) and
> the
> > > same can be done based on the better looking ALSA code.
> > >
> > > I started to strip down the ALSA ac97_codec and intel8x0 sources to
not
> > need
> > > to much ALSA submodules an eventually work on a plain 2.4 kernel some
> day
> > > and had some initial success, not yet for users but I can send it to
any
> > > kernel
> > > hacker who is interested on the early code stripping done.
> > >
> > > Bernd
> > >
> > > > The suggestion has been made to a few developers in the Deep Code
> arena
> > > > (which I am not), that there is desperately needed a FakeDriver with
> the
> > > > following properties:
> > > > 1) It need only support a query to the modem sufficient to identify
> the
> > > > chipset, and there through recommend potentially supporting software
> > > > sources could be identified. The query for example might be
> implemented
> > > > with use of wvdialconf
> > > > 2) Only open source code should be included, so that FakeDriver
could
> be
> > > > distributed with the regular Linux distributions
> > > >
> > > > There has been acknowledgement of the utility of such a tool, but no
> > > > committments as yet.
> > > >
> > > > I'll forward your failure with findAMR to the donor of the code,
> > > > should he have a fix.
> > > >
> > > > MarvS
> > > >
> > > >
> > > >
> > > > >Thorsten Haas wrote:
> > > > >
> > > > > The script findAMR2.sh does not deliver anything useful:
> > > > >
> > > > > # dmesg | grep ac97
> > > > > ac97_codec: AC97 Audio codec, id: YMH3(Unknown)
> > > > >
> > > > > Is there another way to find out what driver to use?
> > > > >
> > > > > findAMR.sh output:
> > > > > ------------ snip ------------
> > > > > To pick out audio and AC97 codec_id information, first filtering
> input
> > > lines
> > > > > with audio and ac97
> > > > > Captured lines:
> > > > > ---------------
> > > > > ac97_codec: AC97 Audio codec, id: YMH3(Unknown)
> > > > > i810_audio: only 48Khz playback available.
> > > > > i810_audio: AC'97 codec 0 supports AMAP, total channels = 2
> > > > > i810_audio: Audio Controller supports 6 channels.
> > > > > i810_audio: Defaulting to base 2 channel mode.
> > > > > --------------
> > > > > Having captured no relevant lines,
> > > > > the following sample block will be processed for
> illustration:
> > > > > ------------ snap ------------
> > > > >
> > > > > --
> > > > > mailto:mail@thorstenhaas.de
> > > > > http://www.thorstenhaas.de
> > > >
> > >
> >
>
------=_NextPart_000_02BC_01C2B80B.D9944880
Content-Type: text/plain;
name="showamr0106-07.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="showamr0106-07.txt"
--- showamr.save.2/ac97_codec_generic.c 2003-01-06 17:43:02.000000000 =
+0100=0A=
+++ showamr/ac97_codec_generic.c 2003-01-07 11:46:40.000000000 +0100=0A=
@@ -88,6 +88,14 @@=0A=
=0A=
/* range 0x3c-0x58 - MODEM */=0A=
#define AC97_EXTENDED_MODEM_ID 0x003C=0A=
+// bits for AC97_EXTENDED_MODEM_ID:=0A=
+#define AC97_EXT_MODEM_LIN1 0x0001 // 1st line supported=0A=
+#define AC97_EXT_MODEM_LIN2 0x0002 // 2nd line supported=0A=
+#define AC97_EXT_MODEM_HSET 0x0004 // handset DAC/ADC supported=0A=
+#define AC97_EXT_MODEM_CID1 0x0008 // caller ID decode for line 1 =
supported=0A=
+#define AC97_EXT_MODEM_CID2 0x0010 // caller ID decode for line 2 =
supported=0A=
+#define AC97_EXT_MODEM_ID1 0x4000 // id1/id2 bitfield: codec =
configuration:=0A=
+#define AC97_EXT_MODEM_ID2 0x8000 // Primary=3D00; =
Secondary=3D01, 10, or 11=0A=
#define AC97_EXTEND_MODEM_STAT 0x003E=0A=
#define AC97_LINE1_RATE 0x0040=0A=
#define AC97_LINE2_RATE 0x0042=0A=
@@ -482,17 +479,96 @@=0A=
ac97->card =3D card;=0A=
=0A=
// snd_ac97_write(ac97, AC97_RESET, 0); /* reset to defaults */=0A=
+// Note: do some delay after resetting! *and write* - before read=0A=
=0A=
- //snd_ac97_write(ac97, AC97_EXTENDED_MODEM_ID, 0);=0A=
+ snd_ac97_write(ac97, AC97_EXTENDED_MODEM_ID, 0);=0A=
+ udelay(50);=0A=
modem_ext_id =3D snd_ac97_read(ac97, AC97_EXTENDED_MODEM_ID);=0A=
=0A=
if(modem_ext_id) {=0A=
+ unsigned int modem_stat;=0A=
printk(KERN_INFO " codec is a softmodem/AMR/MDC. extended modem id: =
%x Registers:
", modem_ext_id);=0A=
snd_ac97_regs_read(ac97);=0A=
+ printk("Register 3c, Extended Modem Id is %4x which says:
", =
modem_ext_id);=0A=
+ printk("support for 1st line: %s
",=0A=
+ (modem_ext_id&AC97_EXT_MODEM_LIN1) ? "yes" : "no");=0A=
+ printk("support for 2nd line: %s
",=0A=
+ (modem_ext_id&AC97_EXT_MODEM_LIN2) ? "yes" : "no");=0A=
+ printk("support for caller id decode on line 1: %s
",=0A=
+ (modem_ext_id&AC97_EXT_MODEM_CID1) ? "yes" : "no");=0A=
+ printk("support for caller id decode on line 2: %s
",=0A=
+ (modem_ext_id&AC97_EXT_MODEM_CID2) ? "yes" : "no");=0A=
+ printk("codec configured as: %s
",=0A=
+ (modem_ext_id&(AC97_EXT_MODEM_ID1|AC97_EXT_MODEM_ID1)) ? =
"secondary" : "primary");=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x3e);=0A=
+ printk("Extended Modem Status is %04x, ff00 says modem is powered =
down
", modem_stat);=0A=
+// GPIO=3D1 indicates GPIO ready =0A=
+// MREF=3D1 indicates Modem Vref s up to nominal level =0A=
+// ADC1=3D1 indicates Modem Line 1 ADC ready =0A=
+// DAC1=3D1 indicates Modem Line 1 DAC ready =0A=
+// ADC2=3D1 indicates Modem Line 2 ADC ready =0A=
+// DAC2=3D1 indicates Modem Line 2 DAC ready =0A=
+// HADC=3D1 indicates Handset ADC ready =0A=
+// HDAC=3D1 indicates Handset DAC ready=0A=
+=0A=
+// PRA=3D1 controls GPIO power-down =0A=
+// PRB=3D1 controls Modem Vref off =0A=
+#define AC97_EXT_MODEM_STAT_PRA (1<<8)=0A=
+#define AC97_EXT_MODEM_STAT_PRB (1<<9)=0A=
+#define AC97_EXT_MODEM_STAT_PRC (1<<10)=0A=
+#define AC97_EXT_MODEM_STAT_PRD (1<<11)=0A=
+// PRC=3D1 controls Modem Line 1 ADC off =0A=
+// PRD=3D1 controls Modem Line 1 DAC off =0A=
+// PRE=3D1 controls Modem Line 2 ADC off =0A=
+// PRF =3D1 controls Modem Line 2 DAC off =0A=
+// PRG=3D1 controls Handset ADC off =0A=
+// PRH=3D1 controls Handset DAC off=0A=
+=0A=
+// Powerup 1st line:=0A=
+ modem_stat &=3D ~AC97_EXT_MODEM_STAT_PRA;=0A=
+ modem_stat &=3D ~AC97_EXT_MODEM_STAT_PRB;=0A=
+ modem_stat &=3D ~AC97_EXT_MODEM_STAT_PRC;=0A=
+ modem_stat &=3D ~AC97_EXT_MODEM_STAT_PRD;=0A=
+ //modem_stat &=3D 0;=0A=
+ //printk(" is %04x
", modem_stat);=0A=
+ snd_ac97_write(ac97, 0x3e, modem_stat);=0A=
+ udelay(50);=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x3e);=0A=
+ printk("Extended Modem Status after poweup of 1st line: %04x
", =
modem_stat);=0A=
+// Set Sample rate of ADC/DAC for 1st line:=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x40);=0A=
+ printk("Sample rate of ADC/DAC for 1st line: %d
", modem_stat);=0A=
+ snd_ac97_write(ac97, 0x40, 0x4b00); // 4b00 is 19200 (samples/second)=0A=
+ udelay(50);=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x40);=0A=
+ printk("Sample rate of ADC/DAC for 1st line: %d (tried to set =
19200)
", modem_stat);=0A=
+// Open Amplifier for 1st line:=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x46);=0A=
+ printk("Amplifier Config for 1st line is %04x, 8080 says ADC and DAC =
muted
", modem_stat);=0A=
+ snd_ac97_write(ac97, 0x46, 0x0f0f);=0A=
+ udelay(50);=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x46);=0A=
+ printk("Amplifier Config for 1st line is %04x (tried to unmute)
", =
modem_stat);=0A=
+// Enable Remote analog loopback=0A=
+ snd_ac97_write(ac97, 0x56, 0x0004); // remote analog loopback for =
line 1=0A=
+ udelay(100);=0A=
+ modem_stat =3D snd_ac97_read(ac97, 0x56);=0A=
+ printk("reg is %04x
", modem_stat);=0A=
+// snd_ac97_write(ac97, AC97_RESET, 0); /* reset to defaults */=0A=
+ udelay(100);=0A=
+ snd_ac97_regs_read(ac97);=0A=
}=0A=
else {=0A=
- ac97->ext_id =3D snd_ac97_read(ac97, AC97_EXTENDED_ID);=0A=
- printk(KERN_INFO " codec is an audio codec. extended id: %x
", =
ac97->ext_id);=0A=
+ ac97->caps =3D snd_ac97_read(ac97, AC97_RESET);=0A=
+ if (ac97->caps & 2) {=0A=
+ printk("codec has reset register (reg 0) bit 1 set which was the =
flag=0A=
+for Modem Line Codec support in the original AC'97 specification,=0A=
+reserved as of Rev 2.3
");=0A=
+ } else {=0A=
+ //ac97->ext_id =3D snd_ac97_read(ac97, AC97_EXTENDED_ID);=0A=
+ //printk(KERN_INFO " codec is an audio codec. extended id: %x
", =
ac97->ext_id);=0A=
+ printk(KERN_INFO " codec looks like an audio codec:
");=0A=
+ }=0A=
}=0A=
=0A=
id =3D snd_ac97_read(ac97, AC97_VENDOR_ID1) << 16;=0A=
------=_NextPart_000_02BC_01C2B80B.D9944880--
Webmaster: Russell Nelson
Last modified: Wed Jul 30 11:02:43 EDT 2003