X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fca0106%2Fca0106_proc.c;h=75ca421eb3a19c9d7c63da437a9b7aad7d015f7b;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=afb711421e479e7e70c4fa95e90607cab1a32f46;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index afb711421..75ca421eb 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2004 James Courtier-Dutton * Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit - * Version: 0.0.17 + * Version: 0.0.18 * * FEATURES currently supported: * See ca0106_main.c for features. @@ -39,7 +39,9 @@ * Modified Copyright message. * 0.0.17 * Add iec958 file in proc file system to show status of SPDIF in. - * + * 0.0.18 + * Implement support for Line-in capture on SB Live 24bit. + * * This code was initally based on code from ALSA's emu10k1x.c which is: * Copyright (c) by Francisco Moraes * @@ -75,6 +77,8 @@ #include "ca0106.h" +#ifdef CONFIG_PROC_FS + struct snd_ca0106_category_str { int val; const char *name; @@ -95,7 +99,7 @@ static struct snd_ca0106_category_str snd_ca0106_con_category[] = { }; -void snd_ca0106_proc_dump_iec958( snd_info_buffer_t *buffer, u32 value) +static void snd_ca0106_proc_dump_iec958( struct snd_info_buffer *buffer, u32 value) { int i; u32 status[4]; @@ -269,10 +273,10 @@ void snd_ca0106_proc_dump_iec958( snd_info_buffer_t *buffer, u32 value) } } -static void snd_ca0106_proc_iec958(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_iec958(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; u32 value; value = snd_ca0106_ptr_read(emu, SAMPLE_RATE_TRACKER_STATUS, 0); @@ -291,10 +295,10 @@ static void snd_ca0106_proc_iec958(snd_info_entry_t *entry, snd_iprintf(buffer, "\n"); } -static void snd_ca0106_proc_reg_write32(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; unsigned long flags; char line[64]; u32 reg, val; @@ -309,10 +313,10 @@ static void snd_ca0106_proc_reg_write32(snd_info_entry_t *entry, } } -static void snd_ca0106_proc_reg_read32(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_read32(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; unsigned long value; unsigned long flags; int i; @@ -325,10 +329,10 @@ static void snd_ca0106_proc_reg_read32(snd_info_entry_t *entry, } } -static void snd_ca0106_proc_reg_read16(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_read16(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; unsigned int value; unsigned long flags; int i; @@ -341,10 +345,10 @@ static void snd_ca0106_proc_reg_read16(snd_info_entry_t *entry, } } -static void snd_ca0106_proc_reg_read8(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_read8(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; unsigned int value; unsigned long flags; int i; @@ -357,10 +361,10 @@ static void snd_ca0106_proc_reg_read8(snd_info_entry_t *entry, } } -static void snd_ca0106_proc_reg_read1(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_read1(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; unsigned long value; int i,j; @@ -375,10 +379,10 @@ static void snd_ca0106_proc_reg_read1(snd_info_entry_t *entry, } } -static void snd_ca0106_proc_reg_read2(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_read2(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; unsigned long value; int i,j; @@ -393,10 +397,10 @@ static void snd_ca0106_proc_reg_read2(snd_info_entry_t *entry, } } -static void snd_ca0106_proc_reg_write(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_ca0106_proc_reg_write(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { - ca0106_t *emu = entry->private_data; + struct snd_ca0106 *emu = entry->private_data; char line[64]; unsigned int reg, channel_id , val; while (!snd_info_get_line(buffer, line, sizeof(line))) { @@ -407,30 +411,51 @@ static void snd_ca0106_proc_reg_write(snd_info_entry_t *entry, } } +static void snd_ca0106_proc_i2c_write(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_ca0106 *emu = entry->private_data; + char line[64]; + unsigned int reg, val; + while (!snd_info_get_line(buffer, line, sizeof(line))) { + if (sscanf(line, "%x %x", ®, &val) != 2) + continue; + if ((reg <= 0x7f) || (val <= 0x1ff)) { + snd_ca0106_i2c_write(emu, reg, val); + } + } +} -int __devinit snd_ca0106_proc_init(ca0106_t * emu) +int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if(! snd_card_proc_new(emu->card, "iec958", &entry)) - snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_iec958); + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_iec958); if(! snd_card_proc_new(emu->card, "ca0106_reg32", &entry)) { - snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read32); - entry->c.text.write_size = 64; + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read32); entry->c.text.write = snd_ca0106_proc_reg_write32; + entry->mode |= S_IWUSR; } if(! snd_card_proc_new(emu->card, "ca0106_reg16", &entry)) - snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read16); + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read16); if(! snd_card_proc_new(emu->card, "ca0106_reg8", &entry)) - snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read8); + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read8); if(! snd_card_proc_new(emu->card, "ca0106_regs1", &entry)) { - snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read1); - entry->c.text.write_size = 64; + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1); entry->c.text.write = snd_ca0106_proc_reg_write; + entry->mode |= S_IWUSR; +// entry->private_data = emu; + } + if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) { + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_i2c_write); + entry->c.text.write = snd_ca0106_proc_i2c_write; + entry->mode |= S_IWUSR; // entry->private_data = emu; } if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) - snd_info_set_text_ops(entry, emu, 1024, snd_ca0106_proc_reg_read2); + snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2); return 0; } +#endif /* CONFIG_PROC_FS */