ac97_patch.c revision 162957
190075Sobrien/*- 290075Sobrien * Copyright 2002 FreeBSD, Inc. All rights reserved. 390075Sobrien * 490075Sobrien * Redistribution and use in source and binary forms, with or without 590075Sobrien * modification, are permitted provided that the following conditions 690075Sobrien * are met: 790075Sobrien * 1. Redistributions of source code must retain the above copyright 890075Sobrien * notice, this list of conditions and the following disclaimer. 990075Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1090075Sobrien * notice, this list of conditions and the following disclaimer in the 1190075Sobrien * documentation and/or other materials provided with the distribution. 1290075Sobrien * 1390075Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1490075Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1590075Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1690075Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1790075Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1890075Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1990075Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2090075Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2190075Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2290075Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2390075Sobrien * SUCH DAMAGE. 2490075Sobrien */ 2590075Sobrien 2690075Sobrien#include <dev/sound/pcm/sound.h> 2790075Sobrien#include <dev/sound/pcm/ac97.h> 2890075Sobrien#include <dev/sound/pcm/ac97_patch.h> 2990075Sobrien 3090075SobrienSND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/ac97_patch.c 162957 2006-10-02 15:32:12Z ariff $"); 3190075Sobrien 3290075Sobrienvoid ad1886_patch(struct ac97_info* codec) 3390075Sobrien{ 3490075Sobrien#define AC97_AD_JACK_SPDIF 0x72 3590075Sobrien /* 3690075Sobrien * Presario700 workaround 3790075Sobrien * for Jack Sense/SPDIF Register misetting causing 3890075Sobrien * no audible output 3990075Sobrien * by Santiago Nullo 04/05/2002 4090075Sobrien */ 4190075Sobrien ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 0x0010); 4290075Sobrien} 4390075Sobrien 4490075Sobrienvoid ad198x_patch(struct ac97_info* codec) 4590075Sobrien{ 4690075Sobrien ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420); 4790075Sobrien} 4890075Sobrien 4990075Sobrienvoid ad1981b_patch(struct ac97_info* codec) 5090075Sobrien{ 5190075Sobrien#if 0 5290075Sobrien ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 5390075Sobrien ac97_rdcd(codec, AC97_AD_JACK_SPDIF) | 0x0800); 5490075Sobrien#endif 5590075Sobrien} 5690075Sobrien 5790075Sobrienvoid cmi9739_patch(struct ac97_info* codec) 5890075Sobrien{ 5990075Sobrien /* 6090075Sobrien * Few laptops (notably ASUS W1000N) need extra register 6190075Sobrien * initialization to power up the internal speakers. 6290075Sobrien */ 6390075Sobrien ac97_wrcd(codec, AC97_REG_POWER, 0x000f); 6490075Sobrien ac97_wrcd(codec, AC97_MIXEXT_CLFE, 0x0000); 6590075Sobrien ac97_wrcd(codec, 0x64, 0x7110); 6690075Sobrien} 6790075Sobrien