ac97_patch.c revision 171140
138032Speter/*- 2261363Sgshapiro * Copyright (c) 2002 Orion Hodson 364565Sgshapiro * All rights reserved. 438032Speter * 538032Speter * Redistribution and use in source and binary forms, with or without 638032Speter * modification, are permitted provided that the following conditions 738032Speter * are met: 838032Speter * 1. Redistributions of source code must retain the above copyright 938032Speter * notice, this list of conditions and the following disclaimer. 1038032Speter * 2. Redistributions in binary form must reproduce the above copyright 1138032Speter * notice, this list of conditions and the following disclaimer in the 1238032Speter * documentation and/or other materials provided with the distribution. 1338032Speter * 1490795Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1590795Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1690795Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17261363Sgshapiro * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1864565Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1964565Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2064565Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2190795Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2238032Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23266692Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2464565Sgshapiro * SUCH DAMAGE. 2538032Speter */ 2638032Speter 2738032Speter#include <dev/sound/pcm/sound.h> 2838032Speter#include <dev/sound/pcm/ac97.h> 2938032Speter#include <dev/sound/pcm/ac97_patch.h> 3038032Speter 3138032SpeterSND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/ac97_patch.c 171140 2007-07-01 17:28:58Z ariff $"); 3238032Speter 3338032Spetervoid ad1886_patch(struct ac97_info* codec) 3438032Speter{ 3538032Speter#define AC97_AD_JACK_SPDIF 0x72 3638032Speter /* 3738032Speter * Presario700 workaround 3838032Speter * for Jack Sense/SPDIF Register misetting causing 3938032Speter * no audible output 4038081Speter * by Santiago Nullo 04/05/2002 4138032Speter */ 4238032Speter ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 0x0010); 4364565Sgshapiro} 4464565Sgshapiro 4564565Sgshapirovoid ad198x_patch(struct ac97_info* codec) 4638032Speter{ 4738032Speter switch (ac97_getsubvendor(codec)) { 4864565Sgshapiro case 0x11931043: /* Not for ASUS A9T (probably else too). */ 4938032Speter break; 5038032Speter default: 5138032Speter ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420); 5238032Speter break; 5338032Speter } 5438032Speter} 5538032Speter 5690795Sgshapirovoid ad1981b_patch(struct ac97_info* codec) 5798125Sgshapiro{ 5890795Sgshapiro /* 5938032Speter * Enable headphone jack sensing. 60105016Sgshapiro */ 61105016Sgshapiro switch (ac97_getsubvendor(codec)) { 6238032Speter case 0x02d91014: /* IBM Thinkcentre */ 6338032Speter ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 6464565Sgshapiro ac97_rdcd(codec, AC97_AD_JACK_SPDIF) | 0x0800); 6538032Speter break; 6638032Speter default: 6764565Sgshapiro break; 6838032Speter } 6938032Speter} 7038032Speter 7138032Spetervoid cmi9739_patch(struct ac97_info* codec) 7290795Sgshapiro{ 7390795Sgshapiro /* 7464565Sgshapiro * Few laptops need extra register initialization 7538032Speter * to power up the internal speakers. 7638032Speter */ 7790795Sgshapiro switch (ac97_getsubvendor(codec)) { 7890795Sgshapiro case 0x18431043: /* ASUS W1000N */ 7990795Sgshapiro ac97_wrcd(codec, AC97_REG_POWER, 0x000f); 8090795Sgshapiro ac97_wrcd(codec, AC97_MIXEXT_CLFE, 0x0000); 8190795Sgshapiro ac97_wrcd(codec, 0x64, 0x7110); 8264565Sgshapiro break; 8338032Speter default: 8438032Speter break; 8538032Speter } 8638032Speter} 8738032Speter 8838032Spetervoid alc655_patch(struct ac97_info* codec) 8990795Sgshapiro{ 9090795Sgshapiro /* 9190795Sgshapiro * MSI (Micro-Star International) specific EAPD quirk. 9290795Sgshapiro */ 9390795Sgshapiro switch (ac97_getsubvendor(codec)) { 9464565Sgshapiro case 0x00611462: /* MSI S250 */ 9538032Speter case 0x01311462: /* MSI S270 */ 9664565Sgshapiro case 0x01611462: /* LG K1 Express */ 9764565Sgshapiro case 0x03511462: /* MSI L725 */ 9864565Sgshapiro ac97_wrcd(codec, 0x7a, ac97_rdcd(codec, 0x7a) & 0xfffd); 99141862Sgshapiro break; 100141862Sgshapiro case 0x10ca1734: 10164565Sgshapiro /* 10264565Sgshapiro * Amilo Pro V2055 with ALC655 has phone out by default 10364565Sgshapiro * disabled (surround on), leaving us only with internal 10464565Sgshapiro * speakers. This should really go to mixer. We write the 10564565Sgshapiro * Data Flow Control reg. 10664565Sgshapiro */ 10764565Sgshapiro ac97_wrcd(codec, 0x6a, ac97_rdcd(codec, 0x6a) | 0x0001); 10864565Sgshapiro break; 10964565Sgshapiro default: 11064565Sgshapiro break; 11164565Sgshapiro } 11264565Sgshapiro} 11364565Sgshapiro