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: Adrian Bunk <bunk@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b4cf9c342a
commit
83bad1d764
@ -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
|
||||
|
@ -1,336 +0,0 @@
|
||||
/*
|
||||
*/
|
||||
|
||||
#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,24 +259,15 @@ 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 & 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 & 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 & 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");
|
||||
|
1139
sound/oss/btaudio.c
1139
sound/oss/btaudio.c
File diff suppressed because it is too large
Load Diff
@ -1,526 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) by Hannu Savolainen 1993-1997
|
||||
*
|
||||
* cs4232.c
|
||||
*
|
||||
* The low level driver for Crystal CS4232 based cards. The CS4232 is
|
||||
* a PnP compatible chip which contains a CS4231A codec, SB emulation,
|
||||
* a MPU401 compatible MIDI port, joystick and synthesizer and IDE CD-ROM
|
||||
* interfaces. This is just a temporary driver until full PnP support
|
||||
* gets implemented. Just the WSS codec, FM synth and the MIDI ports are
|
||||
* supported. Other interfaces are left uninitialized.
|
||||
*
|
||||
* ifdef ...WAVEFRONT...
|
||||
*
|
||||
* Support is provided for initializing the WaveFront synth
|
||||
* interface as well, which is logical device #4. Note that if
|
||||
* you have a Tropez+ card, you probably don't need to setup
|
||||
* the CS4232-supported MIDI interface, since it corresponds to
|
||||
* the internal 26-pin header that's hard to access. Using this
|
||||
* requires an additional IRQ, a resource none too plentiful in
|
||||
* this environment. Just don't set module parameters mpuio and
|
||||
* mpuirq, and the MIDI port will be left uninitialized. You can
|
||||
* still use the ICS2115 hosted MIDI interface which corresponds
|
||||
* to the 9-pin D connector on the back of the card.
|
||||
*
|
||||
* endif ...WAVEFRONT...
|
||||
*
|
||||
* Supported chips are:
|
||||
* CS4232
|
||||
* CS4236
|
||||
* CS4236B
|
||||
*
|
||||
* Note: You will need a PnP config setup to initialise some CS4232 boards
|
||||
* anyway.
|
||||
*
|
||||
* Changes
|
||||
* John Rood Added Bose Sound System Support.
|
||||
* Toshio Spoor
|
||||
* Alan Cox Modularisation, Basic cleanups.
|
||||
* Paul Barton-Davis Separated MPU configuration, added
|
||||
* Tropez+ (WaveFront) support
|
||||
* Christoph Hellwig Adapted to module_init/module_exit,
|
||||
* simple cleanups
|
||||
* Arnaldo C. de Melo got rid of attach_uart401
|
||||
* Bartlomiej Zolnierkiewicz
|
||||
* Added some __init/__initdata/__exit
|
||||
* Marcus Meissner Added ISA PnP support.
|
||||
*/
|
||||
|
||||
#include <linux/pnp.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include "sound_config.h"
|
||||
|
||||
#include "ad1848.h"
|
||||
#include "mpu401.h"
|
||||
|
||||
#define KEY_PORT 0x279 /* Same as LPT1 status port */
|
||||
#define CSN_NUM 0x99 /* Just a random number */
|
||||
#define INDEX_ADDRESS 0x00 /* (R0) Index Address Register */
|
||||
#define INDEX_DATA 0x01 /* (R1) Indexed Data Register */
|
||||
#define PIN_CONTROL 0x0a /* (I10) Pin Control */
|
||||
#define ENABLE_PINS 0xc0 /* XCTRL0/XCTRL1 enable */
|
||||
|
||||
static void CS_OUT(unsigned char a)
|
||||
{
|
||||
outb(a, KEY_PORT);
|
||||
}
|
||||
|
||||
#define CS_OUT2(a, b) {CS_OUT(a);CS_OUT(b);}
|
||||
#define CS_OUT3(a, b, c) {CS_OUT(a);CS_OUT(b);CS_OUT(c);}
|
||||
|
||||
static int __initdata bss = 0;
|
||||
static int mpu_base, mpu_irq;
|
||||
static int synth_base, synth_irq;
|
||||
static int mpu_detected;
|
||||
|
||||
static int probe_cs4232_mpu(struct address_info *hw_config)
|
||||
{
|
||||
/*
|
||||
* Just write down the config values.
|
||||
*/
|
||||
|
||||
mpu_base = hw_config->io_base;
|
||||
mpu_irq = hw_config->irq;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static unsigned char crystal_key[] = /* A 32 byte magic key sequence */
|
||||
{
|
||||
0x96, 0x35, 0x9a, 0xcd, 0xe6, 0xf3, 0x79, 0xbc,
|
||||
0x5e, 0xaf, 0x57, 0x2b, 0x15, 0x8a, 0xc5, 0xe2,
|
||||
0xf1, 0xf8, 0x7c, 0x3e, 0x9f, 0x4f, 0x27, 0x13,
|
||||
0x09, 0x84, 0x42, 0xa1, 0xd0, 0x68, 0x34, 0x1a
|
||||
};
|
||||
|
||||
static void sleep(unsigned howlong)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(howlong);
|
||||
}
|
||||
|
||||
static void enable_xctrl(int baseio)
|
||||
{
|
||||
unsigned char regd;
|
||||
|
||||
/*
|
||||
* Some IBM Aptiva's have the Bose Sound System. By default
|
||||
* the Bose Amplifier is disabled. The amplifier will be
|
||||
* activated, by setting the XCTRL0 and XCTRL1 bits.
|
||||
* Volume of the monitor bose speakers/woofer, can then
|
||||
* be set by changing the PCM volume.
|
||||
*
|
||||
*/
|
||||
|
||||
printk("cs4232: enabling Bose Sound System Amplifier.\n");
|
||||
|
||||
/* Switch to Pin Control Address */
|
||||
regd = inb(baseio + INDEX_ADDRESS) & 0xe0;
|
||||
outb(((unsigned char) (PIN_CONTROL | regd)), baseio + INDEX_ADDRESS );
|
||||
|
||||
/* Activate the XCTRL0 and XCTRL1 Pins */
|
||||
regd = inb(baseio + INDEX_DATA);
|
||||
outb(((unsigned char) (ENABLE_PINS | regd)), baseio + INDEX_DATA );
|
||||
}
|
||||
|
||||
static int __init probe_cs4232(struct address_info *hw_config, int isapnp_configured)
|
||||
{
|
||||
int i, n;
|
||||
int base = hw_config->io_base, irq = hw_config->irq;
|
||||
int dma1 = hw_config->dma, dma2 = hw_config->dma2;
|
||||
struct resource *ports;
|
||||
|
||||
if (base == -1 || irq == -1 || dma1 == -1) {
|
||||
printk(KERN_ERR "cs4232: dma, irq and io must be set.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that the I/O port range is free.
|
||||
*/
|
||||
|
||||
ports = request_region(base, 4, "ad1848");
|
||||
if (!ports) {
|
||||
printk(KERN_ERR "cs4232.c: I/O port 0x%03x not free\n", base);
|
||||
return 0;
|
||||
}
|
||||
if (ad1848_detect(ports, NULL, hw_config->osp)) {
|
||||
goto got_it; /* The card is already active */
|
||||
}
|
||||
if (isapnp_configured) {
|
||||
printk(KERN_ERR "cs4232.c: ISA PnP configured, but not detected?\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* This version of the driver doesn't use the PnP method when configuring
|
||||
* the card but a simplified method defined by Crystal. This means that
|
||||
* just one CS4232 compatible device can exist on the system. Also this
|
||||
* method conflicts with possible PnP support in the OS. For this reason
|
||||
* driver is just a temporary kludge.
|
||||
*
|
||||
* Also the Cirrus/Crystal method doesn't always work. Try ISA PnP first ;)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Repeat initialization few times since it doesn't always succeed in
|
||||
* first time.
|
||||
*/
|
||||
|
||||
for (n = 0; n < 4; n++)
|
||||
{
|
||||
/*
|
||||
* Wake up the card by sending a 32 byte Crystal key to the key port.
|
||||
*/
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
CS_OUT(crystal_key[i]);
|
||||
|
||||
sleep(HZ / 10);
|
||||
|
||||
/*
|
||||
* Now set the CSN (Card Select Number).
|
||||
*/
|
||||
|
||||
CS_OUT2(0x06, CSN_NUM);
|
||||
|
||||
/*
|
||||
* Then set some config bytes. First logical device 0
|
||||
*/
|
||||
|
||||
CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */
|
||||
CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */
|
||||
|
||||
if (!request_region(0x388, 4, "FM")) /* Not free */
|
||||
CS_OUT3(0x48, 0x00, 0x00) /* FM base off */
|
||||
else {
|
||||
release_region(0x388, 4);
|
||||
CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */
|
||||
}
|
||||
|
||||
CS_OUT3(0x42, 0x00, 0x00); /* SB base off */
|
||||
CS_OUT2(0x22, irq); /* SB+WSS IRQ */
|
||||
CS_OUT2(0x2a, dma1); /* SB+WSS DMA */
|
||||
|
||||
if (dma2 != -1)
|
||||
CS_OUT2(0x25, dma2) /* WSS DMA2 */
|
||||
else
|
||||
CS_OUT2(0x25, 4); /* No WSS DMA2 */
|
||||
|
||||
CS_OUT2(0x33, 0x01); /* Activate logical dev 0 */
|
||||
|
||||
sleep(HZ / 10);
|
||||
|
||||
/*
|
||||
* Initialize logical device 3 (MPU)
|
||||
*/
|
||||
|
||||
if (mpu_base != 0 && mpu_irq != 0)
|
||||
{
|
||||
CS_OUT2(0x15, 0x03); /* Select logical device 3 (MPU) */
|
||||
CS_OUT3(0x47, (mpu_base >> 8) & 0xff, mpu_base & 0xff); /* MPU base */
|
||||
CS_OUT2(0x22, mpu_irq); /* MPU IRQ */
|
||||
CS_OUT2(0x33, 0x01); /* Activate logical dev 3 */
|
||||
}
|
||||
|
||||
if(synth_base != 0)
|
||||
{
|
||||
CS_OUT2 (0x15, 0x04); /* logical device 4 (WaveFront) */
|
||||
CS_OUT3 (0x47, (synth_base >> 8) & 0xff,
|
||||
synth_base & 0xff); /* base */
|
||||
CS_OUT2 (0x22, synth_irq); /* IRQ */
|
||||
CS_OUT2 (0x33, 0x01); /* Activate logical dev 4 */
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally activate the chip
|
||||
*/
|
||||
|
||||
CS_OUT(0x79);
|
||||
|
||||
sleep(HZ / 5);
|
||||
|
||||
/*
|
||||
* Then try to detect the codec part of the chip
|
||||
*/
|
||||
|
||||
if (ad1848_detect(ports, NULL, hw_config->osp))
|
||||
goto got_it;
|
||||
|
||||
sleep(HZ);
|
||||
}
|
||||
fail:
|
||||
release_region(base, 4);
|
||||
return 0;
|
||||
|
||||
got_it:
|
||||
if (dma2 == -1)
|
||||
dma2 = dma1;
|
||||
|
||||
hw_config->slots[0] = ad1848_init("Crystal audio controller", ports,
|
||||
irq,
|
||||
dma1, /* Playback DMA */
|
||||
dma2, /* Capture DMA */
|
||||
0,
|
||||
hw_config->osp,
|
||||
THIS_MODULE);
|
||||
|
||||
if (hw_config->slots[0] != -1 &&
|
||||
audio_devs[hw_config->slots[0]]->mixer_dev!=-1)
|
||||
{
|
||||
/* Assume the mixer map is as suggested in the CS4232 databook */
|
||||
AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);
|
||||
AD1848_REROUTE(SOUND_MIXER_LINE2, SOUND_MIXER_CD);
|
||||
AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_SYNTH); /* FM synth */
|
||||
}
|
||||
if (mpu_base != 0 && mpu_irq != 0)
|
||||
{
|
||||
static struct address_info hw_config2 = {
|
||||
0
|
||||
}; /* Ensure it's initialized */
|
||||
|
||||
hw_config2.io_base = mpu_base;
|
||||
hw_config2.irq = mpu_irq;
|
||||
hw_config2.dma = -1;
|
||||
hw_config2.dma2 = -1;
|
||||
hw_config2.always_detect = 0;
|
||||
hw_config2.name = NULL;
|
||||
hw_config2.driver_use_1 = 0;
|
||||
hw_config2.driver_use_2 = 0;
|
||||
hw_config2.card_subtype = 0;
|
||||
|
||||
if (probe_uart401(&hw_config2, THIS_MODULE))
|
||||
{
|
||||
mpu_detected = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mpu_base = mpu_irq = 0;
|
||||
}
|
||||
hw_config->slots[1] = hw_config2.slots[1];
|
||||
}
|
||||
|
||||
if (bss)
|
||||
enable_xctrl(base);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void __devexit unload_cs4232(struct address_info *hw_config)
|
||||
{
|
||||
int base = hw_config->io_base, irq = hw_config->irq;
|
||||
int dma1 = hw_config->dma, dma2 = hw_config->dma2;
|
||||
|
||||
if (dma2 == -1)
|
||||
dma2 = dma1;
|
||||
|
||||
ad1848_unload(base,
|
||||
irq,
|
||||
dma1, /* Playback DMA */
|
||||
dma2, /* Capture DMA */
|
||||
0);
|
||||
|
||||
sound_unload_audiodev(hw_config->slots[0]);
|
||||
if (mpu_base != 0 && mpu_irq != 0 && mpu_detected)
|
||||
{
|
||||
static struct address_info hw_config2 =
|
||||
{
|
||||
0
|
||||
}; /* Ensure it's initialized */
|
||||
|
||||
hw_config2.io_base = mpu_base;
|
||||
hw_config2.irq = mpu_irq;
|
||||
hw_config2.dma = -1;
|
||||
hw_config2.dma2 = -1;
|
||||
hw_config2.always_detect = 0;
|
||||
hw_config2.name = NULL;
|
||||
hw_config2.driver_use_1 = 0;
|
||||
hw_config2.driver_use_2 = 0;
|
||||
hw_config2.card_subtype = 0;
|
||||
hw_config2.slots[1] = hw_config->slots[1];
|
||||
|
||||
unload_uart401(&hw_config2);
|
||||
}
|
||||
}
|
||||
|
||||
static struct address_info cfg;
|
||||
static struct address_info cfg_mpu;
|
||||
|
||||
static int __initdata io = -1;
|
||||
static int __initdata irq = -1;
|
||||
static int __initdata dma = -1;
|
||||
static int __initdata dma2 = -1;
|
||||
static int __initdata mpuio = -1;
|
||||
static int __initdata mpuirq = -1;
|
||||
static int __initdata synthio = -1;
|
||||
static int __initdata synthirq = -1;
|
||||
static int __initdata isapnp = 1;
|
||||
|
||||
static unsigned int cs4232_devices;
|
||||
|
||||
MODULE_DESCRIPTION("CS4232 based soundcard driver");
|
||||
MODULE_AUTHOR("Hannu Savolainen, Paul Barton-Davis");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_param(io, int, 0);
|
||||
MODULE_PARM_DESC(io,"base I/O port for AD1848");
|
||||
module_param(irq, int, 0);
|
||||
MODULE_PARM_DESC(irq,"IRQ for AD1848 chip");
|
||||
module_param(dma, int, 0);
|
||||
MODULE_PARM_DESC(dma,"8 bit DMA for AD1848 chip");
|
||||
module_param(dma2, int, 0);
|
||||
MODULE_PARM_DESC(dma2,"16 bit DMA for AD1848 chip");
|
||||
module_param(mpuio, int, 0);
|
||||
MODULE_PARM_DESC(mpuio,"MPU 401 base address");
|
||||
module_param(mpuirq, int, 0);
|
||||
MODULE_PARM_DESC(mpuirq,"MPU 401 IRQ");
|
||||
module_param(synthio, int, 0);
|
||||
MODULE_PARM_DESC(synthio,"Maui WaveTable base I/O port");
|
||||
module_param(synthirq, int, 0);
|
||||
MODULE_PARM_DESC(synthirq,"Maui WaveTable IRQ");
|
||||
module_param(isapnp, bool, 0);
|
||||
MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)");
|
||||
module_param(bss, bool, 0);
|
||||
MODULE_PARM_DESC(bss,"Enable Bose Sound System Support (default 0)");
|
||||
|
||||
/*
|
||||
* Install a CS4232 based card. Need to have ad1848 and mpu401
|
||||
* loaded ready.
|
||||
*/
|
||||
|
||||
/* All cs4232 based cards have the main ad1848 card either as CSC0000 or
|
||||
* CSC0100. */
|
||||
static const struct pnp_device_id cs4232_pnp_table[] = {
|
||||
{ .id = "CSC0100", .driver_data = 0 },
|
||||
{ .id = "CSC0000", .driver_data = 0 },
|
||||
/* Guillemot Turtlebeach something appears to be cs4232 compatible
|
||||
* (untested) */
|
||||
{ .id = "GIM0100", .driver_data = 0 },
|
||||
{ .id = ""}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table);
|
||||
|
||||
static int __init cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
|
||||
{
|
||||
struct address_info *isapnpcfg;
|
||||
|
||||
isapnpcfg = kmalloc(sizeof(*isapnpcfg),GFP_KERNEL);
|
||||
if (!isapnpcfg)
|
||||
return -ENOMEM;
|
||||
|
||||
isapnpcfg->irq = pnp_irq(dev, 0);
|
||||
isapnpcfg->dma = pnp_dma(dev, 0);
|
||||
isapnpcfg->dma2 = pnp_dma(dev, 1);
|
||||
isapnpcfg->io_base = pnp_port_start(dev, 0);
|
||||
if (probe_cs4232(isapnpcfg,TRUE) == 0) {
|
||||
printk(KERN_ERR "cs4232: ISA PnP card found, but not detected?\n");
|
||||
kfree(isapnpcfg);
|
||||
return -ENODEV;
|
||||
}
|
||||
pnp_set_drvdata(dev,isapnpcfg);
|
||||
cs4232_devices++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __devexit cs4232_pnp_remove(struct pnp_dev *dev)
|
||||
{
|
||||
struct address_info *cfg = pnp_get_drvdata(dev);
|
||||
if (cfg) {
|
||||
unload_cs4232(cfg);
|
||||
kfree(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
static struct pnp_driver cs4232_driver = {
|
||||
.name = "cs4232",
|
||||
.id_table = cs4232_pnp_table,
|
||||
.probe = cs4232_pnp_probe,
|
||||
.remove = __devexit_p(cs4232_pnp_remove),
|
||||
};
|
||||
|
||||
static int __init init_cs4232(void)
|
||||
{
|
||||
#ifdef CONFIG_SOUND_WAVEFRONT_MODULE
|
||||
if(synthio == -1)
|
||||
printk(KERN_INFO "cs4232: set synthio and synthirq to use the wavefront facilities.\n");
|
||||
else {
|
||||
synth_base = synthio;
|
||||
synth_irq = synthirq;
|
||||
}
|
||||
#else
|
||||
if(synthio != -1)
|
||||
printk(KERN_WARNING "cs4232: wavefront support not enabled in this driver.\n");
|
||||
#endif
|
||||
cfg.irq = -1;
|
||||
|
||||
if (isapnp) {
|
||||
pnp_register_driver(&cs4232_driver);
|
||||
if (cs4232_devices)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(io==-1||irq==-1||dma==-1)
|
||||
{
|
||||
printk(KERN_ERR "cs4232: Must set io, irq and dma.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
cfg.io_base = io;
|
||||
cfg.irq = irq;
|
||||
cfg.dma = dma;
|
||||
cfg.dma2 = dma2;
|
||||
|
||||
cfg_mpu.io_base = -1;
|
||||
cfg_mpu.irq = -1;
|
||||
|
||||
if (mpuio != -1 && mpuirq != -1) {
|
||||
cfg_mpu.io_base = mpuio;
|
||||
cfg_mpu.irq = mpuirq;
|
||||
probe_cs4232_mpu(&cfg_mpu); /* Bug always returns 0 not OK -- AC */
|
||||
}
|
||||
|
||||
if (probe_cs4232(&cfg,FALSE) == 0)
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit cleanup_cs4232(void)
|
||||
{
|
||||
pnp_unregister_driver(&cs4232_driver);
|
||||
if (cfg.irq != -1)
|
||||
unload_cs4232(&cfg); /* Unloads global MPU as well, if needed */
|
||||
}
|
||||
|
||||
module_init(init_cs4232);
|
||||
module_exit(cleanup_cs4232);
|
||||
|
||||
#ifndef MODULE
|
||||
static int __init setup_cs4232(char *str)
|
||||
{
|
||||
/* io, irq, dma, dma2 mpuio, mpuirq*/
|
||||
int ints[7];
|
||||
|
||||
/* If we have isapnp cards, no need for options */
|
||||
pnp_register_driver(&cs4232_driver);
|
||||
if (cs4232_devices)
|
||||
return 1;
|
||||
|
||||
str = get_options(str, ARRAY_SIZE(ints), ints);
|
||||
|
||||
io = ints[1];
|
||||
irq = ints[2];
|
||||
dma = ints[3];
|
||||
dma2 = ints[4];
|
||||
mpuio = ints[5];
|
||||
mpuirq = ints[6];
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
__setup("cs4232=", setup_cs4232);
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user