⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ac97_proc.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 2 页
字号:
/* *  Copyright (c) by Jaroslav Kysela <perex@suse.cz> *  Universal interface for Audio Codec '97 * *  For more details look to AC '97 component specification revision 2.2 *  by Intel Corporation (http://developer.intel.com). * * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * *   This program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA * */#include <sound/driver.h>#include <linux/slab.h>#include <sound/core.h>#include <sound/ac97_codec.h>#include <sound/asoundef.h>#include "ac97_local.h"#include "ac97_id.h"/* * proc interface */static void snd_ac97_proc_read_functions(ac97_t *ac97, snd_info_buffer_t *buffer){	int header = 0, function;	unsigned short info, sense_info;	static const char *function_names[12] = {		"Master Out", "AUX Out", "Center/LFE Out", "SPDIF Out",		"Phone In", "Mic 1", "Mic 2", "Line In", "CD In", "Video In",		"Aux In", "Mono Out"	};	static const char *locations[8] = {		"Rear I/O Panel", "Front Panel", "Motherboard", "Dock/External",		"reserved", "reserved", "reserved", "NC/unused"	};	for (function = 0; function < 12; ++function) {		snd_ac97_write(ac97, AC97_FUNC_SELECT, function << 1);		info = snd_ac97_read(ac97, AC97_FUNC_INFO);		if (!(info & 0x0001))			continue;		if (!header) {			snd_iprintf(buffer, "\n                    Gain     Inverted  Buffer delay  Location\n");			header = 1;		}		sense_info = snd_ac97_read(ac97, AC97_SENSE_INFO);		snd_iprintf(buffer, "%-17s: %3d.%d dBV    %c      %2d/fs         %s\n",			    function_names[function],			    (info & 0x8000 ? -1 : 1) * ((info & 0x7000) >> 12) * 3 / 2,			    ((info & 0x0800) >> 11) * 5,			    info & 0x0400 ? 'X' : '-',			    (info & 0x03e0) >> 5,			    locations[sense_info >> 13]);	}}static void snd_ac97_proc_read_main(ac97_t *ac97, snd_info_buffer_t * buffer, int subidx){	char name[64];	unsigned short val, tmp, ext, mext;	static const char *spdif_slots[4] = { " SPDIF=3/4", " SPDIF=7/8", " SPDIF=6/9", " SPDIF=10/11" };	static const char *spdif_rates[4] = { " Rate=44.1kHz", " Rate=res", " Rate=48kHz", " Rate=32kHz" };	static const char *spdif_rates_cs4205[4] = { " Rate=48kHz", " Rate=44.1kHz", " Rate=res", " Rate=res" };	static const char *double_rate_slots[4] = { "10/11", "7/8", "reserved", "reserved" };	snd_ac97_get_name(NULL, ac97->id, name, 0);	snd_iprintf(buffer, "%d-%d/%d: %s\n\n", ac97->addr, ac97->num, subidx, name);	if ((ac97->scaps & AC97_SCAP_AUDIO) == 0)		goto __modem;	if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) {		val = snd_ac97_read(ac97, AC97_INT_PAGING);		snd_ac97_update_bits(ac97, AC97_INT_PAGING,				     AC97_PAGE_MASK, AC97_PAGE_1);		tmp = snd_ac97_read(ac97, AC97_CODEC_CLASS_REV);		snd_iprintf(buffer, "Revision         : 0x%02x\n", tmp & 0xff);		snd_iprintf(buffer, "Compat. Class    : 0x%02x\n", (tmp >> 8) & 0x1f);		snd_iprintf(buffer, "Subsys. Vendor ID: 0x%04x\n",			    snd_ac97_read(ac97, AC97_PCI_SVID));		snd_iprintf(buffer, "Subsys. ID       : 0x%04x\n\n",			    snd_ac97_read(ac97, AC97_PCI_SID));		snd_ac97_update_bits(ac97, AC97_INT_PAGING,				     AC97_PAGE_MASK, val & AC97_PAGE_MASK);	}	// val = snd_ac97_read(ac97, AC97_RESET);	val = ac97->caps;	snd_iprintf(buffer, "Capabilities     :%s%s%s%s%s%s\n",	    	    val & AC97_BC_DEDICATED_MIC ? " -dedicated MIC PCM IN channel-" : "",		    val & AC97_BC_RESERVED1 ? " -reserved1-" : "",		    val & AC97_BC_BASS_TREBLE ? " -bass & treble-" : "",		    val & AC97_BC_SIM_STEREO ? " -simulated stereo-" : "",		    val & AC97_BC_HEADPHONE ? " -headphone out-" : "",		    val & AC97_BC_LOUDNESS ? " -loudness-" : "");	tmp = ac97->caps & AC97_BC_DAC_MASK;	snd_iprintf(buffer, "DAC resolution   : %s%s%s%s\n",		    tmp == AC97_BC_16BIT_DAC ? "16-bit" : "",		    tmp == AC97_BC_18BIT_DAC ? "18-bit" : "",		    tmp == AC97_BC_20BIT_DAC ? "20-bit" : "",		    tmp == AC97_BC_DAC_MASK ? "???" : "");	tmp = ac97->caps & AC97_BC_ADC_MASK;	snd_iprintf(buffer, "ADC resolution   : %s%s%s%s\n",		    tmp == AC97_BC_16BIT_ADC ? "16-bit" : "",		    tmp == AC97_BC_18BIT_ADC ? "18-bit" : "",		    tmp == AC97_BC_20BIT_ADC ? "20-bit" : "",		    tmp == AC97_BC_ADC_MASK ? "???" : "");	snd_iprintf(buffer, "3D enhancement   : %s\n",		snd_ac97_stereo_enhancements[(val >> 10) & 0x1f]);	snd_iprintf(buffer, "\nCurrent setup\n");	val = snd_ac97_read(ac97, AC97_MIC);	snd_iprintf(buffer, "Mic gain         : %s [%s]\n", val & 0x0040 ? "+20dB" : "+0dB", ac97->regs[AC97_MIC] & 0x0040 ? "+20dB" : "+0dB");	val = snd_ac97_read(ac97, AC97_GENERAL_PURPOSE);	snd_iprintf(buffer, "POP path         : %s 3D\n"		    "Sim. stereo      : %s\n"		    "3D enhancement   : %s\n"		    "Loudness         : %s\n"		    "Mono output      : %s\n"		    "Mic select       : %s\n"		    "ADC/DAC loopback : %s\n",		    val & 0x8000 ? "post" : "pre",		    val & 0x4000 ? "on" : "off",		    val & 0x2000 ? "on" : "off",		    val & 0x1000 ? "on" : "off",		    val & 0x0200 ? "Mic" : "MIX",		    val & 0x0100 ? "Mic2" : "Mic1",		    val & 0x0080 ? "on" : "off");	if (ac97->ext_id & AC97_EI_DRA)		snd_iprintf(buffer, "Double rate slots: %s\n",			    double_rate_slots[(val >> 10) & 3]);	ext = snd_ac97_read(ac97, AC97_EXTENDED_ID);	if (ext == 0)		goto __modem;			snd_iprintf(buffer, "Extended ID      : codec=%i rev=%i%s%s%s%s DSA=%i%s%s%s%s\n",			(ext & AC97_EI_ADDR_MASK) >> AC97_EI_ADDR_SHIFT,			(ext & AC97_EI_REV_MASK) >> AC97_EI_REV_SHIFT,			ext & AC97_EI_AMAP ? " AMAP" : "",			ext & AC97_EI_LDAC ? " LDAC" : "",			ext & AC97_EI_SDAC ? " SDAC" : "",			ext & AC97_EI_CDAC ? " CDAC" : "",			(ext & AC97_EI_DACS_SLOT_MASK) >> AC97_EI_DACS_SLOT_SHIFT,			ext & AC97_EI_VRM ? " VRM" : "",			ext & AC97_EI_SPDIF ? " SPDIF" : "",			ext & AC97_EI_DRA ? " DRA" : "",			ext & AC97_EI_VRA ? " VRA" : "");	val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);	snd_iprintf(buffer, "Extended status  :%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",			val & AC97_EA_PRL ? " PRL" : "",			val & AC97_EA_PRK ? " PRK" : "",			val & AC97_EA_PRJ ? " PRJ" : "",			val & AC97_EA_PRI ? " PRI" : "",			val & AC97_EA_SPCV ? " SPCV" : "",			val & AC97_EA_MDAC ? " MADC" : "",			val & AC97_EA_LDAC ? " LDAC" : "",			val & AC97_EA_SDAC ? " SDAC" : "",			val & AC97_EA_CDAC ? " CDAC" : "",			ext & AC97_EI_SPDIF ? spdif_slots[(val & AC97_EA_SPSA_SLOT_MASK) >> AC97_EA_SPSA_SLOT_SHIFT] : "",			val & AC97_EA_VRM ? " VRM" : "",			val & AC97_EA_SPDIF ? " SPDIF" : "",			val & AC97_EA_DRA ? " DRA" : "",			val & AC97_EA_VRA ? " VRA" : "");	if (ext & AC97_EI_VRA) {	/* VRA */		val = snd_ac97_read(ac97, AC97_PCM_FRONT_DAC_RATE);		snd_iprintf(buffer, "PCM front DAC    : %iHz\n", val);		if (ext & AC97_EI_SDAC) {			val = snd_ac97_read(ac97, AC97_PCM_SURR_DAC_RATE);			snd_iprintf(buffer, "PCM Surr DAC     : %iHz\n", val);		}		if (ext & AC97_EI_LDAC) {			val = snd_ac97_read(ac97, AC97_PCM_LFE_DAC_RATE);			snd_iprintf(buffer, "PCM LFE DAC      : %iHz\n", val);		}		val = snd_ac97_read(ac97, AC97_PCM_LR_ADC_RATE);		snd_iprintf(buffer, "PCM ADC          : %iHz\n", val);	}	if (ext & AC97_EI_VRM) {		val = snd_ac97_read(ac97, AC97_PCM_MIC_ADC_RATE);		snd_iprintf(buffer, "PCM MIC ADC      : %iHz\n", val);	}	if ((ext & AC97_EI_SPDIF) || (ac97->flags & AC97_CS_SPDIF)) {	        if (ac97->flags & AC97_CS_SPDIF)			val = snd_ac97_read(ac97, AC97_CSR_SPDIF);		else			val = snd_ac97_read(ac97, AC97_SPDIF);		snd_iprintf(buffer, "SPDIF Control    :%s%s%s%s Category=0x%x Generation=%i%s%s%s\n",			val & AC97_SC_PRO ? " PRO" : " Consumer",			val & AC97_SC_NAUDIO ? " Non-audio" : " PCM",			val & AC97_SC_COPY ? "" : " Copyright",			val & AC97_SC_PRE ? " Preemph50/15" : "",			(val & AC97_SC_CC_MASK) >> AC97_SC_CC_SHIFT,			(val & AC97_SC_L) >> 11,			(ac97->flags & AC97_CS_SPDIF) ?			    spdif_rates_cs4205[(val & AC97_SC_SPSR_MASK) >> AC97_SC_SPSR_SHIFT] :			    spdif_rates[(val & AC97_SC_SPSR_MASK) >> AC97_SC_SPSR_SHIFT],			(ac97->flags & AC97_CS_SPDIF) ?			    (val & AC97_SC_DRS ? " Validity" : "") :			    (val & AC97_SC_DRS ? " DRS" : ""),			(ac97->flags & AC97_CS_SPDIF) ?			    (val & AC97_SC_V ? " Enabled" : "") :			    (val & AC97_SC_V ? " Validity" : ""));		/* ALC650 specific*/		if ((ac97->id & 0xfffffff0) == 0x414c4720 &&		    (snd_ac97_read(ac97, AC97_ALC650_CLOCK) & 0x01)) {			val = snd_ac97_read(ac97, AC97_ALC650_SPDIF_INPUT_STATUS2);			if (val & AC97_ALC650_CLOCK_LOCK) {				val = snd_ac97_read(ac97, AC97_ALC650_SPDIF_INPUT_STATUS1);				snd_iprintf(buffer, "SPDIF In Status  :%s%s%s%s Category=0x%x Generation=%i",					    val & AC97_ALC650_PRO ? " PRO" : " Consumer",					    val & AC97_ALC650_NAUDIO ? " Non-audio" : " PCM",

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -