ac97_patch.c revision 166488
118334Speter/*-
218334Speter * Copyright (c) 2002 Orion Hodson
318334Speter * All rights reserved.
418334Speter *
518334Speter * Redistribution and use in source and binary forms, with or without
618334Speter * modification, are permitted provided that the following conditions
718334Speter * are met:
818334Speter * 1. Redistributions of source code must retain the above copyright
918334Speter *    notice, this list of conditions and the following disclaimer.
1018334Speter * 2. Redistributions in binary form must reproduce the above copyright
1118334Speter *    notice, this list of conditions and the following disclaimer in the
1218334Speter *    documentation and/or other materials provided with the distribution.
1318334Speter *
1418334Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1518334Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1618334Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1718334Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1818334Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1918334Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2018334Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2118334Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2218334Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2318334Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2418334Speter * SUCH DAMAGE.
2518334Speter */
2618334Speter
2718334Speter#include <dev/sound/pcm/sound.h>
2818334Speter#include <dev/sound/pcm/ac97.h>
2918334Speter#include <dev/sound/pcm/ac97_patch.h>
3018334Speter
3118334SpeterSND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pcm/ac97_patch.c 166488 2007-02-04 06:52:33Z joel $");
3218334Speter
3318334Spetervoid ad1886_patch(struct ac97_info* codec)
3418334Speter{
3518334Speter#define AC97_AD_JACK_SPDIF 0x72
3618334Speter	/*
3718334Speter	 *    Presario700 workaround
3818334Speter	 *     for Jack Sense/SPDIF Register misetting causing
3918334Speter	 *    no audible output
4018334Speter	 *    by Santiago Nullo 04/05/2002
4118334Speter	 */
4218334Speter	ac97_wrcd(codec, AC97_AD_JACK_SPDIF, 0x0010);
4318334Speter}
4418334Speter
4518334Spetervoid ad198x_patch(struct ac97_info* codec)
4618334Speter{
4718334Speter	ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420);
4818334Speter}
4918334Speter
5018334Spetervoid ad1981b_patch(struct ac97_info* codec)
5118334Speter{
5218334Speter#if 0
5318334Speter	ac97_wrcd(codec, AC97_AD_JACK_SPDIF,
5418334Speter	    ac97_rdcd(codec, AC97_AD_JACK_SPDIF) | 0x0800);
5518334Speter#endif
5618334Speter}
5750397Sobrien
5850397Sobrienvoid cmi9739_patch(struct ac97_info* codec)
5950397Sobrien{
6018334Speter	/*
6118334Speter	 * Few laptops (notably ASUS W1000N) need extra register
6218334Speter	 * initialization to power up the internal speakers.
6318334Speter	 */
6418334Speter	ac97_wrcd(codec, AC97_REG_POWER, 0x000f);
6518334Speter	ac97_wrcd(codec, AC97_MIXEXT_CLFE, 0x0000);
6618334Speter	ac97_wrcd(codec, 0x64, 0x7110);
6718334Speter}
6818334Speter