* remove ac97 code
* style clean up git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29528 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0db1930895
commit
b06fce1203
@ -1,8 +1,8 @@
|
||||
SubDir HAIKU_TOP src add-ons kernel drivers audio ac97 es1370 ;
|
||||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
UsePrivateHeaders media ;
|
||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ;
|
||||
|
||||
KernelAddon es1370 :
|
||||
debug.c
|
||||
|
@ -1,296 +0,0 @@
|
||||
/*
|
||||
* Auich BeOS Driver for Intel Southbridge audio
|
||||
*
|
||||
* Copyright (c) 2003, Jerome Duval (jerome.duval@free.fr)
|
||||
*
|
||||
* Original code : BeOS Driver for Intel ICH AC'97 Link interface
|
||||
* Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
|
||||
*
|
||||
* All rights reserved.
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#include <OS.h>
|
||||
#include <stdio.h>
|
||||
#include <MediaDefs.h>
|
||||
#include "ac97.h"
|
||||
|
||||
#define REVERSE_EAMP_POLARITY 0
|
||||
|
||||
#include "debug.h"
|
||||
#include "io.h"
|
||||
|
||||
#define B_UTF8_REGISTERED "\xC2\xAE"
|
||||
|
||||
const char * stereo_enhancement_technique[] =
|
||||
{
|
||||
"No 3D Stereo Enhancement",
|
||||
"Analog Devices",
|
||||
"Creative Technology",
|
||||
"National Semiconductor",
|
||||
"Yamaha",
|
||||
"BBE Sound",
|
||||
"Crystal Semiconductor",
|
||||
"Qsound Labs",
|
||||
"Spatializer Audio Laboratories",
|
||||
"SRS Labs",
|
||||
"Platform Tech",
|
||||
"AKM Semiconductor",
|
||||
"Aureal",
|
||||
"Aztech Labs",
|
||||
"Binaura",
|
||||
"ESS Technology",
|
||||
"Harman International",
|
||||
"Nvidea",
|
||||
"Philips",
|
||||
"Texas Instruments",
|
||||
"VLSI Technology",
|
||||
"TriTech",
|
||||
"Realtek",
|
||||
"Samsung",
|
||||
"Wolfson Microelectronics",
|
||||
"Delta Integration",
|
||||
"SigmaTel",
|
||||
"KS Waves",
|
||||
"Rockwell",
|
||||
"Unknown (29)",
|
||||
"Unknown (30)",
|
||||
"Unknown (31)"
|
||||
};
|
||||
|
||||
typedef void (* codec_init)(device_config *);
|
||||
typedef void (* codec_amp_enable)(device_config *, bool);
|
||||
|
||||
typedef struct codec_ops_tag
|
||||
{
|
||||
codec_init init;
|
||||
codec_amp_enable amp_enable;
|
||||
} codec_ops;
|
||||
|
||||
typedef struct codec_table_tag
|
||||
{
|
||||
uint32 id;
|
||||
uint32 mask;
|
||||
codec_ops *ops;
|
||||
const char *info;
|
||||
} codec_table;
|
||||
|
||||
void default_init(device_config *);
|
||||
void ad1886_init(device_config *);
|
||||
|
||||
void default_amp_enable(device_config *, bool);
|
||||
void cs4299_amp_enable(device_config *, bool);
|
||||
|
||||
codec_ops default_ops = { default_init, default_amp_enable };
|
||||
codec_ops ad1886_ops = { ad1886_init, default_amp_enable };
|
||||
codec_ops cs4299_ops = { default_init, cs4299_amp_enable };
|
||||
|
||||
codec_table codecs[] =
|
||||
{
|
||||
/* Vendor ID and description imported from FreeBSD src/sys/dev/sound/pcm/ac97.c */
|
||||
{ 0x414b4d00, 0xffffffff, &default_ops, "Asahi Kasei AK4540" },
|
||||
{ 0x414b4d01, 0xffffffff, &default_ops, "Asahi Kasei AK4542" },
|
||||
{ 0x414b4d02, 0xffffffff, &default_ops, "Asahi Kasei AK4543" },
|
||||
{ 0x43525900, 0xffffffff, &default_ops, "Cirrus Logic CS4297" },
|
||||
{ 0x43525903, 0xffffffff, &default_ops, "Cirrus Logic CS4297" },
|
||||
{ 0x43525913, 0xffffffff, &default_ops, "Cirrus Logic CS4297A" },
|
||||
{ 0x43525914, 0xffffffff, &default_ops, "Cirrus Logic CS4297B" },
|
||||
{ 0x43525923, 0xffffffff, &default_ops, "Cirrus Logic CS4294C" },
|
||||
{ 0x4352592b, 0xffffffff, &default_ops, "Cirrus Logic CS4298C" },
|
||||
{ 0x43525931, 0xffffffff, &cs4299_ops, "Cirrus Logic CS4299A" },
|
||||
{ 0x43525933, 0xffffffff, &cs4299_ops, "Cirrus Logic CS4299C" },
|
||||
{ 0x43525934, 0xffffffff, &cs4299_ops, "Cirrus Logic CS4299D" },
|
||||
{ 0x43525941, 0xffffffff, &default_ops, "Cirrus Logic CS4201A" },
|
||||
{ 0x43525951, 0xffffffff, &default_ops, "Cirrus Logic CS4205A" },
|
||||
{ 0x43525961, 0xffffffff, &default_ops, "Cirrus Logic CS4291A" },
|
||||
{ 0x45838308, 0xffffffff, &default_ops, "ESS Technology ES1921" },
|
||||
{ 0x49434511, 0xffffffff, &default_ops, "ICEnsemble ICE1232" },
|
||||
{ 0x4e534331, 0xffffffff, &default_ops, "National Semiconductor LM4549" },
|
||||
{ 0x83847600, 0xffffffff, &default_ops, "SigmaTel STAC9700/9783/9784" },
|
||||
{ 0x83847604, 0xffffffff, &default_ops, "SigmaTel STAC9701/9703/9704/9705" },
|
||||
{ 0x83847605, 0xffffffff, &default_ops, "SigmaTel STAC9704" },
|
||||
{ 0x83847608, 0xffffffff, &default_ops, "SigmaTel STAC9708/9711" },
|
||||
{ 0x83847609, 0xffffffff, &default_ops, "SigmaTel STAC9721/9723" },
|
||||
{ 0x83847644, 0xffffffff, &default_ops, "SigmaTel STAC9744" },
|
||||
{ 0x83847656, 0xffffffff, &default_ops, "SigmaTel STAC9756/9757" },
|
||||
{ 0x53494c22, 0xffffffff, &default_ops, "Silicon Laboratory Si3036" },
|
||||
{ 0x53494c23, 0xffffffff, &default_ops, "Silicon Laboratory Si3038" },
|
||||
{ 0x54524103, 0xffffffff, &default_ops, "TriTech TR?????" },
|
||||
{ 0x54524106, 0xffffffff, &default_ops, "TriTech TR28026" },
|
||||
{ 0x54524108, 0xffffffff, &default_ops, "TriTech TR28028" },
|
||||
{ 0x54524123, 0xffffffff, &default_ops, "TriTech TR28602" },
|
||||
{ 0x574d4c00, 0xffffffff, &default_ops, "Wolfson WM9701A" },
|
||||
{ 0x574d4c03, 0xffffffff, &default_ops, "Wolfson WM9703/9704" },
|
||||
{ 0x574d4c04, 0xffffffff, &default_ops, "Wolfson WM9704 (quad)" },
|
||||
/* Assembled from datasheets: */
|
||||
{ 0x41445303, 0xffffffff, &default_ops, "Analog Devices AD1819B SoundPort"B_UTF8_REGISTERED },
|
||||
{ 0x41445340, 0xffffffff, &default_ops, "Analog Devices AD1881 SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445348, 0xffffffff, &default_ops, "Analog Devices AD1881A SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445360, 0xffffffff, &default_ops, "Analog Devices AD1885 SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445361, 0xffffffff, &ad1886_ops, "Analog Devices AD1886 SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445362, 0xffffffff, &default_ops, "Analog Devices AD1887 SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445363, 0xffffffff, &default_ops, "Analog Devices AD1886A SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445371, 0xffffffff, &default_ops, "Analog Devices AD1981A SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x41445372, 0xffffffff, &default_ops, "Analog Devices AD1981A SoundMAX"B_UTF8_REGISTERED },
|
||||
{ 0x414c4320, 0xfffffff0, &default_ops, "Avance Logic (Realtek) ALC100/ALC100P, RL5383/RL5522" },
|
||||
{ 0x414c4730, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC101" },
|
||||
#if 0
|
||||
{ 0x414c4710, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC200/ALC200A" }, /* datasheet says id2 = 4710 */
|
||||
{ 0x414c4710, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC201/ALC201A" }, /* 4710 or 4720 */
|
||||
{ 0x414c4720, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC650" }, /* datasheet says id2 = 4720 */
|
||||
#else
|
||||
{ 0x414c4710, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC200/ALC200A or ALC201/ALC201A" },
|
||||
{ 0x414c4720, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC650 or ALC201/ALC201A" },
|
||||
#endif
|
||||
{ 0x414c4740, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC202/ALC202A" },
|
||||
/* Vendors only: */
|
||||
{ 0x41445300, 0xffffff00, &default_ops, "Analog Devices" },
|
||||
{ 0x414b4d00, 0xffffff00, &default_ops, "Asahi Kasei" },
|
||||
{ 0x414c4700, 0xffffff00, &default_ops, "Avance Logic (Realtek)" },
|
||||
{ 0x43525900, 0xffffff00, &default_ops, "Cirrus Logic" },
|
||||
{ 0x45838300, 0xffffff00, &default_ops, "ESS Technology" },
|
||||
{ 0x49434500, 0xffffff00, &default_ops, "ICEnsemble" },
|
||||
{ 0x4e534300, 0xffffff00, &default_ops, "National Semiconductor" },
|
||||
{ 0x83847600, 0xffffff00, &default_ops, "SigmaTel" },
|
||||
{ 0x53494c00, 0xffffff00, &default_ops, "Silicon Laboratory" },
|
||||
{ 0x54524100, 0xffffff00, &default_ops, "TriTech" },
|
||||
{ 0x574d4c00, 0xffffff00, &default_ops, "Wolfson" },
|
||||
{ 0x00000000, 0x00000000, &default_ops, "Unknown" } /* must be last one, matches every codec */
|
||||
};
|
||||
|
||||
static codec_table *
|
||||
find_codec_table(uint32 codecid)
|
||||
{
|
||||
codec_table *codec;
|
||||
for (codec = codecs; codec->id; codec++)
|
||||
if ((codec->id & codec->mask) == (codecid & codec->mask))
|
||||
break;
|
||||
return codec;
|
||||
}
|
||||
|
||||
const char *
|
||||
ac97_get_3d_stereo_enhancement(device_config *config)
|
||||
{
|
||||
uint16 data;
|
||||
data = auich_codec_read(config, AC97_RESET);
|
||||
data = (data >> 10) & 31;
|
||||
return stereo_enhancement_technique[data];
|
||||
}
|
||||
|
||||
const char *
|
||||
ac97_get_vendor_id_description(device_config *config)
|
||||
{
|
||||
uint32 id = ac97_get_vendor_id(config);
|
||||
codec_table *codec = find_codec_table(id);
|
||||
char f = (id >> 24) & 0xff;
|
||||
char s = (id >> 16) & 0xff;
|
||||
char t = (id >> 8) & 0xff;
|
||||
if (f == 0) f = '?';
|
||||
if (s == 0) s = '?';
|
||||
if (t == 0) t = '?';
|
||||
LOG(("codec %c%c%c %u\n",f,s,t,id & 0xff));
|
||||
LOG(("info: %s\n",codec->info));
|
||||
return codec->info;
|
||||
}
|
||||
|
||||
uint32
|
||||
ac97_get_vendor_id(device_config *config)
|
||||
{
|
||||
uint16 data1;
|
||||
uint16 data2;
|
||||
data1 = auich_codec_read(config, AC97_VENDOR_ID1);
|
||||
data2 = auich_codec_read(config, AC97_VENDOR_ID2);
|
||||
return (((uint32)data1) << 16) | data2;
|
||||
}
|
||||
|
||||
void
|
||||
ac97_amp_enable(device_config *config, bool yesno)
|
||||
{
|
||||
codec_table *codec;
|
||||
LOG(("ac97_amp_enable\n"));
|
||||
codec = find_codec_table(ac97_get_vendor_id(config));
|
||||
codec->ops->amp_enable(config, yesno);
|
||||
}
|
||||
|
||||
void
|
||||
ac97_init(device_config *config)
|
||||
{
|
||||
codec_table *codec;
|
||||
LOG(("ac97_init\n"));
|
||||
codec = find_codec_table(ac97_get_vendor_id(config));
|
||||
codec->ops->init(config);
|
||||
|
||||
auich_codec_write(config, AC97_EXTENDED_AUDIO_STATUS,
|
||||
auich_codec_read(config, AC97_EXTENDED_AUDIO_STATUS) | 1);
|
||||
|
||||
}
|
||||
|
||||
void default_init(device_config *config)
|
||||
{
|
||||
LOG(("default_init\n"));
|
||||
}
|
||||
|
||||
void ad1886_init(device_config *config)
|
||||
{
|
||||
LOG(("ad1886_init\n"));
|
||||
auich_codec_write(config, 0x72, 0x0010);
|
||||
}
|
||||
|
||||
void default_amp_enable(device_config *config, bool yesno)
|
||||
{
|
||||
LOG(("default_amp_enable\n"));
|
||||
LOG(("powerdown register was = %#04x\n",auich_codec_read(config, AC97_POWERDOWN)));
|
||||
#if REVERSE_EAMP_POLARITY
|
||||
yesno = !yesno;
|
||||
LOG(("using reverse eamp polarity\n"));
|
||||
#endif
|
||||
if (yesno)
|
||||
auich_codec_write(config, AC97_POWERDOWN, auich_codec_read(config, AC97_POWERDOWN) & ~0x8000); /* switch on (low active) */
|
||||
else
|
||||
auich_codec_write(config, AC97_POWERDOWN, auich_codec_read(config, AC97_POWERDOWN) | 0x8000); /* switch off */
|
||||
LOG(("powerdown register is = %#04x\n", auich_codec_read(config, AC97_POWERDOWN)));
|
||||
}
|
||||
|
||||
void cs4299_amp_enable(device_config *config, bool yesno)
|
||||
{
|
||||
LOG(("cs4299_amp_enable\n"));
|
||||
if (yesno)
|
||||
auich_codec_write(config, 0x68, 0x8004);
|
||||
else
|
||||
auich_codec_write(config, 0x68, 0);
|
||||
}
|
||||
|
||||
const ac97_source_info source_info[] = {
|
||||
{ "Recording", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO|B_MIX_RECORDMUX, 100, AC97_RECORD_GAIN, 0x8000, 4, 0, 1, 0, 0.0, 22.5, 1.5 },
|
||||
{ "Master", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 101, AC97_MASTER_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 },
|
||||
//{ "Bass/Treble", B_MIX_GAIN|B_MIX_STEREO, 102, AC97_MASTER_TONE, 0x0f0f, 4, 0, 1, 1,-12.0, 10.5, 1.5 },
|
||||
//{ "Aux Out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 103, AC97_AUX_OUT_VOLUME, 0x8000, 5, 0, 1, 1,-46.5, 0.0, 1.5 },
|
||||
{ "PCM Out", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 104, AC97_PCM_OUT_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
{ "CD", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 105, AC97_CD_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
{ "Aux In", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 106, AC97_AUX_IN_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
{ "TAD", B_MIX_GAIN|B_MIX_MUTE|B_MIX_MONO, 107, AC97_PHONE_VOLUME, 0x8008, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
{ "Mic", B_MIX_GAIN|B_MIX_MUTE|B_MIX_MONO|B_MIX_MICBOOST, 108, AC97_MIC_VOLUME, 0x8008, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
{ "Line In", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 109, AC97_LINE_IN_VOLUME, 0x8808, 5, 0, 1, 1,-34.5, 12.0, 1.5 },
|
||||
//{ "Center/Lfe", B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 111, AC97_CENTER_LFE_VOLUME, 0x8080, 5, 0, 1, 1,-46.5, 0.0, 1.5 },
|
||||
{ "Center/Lfe" /* should be "Surround" but no */, B_MIX_GAIN|B_MIX_MUTE|B_MIX_STEREO, 110, AC97_SURROUND_VOLUME, 0x8080, 5, 0, 1, 1,-46.5, 0.0, 1.5 }
|
||||
};
|
||||
|
||||
const int32 source_info_size = (sizeof(source_info)/sizeof(source_info[0]));
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Auich BeOS Driver for Intel Southbridge audio
|
||||
*
|
||||
* Copyright (c) 2003, Jerome Duval (jerome.duval@free.fr)
|
||||
*
|
||||
* Original code : BeOS Driver for Intel ICH AC'97 Link interface
|
||||
* Copyright (c) 2002, Marcus Overhagen <marcus@overhagen.de>
|
||||
*
|
||||
* All rights reserved.
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _AC97_H_
|
||||
#define _AC97_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
enum AC97_REGISTER {
|
||||
AC97_RESET = 0x00,
|
||||
AC97_MASTER_VOLUME = 0x02,
|
||||
AC97_AUX_OUT_VOLUME = 0x04,
|
||||
AC97_MONO_VOLUME = 0x06,
|
||||
AC97_MASTER_TONE = 0x08,
|
||||
AC97_PC_BEEP_VOLUME = 0x0A,
|
||||
AC97_PHONE_VOLUME = 0x0C,
|
||||
AC97_MIC_VOLUME = 0x0E,
|
||||
AC97_LINE_IN_VOLUME = 0x10,
|
||||
AC97_CD_VOLUME = 0x12,
|
||||
AC97_VIDEO_VOLUME = 0x14,
|
||||
AC97_AUX_IN_VOLUME = 0x16,
|
||||
AC97_PCM_OUT_VOLUME = 0x18,
|
||||
AC97_RECORD_SELECT = 0x1A,
|
||||
AC97_RECORD_GAIN = 0x1C,
|
||||
AC97_RECORD_GAIN_MIC = 0x1E,
|
||||
AC97_GENERAL_PURPOSE = 0x20,
|
||||
AC97_3D_CONTROL = 0x22,
|
||||
AC97_PAGING = 0x24,
|
||||
AC97_POWERDOWN = 0x26,
|
||||
AC97_EXTENDED_AUDIO_ID = 0x28,
|
||||
AC97_EXTENDED_AUDIO_STATUS = 0x2A,
|
||||
AC97_PCM_FRONT_DAC_RATE = 0x2C,
|
||||
AC97_PCM_SURR_DAC_RATE = 0x2E,
|
||||
AC97_PCM_LFE_DAC_RATE = 0x30,
|
||||
AC97_PCM_LR_ADC_RATE = 0x32,
|
||||
AC97_MIC_ADC_RATE = 0x34,
|
||||
AC97_CENTER_LFE_VOLUME = 0x36,
|
||||
AC97_SURROUND_VOLUME = 0x38,
|
||||
AC97_SPDIF_CONTROL = 0x3A,
|
||||
AC97_VENDOR_ID1 = 0x7C,
|
||||
AC97_VENDOR_ID2 = 0x7E
|
||||
};
|
||||
|
||||
const char * ac97_get_3d_stereo_enhancement(device_config *config);
|
||||
const char * ac97_get_vendor_id_description(device_config *config);
|
||||
uint32 ac97_get_vendor_id(device_config *config);
|
||||
void ac97_init(device_config *config);
|
||||
|
||||
void ac97_amp_enable(device_config *config, bool yesno);
|
||||
|
||||
typedef enum {
|
||||
B_MIX_GAIN = 1 << 0,
|
||||
B_MIX_MUTE = 1 << 1,
|
||||
B_MIX_MONO = 1 << 2,
|
||||
B_MIX_STEREO = 1 << 3,
|
||||
B_MIX_MUX = 1 << 4,
|
||||
B_MIX_MICBOOST = 1 << 5,
|
||||
B_MIX_RECORDMUX = 1 << 6
|
||||
} ac97_mixer_type;
|
||||
|
||||
typedef struct _ac97_source_info {
|
||||
const char *name;
|
||||
ac97_mixer_type type;
|
||||
|
||||
int32 id;
|
||||
uint8 reg;
|
||||
uint16 default_value;
|
||||
uint8 bits:3;
|
||||
uint8 ofs:4;
|
||||
uint8 mute:1;
|
||||
uint8 polarity:1; // max_gain -> 0
|
||||
float min_gain;
|
||||
float max_gain;
|
||||
float granularity;
|
||||
} ac97_source_info;
|
||||
|
||||
extern const ac97_source_info source_info[];
|
||||
extern const int32 source_info_size;
|
||||
|
||||
#endif
|
@ -125,7 +125,7 @@ es1370_ac97_set_mix(void *card, const void *cookie, int32 type, float *values) {
|
||||
value = es1370_codec_read(&dev->config, info->reg);
|
||||
value &= ~mask;
|
||||
value |= ((values[0] == 1.0 ? 1 : 0 ) << 15 & mask);
|
||||
if(info->reg == AC97_SURROUND_VOLUME) {
|
||||
if(info->reg == AC97_SURR_VOLUME) {
|
||||
// there is a independent mute for each channel
|
||||
mask = ((1 << 1) - 1) << 7;
|
||||
value &= ~mask;
|
||||
@ -178,12 +178,12 @@ es1370_create_controls_list(multi_dev *multi)
|
||||
}
|
||||
|
||||
static status_t
|
||||
es1370_get_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
es1370_get_mix(es1370_dev *card, multi_mix_value_info * mmvi)
|
||||
{
|
||||
int32 i, id;
|
||||
multi_mixer_control *control = NULL;
|
||||
for(i=0; i<MMVI->item_count; i++) {
|
||||
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
for(i = 0; i < mmvi->item_count; i++) {
|
||||
id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
if(id < 0 || id >= card->multi.control_count) {
|
||||
PRINT(("es1370_get_mix : invalid control id requested : %li\n", id));
|
||||
continue;
|
||||
@ -195,34 +195,34 @@ es1370_get_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
float values[2];
|
||||
control->get(card, control->cookie, control->type, values);
|
||||
if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
|
||||
MMVI->values[i].u.gain = values[0];
|
||||
mmvi->values[i].u.gain = values[0];
|
||||
else
|
||||
MMVI->values[i].u.gain = values[1];
|
||||
mmvi->values[i].u.gain = values[1];
|
||||
}
|
||||
}
|
||||
|
||||
if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) {
|
||||
float values[1];
|
||||
control->get(card, control->cookie, control->type, values);
|
||||
MMVI->values[i].u.enable = (values[0] == 1.0);
|
||||
mmvi->values[i].u.enable = (values[0] == 1.0);
|
||||
}
|
||||
|
||||
if(control->mix_control.flags & B_MULTI_MIX_MUX && control->get) {
|
||||
float values[1];
|
||||
control->get(card, control->cookie, control->type, values);
|
||||
MMVI->values[i].u.mux = (int32)values[0];
|
||||
mmvi->values[i].u.mux = (int32)values[0];
|
||||
}
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
static status_t
|
||||
es1370_set_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
es1370_set_mix(es1370_dev *card, multi_mix_value_info * mmvi)
|
||||
{
|
||||
int32 i, id;
|
||||
multi_mixer_control *control = NULL;
|
||||
for(i=0; i<MMVI->item_count; i++) {
|
||||
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
for(i = 0; i < mmvi->item_count; i++) {
|
||||
id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
if(id < 0 || id >= card->multi.control_count) {
|
||||
PRINT(("es1370_set_mix : invalid control id requested : %li\n", id));
|
||||
continue;
|
||||
@ -231,8 +231,8 @@ es1370_set_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
|
||||
if(control->mix_control.flags & B_MULTI_MIX_GAIN) {
|
||||
multi_mixer_control *control2 = NULL;
|
||||
if(i+1<MMVI->item_count) {
|
||||
id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
if(i+1<mmvi->item_count) {
|
||||
id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
if(id < 0 || id >= card->multi.control_count) {
|
||||
PRINT(("es1370_set_mix : invalid control id requested : %li\n", id));
|
||||
} else {
|
||||
@ -248,12 +248,12 @@ es1370_set_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
values[1] = 0.0;
|
||||
|
||||
if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID)
|
||||
values[0] = MMVI->values[i].u.gain;
|
||||
values[0] = mmvi->values[i].u.gain;
|
||||
else
|
||||
values[1] = MMVI->values[i].u.gain;
|
||||
values[1] = mmvi->values[i].u.gain;
|
||||
|
||||
if(control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID)
|
||||
values[1] = MMVI->values[i+1].u.gain;
|
||||
values[1] = mmvi->values[i+1].u.gain;
|
||||
|
||||
control->set(card, control->cookie, control->type, values);
|
||||
}
|
||||
@ -265,14 +265,14 @@ es1370_set_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) {
|
||||
float values[1];
|
||||
|
||||
values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0;
|
||||
values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0;
|
||||
control->set(card, control->cookie, control->type, values);
|
||||
}
|
||||
|
||||
if(control->mix_control.flags & B_MULTI_MIX_MUX && control->set) {
|
||||
float values[1];
|
||||
|
||||
values[0] = (float)MMVI->values[i].u.mux;
|
||||
values[0] = (float)mmvi->values[i].u.mux;
|
||||
control->set(card, control->cookie, control->type, values);
|
||||
}
|
||||
}
|
||||
@ -280,22 +280,22 @@ es1370_set_mix(es1370_dev *card, multi_mix_value_info * MMVI)
|
||||
}
|
||||
|
||||
static status_t
|
||||
es1370_list_mix_controls(es1370_dev *card, multi_mix_control_info * MMCI)
|
||||
es1370_list_mix_controls(es1370_dev *card, multi_mix_control_info * mmci)
|
||||
{
|
||||
multi_mix_control *MMC;
|
||||
multi_mix_control *mmc;
|
||||
int32 i;
|
||||
|
||||
MMC = MMCI->controls;
|
||||
if(MMCI->control_count < 24)
|
||||
mmc = mmci->controls;
|
||||
if(mmci->control_count < 24)
|
||||
return B_ERROR;
|
||||
|
||||
if(es1370_create_controls_list(&card->multi) < B_OK)
|
||||
return B_ERROR;
|
||||
for(i=0; i<card->multi.control_count; i++) {
|
||||
MMC[i] = card->multi.controls[i].mix_control;
|
||||
for(i = 0; i < card->multi.control_count; i++) {
|
||||
mmc[i] = card->multi.controls[i].mix_control;
|
||||
}
|
||||
|
||||
MMCI->control_count = card->multi.control_count;
|
||||
mmci->control_count = card->multi.control_count;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ es1370_create_channels_list(multi_dev *multi)
|
||||
else
|
||||
designations = B_CHANNEL_SURROUND_BUS;
|
||||
|
||||
for(i=0; i<stream->channels; i++) {
|
||||
for(i = 0; i < stream->channels; i++) {
|
||||
chans[index].channel_id = index;
|
||||
chans[index].kind = (mode == ES1370_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL;
|
||||
chans[index].designations = designations | chan_designations[i];
|
||||
@ -550,7 +550,7 @@ es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
|
||||
if(bufcount > data->request_playback_buffers)
|
||||
bufcount = data->request_playback_buffers;
|
||||
|
||||
for(i=0; i<bufcount; i++)
|
||||
for(i = 0; i < bufcount; i++)
|
||||
for(j=0; j<pchannels; j++)
|
||||
es1370_stream_get_nth_buffer(card->pstream, j, i,
|
||||
&data->playback_buffers[i][j].base,
|
||||
@ -564,7 +564,7 @@ es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
|
||||
if(bufcount > data->request_record_buffers)
|
||||
bufcount = data->request_record_buffers;
|
||||
|
||||
for(i=0; i<bufcount; i++)
|
||||
for(i = 0; i < bufcount; i++)
|
||||
for(j=0; j<rchannels; j++)
|
||||
es1370_stream_get_nth_buffer(card->rstream, j, i,
|
||||
&data->record_buffers[i][j].base,
|
||||
|
Loading…
x
Reference in New Issue
Block a user