Commit e7dd8c1b authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/misc' into topic/pcsp-fix

Conflicts:
	sound/drivers/pcsp/pcsp_lib.c
parents ed313489 bc4a68fe
...@@ -353,7 +353,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) ...@@ -353,7 +353,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
* snd_printk - printk wrapper * snd_printk - printk wrapper
* @fmt: format string * @fmt: format string
* *
* Works like print() but prints the file and the line of the caller * Works like printk() but prints the file and the line of the caller
* when configured with CONFIG_SND_VERBOSE_PRINTK. * when configured with CONFIG_SND_VERBOSE_PRINTK.
*/ */
#define snd_printk(fmt, args...) \ #define snd_printk(fmt, args...) \
...@@ -380,18 +380,40 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) ...@@ -380,18 +380,40 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
printk(fmt ,##args) printk(fmt ,##args)
#endif #endif
/**
* snd_BUG - give a BUG warning message and stack trace
*
* Calls WARN() if CONFIG_SND_DEBUG is set.
* Ignored when CONFIG_SND_DEBUG is not set.
*/
#define snd_BUG() WARN(1, "BUG?\n") #define snd_BUG() WARN(1, "BUG?\n")
/**
* snd_BUG_ON - debugging check macro
* @cond: condition to evaluate
*
* When CONFIG_SND_DEBUG is set, this macro evaluates the given condition,
* and call WARN() and returns the value if it's non-zero.
*
* When CONFIG_SND_DEBUG is not set, this just returns zero, and the given
* condition is ignored.
*
* NOTE: the argument won't be evaluated at all when CONFIG_SND_DEBUG=n.
* Thus, don't put any statement that influences on the code behavior,
* such as pre/post increment, to the argument of this macro.
* If you want to evaluate and give a warning, use standard WARN_ON().
*/
#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond)) #define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
#else /* !CONFIG_SND_DEBUG */ #else /* !CONFIG_SND_DEBUG */
#define snd_printd(fmt, args...) do { } while (0) #define snd_printd(fmt, args...) do { } while (0)
#define snd_BUG() do { } while (0) #define snd_BUG() do { } while (0)
static inline int __snd_bug_on(void) static inline int __snd_bug_on(int cond)
{ {
return 0; return 0;
} }
#define snd_BUG_ON(cond) __snd_bug_on() /* always false */ #define snd_BUG_ON(cond) __snd_bug_on(0 && (cond)) /* always false */
#endif /* CONFIG_SND_DEBUG */ #endif /* CONFIG_SND_DEBUG */
......
/* include/version.h */ /* include/version.h */
#define CONFIG_SND_VERSION "1.0.18rc3" #define CONFIG_SND_VERSION "1.0.18a"
#define CONFIG_SND_DATE "" #define CONFIG_SND_DATE ""
...@@ -98,7 +98,7 @@ int snd_device_free(struct snd_card *card, void *device_data) ...@@ -98,7 +98,7 @@ int snd_device_free(struct snd_card *card, void *device_data)
kfree(dev); kfree(dev);
return 0; return 0;
} }
snd_printd("device free %p (from %p), not found\n", device_data, snd_printd("device free %p (from %pF), not found\n", device_data,
__builtin_return_address(0)); __builtin_return_address(0));
return -ENXIO; return -ENXIO;
} }
...@@ -135,7 +135,7 @@ int snd_device_disconnect(struct snd_card *card, void *device_data) ...@@ -135,7 +135,7 @@ int snd_device_disconnect(struct snd_card *card, void *device_data)
} }
return 0; return 0;
} }
snd_printd("device disconnect %p (from %p), not found\n", device_data, snd_printd("device disconnect %p (from %pF), not found\n", device_data,
__builtin_return_address(0)); __builtin_return_address(0));
return -ENXIO; return -ENXIO;
} }
......
...@@ -96,7 +96,7 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) ...@@ -96,7 +96,7 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
return -EINVAL; return -EINVAL;
hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pcsp_chip.timer.cb_mode = HRTIMER_CB_SOFTIRQ; pcsp_chip.timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
pcsp_chip.timer.function = pcsp_do_timer; pcsp_chip.timer.function = pcsp_do_timer;
card = snd_card_new(index, id, THIS_MODULE, 0); card = snd_card_new(index, id, THIS_MODULE, 0);
...@@ -188,10 +188,8 @@ static int __devexit pcsp_remove(struct platform_device *dev) ...@@ -188,10 +188,8 @@ static int __devexit pcsp_remove(struct platform_device *dev)
static void pcsp_stop_beep(struct snd_pcsp *chip) static void pcsp_stop_beep(struct snd_pcsp *chip)
{ {
spin_lock_irq(&chip->substream_lock); pcsp_sync_stop(chip);
if (!chip->playback_substream) pcspkr_stop_sound();
pcspkr_stop_sound();
spin_unlock_irq(&chip->substream_lock);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
...@@ -77,6 +77,7 @@ struct snd_pcsp { ...@@ -77,6 +77,7 @@ struct snd_pcsp {
extern struct snd_pcsp pcsp_chip; extern struct snd_pcsp pcsp_chip;
extern enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle); extern enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle);
extern void pcsp_sync_stop(struct snd_pcsp *chip);
extern int snd_pcsp_new_pcm(struct snd_pcsp *chip); extern int snd_pcsp_new_pcm(struct snd_pcsp *chip);
extern int snd_pcsp_new_mixer(struct snd_pcsp *chip); extern int snd_pcsp_new_mixer(struct snd_pcsp *chip);
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <asm/io.h> #include <asm/io.h>
#include "pcsp.h" #include "pcsp.h"
...@@ -19,6 +20,22 @@ MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " ...@@ -19,6 +20,22 @@ MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround "
#define DMIX_WANTS_S16 1 #define DMIX_WANTS_S16 1
/*
* Call snd_pcm_period_elapsed in a tasklet
* This avoids spinlock messes and long-running irq contexts
*/
static void pcsp_call_pcm_elapsed(unsigned long priv)
{
if (atomic_read(&pcsp_chip.timer_active)) {
struct snd_pcm_substream *substream;
substream = pcsp_chip.playback_substream;
if (substream)
snd_pcm_period_elapsed(substream);
}
}
static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0);
enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
{ {
unsigned char timer_cnt, val; unsigned char timer_cnt, val;
...@@ -28,41 +45,23 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) ...@@ -28,41 +45,23 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
struct snd_pcm_runtime *runtime; struct snd_pcm_runtime *runtime;
struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer);
unsigned long flags;
if (chip->thalf) { if (chip->thalf) {
outb(chip->val61, 0x61); outb(chip->val61, 0x61);
chip->thalf = 0; chip->thalf = 0;
if (!atomic_read(&chip->timer_active)) if (!atomic_read(&chip->timer_active))
return HRTIMER_NORESTART; goto stop;
hrtimer_forward(&chip->timer, hrtimer_get_expires(&chip->timer), hrtimer_forward(&chip->timer, hrtimer_get_expires(&chip->timer),
ktime_set(0, chip->ns_rem)); ktime_set(0, chip->ns_rem));
return HRTIMER_RESTART; return HRTIMER_RESTART;
} }
spin_lock_irq(&chip->substream_lock);
/* Takashi Iwai says regarding this extra lock:
If the irq handler handles some data on the DMA buffer, it should
do snd_pcm_stream_lock().
That protects basically against all races among PCM callbacks, yes.
However, there are two remaining issues:
1. The substream pointer you try to lock isn't protected _before_
this lock yet.
2. snd_pcm_period_elapsed() itself acquires the lock.
The requirement of another lock is because of 1. When you get
chip->playback_substream, it's not protected.
Keeping this lock while snd_pcm_period_elapsed() assures the substream
is still protected (at least, not released). And the other status is
handled properly inside snd_pcm_stream_lock() in
snd_pcm_period_elapsed().
*/
if (!chip->playback_substream)
goto exit_nr_unlock1;
substream = chip->playback_substream;
snd_pcm_stream_lock(substream);
if (!atomic_read(&chip->timer_active)) if (!atomic_read(&chip->timer_active))
goto exit_nr_unlock2; goto stop;
substream = chip->playback_substream;
if (!substream)
goto stop;
runtime = substream->runtime; runtime = substream->runtime;
fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3; fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3;
...@@ -87,6 +86,8 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) ...@@ -87,6 +86,8 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
period_bytes = snd_pcm_lib_period_bytes(substream); period_bytes = snd_pcm_lib_period_bytes(substream);
buffer_bytes = snd_pcm_lib_buffer_bytes(substream); buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
spin_lock_irqsave(&chip->substream_lock, flags);
chip->playback_ptr += PCSP_INDEX_INC() * fmt_size; chip->playback_ptr += PCSP_INDEX_INC() * fmt_size;
periods_elapsed = chip->playback_ptr - chip->period_ptr; periods_elapsed = chip->playback_ptr - chip->period_ptr;
if (periods_elapsed < 0) { if (periods_elapsed < 0) {
...@@ -102,18 +103,15 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) ...@@ -102,18 +103,15 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
* or ALSA will BUG on us. */ * or ALSA will BUG on us. */
chip->playback_ptr %= buffer_bytes; chip->playback_ptr %= buffer_bytes;
snd_pcm_stream_unlock(substream);
if (periods_elapsed) { if (periods_elapsed) {
snd_pcm_period_elapsed(substream);
chip->period_ptr += periods_elapsed * period_bytes; chip->period_ptr += periods_elapsed * period_bytes;
chip->period_ptr %= buffer_bytes; chip->period_ptr %= buffer_bytes;
tasklet_schedule(&pcsp_pcm_tasklet);
} }
spin_unlock_irqrestore(&chip->substream_lock, flags);
spin_unlock_irq(&chip->substream_lock);
if (!atomic_read(&chip->timer_active)) if (!atomic_read(&chip->timer_active))
return HRTIMER_NORESTART; goto stop;
chip->ns_rem = PCSP_PERIOD_NS(); chip->ns_rem = PCSP_PERIOD_NS();
ns = (chip->thalf ? PCSP_CALC_NS(timer_cnt) : chip->ns_rem); ns = (chip->thalf ? PCSP_CALC_NS(timer_cnt) : chip->ns_rem);
...@@ -122,10 +120,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) ...@@ -122,10 +120,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
ktime_set(0, ns)); ktime_set(0, ns));
return HRTIMER_RESTART; return HRTIMER_RESTART;
exit_nr_unlock2: stop:
snd_pcm_stream_unlock(substream);
exit_nr_unlock1:
spin_unlock_irq(&chip->substream_lock);
return HRTIMER_NORESTART; return HRTIMER_NORESTART;
} }
...@@ -165,26 +160,35 @@ static void pcsp_stop_playing(struct snd_pcsp *chip) ...@@ -165,26 +160,35 @@ static void pcsp_stop_playing(struct snd_pcsp *chip)
spin_unlock(&i8253_lock); spin_unlock(&i8253_lock);
} }
/*
* Force to stop and sync the stream
*/
void pcsp_sync_stop(struct snd_pcsp *chip)
{
local_irq_disable();
pcsp_stop_playing(chip);
local_irq_enable();
hrtimer_cancel(&chip->timer);
tasklet_kill(&pcsp_pcm_tasklet);
}
static int snd_pcsp_playback_close(struct snd_pcm_substream *substream) static int snd_pcsp_playback_close(struct snd_pcm_substream *substream)
{ {
struct snd_pcsp *chip = snd_pcm_substream_chip(substream); struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
#if PCSP_DEBUG #if PCSP_DEBUG
printk(KERN_INFO "PCSP: close called\n"); printk(KERN_INFO "PCSP: close called\n");
#endif #endif
if (atomic_read(&chip->timer_active)) { pcsp_sync_stop(chip);
printk(KERN_ERR "PCSP: timer still active\n");
pcsp_stop_playing(chip);
}
spin_lock_irq(&chip->substream_lock);
chip->playback_substream = NULL; chip->playback_substream = NULL;
spin_unlock_irq(&chip->substream_lock);
return 0; return 0;
} }
static int snd_pcsp_playback_hw_params(struct snd_pcm_substream *substream, static int snd_pcsp_playback_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params) struct snd_pcm_hw_params *hw_params)
{ {
struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
int err; int err;
pcsp_sync_stop(chip);
err = snd_pcm_lib_malloc_pages(substream, err = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params)); params_buffer_bytes(hw_params));
if (err < 0) if (err < 0)
...@@ -194,9 +198,11 @@ static int snd_pcsp_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -194,9 +198,11 @@ static int snd_pcsp_playback_hw_params(struct snd_pcm_substream *substream,
static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream) static int snd_pcsp_playback_hw_free(struct snd_pcm_substream *substream)
{ {
struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
#if PCSP_DEBUG #if PCSP_DEBUG
printk(KERN_INFO "PCSP: hw_free called\n"); printk(KERN_INFO "PCSP: hw_free called\n");
#endif #endif
pcsp_sync_stop(chip);
return snd_pcm_lib_free_pages(substream); return snd_pcm_lib_free_pages(substream);
} }
...@@ -212,6 +218,7 @@ static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream) ...@@ -212,6 +218,7 @@ static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream)
snd_pcm_lib_period_bytes(substream), snd_pcm_lib_period_bytes(substream),
substream->runtime->periods); substream->runtime->periods);
#endif #endif
pcsp_sync_stop(chip);
chip->playback_ptr = 0; chip->playback_ptr = 0;
chip->period_ptr = 0; chip->period_ptr = 0;
return 0; return 0;
...@@ -242,7 +249,11 @@ static snd_pcm_uframes_t snd_pcsp_playback_pointer(struct snd_pcm_substream ...@@ -242,7 +249,11 @@ static snd_pcm_uframes_t snd_pcsp_playback_pointer(struct snd_pcm_substream
*substream) *substream)
{ {
struct snd_pcsp *chip = snd_pcm_substream_chip(substream); struct snd_pcsp *chip = snd_pcm_substream_chip(substream);
return bytes_to_frames(substream->runtime, chip->playback_ptr); unsigned int pos;
spin_lock(&chip->substream_lock);
pos = chip->playback_ptr;
spin_unlock(&chip->substream_lock);
return bytes_to_frames(substream->runtime, pos);
} }
static struct snd_pcm_hardware snd_pcsp_playback = { static struct snd_pcm_hardware snd_pcsp_playback = {
...@@ -279,9 +290,7 @@ static int snd_pcsp_playback_open(struct snd_pcm_substream *substream) ...@@ -279,9 +290,7 @@ static int snd_pcsp_playback_open(struct snd_pcm_substream *substream)
return -EBUSY; return -EBUSY;
} }
runtime->hw = snd_pcsp_playback; runtime->hw = snd_pcsp_playback;
spin_lock_irq(&chip->substream_lock);
chip->playback_substream = substream; chip->playback_substream = substream;
spin_unlock_irq(&chip->substream_lock);
return 0; return 0;
} }
......
...@@ -2832,6 +2832,8 @@ static int patch_alc655(struct snd_ac97 * ac97) ...@@ -2832,6 +2832,8 @@ static int patch_alc655(struct snd_ac97 * ac97)
val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */ val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */
else else
val |= (1 << 1); /* Pin 47 is spdif input pin */ val |= (1 << 1); /* Pin 47 is spdif input pin */
/* this seems missing on some hardwares */
ac97->ext_id |= AC97_EI_SPDIF;
} }
val &= ~(1 << 12); /* vref enable */ val &= ~(1 << 12); /* vref enable */
snd_ac97_write_cache(ac97, 0x7a, val); snd_ac97_write_cache(ac97, 0x7a, val);
......
...@@ -69,7 +69,7 @@ MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME); ...@@ -69,7 +69,7 @@ MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME);
* EMU10K1 init / done * EMU10K1 init / done
*************************************************************************/ *************************************************************************/
void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int ch) void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)
{ {
snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0); snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0);
snd_emu10k1_ptr_write(emu, IP, ch, 0); snd_emu10k1_ptr_write(emu, IP, ch, 0);
...@@ -151,9 +151,9 @@ static unsigned int i2c_adc_init[][2] = { ...@@ -151,9 +151,9 @@ static unsigned int i2c_adc_init[][2] = {
{ 0x12, 0x32 }, /* ALC Control 3 */ { 0x12, 0x32 }, /* ALC Control 3 */
{ 0x13, 0x00 }, /* Noise gate control */ { 0x13, 0x00 }, /* Noise gate control */
{ 0x14, 0xa6 }, /* Limiter control */ { 0x14, 0xa6 }, /* Limiter control */
{ 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for Audigy 2 ZS Notebook */ { 0x15, ADC_MUX_2 }, /* ADC Mixer control. Mic for A2ZS Notebook */
}; };
static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
{ {
unsigned int silent_page; unsigned int silent_page;
...@@ -161,8 +161,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -161,8 +161,8 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
u32 tmp; u32 tmp;
/* disable audio and lock cache */ /* disable audio and lock cache */
outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK |
emu->port + HCFG); HCFG_MUTEBUTTONENABLE, emu->port + HCFG);
/* reset recording buffers */ /* reset recording buffers */
snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE); snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE);
...@@ -179,7 +179,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -179,7 +179,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
snd_emu10k1_ptr_write(emu, SOLEL, 0, 0); snd_emu10k1_ptr_write(emu, SOLEL, 0, 0);
snd_emu10k1_ptr_write(emu, SOLEH, 0, 0); snd_emu10k1_ptr_write(emu, SOLEH, 0, 0);
if (emu->audigy){ if (emu->audigy) {
/* set SPDIF bypass mode */ /* set SPDIF bypass mode */
snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT); snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT);
/* enable rear left + rear right AC97 slots */ /* enable rear left + rear right AC97 slots */
...@@ -197,12 +197,12 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -197,12 +197,12 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
/* Hacks for Alice3 to work independent of haP16V driver */ /* Hacks for Alice3 to work independent of haP16V driver */
//Setup SRCMulti_I2S SamplingRate /* Setup SRCMulti_I2S SamplingRate */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
tmp &= 0xfffff1ff; tmp &= 0xfffff1ff;
tmp |= (0x2<<9); tmp |= (0x2<<9);
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp); snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
/* Setup SRCSel (Enable Spdif,I2S SRCMulti) */ /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14); snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14);
/* Setup SRCMulti Input Audio Enable */ /* Setup SRCMulti Input Audio Enable */
...@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -217,7 +217,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */ if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
/* Hacks for Alice3 to work independent of haP16V driver */ /* Hacks for Alice3 to work independent of haP16V driver */
snd_printk(KERN_INFO "Audigy2 value: Special config.\n"); snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
//Setup SRCMulti_I2S SamplingRate /* Setup SRCMulti_I2S SamplingRate */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0); tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
tmp &= 0xfffff1ff; tmp &= 0xfffff1ff;
tmp |= (0x2<<9); tmp |= (0x2<<9);
...@@ -270,13 +270,13 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -270,13 +270,13 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
size = ARRAY_SIZE(i2c_adc_init); size = ARRAY_SIZE(i2c_adc_init);
for (n = 0; n < size; n++) for (n = 0; n < size; n++)
snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]); snd_emu10k1_i2c_write(emu, i2c_adc_init[n][0], i2c_adc_init[n][1]);
for (n=0; n < 4; n++) { for (n = 0; n < 4; n++) {
emu->i2c_capture_volume[n][0]= 0xcf; emu->i2c_capture_volume[n][0] = 0xcf;
emu->i2c_capture_volume[n][1]= 0xcf; emu->i2c_capture_volume[n][1] = 0xcf;
} }
} }
snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr); snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr);
snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */
snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */ snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */
...@@ -313,7 +313,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -313,7 +313,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
(emu->model == 0x21 && emu->revision < 6)) (emu->model == 0x21 && emu->revision < 6))
outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG); outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG);
else else
// With on-chip joystick /* With on-chip joystick */
outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG); outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
if (enable_ir) { /* enable IR for SB Live */ if (enable_ir) { /* enable IR for SB Live */
...@@ -335,9 +335,9 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) ...@@ -335,9 +335,9 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG); outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG);
udelay(100); udelay(100);
outl(reg, emu->port + HCFG); outl(reg, emu->port + HCFG);
} }
} }
if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->emu_model) {
; /* Disable all access to A_IOCFG for the emu1010 */ ; /* Disable all access to A_IOCFG for the emu1010 */
} else if (emu->card_capabilities->i2c_adc) { } else if (emu->card_capabilities->i2c_adc) {
...@@ -364,7 +364,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) ...@@ -364,7 +364,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
; /* Disable A_IOCFG for Audigy 2 ZS Notebook */ ; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
} else if (emu->audigy) { } else if (emu->audigy) {
outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
if (emu->card_capabilities->ca0151_chip) { /* audigy2 */ if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
/* Unmute Analog now. Set GPO6 to 1 for Apollo. /* Unmute Analog now. Set GPO6 to 1 for Apollo.
* This has to be done after init ALice3 I2SOut beyond 48KHz. * This has to be done after init ALice3 I2SOut beyond 48KHz.
...@@ -378,12 +378,12 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) ...@@ -378,12 +378,12 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG); outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG);
} }
} }
#if 0 #if 0
{ {
unsigned int tmp; unsigned int tmp;
/* FIXME: the following routine disables LiveDrive-II !! */ /* FIXME: the following routine disables LiveDrive-II !! */
// TOSLink detection /* TOSLink detection */
emu->tos_link = 0; emu->tos_link = 0;
tmp = inl(emu->port + HCFG); tmp = inl(emu->port + HCFG);
if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) { if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) {
...@@ -400,7 +400,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu) ...@@ -400,7 +400,7 @@ static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE); snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE);
} }
int snd_emu10k1_done(struct snd_emu10k1 * emu) int snd_emu10k1_done(struct snd_emu10k1 *emu)
{ {
int ch; int ch;
...@@ -495,7 +495,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu) ...@@ -495,7 +495,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
#define EC_LAST_PROMFILE_ADDR 0x2f #define EC_LAST_PROMFILE_ADDR 0x2f
#define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The #define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The
* can be up to 30 characters in length * can be up to 30 characters in length
* and is stored as a NULL-terminated * and is stored as a NULL-terminated
* ASCII string. Any unused bytes must be * ASCII string. Any unused bytes must be
...@@ -503,8 +503,8 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu) ...@@ -503,8 +503,8 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
#define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */ #define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */
/* Most of this stuff is pretty self-evident. According to the hardware /* Most of this stuff is pretty self-evident. According to the hardware
* dudes, we need to leave the ADCCAL bit low in order to avoid a DC * dudes, we need to leave the ADCCAL bit low in order to avoid a DC
* offset problem. Weird. * offset problem. Weird.
*/ */
#define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \ #define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \
...@@ -523,7 +523,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu) ...@@ -523,7 +523,7 @@ int snd_emu10k1_done(struct snd_emu10k1 * emu)
* register. * register.
*/ */
static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value) static void snd_emu10k1_ecard_write(struct snd_emu10k1 *emu, unsigned int value)
{ {
unsigned short count; unsigned short count;
unsigned int data; unsigned int data;
...@@ -561,7 +561,7 @@ static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value ...@@ -561,7 +561,7 @@ static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value
* channel. * channel.
*/ */
static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 *emu,
unsigned short gain) unsigned short gain)
{ {
unsigned int bit; unsigned int bit;
...@@ -574,7 +574,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, ...@@ -574,7 +574,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
for (bit = (1 << 15); bit; bit >>= 1) { for (bit = (1 << 15); bit; bit >>= 1) {
unsigned int value; unsigned int value;
value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA); value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA);
if (gain & bit) if (gain & bit)
...@@ -589,7 +589,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu, ...@@ -589,7 +589,7 @@ static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
snd_emu10k1_ecard_write(emu, emu->ecard_ctrl); snd_emu10k1_ecard_write(emu, emu->ecard_ctrl);
} }
static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) static int snd_emu10k1_ecard_init(struct snd_emu10k1 *emu)
{ {
unsigned int hc_value; unsigned int hc_value;
...@@ -598,7 +598,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) ...@@ -598,7 +598,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) | EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) |
EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL); EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL);
/* Step 0: Set the codec type in the hardware control register /* Step 0: Set the codec type in the hardware control register
* and enable audio output */ * and enable audio output */
hc_value = inl(emu->port + HCFG); hc_value = inl(emu->port + HCFG);
outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG); outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG);
...@@ -629,7 +629,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu) ...@@ -629,7 +629,7 @@ static int snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
return 0; return 0;
} }
static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
{ {
unsigned long special_port; unsigned long special_port;
unsigned int value; unsigned int value;
...@@ -656,7 +656,7 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu) ...@@ -656,7 +656,7 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu)
return 0; return 0;
} }
static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * filename) static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filename)
{ {
int err; int err;
int n, i; int n, i;
...@@ -666,11 +666,12 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file ...@@ -666,11 +666,12 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
unsigned long flags; unsigned long flags;
const struct firmware *fw_entry; const struct firmware *fw_entry;
if ((err = request_firmware(&fw_entry, filename, &emu->pci->dev)) != 0) { err = request_firmware(&fw_entry, filename, &emu->pci->dev);
snd_printk(KERN_ERR "firmware: %s not found. Err=%d\n",filename, err); if (err != 0) {
snd_printk(KERN_ERR "firmware: %s not found. Err = %d\n", filename, err);
return err; return err;
} }
snd_printk(KERN_INFO "firmware size=0x%zx\n", fw_entry->size); snd_printk(KERN_INFO "firmware size = 0x%zx\n", fw_entry->size);
/* The FPGA is a Xilinx Spartan IIE XC2S50E */ /* The FPGA is a Xilinx Spartan IIE XC2S50E */
/* GPIO7 -> FPGA PGMN /* GPIO7 -> FPGA PGMN
...@@ -685,13 +686,13 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file ...@@ -685,13 +686,13 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */ outl(0x80, emu->port + A_IOCFG); /* Leave bit 7 set during netlist setup. */
write_post = inl(emu->port + A_IOCFG); write_post = inl(emu->port + A_IOCFG);
udelay(100); /* Allow FPGA memory to clean */ udelay(100); /* Allow FPGA memory to clean */
for(n = 0; n < fw_entry->size; n++) { for (n = 0; n < fw_entry->size; n++) {
value=fw_entry->data[n]; value = fw_entry->data[n];
for(i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
reg = 0x80; reg = 0x80;
if (value & 0x1) if (value & 0x1)
reg = reg | 0x20; reg = reg | 0x20;
value = value >> 1; value = value >> 1;
outl(reg, emu->port + A_IOCFG); outl(reg, emu->port + A_IOCFG);
write_post = inl(emu->port + A_IOCFG); write_post = inl(emu->port + A_IOCFG);
outl(reg | 0x40, emu->port + A_IOCFG); outl(reg | 0x40, emu->port + A_IOCFG);
...@@ -703,14 +704,14 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file ...@@ -703,14 +704,14 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * file
write_post = inl(emu->port + A_IOCFG); write_post = inl(emu->port + A_IOCFG);
spin_unlock_irqrestore(&emu->emu_lock, flags); spin_unlock_irqrestore(&emu->emu_lock, flags);
release_firmware(fw_entry); release_firmware(fw_entry);
return 0; return 0;
} }
static int emu1010_firmware_thread(void *data) static int emu1010_firmware_thread(void *data)
{ {
struct snd_emu10k1 * emu = data; struct snd_emu10k1 *emu = data;
int tmp,tmp2; int tmp, tmp2;
int reg; int reg;
int err; int err;
...@@ -719,50 +720,50 @@ static int emu1010_firmware_thread(void *data) ...@@ -719,50 +720,50 @@ static int emu1010_firmware_thread(void *data)
msleep_interruptible(1000); msleep_interruptible(1000);
if (kthread_should_stop()) if (kthread_should_stop())
break; break;
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp ); /* IRQ Status */ snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); /* OPTIONS: Which cards are attached to the EMU */ snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */
if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
/* Audio Dock attached */ /* Audio Dock attached */
/* Return to Audio Dock programming mode */ /* Return to Audio Dock programming mode */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK ); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
if (emu->card_capabilities->emu_model == if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1010) { EMU_MODEL_EMU1010) {
if ((err = snd_emu1010_load_firmware(emu, DOCK_FILENAME)) != 0) { err = snd_emu1010_load_firmware(emu, DOCK_FILENAME);
if (err != 0)
continue; continue;
}
} else if (emu->card_capabilities->emu_model == } else if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1010B) { EMU_MODEL_EMU1010B) {
if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
if (err != 0)
continue; continue;
}
} else if (emu->card_capabilities->emu_model == } else if (emu->card_capabilities->emu_model ==
EMU_MODEL_EMU1616) { EMU_MODEL_EMU1616) {
if ((err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME)) != 0) { err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
if (err != 0)
continue; continue;
}
} }
snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 ); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS = 0x%x\n", reg);
/* ID, should read & 0x7f = 0x55 when FPGA programmed. */ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_ID = 0x%x\n", reg);
if ((reg & 0x1f) != 0x15) { if ((reg & 0x1f) != 0x15) {
/* FPGA failed to be programmed */ /* FPGA failed to be programmed */
snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg=0x%x\n", reg); snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware file failed, reg = 0x%x\n", reg);
continue; continue;
} }
snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n");
snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp ); snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2 ); snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
snd_printk("Audio Dock ver:%d.%d\n",tmp ,tmp2); snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2);
/* Sync clocking between 1010 and Dock */ /* Sync clocking between 1010 and Dock */
/* Allow DLL to settle */ /* Allow DLL to settle */
msleep(10); msleep(10);
/* Unmute all. Default is muted after a firmware load */ /* Unmute all. Default is muted after a firmware load */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
} }
} }
snd_printk(KERN_INFO "emu1010: firmware thread stopping\n"); snd_printk(KERN_INFO "emu1010: firmware thread stopping\n");
...@@ -800,10 +801,10 @@ static int emu1010_firmware_thread(void *data) ...@@ -800,10 +801,10 @@ static int emu1010_firmware_thread(void *data)
* 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops * 16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
* 16 x 32-bit capture - snd_emu10k1_capture_efx_ops * 16 x 32-bit capture - snd_emu10k1_capture_efx_ops
*/ */
static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
{ {
unsigned int i; unsigned int i;
int tmp,tmp2; int tmp, tmp2;
int reg; int reg;
int err; int err;
const char *filename = NULL; const char *filename = NULL;
...@@ -818,7 +819,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -818,7 +819,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
* Lock Tank Memory Cache, * Lock Tank Memory Cache,
* Mute all codecs. * Mute all codecs.
*/ */
outl(0x0005a004, emu->port + HCFG); outl(0x0005a004, emu->port + HCFG);
/* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
* Mute all codecs. * Mute all codecs.
*/ */
...@@ -829,25 +830,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -829,25 +830,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
outl(0x0005a000, emu->port + HCFG); outl(0x0005a000, emu->port + HCFG);
/* Disable 48Volt power to Audio Dock */ /* Disable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
/* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */ /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
snd_printdd("reg1=0x%x\n",reg); snd_printdd("reg1 = 0x%x\n", reg);
if ((reg & 0x3f) == 0x15) { if ((reg & 0x3f) == 0x15) {
/* FPGA netlist already present so clear it */ /* FPGA netlist already present so clear it */
/* Return to programming mode */ /* Return to programming mode */
snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02 ); snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0x02);
} }
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
snd_printdd("reg2=0x%x\n",reg); snd_printdd("reg2 = 0x%x\n", reg);
if ((reg & 0x3f) == 0x15) { if ((reg & 0x3f) == 0x15) {
/* FPGA failed to return to programming mode */ /* FPGA failed to return to programming mode */
snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n"); snd_printk(KERN_INFO "emu1010: FPGA failed to return to programming mode\n");
return -ENODEV; return -ENODEV;
} }
snd_printk(KERN_INFO "emu1010: EMU_HANA_ID=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
switch (emu->card_capabilities->emu_model) { switch (emu->card_capabilities->emu_model) {
case EMU_MODEL_EMU1010: case EMU_MODEL_EMU1010:
filename = HANA_FILENAME; filename = HANA_FILENAME;
...@@ -876,25 +877,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -876,25 +877,25 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
} }
/* ID, should read & 0x7f = 0x55 when FPGA programmed. */ /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
if ((reg & 0x3f) != 0x15) { if ((reg & 0x3f) != 0x15) {
/* FPGA failed to be programmed */ /* FPGA failed to be programmed */
snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg=0x%x\n", reg); snd_printk(KERN_INFO "emu1010: Loading Hana Firmware file failed, reg = 0x%x\n", reg);
return -ENODEV; return -ENODEV;
} }
snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2 ); snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
snd_printk("Hana ver:%d.%d\n",tmp ,tmp2); snd_printk("emu1010: Hana version: %d.%d\n", tmp, tmp2);
/* Enable 48Volt power to Audio Dock */ /* Enable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: Card options = 0x%x\n", reg);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp);
/* Optical -> ADAT I/O */ /* Optical -> ADAT I/O */
/* 0 : SPDIF /* 0 : SPDIF
* 1 : ADAT * 1 : ADAT
...@@ -904,41 +905,42 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -904,41 +905,42 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
tmp = 0; tmp = 0;
tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) | tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) |
(emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0); (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0);
snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp ); snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp);
/* Set no attenuation on Audio Dock pads. */ /* Set no attenuation on Audio Dock pads. */
snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00);
emu->emu1010.adc_pads = 0x00; emu->emu1010.adc_pads = 0x00;
snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
/* Unmute Audio dock DACs, Headphone source DAC-4. */ /* Unmute Audio dock DACs, Headphone source DAC-4. */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp);
/* DAC PADs. */ /* DAC PADs. */
snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f ); snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f);
emu->emu1010.dac_pads = 0x0f; emu->emu1010.dac_pads = 0x0f;
snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp);
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30);
snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
/* SPDIF Format. Set Consumer mode, 24bit, copy enable */ /* SPDIF Format. Set Consumer mode, 24bit, copy enable */
snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10);
/* MIDI routing */ /* MIDI routing */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19);
/* Unknown. */ /* Unknown. */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c);
/* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); // IRQ Enable: All on */ /* IRQ Enable: Alll on */
/* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); */
/* IRQ Enable: All off */ /* IRQ Enable: All off */
snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00 ); snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg);
snd_printk(KERN_INFO "emu1010: Card options3=0x%x\n",reg); snd_printk(KERN_INFO "emu1010: Card options3 = 0x%x\n", reg);
/* Default WCLK set to 48kHz. */ /* Default WCLK set to 48kHz. */
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00 ); snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x00);
/* Word Clock source, Internal 48kHz x1 */ /* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
//snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); /* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
/* Audio Dock LEDs. */ /* Audio Dock LEDs. */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);
#if 0 #if 0
/* For 96kHz */ /* For 96kHz */
...@@ -992,7 +994,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -992,7 +994,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
* Defaults only, users will set their own values anyways, let's * Defaults only, users will set their own values anyways, let's
* just copy/paste. * just copy/paste.
*/ */
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1); EMU_DST_ALICE2_EMU32_8, EMU_SRC_DOCK_MIC_A1);
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
...@@ -1037,19 +1039,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1037,19 +1039,19 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2); EMU_DST_ALICE2_EMU32_F, EMU_SRC_HAMOA_ADC_LEFT2);
#endif #endif
for (i = 0;i < 0x20; i++ ) { for (i = 0; i < 0x20; i++) {
/* AudioDock Elink <- Silence */ /* AudioDock Elink <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, 0x0100+i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, 0x0100 + i, EMU_SRC_SILENCE);
} }
for (i = 0;i < 4; i++) { for (i = 0; i < 4; i++) {
/* Hana SPDIF Out <- Silence */ /* Hana SPDIF Out <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, 0x0200+i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, 0x0200 + i, EMU_SRC_SILENCE);
} }
for (i = 0;i < 7; i++) { for (i = 0; i < 7; i++) {
/* Hamoa DAC <- Silence */ /* Hamoa DAC <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, 0x0300+i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, 0x0300 + i, EMU_SRC_SILENCE);
} }
for (i = 0;i < 7; i++) { for (i = 0; i < 7; i++) {
/* Hana ADAT Out <- Silence */ /* Hana ADAT Out <- Silence */
snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE); snd_emu1010_fpga_link_dst_src_write(emu, EMU_DST_HANA_ADAT + i, EMU_SRC_SILENCE);
} }
...@@ -1065,30 +1067,30 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1065,30 +1067,30 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1); EMU_DST_ALICE_I2S2_LEFT, EMU_SRC_DOCK_ADC3_LEFT1);
snd_emu1010_fpga_link_dst_src_write(emu, snd_emu1010_fpga_link_dst_src_write(emu,
EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1); EMU_DST_ALICE_I2S2_RIGHT, EMU_SRC_DOCK_ADC3_RIGHT1);
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01 ); // Unmute all snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x01); /* Unmute all */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp );
/* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
* Lock Sound Memory Cache, Lock Tank Memory Cache, * Lock Sound Memory Cache, Lock Tank Memory Cache,
* Mute all codecs. * Mute all codecs.
*/ */
outl(0x0000a000, emu->port + HCFG); outl(0x0000a000, emu->port + HCFG);
/* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave, /* AC97 1.03, Any 32Meg of 2Gig address, Auto-Mute, EMU32 Slave,
* Lock Sound Memory Cache, Lock Tank Memory Cache, * Lock Sound Memory Cache, Lock Tank Memory Cache,
* Un-Mute all codecs. * Un-Mute all codecs.
*/ */
outl(0x0000a001, emu->port + HCFG); outl(0x0000a001, emu->port + HCFG);
/* Initial boot complete. Now patches */ /* Initial boot complete. Now patches */
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp);
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19); /* MIDI Route */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c); /* Unknown */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19); /* MIDI Route */
snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c); /* Unknown */
snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp);
snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10); /* SPDIF Format spdif (or 0x11 for aes/ebu) */
/* Start Micro/Audio Dock firmware loader thread */ /* Start Micro/Audio Dock firmware loader thread */
if (!emu->emu1010.firmware_thread) { if (!emu->emu1010.firmware_thread) {
...@@ -1218,20 +1220,20 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) ...@@ -1218,20 +1220,20 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
emu->emu1010.output_source[23] = 28; emu->emu1010.output_source[23] = 28;
} }
/* TEMP: Select SPDIF in/out */ /* TEMP: Select SPDIF in/out */
//snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ /* snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); */ /* Output spdif */
/* TEMP: Select 48kHz SPDIF out */ /* TEMP: Select 48kHz SPDIF out */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */ snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 0x0); /* Default fallback clock 48kHz */
/* Word Clock source, Internal 48kHz x1 */ /* Word Clock source, Internal 48kHz x1 */
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K ); snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K);
//snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X ); /* snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_4X); */
emu->emu1010.internal_clock = 1; /* 48000 */ emu->emu1010.internal_clock = 1; /* 48000 */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12);/* Set LEDs on Audio Dock */ snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12); /* Set LEDs on Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */ snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x1); /* Unmute all */
//snd_emu1010_fpga_write(emu, 0x7, 0x0); /* Mute all */ /* snd_emu1010_fpga_write(emu, 0x7, 0x0); */ /* Mute all */
//snd_emu1010_fpga_write(emu, 0x7, 0x1); /* Unmute all */ /* snd_emu1010_fpga_write(emu, 0x7, 0x1); */ /* Unmute all */
//snd_emu1010_fpga_write(emu, 0xe, 0x12); /* Set LEDs on Audio Dock */ /* snd_emu1010_fpga_write(emu, 0xe, 0x12); */ /* Set LEDs on Audio Dock */
return 0; return 0;
} }
...@@ -1247,13 +1249,13 @@ static void free_pm_buffer(struct snd_emu10k1 *emu); ...@@ -1247,13 +1249,13 @@ static void free_pm_buffer(struct snd_emu10k1 *emu);
static int snd_emu10k1_free(struct snd_emu10k1 *emu) static int snd_emu10k1_free(struct snd_emu10k1 *emu)
{ {
if (emu->port) { /* avoid access to already used hardware */ if (emu->port) { /* avoid access to already used hardware */
snd_emu10k1_fx8010_tram_setup(emu, 0); snd_emu10k1_fx8010_tram_setup(emu, 0);
snd_emu10k1_done(emu); snd_emu10k1_done(emu);
snd_emu10k1_free_efx(emu); snd_emu10k1_free_efx(emu);
} }
if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) { if (emu->card_capabilities->emu_model == EMU_MODEL_EMU1010) {
/* Disable 48Volt power to Audio Dock */ /* Disable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0 ); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
} }
if (emu->emu1010.firmware_thread) if (emu->emu1010.firmware_thread)
kthread_stop(emu->emu1010.firmware_thread); kthread_stop(emu->emu1010.firmware_thread);
...@@ -1278,7 +1280,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) ...@@ -1278,7 +1280,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
#endif #endif
if (emu->port) if (emu->port)
pci_release_regions(emu->pci); pci_release_regions(emu->pci);
if (emu->card_capabilities->ca0151_chip) /* P16V */ if (emu->card_capabilities->ca0151_chip) /* P16V */
snd_p16v_free(emu); snd_p16v_free(emu);
pci_disable_device(emu->pci); pci_disable_device(emu->pci);
kfree(emu); kfree(emu);
...@@ -1292,21 +1294,6 @@ static int snd_emu10k1_dev_free(struct snd_device *device) ...@@ -1292,21 +1294,6 @@ static int snd_emu10k1_dev_free(struct snd_device *device)
} }
static struct snd_emu_chip_details emu_chip_details[] = { static struct snd_emu_chip_details emu_chip_details[] = {
/* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/
/* Tested by James@superbug.co.uk 3rd July 2005 */
/* DSP: CA0108-IAT
* DAC: CS4382-KQ
* ADC: Philips 1361T
* AC97: STAC9750
* CA0151: None
*/
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
.driver = "Audigy2", .name = "Audigy 2 Value [SB0400]",
.id = "Audigy2",
.emu10k2_chip = 1,
.ca0108_chip = 1,
.spk71 = 1,
.ac97_chip = 1} ,
/* Audigy4 (Not PRO) SB0610 */ /* Audigy4 (Not PRO) SB0610 */
/* Tested by James@superbug.co.uk 4th April 2006 */ /* Tested by James@superbug.co.uk 4th April 2006 */
/* A_IOCFG bits /* A_IOCFG bits
...@@ -1346,20 +1333,37 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1346,20 +1333,37 @@ static struct snd_emu_chip_details emu_chip_details[] = {
* CA0151: None * CA0151: None
*/ */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10211102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10211102,
.driver = "Audigy2", .name = "Audigy 4 [SB0610]", .driver = "Audigy2", .name = "SB Audigy 4 [SB0610]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
.spk71 = 1, .spk71 = 1,
.adc_1361t = 1, /* 24 bit capture instead of 16bit */ .adc_1361t = 1, /* 24 bit capture instead of 16bit */
.ac97_chip = 1} , .ac97_chip = 1} ,
/* Audigy 2 Value AC3 out does not work yet.
* Need to find out how to turn off interpolators.
*/
/* Tested by James@superbug.co.uk 3rd July 2005 */
/* DSP: CA0108-IAT
* DAC: CS4382-KQ
* ADC: Philips 1361T
* AC97: STAC9750
* CA0151: None
*/
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
.driver = "Audigy2", .name = "SB Audigy 2 Value [SB0400]",
.id = "Audigy2",
.emu10k2_chip = 1,
.ca0108_chip = 1,
.spk71 = 1,
.ac97_chip = 1} ,
/* Audigy 2 ZS Notebook Cardbus card.*/ /* Audigy 2 ZS Notebook Cardbus card.*/
/* Tested by James@superbug.co.uk 6th November 2006 */ /* Tested by James@superbug.co.uk 6th November 2006 */
/* Audio output 7.1/Headphones working. /* Audio output 7.1/Headphones working.
* Digital output working. (AC3 not checked, only PCM) * Digital output working. (AC3 not checked, only PCM)
* Audio Mic/Line inputs working. * Audio Mic/Line inputs working.
* Digital input not tested. * Digital input not tested.
*/ */
/* DSP: Tina2 /* DSP: Tina2
* DAC: Wolfson WM8768/WM8568 * DAC: Wolfson WM8768/WM8568
* ADC: Wolfson WM8775 * ADC: Wolfson WM8775
...@@ -1386,7 +1390,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1386,7 +1390,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
* *
*/ */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102,
.driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", .driver = "Audigy2", .name = "SB Audigy 2 ZS Notebook [SB0530]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
...@@ -1396,7 +1400,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1396,7 +1400,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.spk71 = 1} , .spk71 = 1} ,
/* Tested by James@superbug.co.uk 4th Nov 2007. */ /* Tested by James@superbug.co.uk 4th Nov 2007. */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
.driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]", .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
.id = "EMU1010", .id = "EMU1010",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
...@@ -1404,47 +1408,49 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1404,47 +1408,49 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.spk71 = 1 , .spk71 = 1 ,
.emu_model = EMU_MODEL_EMU1616}, .emu_model = EMU_MODEL_EMU1616},
/* Tested by James@superbug.co.uk 4th Nov 2007. */ /* Tested by James@superbug.co.uk 4th Nov 2007. */
/* This is MAEM8960, 0202 is MAEM 8980 */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40041102,
.driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM????]", .driver = "Audigy2", .name = "E-mu 1010b PCI [MAEM8960]",
.id = "EMU1010", .id = "EMU1010",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = EMU_MODEL_EMU1010B}, .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
/* Tested by James@superbug.co.uk 8th July 2005. */ /* Tested by James@superbug.co.uk 8th July 2005. */
/* This is MAEM8810, 0202 is MAEM8820 */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
.driver = "Audigy2", .name = "E-mu 1010 [4001]", .driver = "Audigy2", .name = "E-mu 1010 [MAEM8810]",
.id = "EMU1010", .id = "EMU1010",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = EMU_MODEL_EMU1010}, /* Emu 1010 */ .emu_model = EMU_MODEL_EMU1010}, /* EMU 1010 old revision */
/* EMU0404b */ /* EMU0404b */
{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40021102, {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40021102,
.driver = "Audigy2", .name = "E-mu 0404b [4002]", .driver = "Audigy2", .name = "E-mu 0404b PCI [MAEM8852]",
.id = "EMU0404", .id = "EMU0404",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 */ .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 new revision */
/* Tested by James@superbug.co.uk 20-3-2007. */ /* Tested by James@superbug.co.uk 20-3-2007. */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40021102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40021102,
.driver = "Audigy2", .name = "E-mu 0404 [4002]", .driver = "Audigy2", .name = "E-mu 0404 [MAEM8850]",
.id = "EMU0404", .id = "EMU0404",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.spk71 = 1, .spk71 = 1,
.emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 */ .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 */
/* Audigy4 (Not PRO) SB0610 */ /* Note that all E-mu cards require kernel 2.6 or newer. */
{.vendor = 0x1102, .device = 0x0008, {.vendor = 0x1102, .device = 0x0008,
.driver = "Audigy2", .name = "Audigy 2 Value [Unknown]", .driver = "Audigy2", .name = "SB Audigy 2 Value [Unknown]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0108_chip = 1, .ca0108_chip = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
/* Tested by James@superbug.co.uk 3rd July 2005 */ /* Tested by James@superbug.co.uk 3rd July 2005 */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102,
.driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]", .driver = "Audigy2", .name = "SB Audigy 4 PRO [SB0380]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1457,7 +1463,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1457,7 +1463,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
* Just like 0x20021102 * Just like 0x20021102
*/ */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102,
.driver = "Audigy2", .name = "Audigy 2 [SB0350b]", .driver = "Audigy2", .name = "SB Audigy 2 [SB0350b]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1467,7 +1473,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1467,7 +1473,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.invert_shared_spdif = 1, /* digital/analog switch swapped */ .invert_shared_spdif = 1, /* digital/analog switch swapped */
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
.driver = "Audigy2", .name = "Audigy 2 ZS [SB0350]", .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1477,7 +1483,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1477,7 +1483,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.invert_shared_spdif = 1, /* digital/analog switch swapped */ .invert_shared_spdif = 1, /* digital/analog switch swapped */
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102,
.driver = "Audigy2", .name = "Audigy 2 ZS [2001]", .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0360]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1495,7 +1501,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1495,7 +1501,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
* CA0151: Yes * CA0151: Yes
*/ */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10071102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10071102,
.driver = "Audigy2", .name = "Audigy 2 [SB0240]", .driver = "Audigy2", .name = "SB Audigy 2 [SB0240]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1505,7 +1511,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1505,7 +1511,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.adc_1361t = 1, /* 24 bit capture instead of 16bit */ .adc_1361t = 1, /* 24 bit capture instead of 16bit */
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102,
.driver = "Audigy2", .name = "Audigy 2 EX [1005]", .driver = "Audigy2", .name = "SB Audigy 2 Platinum EX [SB0280]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1515,7 +1521,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1515,7 +1521,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
/* Dell OEM/Creative Labs Audigy 2 ZS */ /* Dell OEM/Creative Labs Audigy 2 ZS */
/* See ALSA bug#1365 */ /* See ALSA bug#1365 */
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10031102,
.driver = "Audigy2", .name = "Audigy 2 ZS [SB0353]", .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0353]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1524,7 +1530,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1524,7 +1530,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.spdif_bug = 1, .spdif_bug = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102,
.driver = "Audigy2", .name = "Audigy 2 Platinum [SB0240P]", .driver = "Audigy2", .name = "SB Audigy 2 Platinum [SB0240P]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1535,7 +1541,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1535,7 +1541,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */ .adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .revision = 0x04, {.vendor = 0x1102, .device = 0x0004, .revision = 0x04,
.driver = "Audigy2", .name = "Audigy 2 [Unknown]", .driver = "Audigy2", .name = "SB Audigy 2 [Unknown]",
.id = "Audigy2", .id = "Audigy2",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
...@@ -1543,78 +1549,79 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1543,78 +1549,79 @@ static struct snd_emu_chip_details emu_chip_details[] = {
.spdif_bug = 1, .spdif_bug = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102,
.driver = "Audigy", .name = "Audigy 1 [SB0090]", .driver = "Audigy", .name = "SB Audigy 1 [SB0092]",
.id = "Audigy", .id = "Audigy",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102,
.driver = "Audigy", .name = "Audigy 1 ES [SB0160]", .driver = "Audigy", .name = "SB Audigy 1 ES [SB0160]",
.id = "Audigy", .id = "Audigy",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.spdif_bug = 1, .spdif_bug = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102, {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102,
.driver = "Audigy", .name = "Audigy 1 [SB0090]", .driver = "Audigy", .name = "SB Audigy 1 [SB0090]",
.id = "Audigy", .id = "Audigy",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0004, {.vendor = 0x1102, .device = 0x0004,
.driver = "Audigy", .name = "Audigy 1 [Unknown]", .driver = "Audigy", .name = "Audigy 1 [Unknown]",
.id = "Audigy", .id = "Audigy",
.emu10k2_chip = 1, .emu10k2_chip = 1,
.ca0102_chip = 1, .ca0102_chip = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x100a1102,
.driver = "EMU10K1", .name = "SBLive! [SB0105]", .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0220]",
.id = "Live",
.emu10k1_chip = 1,
.ac97_chip = 1,
.sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806b1102,
.driver = "EMU10K1", .name = "SB Live! [SB0105]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806a1102,
.driver = "EMU10K1", .name = "SBLive! Value [SB0103]", .driver = "EMU10K1", .name = "SB Live! Value [SB0103]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102,
.driver = "EMU10K1", .name = "SBLive! Value [SB0101]", .driver = "EMU10K1", .name = "SB Live! Value [SB0101]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
/* Tested by ALSA bug#1680 26th December 2005 */ /* Tested by ALSA bug#1680 26th December 2005 */
/* note: It really has SB0220 written on the card. */ /* note: It really has SB0220 written on the card, */
/* but it's SB0228 according to kx.inf */
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80661102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80661102,
.driver = "EMU10K1", .name = "SB Live 5.1 Dell OEM [SB0220]", .driver = "EMU10K1", .name = "SB Live! 5.1 Dell OEM [SB0228]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
/* Tested by Thomas Zehetbauer 27th Aug 2005 */ /* Tested by Thomas Zehetbauer 27th Aug 2005 */
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102,
.driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]", .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0220]",
.id = "Live",
.emu10k1_chip = 1,
.ac97_chip = 1,
.sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x100a1102,
.driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102,
.driver = "EMU10K1", .name = "SB Live 5.1", .driver = "EMU10K1", .name = "SB Live! 5.1",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
/* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */ /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
.driver = "EMU10K1", .name = "SBLive 5.1 [SB0060]", .driver = "EMU10K1", .name = "SB Live! 5.1 [SB0060]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum
...@@ -1622,78 +1629,78 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1622,78 +1629,78 @@ static struct snd_emu_chip_details emu_chip_details[] = {
*/ */
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4850]", .driver = "EMU10K1", .name = "SB Live! Value [CT4850]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102,
.driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]", .driver = "EMU10K1", .name = "SB Live! Platinum [CT4760P]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1} , .ac97_chip = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4871]", .driver = "EMU10K1", .name = "SB Live! Value [CT4871]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80311102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80311102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4831]", .driver = "EMU10K1", .name = "SB Live! Value [CT4831]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4870]", .driver = "EMU10K1", .name = "SB Live! Value [CT4870]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
/* Tested by James@superbug.co.uk 3rd July 2005 */ /* Tested by James@superbug.co.uk 3rd July 2005 */
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4832]", .driver = "EMU10K1", .name = "SB Live! Value [CT4832]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4830]", .driver = "EMU10K1", .name = "SB Live! Value [CT4830]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102,
.driver = "EMU10K1", .name = "SB PCI512 [CT4790]", .driver = "EMU10K1", .name = "SB PCI512 [CT4790]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4780]", .driver = "EMU10K1", .name = "SB Live! Value [CT4780]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102,
.driver = "EMU10K1", .name = "E-mu APS [4001]", .driver = "EMU10K1", .name = "E-mu APS [PC545]",
.id = "APS", .id = "APS",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ecard = 1} , .ecard = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102,
.driver = "EMU10K1", .name = "SBLive! [CT4620]", .driver = "EMU10K1", .name = "SB Live! [CT4620]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102, {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102,
.driver = "EMU10K1", .name = "SBLive! Value [CT4670]", .driver = "EMU10K1", .name = "SB Live! Value [CT4670]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
.sblive51 = 1} , .sblive51 = 1} ,
{.vendor = 0x1102, .device = 0x0002, {.vendor = 0x1102, .device = 0x0002,
.driver = "EMU10K1", .name = "SB Live [Unknown]", .driver = "EMU10K1", .name = "SB Live! [Unknown]",
.id = "Live", .id = "Live",
.emu10k1_chip = 1, .emu10k1_chip = 1,
.ac97_chip = 1, .ac97_chip = 1,
...@@ -1702,13 +1709,13 @@ static struct snd_emu_chip_details emu_chip_details[] = { ...@@ -1702,13 +1709,13 @@ static struct snd_emu_chip_details emu_chip_details[] = {
}; };
int __devinit snd_emu10k1_create(struct snd_card *card, int __devinit snd_emu10k1_create(struct snd_card *card,
struct pci_dev * pci, struct pci_dev *pci,
unsigned short extin_mask, unsigned short extin_mask,
unsigned short extout_mask, unsigned short extout_mask,
long max_cache_bytes, long max_cache_bytes,
int enable_ir, int enable_ir,
uint subsystem, uint subsystem,
struct snd_emu10k1 ** remu) struct snd_emu10k1 **remu)
{ {
struct snd_emu10k1 *emu; struct snd_emu10k1 *emu;
int idx, err; int idx, err;
...@@ -1718,11 +1725,12 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1718,11 +1725,12 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
.dev_free = snd_emu10k1_dev_free, .dev_free = snd_emu10k1_dev_free,
}; };
*remu = NULL; *remu = NULL;
/* enable PCI device */ /* enable PCI device */
if ((err = pci_enable_device(pci)) < 0) err = pci_enable_device(pci);
if (err < 0)
return err; return err;
emu = kzalloc(sizeof(*emu), GFP_KERNEL); emu = kzalloc(sizeof(*emu), GFP_KERNEL);
...@@ -1749,16 +1757,17 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1749,16 +1757,17 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
emu->revision = pci->revision; emu->revision = pci->revision;
pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model); snd_printdd("vendor = 0x%x, device = 0x%x, subsystem_vendor_id = 0x%x, subsystem_id = 0x%x\n", pci->vendor, pci->device, emu->serial, emu->model);
for (c = emu_chip_details; c->vendor; c++) { for (c = emu_chip_details; c->vendor; c++) {
if (c->vendor == pci->vendor && c->device == pci->device) { if (c->vendor == pci->vendor && c->device == pci->device) {
if (subsystem) { if (subsystem) {
if (c->subsystem && (c->subsystem == subsystem) ) { if (c->subsystem && (c->subsystem == subsystem))
break; break;
} else continue; else
continue;
} else { } else {
if (c->subsystem && (c->subsystem != emu->serial) ) if (c->subsystem && (c->subsystem != emu->serial))
continue; continue;
if (c->revision && c->revision != emu->revision) if (c->revision && c->revision != emu->revision)
continue; continue;
...@@ -1774,14 +1783,18 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1774,14 +1783,18 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
} }
emu->card_capabilities = c; emu->card_capabilities = c;
if (c->subsystem && !subsystem) if (c->subsystem && !subsystem)
snd_printdd("Sound card name=%s\n", c->name); snd_printdd("Sound card name = %s\n", c->name);
else if (subsystem) else if (subsystem)
snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n", snd_printdd("Sound card name = %s, "
c->name, pci->vendor, pci->device, emu->serial, c->subsystem); "vendor = 0x%x, device = 0x%x, subsystem = 0x%x. "
else "Forced to subsytem = 0x%x\n", c->name,
snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n", pci->vendor, pci->device, emu->serial, c->subsystem);
c->name, pci->vendor, pci->device, emu->serial); else
snd_printdd("Sound card name = %s, "
"vendor = 0x%x, device = 0x%x, subsystem = 0x%x.\n",
c->name, pci->vendor, pci->device,
emu->serial);
if (!*card->id && c->id) { if (!*card->id && c->id) {
int i, n = 0; int i, n = 0;
strlcpy(card->id, c->id, sizeof(card->id)); strlcpy(card->id, c->id, sizeof(card->id));
...@@ -1815,7 +1828,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1815,7 +1828,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
else else
emu->gpr_base = FXGPREGBASE; emu->gpr_base = FXGPREGBASE;
if ((err = pci_request_regions(pci, "EMU10K1")) < 0) { err = pci_request_regions(pci, "EMU10K1");
if (err < 0) {
kfree(emu); kfree(emu);
pci_disable_device(pci); pci_disable_device(pci);
return err; return err;
...@@ -1862,21 +1876,25 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1862,21 +1876,25 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
emu->enable_ir = enable_ir; emu->enable_ir = enable_ir;
if (emu->card_capabilities->ca_cardbus_chip) { if (emu->card_capabilities->ca_cardbus_chip) {
if ((err = snd_emu10k1_cardbus_init(emu)) < 0) err = snd_emu10k1_cardbus_init(emu);
if (err < 0)
goto error; goto error;
} }
if (emu->card_capabilities->ecard) { if (emu->card_capabilities->ecard) {
if ((err = snd_emu10k1_ecard_init(emu)) < 0) err = snd_emu10k1_ecard_init(emu);
if (err < 0)
goto error; goto error;
} else if (emu->card_capabilities->emu_model) { } else if (emu->card_capabilities->emu_model) {
if ((err = snd_emu10k1_emu1010_init(emu)) < 0) { err = snd_emu10k1_emu1010_init(emu);
snd_emu10k1_free(emu); if (err < 0) {
return err; snd_emu10k1_free(emu);
} return err;
}
} else { } else {
/* 5.1: Enable the additional AC97 Slots. If the emu10k1 version /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version
does not support this, it shouldn't do any harm */ does not support this, it shouldn't do any harm */
snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); snd_emu10k1_ptr_write(emu, AC97SLOT, 0,
AC97SLOT_CNTR|AC97SLOT_LFE);
} }
/* initialize TRAM setup */ /* initialize TRAM setup */
...@@ -1916,7 +1934,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1916,7 +1934,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
snd_emu10k1_synth_alloc(emu, 4096); snd_emu10k1_synth_alloc(emu, 4096);
if (emu->reserved_page) if (emu->reserved_page)
emu->reserved_page->map_locked = 1; emu->reserved_page->map_locked = 1;
/* Clear silent pages and set up pointers */ /* Clear silent pages and set up pointers */
memset(emu->silent_page.area, 0, PAGE_SIZE); memset(emu->silent_page.area, 0, PAGE_SIZE);
silent_page = emu->silent_page.addr << 1; silent_page = emu->silent_page.addr << 1;
...@@ -1929,19 +1947,23 @@ int __devinit snd_emu10k1_create(struct snd_card *card, ...@@ -1929,19 +1947,23 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
emu->voices[idx].number = idx; emu->voices[idx].number = idx;
} }
if ((err = snd_emu10k1_init(emu, enable_ir, 0)) < 0) err = snd_emu10k1_init(emu, enable_ir, 0);
if (err < 0)
goto error; goto error;
#ifdef CONFIG_PM #ifdef CONFIG_PM
if ((err = alloc_pm_buffer(emu)) < 0) err = alloc_pm_buffer(emu);
if (err < 0)
goto error; goto error;
#endif #endif
/* Initialize the effect engine */ /* Initialize the effect engine */
if ((err = snd_emu10k1_init_efx(emu)) < 0) err = snd_emu10k1_init_efx(emu);
if (err < 0)
goto error; goto error;
snd_emu10k1_audio_enable(emu); snd_emu10k1_audio_enable(emu);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops)) < 0) err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops);
if (err < 0)
goto error; goto error;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
...@@ -1981,7 +2003,7 @@ static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu) ...@@ -1981,7 +2003,7 @@ static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu)
if (emu->audigy) if (emu->audigy)
size += ARRAY_SIZE(saved_regs_audigy); size += ARRAY_SIZE(saved_regs_audigy);
emu->saved_ptr = vmalloc(4 * NUM_G * size); emu->saved_ptr = vmalloc(4 * NUM_G * size);
if (! emu->saved_ptr) if (!emu->saved_ptr)
return -ENOMEM; return -ENOMEM;
if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0) if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0)
return -ENOMEM; return -ENOMEM;
...@@ -2026,7 +2048,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu) ...@@ -2026,7 +2048,7 @@ void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
if (emu->card_capabilities->ecard) if (emu->card_capabilities->ecard)
snd_emu10k1_ecard_init(emu); snd_emu10k1_ecard_init(emu);
else if (emu->card_capabilities->emu_model) else if (emu->card_capabilities->emu_model)
snd_emu10k1_emu1010_init(emu); snd_emu10k1_emu1010_init(emu);
else else
snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE); snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
snd_emu10k1_init(emu, emu->enable_ir, 1); snd_emu10k1_init(emu, emu->enable_ir, 1);
......
...@@ -382,23 +382,25 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) ...@@ -382,23 +382,25 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
unsigned char status_mask = unsigned char status_mask =
VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX | VT1724_IRQ_MTPCM; VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX | VT1724_IRQ_MTPCM;
int handled = 0; int handled = 0;
#ifdef CONFIG_SND_DEBUG
int timeout = 0; int timeout = 0;
#endif
while (1) { while (1) {
status = inb(ICEREG1724(ice, IRQSTAT)); status = inb(ICEREG1724(ice, IRQSTAT));
status &= status_mask; status &= status_mask;
if (status == 0) if (status == 0)
break; break;
#ifdef CONFIG_SND_DEBUG
if (++timeout > 10) { if (++timeout > 10) {
printk(KERN_ERR status = inb(ICEREG1724(ice, IRQSTAT));
"ice1724: Too long irq loop, status = 0x%x\n", printk(KERN_ERR "ice1724: Too long irq loop, "
status); "status = 0x%x\n", status);
if (status & VT1724_IRQ_MPU_TX) {
printk(KERN_ERR "ice1724: Disabling MPU_TX\n");
outb(inb(ICEREG1724(ice, IRQMASK)) |
VT1724_IRQ_MPU_TX,
ICEREG1724(ice, IRQMASK));
}
break; break;
} }
#endif
handled = 1; handled = 1;
if (status & VT1724_IRQ_MPU_TX) { if (status & VT1724_IRQ_MPU_TX) {
spin_lock(&ice->reg_lock); spin_lock(&ice->reg_lock);
...@@ -2351,7 +2353,6 @@ static int __devinit snd_vt1724_create(struct snd_card *card, ...@@ -2351,7 +2353,6 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
{ {
struct snd_ice1712 *ice; struct snd_ice1712 *ice;
int err; int err;
unsigned char mask;
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
.dev_free = snd_vt1724_dev_free, .dev_free = snd_vt1724_dev_free,
}; };
...@@ -2412,9 +2413,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card, ...@@ -2412,9 +2413,9 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
return -EIO; return -EIO;
} }
/* unmask used interrupts */ /* MPU_RX and TX irq masks are cleared later dynamically */
mask = VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX; outb(VT1724_IRQ_MPU_RX | VT1724_IRQ_MPU_TX , ICEREG1724(ice, IRQMASK));
outb(mask, ICEREG1724(ice, IRQMASK));
/* don't handle FIFO overrun/underruns (just yet), /* don't handle FIFO overrun/underruns (just yet),
* since they cause machine lockups * since they cause machine lockups
*/ */
......
...@@ -1033,7 +1033,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip) ...@@ -1033,7 +1033,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
} }
if (of_device_is_compatible(sound, "tumbler")) { if (of_device_is_compatible(sound, "tumbler")) {
chip->model = PMAC_TUMBLER; chip->model = PMAC_TUMBLER;
chip->can_capture = 0; /* no capture */ chip->can_capture = machine_is_compatible("PowerMac4,2");
chip->can_duplex = 0; chip->can_duplex = 0;
// chip->can_byte_swap = 0; /* FIXME: check this */ // chip->can_byte_swap = 0; /* FIXME: check this */
chip->num_freqs = ARRAY_SIZE(tumbler_freqs); chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
......
...@@ -875,7 +875,8 @@ static struct snd_kcontrol_new snapper_mixers[] __initdata = { ...@@ -875,7 +875,8 @@ static struct snd_kcontrol_new snapper_mixers[] __initdata = {
.put = tumbler_put_master_switch .put = tumbler_put_master_switch
}, },
DEFINE_SNAPPER_MIX("PCM Playback Volume", 0, VOL_IDX_PCM), DEFINE_SNAPPER_MIX("PCM Playback Volume", 0, VOL_IDX_PCM),
DEFINE_SNAPPER_MIX("PCM Playback Volume", 1, VOL_IDX_PCM2), /* Alternative PCM is assigned to Mic analog loopback on iBook G4 */
DEFINE_SNAPPER_MIX("Mic Playback Volume", 0, VOL_IDX_PCM2),
DEFINE_SNAPPER_MIX("Monitor Mix Volume", 0, VOL_IDX_ADC), DEFINE_SNAPPER_MIX("Monitor Mix Volume", 0, VOL_IDX_ADC),
DEFINE_SNAPPER_MONO("Tone Control - Bass", bass), DEFINE_SNAPPER_MONO("Tone Control - Bass", bass),
DEFINE_SNAPPER_MONO("Tone Control - Treble", treble), DEFINE_SNAPPER_MONO("Tone Control - Treble", treble),
......
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