Commit 83bad1d7 authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

scheduled OSS driver removal

This patch contains the scheduled removal of OSS drivers whose config
options have been removed in 2.6.23.
Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b4cf9c34
......@@ -208,13 +208,6 @@ Who: Randy Dunlap <randy.dunlap@oracle.com>
---------------------------
What: drivers depending on OSS_OBSOLETE
When: options in 2.6.23, code in 2.6.25
Why: obsolete OSS drivers
Who: Adrian Bunk <bunk@stusta.de>
---------------------------
What: libata spindown skipping and warning
When: Dec 2008
Why: Some halt(8) implementations synchronize caches for and spin
......
......@@ -91,20 +91,11 @@ extern void prep_tiger1_setup_pci(char *irq_edge_mask_lo, char *irq_edge_mask_hi
#define cached_21 (((char *)(ppc_cached_irq_mask))[3])
#define cached_A1 (((char *)(ppc_cached_irq_mask))[2])
#ifdef CONFIG_SOUND_CS4232
long ppc_cs4232_dma, ppc_cs4232_dma2;
#endif
extern PTE *Hash, *Hash_end;
extern unsigned long Hash_size, Hash_mask;
extern int probingmem;
extern unsigned long loops_per_jiffy;
#ifdef CONFIG_SOUND_CS4232
EXPORT_SYMBOL(ppc_cs4232_dma);
EXPORT_SYMBOL(ppc_cs4232_dma2);
#endif
/* useful ISA ports */
#define PREP_SYSCTL 0x81c
/* present in the IBM reference design; possibly identical in Mot boxes: */
......@@ -569,74 +560,6 @@ prep_show_percpuinfo(struct seq_file *m, int i)
return 0;
}
#ifdef CONFIG_SOUND_CS4232
static long __init masktoint(unsigned int i)
{
int t = -1;
while (i >> ++t)
;
return (t-1);
}
/*
* ppc_cs4232_dma and ppc_cs4232_dma2 are used in include/asm/dma.h
* to distinguish sound dma-channels from others. This is because
* blocksize on 16 bit dma-channels 5,6,7 is 128k, but
* the cs4232.c uses 64k like on 8 bit dma-channels 0,1,2,3
*/
static void __init prep_init_sound(void)
{
PPC_DEVICE *audiodevice = NULL;
/*
* Get the needed resource information from residual data.
*
*/
if (have_residual_data)
audiodevice = residual_find_device(~0, NULL,
MultimediaController, AudioController, -1, 0);
if (audiodevice != NULL) {
PnP_TAG_PACKET *pkt;
pkt = PnP_find_packet((unsigned char *)&res->DevicePnPHeap[audiodevice->AllocatedOffset],
S5_Packet, 0);
if (pkt != NULL)
ppc_cs4232_dma = masktoint(pkt->S5_Pack.DMAMask);
pkt = PnP_find_packet((unsigned char*)&res->DevicePnPHeap[audiodevice->AllocatedOffset],
S5_Packet, 1);
if (pkt != NULL)
ppc_cs4232_dma2 = masktoint(pkt->S5_Pack.DMAMask);
}
/*
* These are the PReP specs' defaults for the cs4231. We use these
* as fallback incase we don't have residual data.
* At least the IBM Thinkpad 850 with IDE DMA Channels at 6 and 7
* will use the other values.
*/
if (audiodevice == NULL) {
switch (_prep_type) {
case _PREP_IBM:
ppc_cs4232_dma = 1;
ppc_cs4232_dma2 = -1;
break;
default:
ppc_cs4232_dma = 6;
ppc_cs4232_dma2 = 7;
}
}
/*
* Find a way to push this information to the cs4232 driver
* Give it out with printk, when not in cmd_line?
* Append it to cmd_line and boot_command_line?
* Format is cs4232=io,irq,dma,dma2
*/
}
#endif /* CONFIG_SOUND_CS4232 */
/*
* Fill out screen_info according to the residual data. This allows us to use
* at least vesafb.
......@@ -898,10 +821,6 @@ prep_setup_arch(void)
}
}
#ifdef CONFIG_SOUND_CS4232
prep_init_sound();
#endif /* CONFIG_SOUND_CS4232 */
prep_init_vesa();
switch (_prep_type) {
......
......@@ -22,7 +22,6 @@ obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o
obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o
obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o
......
/*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/videodev.h>
#include <linux/init.h>
#include <linux/kdev_t.h>
#include <linux/sound.h>
#include <linux/soundcard.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#define DEV_MAX 4
static int devnr = -1;
module_param(devnr, int, 0644);
MODULE_AUTHOR("Gerd Knorr");
MODULE_LICENSE("GPL");
/* ----------------------------------------------------------------------- */
struct TVMIXER {
struct i2c_client *dev;
int minor;
int count;
};
static struct TVMIXER devices[DEV_MAX];
static int tvmixer_adapters(struct i2c_adapter *adap);
static int tvmixer_clients(struct i2c_client *client);
/* ----------------------------------------------------------------------- */
static int mix_to_v4l(int i)
{
int r;
r = ((i & 0xff) * 65536 + 50) / 100;
if (r > 65535) r = 65535;
if (r < 0) r = 0;
return r;
}
static int v4l_to_mix(int i)
{
int r;
r = (i * 100 + 32768) / 65536;
if (r > 100) r = 100;
if (r < 0) r = 0;
return r | (r << 8);
}
static int v4l_to_mix2(int l, int r)
{
r = (r * 100 + 32768) / 65536;
if (r > 100) r = 100;
if (r < 0) r = 0;
l = (l * 100 + 32768) / 65536;
if (l > 100) l = 100;
if (l < 0) l = 0;
return (r << 8) | l;
}
static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
struct video_audio va;
int left,right,ret,val = 0;
struct TVMIXER *mix = file->private_data;
struct i2c_client *client = mix->dev;
void __user *argp = (void __user *)arg;
int __user *p = argp;
if (NULL == client)
return -ENODEV;
if (cmd == SOUND_MIXER_INFO) {
mixer_info info;
strlcpy(info.id, "tv card", sizeof(info.id));
strlcpy(info.name, client->name, sizeof(info.name));
info.modify_counter = 42 /* FIXME */;
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
if (cmd == SOUND_OLD_MIXER_INFO) {
_old_mixer_info info;
strlcpy(info.id, "tv card", sizeof(info.id));
strlcpy(info.name, client->name, sizeof(info.name));
if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
if (cmd == OSS_GETVERSION)
return put_user(SOUND_VERSION, p);
if (_SIOC_DIR(cmd) & _SIOC_WRITE)
if (get_user(val, p))
return -EFAULT;
/* read state */
memset(&va,0,sizeof(va));
client->driver->command(client,VIDIOCGAUDIO,&va);
switch (cmd) {
case MIXER_READ(SOUND_MIXER_RECMASK):
case MIXER_READ(SOUND_MIXER_CAPS):
case MIXER_READ(SOUND_MIXER_RECSRC):
case MIXER_WRITE(SOUND_MIXER_RECSRC):
ret = 0;
break;
case MIXER_READ(SOUND_MIXER_STEREODEVS):
ret = SOUND_MASK_VOLUME;
break;
case MIXER_READ(SOUND_MIXER_DEVMASK):
ret = SOUND_MASK_VOLUME;
if (va.flags & VIDEO_AUDIO_BASS)
ret |= SOUND_MASK_BASS;
if (va.flags & VIDEO_AUDIO_TREBLE)
ret |= SOUND_MASK_TREBLE;
break;
case MIXER_WRITE(SOUND_MIXER_VOLUME):
left = mix_to_v4l(val);
right = mix_to_v4l(val >> 8);
va.volume = max(left,right);
va.balance = (32768*min(left,right)) / (va.volume ? va.volume : 1);
va.balance = (left<right) ? (65535-va.balance) : va.balance;
if (va.volume)
va.flags &= ~VIDEO_AUDIO_MUTE;
client->driver->command(client,VIDIOCSAUDIO,&va);
client->driver->command(client,VIDIOCGAUDIO,&va);
/* fall throuth */
case MIXER_READ(SOUND_MIXER_VOLUME):
left = (min(65536 - va.balance,32768) *
va.volume) / 32768;
right = (min(va.balance,(u16)32768) *
va.volume) / 32768;
ret = v4l_to_mix2(left,right);
break;
case MIXER_WRITE(SOUND_MIXER_BASS):
va.bass = mix_to_v4l(val);
client->driver->command(client,VIDIOCSAUDIO,&va);
client->driver->command(client,VIDIOCGAUDIO,&va);
/* fall throuth */
case MIXER_READ(SOUND_MIXER_BASS):
ret = v4l_to_mix(va.bass);
break;
case MIXER_WRITE(SOUND_MIXER_TREBLE):
va.treble = mix_to_v4l(val);
client->driver->command(client,VIDIOCSAUDIO,&va);
client->driver->command(client,VIDIOCGAUDIO,&va);
/* fall throuth */
case MIXER_READ(SOUND_MIXER_TREBLE):
ret = v4l_to_mix(va.treble);
break;
default:
return -EINVAL;
}
if (put_user(ret, p))
return -EFAULT;
return 0;
}
static int tvmixer_open(struct inode *inode, struct file *file)
{
int i, minor = iminor(inode);
struct TVMIXER *mix = NULL;
struct i2c_client *client = NULL;
for (i = 0; i < DEV_MAX; i++) {
if (devices[i].minor == minor) {
mix = devices+i;
client = mix->dev;
break;
}
}
if (NULL == client)
return -ENODEV;
/* lock bttv in memory while the mixer is in use */
file->private_data = mix;
if (client->adapter->owner)
try_module_get(client->adapter->owner);
return 0;
}
static int tvmixer_release(struct inode *inode, struct file *file)
{
struct TVMIXER *mix = file->private_data;
struct i2c_client *client;
client = mix->dev;
if (NULL == client) {
return -ENODEV;
}
module_put(client->adapter->owner);
return 0;
}
static struct i2c_driver driver = {
.driver = {
.name = "tvmixer",
},
.id = I2C_DRIVERID_TVMIXER,
.detach_adapter = tvmixer_adapters,
.attach_adapter = tvmixer_adapters,
.detach_client = tvmixer_clients,
};
static const struct file_operations tvmixer_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.ioctl = tvmixer_ioctl,
.open = tvmixer_open,
.release = tvmixer_release,
};
/* ----------------------------------------------------------------------- */
static int tvmixer_adapters(struct i2c_adapter *adap)
{
struct i2c_client *client;
list_for_each_entry(client, &adap->clients, list)
tvmixer_clients(client);
return 0;
}
static int tvmixer_clients(struct i2c_client *client)
{
struct video_audio va;
int i,minor;
if (!(client->adapter->class & I2C_CLASS_TV_ANALOG))
return -1;
/* unregister ?? */
for (i = 0; i < DEV_MAX; i++) {
if (devices[i].dev == client) {
/* unregister */
unregister_sound_mixer(devices[i].minor);
devices[i].dev = NULL;
devices[i].minor = -1;
printk("tvmixer: %s unregistered (#1)\n",
client->name);
return 0;
}
}
/* look for a free slot */
for (i = 0; i < DEV_MAX; i++)
if (NULL == devices[i].dev)
break;
if (i == DEV_MAX) {
printk(KERN_WARNING "tvmixer: DEV_MAX too small\n");
return -1;
}
/* audio chip with mixer ??? */
if (NULL == client->driver->command)
return -1;
memset(&va,0,sizeof(va));
if (0 != client->driver->command(client,VIDIOCGAUDIO,&va))
return -1;
if (0 == (va.flags & VIDEO_AUDIO_VOLUME))
return -1;
/* everything is fine, register */
if ((minor = register_sound_mixer(&tvmixer_fops,devnr)) < 0) {
printk(KERN_ERR "tvmixer: cannot allocate mixer device\n");
return -1;
}
devices[i].minor = minor;
devices[i].count = 0;
devices[i].dev = client;
printk("tvmixer: %s (%s) registered with minor %d\n",
client->name,client->adapter->name,minor);
return 0;
}
/* ----------------------------------------------------------------------- */
static int __init tvmixer_init_module(void)
{
int i;
for (i = 0; i < DEV_MAX; i++)
devices[i].minor = -1;
return i2c_add_driver(&driver);
}
static void __exit tvmixer_cleanup_module(void)
{
int i;
i2c_del_driver(&driver);
for (i = 0; i < DEV_MAX; i++) {
if (devices[i].minor != -1) {
unregister_sound_mixer(devices[i].minor);
printk("tvmixer: %s unregistered (#2)\n",
devices[i].dev->name);
}
}
}
module_init(tvmixer_init_module);
module_exit(tvmixer_cleanup_module);
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* ---------------------------------------------------------------------------
* Local variables:
* c-basic-offset: 8
* End:
*/
......@@ -93,16 +93,6 @@
*
*/
/* see prep_setup_arch() for detailed informations */
#if defined(CONFIG_SOUND_CS4232) && defined(CONFIG_PPC_PREP)
extern long ppc_cs4232_dma, ppc_cs4232_dma2;
#define SND_DMA1 ppc_cs4232_dma
#define SND_DMA2 ppc_cs4232_dma2
#else
#define SND_DMA1 -1
#define SND_DMA2 -1
#endif
/* 8237 DMA controllers */
#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
......@@ -269,23 +259,14 @@ static __inline__ void set_dma_page(unsigned int dmanr, int pagenr)
dma_outb(pagenr >> 8, DMA_HI_PAGE_3);
break;
case 5:
if (SND_DMA1 == 5 || SND_DMA2 == 5)
dma_outb(pagenr, DMA_LO_PAGE_5);
else
dma_outb(pagenr & 0xfe, DMA_LO_PAGE_5);
dma_outb(pagenr >> 8, DMA_HI_PAGE_5);
break;
case 6:
if (SND_DMA1 == 6 || SND_DMA2 == 6)
dma_outb(pagenr, DMA_LO_PAGE_6);
else
dma_outb(pagenr & 0xfe, DMA_LO_PAGE_6);
dma_outb(pagenr >> 8, DMA_HI_PAGE_6);
break;
case 7:
if (SND_DMA1 == 7 || SND_DMA2 == 7)
dma_outb(pagenr, DMA_LO_PAGE_7);
else
dma_outb(pagenr & 0xfe, DMA_LO_PAGE_7);
dma_outb(pagenr >> 8, DMA_HI_PAGE_7);
break;
......@@ -302,12 +283,6 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int phys)
((dmanr & 3) << 1) + IO_DMA1_BASE);
dma_outb((phys >> 8) & 0xff,
((dmanr & 3) << 1) + IO_DMA1_BASE);
} else if (dmanr == SND_DMA1 || dmanr == SND_DMA2) {
dma_outb(phys & 0xff,
((dmanr & 3) << 2) + IO_DMA2_BASE);
dma_outb((phys >> 8) & 0xff,
((dmanr & 3) << 2) + IO_DMA2_BASE);
dma_outb((dmanr & 3), DMA2_EXT_REG);
} else {
dma_outb((phys >> 1) & 0xff,
((dmanr & 3) << 2) + IO_DMA2_BASE);
......@@ -334,11 +309,6 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
dma_outb((count >> 8) & 0xff,
((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
} else if (dmanr == SND_DMA1 || dmanr == SND_DMA2) {
dma_outb(count & 0xff,
((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
dma_outb((count >> 8) & 0xff,
((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
} else {
dma_outb((count >> 1) & 0xff,
((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
......@@ -368,8 +338,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
count = 1 + dma_inb(io_port);
count += dma_inb(io_port) << 8;
return (dmanr <= 3 || dmanr == SND_DMA1 || dmanr == SND_DMA2)
? count : (count << 1);
return (dmanr <= 3) ? count : (count << 1);
}
/* These are in kernel/dma.c: */
......
......@@ -326,11 +326,7 @@ struct ac97_ops
#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */
};
extern int ac97_read_proc (char *page_out, char **start, off_t off,
int count, int *eof, void *data);
extern int ac97_probe_codec(struct ac97_codec *);
extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);
extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
extern struct ac97_codec *ac97_alloc_codec(void);
extern void ac97_release_codec(struct ac97_codec *codec);
......@@ -363,7 +359,4 @@ struct ac97_quirk {
int type; /* quirk type above */
};
struct pci_dev;
extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);
#endif /* _AC97_CODEC_H_ */
......@@ -6,7 +6,6 @@
# Each configuration option enables a list of files.
obj-$(CONFIG_SOUND_OSS) += sound.o
obj-$(CONFIG_SOUND_CS4232) += cs4232.o ad1848.o
# Please leave it as is, cause the link order is significant !
......@@ -16,7 +15,6 @@ obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o
obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o
obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o
obj-$(CONFIG_SOUND_SSCAPE) += sscape.o ad1848.o mpu401.o
obj-$(CONFIG_SOUND_CS4232) += cs4232.o uart401.o
obj-$(CONFIG_SOUND_MSS) += ad1848.o
obj-$(CONFIG_SOUND_PAS) += pas2.o sb.o sb_lib.o uart401.o
obj-$(CONFIG_SOUND_SB) += sb.o sb_lib.o uart401.o
......@@ -27,19 +25,12 @@ obj-$(CONFIG_SOUND_YM3812) += opl3.o
obj-$(CONFIG_SOUND_VMIDI) += v_midi.o
obj-$(CONFIG_SOUND_VIDC) += vidc_mod.o
obj-$(CONFIG_SOUND_WAVEARTIST) += waveartist.o
obj-$(CONFIG_SOUND_VIA82CXXX) += via82cxxx_audio.o ac97_codec.o
ifeq ($(CONFIG_MIDI_VIA82CXXX),y)
obj-$(CONFIG_SOUND_VIA82CXXX) += sound.o uart401.o
endif
obj-$(CONFIG_SOUND_MSNDCLAS) += msnd.o msnd_classic.o
obj-$(CONFIG_SOUND_MSNDPIN) += msnd.o msnd_pinnacle.o
obj-$(CONFIG_SOUND_VWSND) += vwsnd.o
obj-$(CONFIG_SOUND_ICH) += i810_audio.o ac97_codec.o
obj-$(CONFIG_SOUND_AU1550_AC97) += au1550_ac97.o ac97_codec.o
obj-$(CONFIG_SOUND_TRIDENT) += trident.o ac97_codec.o
obj-$(CONFIG_SOUND_BCM_CS4297A) += swarm_cs4297a.o
obj-$(CONFIG_SOUND_BT878) += btaudio.o
obj-$(CONFIG_SOUND_WM97XX) += ac97_plugin_wm97xx.o
......
......@@ -189,42 +189,6 @@ static const struct {
{0x57454301, "Winbond 83971D", &null_ops},
};
static const char *ac97_stereo_enhancements[] =
{
/* 0 */ "No 3D Stereo Enhancement",
/* 1 */ "Analog Devices Phat Stereo",
/* 2 */ "Creative Stereo Enhancement",
/* 3 */ "National Semi 3D Stereo Enhancement",
/* 4 */ "YAMAHA Ymersion",
/* 5 */ "BBE 3D Stereo Enhancement",
/* 6 */ "Crystal Semi 3D Stereo Enhancement",
/* 7 */ "Qsound QXpander",
/* 8 */ "Spatializer 3D Stereo Enhancement",
/* 9 */ "SRS 3D Stereo Enhancement",
/* 10 */ "Platform Tech 3D Stereo Enhancement",
/* 11 */ "AKM 3D Audio",
/* 12 */ "Aureal Stereo Enhancement",
/* 13 */ "Aztech 3D Enhancement",
/* 14 */ "Binaura 3D Audio Enhancement",
/* 15 */ "ESS Technology Stereo Enhancement",
/* 16 */ "Harman International VMAx",
/* 17 */ "Nvidea 3D Stereo Enhancement",
/* 18 */ "Philips Incredible Sound",
/* 19 */ "Texas Instruments 3D Stereo Enhancement",
/* 20 */ "VLSI Technology 3D Stereo Enhancement",
/* 21 */ "TriTech 3D Stereo Enhancement",
/* 22 */ "Realtek 3D Stereo Enhancement",
/* 23 */ "Samsung 3D Stereo Enhancement",
/* 24 */ "Wolfson Microelectronics 3D Enhancement",
/* 25 */ "Delta Integration 3D Enhancement",
/* 26 */ "SigmaTel 3D Enhancement",
/* 27 */ "Winbond 3D Stereo Enhancement",
/* 28 */ "Rockwell 3D Stereo Enhancement",
/* 29 */ "Reserved 29",
/* 30 */ "Reserved 30",
/* 31 */ "Reserved 31"
};
/* this table has default mixer values for all OSS mixers. */
static struct mixer_defaults {
int mixer;
......@@ -614,83 +578,6 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned
return -EINVAL;
}
/* entry point for /proc/driver/controller_vendor/ac97/%d */
int ac97_read_proc (char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int len = 0, cap, extid, val, id1, id2;
struct ac97_codec *codec;
int is_ac97_20 = 0;
if ((codec = data) == NULL)
return -ENODEV;
id1 = codec->codec_read(codec, AC97_VENDOR_ID1);
id2 = codec->codec_read(codec, AC97_VENDOR_ID2);
len += sprintf (page+len, "Vendor name : %s\n", codec->name);
len += sprintf (page+len, "Vendor id : %04X %04X\n", id1, id2);
extid = codec->codec_read(codec, AC97_EXTENDED_ID);
extid &= ~((1<<2)|(1<<4)|(1<<5)|(1<<10)|(1<<11)|(1<<12)|(1<<13));
len += sprintf (page+len, "AC97 Version : %s\n",
extid ? "2.0 or later" : "1.0");
if (extid) is_ac97_20 = 1;
cap = codec->codec_read(codec, AC97_RESET);
len += sprintf (page+len, "Capabilities :%s%s%s%s%s%s\n",
cap & 0x0001 ? " -dedicated MIC PCM IN channel-" : "",
cap & 0x0002 ? " -reserved1-" : "",
cap & 0x0004 ? " -bass & treble-" : "",
cap & 0x0008 ? " -simulated stereo-" : "",
cap & 0x0010 ? " -headphone out-" : "",
cap & 0x0020 ? " -loudness-" : "");
val = cap & 0x00c0;
len += sprintf (page+len, "DAC resolutions :%s%s%s\n",
" -16-bit-",
val & 0x0040 ? " -18-bit-" : "",
val & 0x0080 ? " -20-bit-" : "");
val = cap & 0x0300;
len += sprintf (page+len, "ADC resolutions :%s%s%s\n",
" -16-bit-",
val & 0x0100 ? " -18-bit-" : "",
val & 0x0200 ? " -20-bit-" : "");
len += sprintf (page+len, "3D enhancement : %s\n",
ac97_stereo_enhancements[(cap >> 10) & 0x1f]);
val = codec->codec_read(codec, AC97_GENERAL_PURPOSE);
len += sprintf (page+len, "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");
extid = codec->codec_read(codec, AC97_EXTENDED_ID);
cap = extid;
len += sprintf (page+len, "Ext Capabilities :%s%s%s%s%s%s%s\n",
cap & 0x0001 ? " -var rate PCM audio-" : "",
cap & 0x0002 ? " -2x PCM audio out-" : "",
cap & 0x0008 ? " -var rate MIC in-" : "",
cap & 0x0040 ? " -PCM center DAC-" : "",
cap & 0x0080 ? " -PCM surround DAC-" : "",
cap & 0x0100 ? " -PCM LFE DAC-" : "",
cap & 0x0200 ? " -slot/DAC mappings-" : "");
if (is_ac97_20) {
len += sprintf (page+len, "Front DAC rate : %d\n",
codec->codec_read(codec, AC97_PCM_FRONT_DAC_RATE));
}
return len;
}
/**
* codec_id - Turn id1/id2 into a PnP string
* @id1: Vendor ID1
......@@ -1313,176 +1200,5 @@ static int pt101_init(struct ac97_codec * codec)
#endif
EXPORT_SYMBOL(ac97_read_proc);
EXPORT_SYMBOL(ac97_probe_codec);
/*
* AC97 library support routines
*/
/**
* ac97_set_dac_rate - set codec rate adaption
* @codec: ac97 code
* @rate: rate in hertz
*
* Set the DAC rate. Assumes the codec supports VRA. The caller is
* expected to have checked this little detail.
*/
unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate)
{
unsigned int new_rate = rate;
u32 dacp;
u32 mast_vol, phone_vol, mono_vol, pcm_vol;
u32 mute_vol = 0x8000; /* The mute volume? */
if(rate != codec->codec_read(codec, AC97_PCM_FRONT_DAC_RATE))
{
/* Mute several registers */
mast_vol = codec->codec_read(codec, AC97_MASTER_VOL_STEREO);
mono_vol = codec->codec_read(codec, AC97_MASTER_VOL_MONO);
phone_vol = codec->codec_read(codec, AC97_HEADPHONE_VOL);
pcm_vol = codec->codec_read(codec, AC97_PCMOUT_VOL);
codec->codec_write(codec, AC97_MASTER_VOL_STEREO, mute_vol);
codec->codec_write(codec, AC97_MASTER_VOL_MONO, mute_vol);
codec->codec_write(codec, AC97_HEADPHONE_VOL, mute_vol);
codec->codec_write(codec, AC97_PCMOUT_VOL, mute_vol);
/* Power down the DAC */
dacp=codec->codec_read(codec, AC97_POWER_CONTROL);
codec->codec_write(codec, AC97_POWER_CONTROL, dacp|0x0200);
/* Load the rate and read the effective rate */
codec->codec_write(codec, AC97_PCM_FRONT_DAC_RATE, rate);
new_rate=codec->codec_read(codec, AC97_PCM_FRONT_DAC_RATE);
/* Power it back up */
codec->codec_write(codec, AC97_POWER_CONTROL, dacp);
/* Restore volumes */
codec->codec_write(codec, AC97_MASTER_VOL_STEREO, mast_vol);
codec->codec_write(codec, AC97_MASTER_VOL_MONO, mono_vol);
codec->codec_write(codec, AC97_HEADPHONE_VOL, phone_vol);
codec->codec_write(codec, AC97_PCMOUT_VOL, pcm_vol);
}
return new_rate;
}
EXPORT_SYMBOL(ac97_set_dac_rate);
/**
* ac97_set_adc_rate - set codec rate adaption
* @codec: ac97 code
* @rate: rate in hertz
*
* Set the ADC rate. Assumes the codec supports VRA. The caller is
* expected to have checked this little detail.
*/
unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate)
{
unsigned int new_rate = rate;
u32 dacp;
if(rate != codec->codec_read(codec, AC97_PCM_LR_ADC_RATE))
{
/* Power down the ADC */
dacp=codec->codec_read(codec, AC97_POWER_CONTROL);
codec->codec_write(codec, AC97_POWER_CONTROL, dacp|0x0100);
/* Load the rate and read the effective rate */
codec->codec_write(codec, AC97_PCM_LR_ADC_RATE, rate);
new_rate=codec->codec_read(codec, AC97_PCM_LR_ADC_RATE);
/* Power it back up */
codec->codec_write(codec, AC97_POWER_CONTROL, dacp);
}
return new_rate;
}
EXPORT_SYMBOL(ac97_set_adc_rate);
static int swap_headphone(int remove_master)
{
struct list_head *l;
struct ac97_codec *c;
if (remove_master) {
mutex_lock(&codec_mutex);
list_for_each(l, &codecs)
{
c = list_entry(l, struct ac97_codec, list);
if (supported_mixer(c, SOUND_MIXER_PHONEOUT))
c->supported_mixers &= ~SOUND_MASK_PHONEOUT;
}
mutex_unlock(&codec_mutex);
} else
ac97_hw[SOUND_MIXER_PHONEOUT].offset = AC97_MASTER_VOL_STEREO;
/* Scale values already match */
ac97_hw[SOUND_MIXER_VOLUME].offset = AC97_MASTER_VOL_MONO;
return 0;
}
static int apply_quirk(int quirk)
{
switch (quirk) {
case AC97_TUNE_NONE:
return 0;
case AC97_TUNE_HP_ONLY:
return swap_headphone(1);
case AC97_TUNE_SWAP_HP:
return swap_headphone(0);
case AC97_TUNE_SWAP_SURROUND:
return -ENOSYS; /* not yet implemented */
case AC97_TUNE_AD_SHARING:
return -ENOSYS; /* not yet implemented */
case AC97_TUNE_ALC_JACK:
return -ENOSYS; /* not yet implemented */
}
return -EINVAL;
}
/**
* ac97_tune_hardware - tune up the hardware
* @pdev: pci_dev pointer
* @quirk: quirk list
* @override: explicit quirk value (overrides if not AC97_TUNE_DEFAULT)
*
* Do some workaround for each pci device, such as renaming of the
* headphone (true line-out) control as "Master".
* The quirk-list must be terminated with a zero-filled entry.
*
* Returns zero if successful, or a negative error code on failure.
*/
int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override)
{
int result;
if (!quirk)
return -EINVAL;
if (override != AC97_TUNE_DEFAULT) {
result = apply_quirk(override);
if (result < 0)
printk(KERN_ERR "applying quirk type %d failed (%d)\n", override, result);
return result;
}
for (; quirk->vendor; quirk++) {
if (quirk->vendor != pdev->subsystem_vendor)
continue;
if ((! quirk->mask && quirk->device == pdev->subsystem_device) ||
quirk->device == (quirk->mask & pdev->subsystem_device)) {
#ifdef DEBUG
printk("ac97 quirk for %s (%04x:%04x)\n", quirk->name, ac97->subsystem_vendor, pdev->subsystem_device);
#endif
result = apply_quirk(quirk->type);
if (result < 0)
printk(KERN_ERR "applying quirk type %d for %s failed (%d)\n", quirk->type, quirk->name, result);
return result;
}
}
return 0;
}
EXPORT_SYMBOL_GPL(ac97_tune_hardware);
MODULE_LICENSE("GPL");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment