From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 25 05:56:26 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0534D37B401 for ; Wed, 25 Jun 2003 05:56:26 -0700 (PDT) Received: from asterix.rsu.ru (asterix.rsu.ru [195.208.245.250]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7743F43FE9 for ; Wed, 25 Jun 2003 05:56:24 -0700 (PDT) (envelope-from os@rsu.ru) Received: from brain.cc.rsu.ru (brain.cc.rsu.ru [195.208.252.154]) (authenticated bits=0) by asterix.rsu.ru (8.12.9/8.12.9) with ESMTP id h5PCuF4e043885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 25 Jun 2003 16:56:15 +0400 (MSD) (envelope-from os@rsu.ru) Date: Wed, 25 Jun 2003 16:56:17 +0400 (MSD) From: Oleg Sharoiko X-X-Sender: os@brain.cc.rsu.ru To: hackers@freebsd.org Message-ID: <20030625162142.W547@brain.cc.rsu.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-98.9 required=5.0 tests=SUBJ_ALL_CAPS,USER_IN_WHITELIST version=2.54 X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) cc: Wheel of RSUNet Subject: VIA8235 + AD1980 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2003 12:56:26 -0000 Hello! I need some help from sound drivers guru. I have motherboard with via8235 and ad1980 (ac97 compatible codec from analog devices) FreeBSD's driver doesn't work correctly with this codec. The problem is that sound is quiet and it comes out the wrong jack (Mic jack instead of line out). I spent some time reading AD1980 specification and ALSA sources. I found a quick solution to this problems. Here is the core of it: void ad1980_patch(struct ac97_info* codec) { ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420); codec->mix[SOUND_MIXER_VOLUME].reg = AC97_MIXEXT_SURROUND; } Here are descritions of bits 0x0400 and 0x0020 from register 0x76 (from ad spec): --- 0x0020 LOSEL LINE_OUT Amplifiers Input Select. This bit allows the LINE_OUT output amplifiers to be driven by the mixer or the surround DACs. The main purpose for this is to allow swapping of the front and surround channels to make better use of the SURR/HP_OUT output amplifiers. This bit should normally be used in tandem with the HPSEL bit (see below). 0 = LINE_OUT amplifiers are driven by the mixer outputs (reset default). 1 = LINE_OUT amplifiers are driven by the surround DAC outputs. 0x0400 HPSEL Headphone Amplifier Input Select. This bit allows the headphone power amps to be driven from the surround DACs or from the mixer outputs. There are two reasons for this: one is to allow 2-channel media to use the higher power headphone amplifiers available on the SURR/HP_OUT outputs; the other is to allow spreading of 2-channel media to the surround outputs. Together with the LOSEL bit (see above), this bit also provides for analog swapping of the mixer (front) and surround outputs. 0 = SURR_out/HP_out outputs are driven by the surround DACs (reset default). 1 = SURR_out/HP_out outputs are driven by the mixer outputs. --- AC97_MIXEXT_SURROUND is the Surround mixer register. There is a small problem with this patch: AC97_MIXEXT_SURROUND has seprate mute bits for right and left channels and I don't see how can they be implemented in FreeBSD. I'd like to get to the roots of this problem and this is where I need some help. If I understood everything correctly than it happens so that the sound somehow goes to surround dac. The question that I cannot answer: why it goes to surround dac? Unfortunately I don't have via8235 spec. Myabe data are being put into wrong timeslots? -- Oleg Sharoiko. Software and Network Engineer Computer Center of Rostov State University.