From alsa-devel-owner@alsa.jcu.cz  Fri Jul 17 10:57:02 1998
Received: from btmplq.god.bel.alcatel.be (gatekeeper.alcatel.be [138.203.244.2])
	by marvin.jcu.cz (8.8.8/8.8.8) with ESMTP id KAA29094;
	Fri, 17 Jul 1998 10:56:32 +0200
Received: from btmpjg.god.bel.alcatel.be (root@btmpjg.god.bel.alcatel.be [138.203.144.75])
	by btmplq.god.bel.alcatel.be (8.9.0/8.9.0) with SMTP id KAA15984;
	Fri, 17 Jul 1998 10:54:46 +0200 (MET DST)
Received: from nlsun1.ats.nld.alcatel.nl (root@nlsun1.ats.nld.alcatel.nl [138.203.176.10]) by btmpjg.god.bel.alcatel.be (8.6.12/8.6.12) with ESMTP id LAA06187; Fri, 17 Jul 1998 11:04:02 +0200
Received: from ats.nld.alcatel.nl (nlsw17 [138.203.176.17]) by nlsun1.ats.nld.alcatel.nl (8.6.5/8.6.5) with ESMTP id KAA16121; Fri, 17 Jul 1998 10:56:25 +0200
Message-ID: <35AF11B4.183E69F9@ats.nld.alcatel.nl>
Date: Fri, 17 Jul 1998 10:56:21 +0200
From: joris jansen <jansen@ats.nld.alcatel.nl>
MIME-Version: 1.0
To: Jaroslav Kysela <perex@jcu.cz>
CC: alsa-devel@jcu.cz
Subject: Bug in snd_cs4231_mute ?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

Hi Jaroslav,

I'm still busy with the addaptions for the ad1845 chip in the cs4231
code. Too bad OI don't have that much time for it, therefore I'm not
going that fast on this ...
Checking the code for addaptions to be made I ran into the 
snd_cs4231_mute function and I thinh I found a bug:
For muting mask is sent to the regl and/or regr registers instead of
the mute value in channel->hw.private_value. Below I fixed it.
(Look for lines starting with ##) in the code beneath.

Furthermore I have a question, why do you use the mono input channel
(meant for pc-speaker input if I'm right) as line input ?
As far as I know do both cs4231 and ad1845 have stereo mic input. Though
on cs4231 this one cannot be mixed to the output as can with the ad1845.
But on both chips you can select the mic input as input for the adc.
Is it a small mistake or do you have good reasons for taking the
mono-input ?


static void snd_cs4231_mute( snd_kmixer_t *mixer, snd_kmixer_channel_t
*channel, unsigned int mute )
{
  unsigned long flags;
  unsigned char regl, regr, mask;
  cs4231_t *codec;

  regl = (unsigned char)(channel -> hw.private_value >> 24);
  regr = (unsigned char)(channel -> hw.private_value >> 16);
  mask = (unsigned char)(channel -> hw.private_value);
  if ( channel -> hw.private_value & 0x1000 ) mute ^= SND_MIX_MUTE;
#if 0
  snd_printk( "mute: regl = 0x%x(0x%x), regr = 0x%x(0x%x), mask = 0x%x,
mute = 0x%x\n", regl, snd_cs4231_in( mixer -> private_data, regl ),
regr, snd_cs4231_in( mixer -> private_data, regr ), mask, mute );
#endif
  codec = (cs4231_t *)mixer -> private_data;
  snd_spin_lock( codec, reg, &flags );
##snd_cs4231_outm( codec, regl, ~mask, (mute & SND_MIX_MUTE_LEFT) ? mask
: 0 ); 
  snd_cs4231_outm( codec, regl, ~mask, (mute & SND_MIX_MUTE_LEFT) ?
                                        channel->hw.private_value & 0xFF
: 0 ); 
  if ( channel -> hw.stereo )
##  snd_cs4231_outm( codec, regr, ~mask, (mute & SND_MIX_MUTE_RIGHT) ?
mask : 0 );
    snd_cs4231_outm( codec, regr, ~mask, (mute & SND_MIX_MUTE_RIGHT) ?
                                        channel->hw.private_value & 0xFF
: 0 ); 
  snd_spin_unlock( codec, reg, &flags );
}


		Joris.

P.S. I started code-reading on the mozart.c file. This one isn't as big
     as the cs4231.c file so I will be finished with it quite soon :-)
     And then, the 'hard work' starts ;-)) Don't expect anything too
     soon, because this weekend I have to replace the water pipes in my
     house (replace plump with cupper) so I don't know how much time
     there will be left for ALSA.
-- 
+----------------------------------+-----------------------------------+
| Joris Jansen                     | Alcatel Telecom Nederland         |
| jansen@ats.nld.alcatel.nl        | Postbus 3292                      |
| phone +31 (70) 307 9136          | 2280 GG  Rijswijk (ZH)            |
| fax   +31 (70) 307 9191          | The Netherlands                   |
+----------------------------------+-----------------------------------+
| No question is too silly to ask, though some are too silly to answer |
+----------------------------------------------------------------------+

