diff options
author | Jaroslav Kysela <perex@suse.cz> | 2002-02-25 19:47:57 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-02-25 19:47:57 -0800 |
commit | 4fff2c1aaf03e40fbda6f41a433f9ed551cc2bf5 (patch) | |
tree | bc6b7b5047166af908b1dcccbdcf241b17ee3f82 | |
parent | dd56376dcd8c94342857257aa34a5720baeb807a (diff) | |
download | history-4fff2c1aaf03e40fbda6f41a433f9ed551cc2bf5.tar.gz |
[PATCH] ALSA patch for 2.5.5v2.5.6-pre1
- added support for KERN_ prefixes for snd_printk
- verbose printk (file:number) is now optional
- fixed devfs OSS device names in soundcore
- added XRUN ioctl for PCM API
- improved support for Sound Blaster Audigy
- fixed AC3 forwarding for Sound Blaster Live!
- more fixes in dependencies in Makefiles
- llseek locking fixes for sound/core/info.c
- fixed ISA DMA allocation
- added wait() callback for ac97_codec.c and VIA686 driver
- CMIPCI driver updates
- added AMD-8111 support for Intel8x0
97 files changed, 940 insertions, 551 deletions
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h index 5701028e1d23c..70dc293be1e21 100644 --- a/include/sound/ac97_codec.h +++ b/include/sound/ac97_codec.h @@ -135,6 +135,7 @@ typedef struct _snd_ac97 ac97_t; struct _snd_ac97 { void (*write) (ac97_t *ac97, unsigned short reg, unsigned short val); unsigned short (*read) (ac97_t *ac97, unsigned short reg); + void (*wait) (ac97_t *ac97); void (*init) (ac97_t *ac97); snd_info_entry_t *proc_entry; snd_info_entry_t *proc_regs_entry; diff --git a/include/sound/asound.h b/include/sound/asound.h index 013e59fb6eb40..3c7df6d596491 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -127,7 +127,7 @@ enum { * * *****************************************************************************/ -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 1) typedef unsigned long sndrv_pcm_uframes_t; typedef long sndrv_pcm_sframes_t; @@ -411,6 +411,7 @@ enum { SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int), SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, sndrv_pcm_uframes_t), SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47), + SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48), SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct sndrv_xferi), SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct sndrv_xferi), SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct sndrv_xfern), @@ -578,7 +579,7 @@ struct sndrv_timer_read { * * ****************************************************************************/ -#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) +#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) struct sndrv_ctl_card_info { int card; /* card number */ diff --git a/include/sound/core.h b/include/sound/core.h index ebd845c0191b6..5744cdd5cc8e7 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -292,13 +292,21 @@ unsigned int snd_dma_residue(unsigned long dma); /* misc.c */ int snd_task_name(struct task_struct *task, char *name, size_t size); +#ifdef CONFIG_SND_VERBOSE_PRINTK +int snd_verbose_printk(const char *file, int line, const char *format); +#endif /* --- */ +#ifdef CONFIG_SND_VERBOSE_PRINTK +#define snd_printk(format, args...) do { \ + printk(snd_verbose_printk(__FILE__, __LINE__, format) ? format + 3 : format, ##args); \ +} while (0) +#else #define snd_printk(format, args...) do { \ - printk("ALSA %s:%d: ", __FILE__, __LINE__); \ printk(format, ##args); \ } while (0) +#endif #ifdef CONFIG_SND_DEBUG diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 4705a929d7d67..3f03bec0cf415 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h @@ -588,7 +588,7 @@ #define REG53 0x53 /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */ #define A_DBG 0x53 -#define A_DBG_SINGLE_STEP_ADDR 0x00020000 /* Set to zero to start dsp */ +#define A_DBG_SINGLE_STEP 0x00020000 /* Set to zero to start dsp */ #define A_DBG_ZC 0x40000000 /* zero tram counter */ #define A_DBG_STEP_ADDR 0x000003ff #define A_DBG_SATURATION_OCCURED 0x20000000 @@ -657,6 +657,11 @@ #define SRCS_RATELOCKED 0x01000000 /* Sample rate locked */ #define SRCS_ESTSAMPLERATE 0x0007ffff /* Do not modify this field. */ +/* Note that these values can vary +/- by a small amount */ +#define SRCS_SPDIFRATE_44 0x0003acd9 +#define SRCS_SPDIFRATE_48 0x00040000 +#define SRCS_SPDIFRATE_96 0x00080000 + #define MICIDX 0x63 /* Microphone recording buffer index register */ #define MICIDX_MASK 0x0000ffff /* 16-bit value */ #define MICIDX_IDX 0x10000063 @@ -683,15 +688,15 @@ #define A_MUSTAT2 A_MUCMD2 #define A_SPDIF_SAMPLERATE 0x76 /* Set the sample rate of SPDIF output */ -#define A_SPDIF_48000 0x00000000 -#define A_SPDIF_44100 0x00000040 -#define A_SPDIF_96000 0x00000080 +#define A_SPDIF_48000 0x00000080 +#define A_SPDIF_44100 0x00000000 +#define A_SPDIF_96000 0x00000040 #define A_FXRT2 0x7c -#define A_FXRT_CHANNELE 0x0000003f /* Effects send bus number for channel's effects send A */ -#define A_FXRT_CHANNELF 0x00003f00 /* Effects send bus number for channel's effects send B */ -#define A_FXRT_CHANNELG 0x003f0000 /* Effects send bus number for channel's effects send C */ -#define A_FXRT_CHANNELH 0x3f000000 /* Effects send bus number for channel's effects send D */ +#define A_FXRT_CHANNELE 0x0000003f /* Effects send bus number for channel's effects send E */ +#define A_FXRT_CHANNELF 0x00003f00 /* Effects send bus number for channel's effects send F */ +#define A_FXRT_CHANNELG 0x003f0000 /* Effects send bus number for channel's effects send G */ +#define A_FXRT_CHANNELH 0x3f000000 /* Effects send bus number for channel's effects send H */ #define A_SENDAMOUNTS 0x7d #define A_FXSENDAMOUNT_E_MASK 0xFF000000 @@ -797,8 +802,8 @@ struct _snd_emu10k1_pcm { }; typedef struct { - unsigned long send_routing[3]; - unsigned char send_volume[3][4]; + unsigned char send_routing[3][8]; + unsigned char send_volume[3][8]; unsigned short attn[3]; snd_kcontrol_t *ctl_send_routing; snd_kcontrol_t *ctl_send_volume; @@ -806,6 +811,15 @@ typedef struct { emu10k1_pcm_t *epcm; } emu10k1_pcm_mixer_t; +#define snd_emu10k1_compose_send_routing(route) \ +((route[0] | (route[1] << 4) | (route[2] << 8) | (route[3] << 12)) << 16) + +#define snd_emu10k1_compose_audigy_fxrt1(route) \ +(((unsigned int)route[0] | ((unsigned int)route[1] << 8) | ((unsigned int)route[2] << 16) | ((unsigned int)route[3] << 12)) << 24) + +#define snd_emu10k1_compose_audigy_fxrt2(route) \ +(((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 12)) << 24) + typedef struct snd_emu10k1_memblk { snd_util_memblk_t mem; /* private part */ @@ -1102,11 +1116,11 @@ int snd_emu10k1_proc_done(emu10k1_t * emu); #define GPR_NOISE1 0x59 /* noise source */ #define GPR_IRQ 0x5a /* IRQ register */ #define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */ -#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ -#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + (x)) /* x = 0x00 - 0x7f */ -#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 80 + (x)) /* x = 0x00 - 0x1f */ -#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + (x)) /* x = 0x00 - 0x7f */ -#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 80 + (x)) /* x = 0x00 - 0x1f */ +#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */ +#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ +#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ +#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */ +#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */ #define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f? */ #define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x1f? */ @@ -1171,6 +1185,10 @@ int snd_emu10k1_proc_done(emu10k1_t * emu); #define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */ #define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ #define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ +#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ +#define A_EXTIN_LINE2_R 0x09 /* right */ +#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */ +#define A_EXTIN_AUX2_R 0x0d /* - right */ /* Audigiy Outputs */ #define A_EXTOUT_FRONT_L 0x00 /* digital front left */ @@ -1189,9 +1207,38 @@ int snd_emu10k1_proc_done(emu10k1_t * emu); /* 0x0d ?? */ #define A_EXTOUT_AREAR_L 0x0e /* analog rear left */ #define A_EXTOUT_AREAR_R 0x0f /* right */ -/* 0x10-0x15 ?? */ -#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */ -#define A_EXTOUT_ADC_CAP_R 0x17 /* right */ +#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */ +#define A_EXTOUT_AC97_R 0x11 /* right */ +#define A_EXTOUT_ADC_CAP_L 0x12 /* ADC capture buffer left */ +#define A_EXTOUT_ADC_CAP_R 0x13 /* right */ + +/* Audigy constants */ +#define A_C_00000000 0xc0 +#define A_C_00000001 0xc1 +#define A_C_00000002 0xc2 +#define A_C_00000003 0xc3 +#define A_C_00000004 0xc4 +#define A_C_00000008 0xc5 +#define A_C_00000010 0xc6 +#define A_C_00000020 0xc7 +#define A_C_00000100 0xc8 +#define A_C_00010000 0xc9 +#define A_C_00000800 0xca +#define A_C_10000000 0xcb +#define A_C_20000000 0xcc +#define A_C_40000000 0xcd +#define A_C_80000000 0xce +#define A_C_7fffffff 0xcf +#define A_C_ffffffff 0xd0 +#define A_C_fffffffe 0xd1 +#define A_C_c0000000 0xd2 +#define A_C_4f1bbcdc 0xd3 +#define A_C_5a7ef9db 0xd4 +#define A_C_00100000 0xd5 +/* 0xd6 = 0x7fffffff (?) ACCUM? */ +/* 0xd7 = 0x0000000 CCR */ +/* 0xd8 = noise1 */ +/* 0xd9 = noise2 */ /* definitions for debug register */ #define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */ diff --git a/include/sound/version.h b/include/sound/version.h index eac7e72f5513f..50a7e6f090d82 100644 --- a/include/sound/version.h +++ b/include/sound/version.h @@ -1,3 +1,3 @@ /* include/version.h. Generated automatically by configure. */ -#define CONFIG_SND_VERSION "0.9.0beta11" -#define CONFIG_SND_DATE " (Tue Feb 19 08:14:59 2002 UTC)" +#define CONFIG_SND_VERSION "0.9.0beta12" +#define CONFIG_SND_DATE " (Tue Feb 26 09:34:24 2002 UTC)" diff --git a/sound/Makefile b/sound/Makefile index 5f8ab0265f02c..2d056abf97b98 100644 --- a/sound/Makefile +++ b/sound/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_SOUND) += soundcore.o subdir-$(CONFIG_SOUND_PRIME) += oss ifeq ($(CONFIG_SOUND_PRIME),y) + subdir-m += oss obj-y += oss/sounddrivers.o endif diff --git a/sound/core/Config.in b/sound/core/Config.in index bd5bf6c18bc5f..5e9b5a1c176a4 100644 --- a/sound/core/Config.in +++ b/sound/core/Config.in @@ -1,6 +1,5 @@ # ALSA soundcard-configuration -dep_tristate ' RTC Timer support' CONFIG_SND_RTCTIMER $CONFIG_SND dep_tristate ' Sequencer support' CONFIG_SND_SEQUENCER $CONFIG_SND if [ "$CONFIG_SND_SEQUENCER" != "n" ]; then dep_tristate ' Sequencer dummy client' CONFIG_SND_SEQ_DUMMY $CONFIG_SND_SEQUENCER @@ -13,9 +12,10 @@ if [ "$CONFIG_SND_OSSEMUL" = "y" ]; then dep_tristate ' OSS Sequencer API' CONFIG_SND_SEQUENCER_OSS $CONFIG_SND_SEQUENCER fi fi +dep_tristate ' RTC Timer support' CONFIG_SND_RTCTIMER $CONFIG_SND +bool ' Verbose printk' CONFIG_SND_VERBOSE_PRINTK bool ' Debug' CONFIG_SND_DEBUG if [ "$CONFIG_SND_DEBUG" = "y" ]; then bool ' Debug memory' CONFIG_SND_DEBUG_MEMORY - bool ' Debug full' CONFIG_SND_DEBUG_FULL bool ' Debug detection' CONFIG_SND_DEBUG_DETECT fi diff --git a/sound/core/Makefile b/sound/core/Makefile index 3168272a32246..50dd397f48430 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile @@ -33,16 +33,18 @@ obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o subdir-$(CONFIG_SND_MIXER_OSS) += oss subdir-$(CONFIG_SND_PCM_OSS) += oss ifeq ($(filter $(subdir-y),oss),oss) + subdir-m += oss obj-y += oss/oss.o endif subdir-$(CONFIG_SND_SEQUENCER) += seq ifeq ($(CONFIG_SND_SEQUENCER),y) - ifeq ($(CONFIG_SND),y) - obj-y += seq/sq.o - endif + subdir-m += seq + obj-y += seq/sq.o endif +obj-$(CONFIG_SND_SEQUENCER) += snd-timer.o + # Toplevel Module Dependency obj-$(CONFIG_SND_DUMMY) += snd-pcm.o snd-timer.o snd.o obj-$(CONFIG_SND_VIRMIDI) += snd-rawmidi.o snd.o snd-timer.o @@ -69,7 +71,7 @@ obj-$(CONFIG_SND_INTERWAVE_STB) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o obj-$(CONFIG_SND_OPTI92X_AD1848) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_OPTI92X_CS4231) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_OPTI93X) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o -obj-$(CONFIG_SND_SB) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o +obj-$(CONFIG_SND_SB8) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_SB16) += snd-pcm.o snd-timer.o snd.o snd-hwdep.o snd-rawmidi.o obj-$(CONFIG_SND_SBAWE) += snd-pcm.o snd-timer.o snd.o snd-hwdep.o snd-rawmidi.o obj-$(CONFIG_SND_ES968) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o @@ -79,7 +81,7 @@ obj-$(CONFIG_SND_CMIPCI) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep. obj-$(CONFIG_SND_CS4281) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_ENS1370) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o obj-$(CONFIG_SND_ENS1371) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o -obj-$(CONFIG_SND_ES1938) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o +obj-$(CONFIG_SND_ES1938) += snd-pcm.o snd-timer.o snd.o snd-hwdep.o snd-rawmidi.o obj-$(CONFIG_SND_ES1968) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o obj-$(CONFIG_SND_FM801) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_ICE1712) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o diff --git a/sound/core/control.c b/sound/core/control.c index 840b563d71567..b809c178714b9 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -166,7 +166,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) ev->mask = mask; list_add_tail(&ev->list, &ctl->events); } else { - snd_printk("No memory available to allocate event\n"); + snd_printk(KERN_ERR "No memory available to allocate event\n"); } _found: wake_up(&ctl->change_sleep); diff --git a/sound/core/device.c b/sound/core/device.c index a5d8efa4c9c01..39ee1570a14cb 100644 --- a/sound/core/device.c +++ b/sound/core/device.c @@ -58,11 +58,11 @@ int snd_device_free(snd_card_t *card, void *device_data) list_del(&dev->list); if (dev->state == SNDRV_DEV_REGISTERED && dev->ops->dev_unregister) { if (dev->ops->dev_unregister(dev)) - snd_printk("device unregister failure\n"); + snd_printk(KERN_ERR "device unregister failure\n"); } else { if (dev->ops->dev_free) { if (dev->ops->dev_free(dev)) - snd_printk("device free failure\n"); + snd_printk(KERN_ERR "device free failure\n"); } } snd_magic_kfree(dev); diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 5a860eaff819c..1714df12e5aeb 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -321,7 +321,7 @@ static int snd_hwdep_dev_register(snd_device_t *device) if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device, &snd_hwdep_reg, name)) < 0) { - snd_printk("unable to register hardware dependant device %i:%i\n", + snd_printk(KERN_ERR "unable to register hardware dependant device %i:%i\n", hwdep->card->number, hwdep->device); snd_hwdep_devices[idx] = NULL; up(®ister_mutex); @@ -331,12 +331,12 @@ static int snd_hwdep_dev_register(snd_device_t *device) hwdep->ossreg = 0; if (hwdep->oss_type >= 0) { if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) { - snd_printk ("only hwdep device 0 can be registered as OSS direct FM device!\n"); + snd_printk (KERN_WARNING "only hwdep device 0 can be registered as OSS direct FM device!\n"); } else { if (snd_register_oss_device(hwdep->oss_type, hwdep->card, hwdep->device, &snd_hwdep_reg, hwdep->oss_dev) < 0) { - snd_printk("unable to register OSS compatibility device %i:%i\n", + snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n", hwdep->card->number, hwdep->device); } else { snd_oss_info_register(SNDRV_OSS_INFO_DEV_SYNTH, hwdep->card->number, hwdep->name); diff --git a/sound/core/info.c b/sound/core/info.c index 3faa42e0496fc..5e6eb497eac42 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -430,7 +430,7 @@ static int snd_info_entry_release(struct inode *inode, struct file *file) if (entry->c.text.write) { entry->c.text.write(entry, data->wbuffer); if (data->wbuffer->error) { - snd_printk("data write error to %s (%i)\n", + snd_printk(KERN_WARNING "data write error to %s (%i)\n", entry->name, data->wbuffer->error); } diff --git a/sound/core/init.c b/sound/core/init.c index 6d35d524320d8..80286c736d9cb 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -74,7 +74,7 @@ snd_card_t *snd_card_new(int idx, const char *xid, if (idx < 0 || idx >= snd_ecards_limit) { write_unlock(&snd_card_rwlock); if (idx >= snd_ecards_limit) - snd_printk("card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1); + snd_printk(KERN_ERR "card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1); goto __error; } snd_cards_lock |= 1 << idx; /* lock it */ @@ -140,26 +140,26 @@ int snd_card_free(snd_card_t * card) snd_mixer_oss_notify_callback(card, 1); #endif if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) { - snd_printk("unable to free all devices (pre)\n"); + snd_printk(KERN_ERR "unable to free all devices (pre)\n"); /* Fatal, but this situation should never occur */ } if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) { - snd_printk("unable to free all devices (normal)\n"); + snd_printk(KERN_ERR "unable to free all devices (normal)\n"); /* Fatal, but this situation should never occur */ } if (snd_ctl_unregister(card) < 0) { - snd_printk("unable to unregister control minors\n"); + snd_printk(KERN_ERR "unable to unregister control minors\n"); /* Not fatal error */ } if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) { - snd_printk("unable to free all devices (post)\n"); + snd_printk(KERN_ERR "unable to free all devices (post)\n"); /* Fatal, but this situation should never occur */ } if (card->private_free) card->private_free(card); snd_info_free_entry(card->proc_id); if (snd_info_card_unregister(card) < 0) { - snd_printk("unable to unregister card info\n"); + snd_printk(KERN_WARNING "unable to unregister card info\n"); /* Not fatal error */ } write_lock(&snd_card_rwlock); diff --git a/sound/core/memory.c b/sound/core/memory.c index 0f051ef3896f3..25664f8bf664a 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c @@ -68,28 +68,28 @@ void snd_memory_done(void) struct list_head *head; struct snd_alloc_track *t; if (snd_alloc_pages > 0) - snd_printk("Not freed snd_alloc_pages = %li\n", snd_alloc_pages); + snd_printk(KERN_ERR "Not freed snd_alloc_pages = %li\n", snd_alloc_pages); if (snd_alloc_kmalloc > 0) - snd_printk("Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc); + snd_printk(KERN_ERR "Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc); if (snd_alloc_vmalloc > 0) - snd_printk("Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc); + snd_printk(KERN_ERR "Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc); for (head = snd_alloc_kmalloc_list.prev; head != &snd_alloc_kmalloc_list; head = head->prev) { t = list_entry(head, struct snd_alloc_track, list); if (t->magic != KMALLOC_MAGIC) { - snd_printk("Corrupted kmalloc\n"); + snd_printk(KERN_ERR "Corrupted kmalloc\n"); break; } - snd_printk("kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); + snd_printk(KERN_ERR "kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); } for (head = snd_alloc_vmalloc_list.prev; head != &snd_alloc_vmalloc_list; head = head->prev) { t = list_entry(head, struct snd_alloc_track, list); if (t->magic != VMALLOC_MAGIC) { - snd_printk("Corrupted vmalloc\n"); + snd_printk(KERN_ERR "Corrupted vmalloc\n"); break; } - snd_printk("vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); + snd_printk(KERN_ERR "vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); } } @@ -125,12 +125,12 @@ void snd_hidden_kfree(const void *obj) unsigned long flags; struct snd_alloc_track *t; if (obj == NULL) { - snd_printk("null kfree (called from %p)\n", __builtin_return_address(0)); + snd_printk(KERN_WARNING "null kfree (called from %p)\n", __builtin_return_address(0)); return; } t = snd_alloc_track_entry(obj); if (t->magic != KMALLOC_MAGIC) { - snd_printk("bad kfree (called from %p)\n", __builtin_return_address(0)); + snd_printk(KERN_WARNING "bad kfree (called from %p)\n", __builtin_return_address(0)); return; } spin_lock_irqsave(&snd_alloc_kmalloc_lock, flags); @@ -166,7 +166,7 @@ void snd_magic_kfree(void *_ptr) { unsigned long *ptr = _ptr; if (ptr == NULL) { - snd_printk("null snd_magic_kfree (called from %p)\n", __builtin_return_address(0)); + snd_printk(KERN_WARNING "null snd_magic_kfree (called from %p)\n", __builtin_return_address(0)); return; } *--ptr = 0; @@ -174,7 +174,7 @@ void snd_magic_kfree(void *_ptr) struct snd_alloc_track *t; t = snd_alloc_track_entry(ptr); if (t->magic != KMALLOC_MAGIC) { - snd_printk("bad snd_magic_kfree (called from %p)\n", __builtin_return_address(0)); + snd_printk(KERN_ERR "bad snd_magic_kfree (called from %p)\n", __builtin_return_address(0)); return; } } @@ -204,12 +204,12 @@ void snd_hidden_vfree(void *obj) { struct snd_alloc_track *t; if (obj == NULL) { - snd_printk("null vfree (called from %p)\n", __builtin_return_address(0)); + snd_printk(KERN_WARNING "null vfree (called from %p)\n", __builtin_return_address(0)); return; } t = snd_alloc_track_entry(obj); if (t->magic != VMALLOC_MAGIC) { - snd_printk("bad vfree (called from %p)\n", __builtin_return_address(0)); + snd_printk(KERN_ERR "bad vfree (called from %p)\n", __builtin_return_address(0)); return; } spin_lock(&snd_alloc_vmalloc_lock); @@ -516,29 +516,36 @@ int copy_from_user_toio(unsigned long dst, const void *src, size_t count) /* * A dirty hack... when the kernel code is fixed this should be removed. * - * since pci_alloc_consistent always tries GFP_ATOMIC when the requested + * since pci_alloc_consistent always tries GFP_DMA when the requested * pci memory region is below 32bit, it happens quite often that even * 2 order or pages cannot be allocated. * - * so in the following, GFP_ATOMIC is used only when the first allocation + * so in the following, GFP_DMA is used only when the first allocation * doesn't match the requested region. */ +#ifdef __i386__ +#define get_phys_addr(x) virt_to_phys(x) +#else /* ppc */ +#define get_phys_addr(x) virt_to_bus(x) +#endif void *snd_pci_hack_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle) { void *ret; int gfp = GFP_ATOMIC; + if (hwdev == NULL) + gfp |= GFP_DMA; ret = (void *)__get_free_pages(gfp, get_order(size)); if (ret) { - if (hwdev && ((virt_to_phys(ret) + size - 1) & ~hwdev->dma_mask)) { + if (hwdev && ((get_phys_addr(ret) + size - 1) & ~hwdev->dma_mask)) { free_pages((unsigned long)ret, get_order(size)); ret = (void *)__get_free_pages(gfp | GFP_DMA, get_order(size)); } } if (ret) { memset(ret, 0, size); - *dma_handle = virt_to_phys(ret); + *dma_handle = get_phys_addr(ret); } return ret; } diff --git a/sound/core/misc.c b/sound/core/misc.c index 195552a6d2c49..2e393982fdd96 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c @@ -36,3 +36,18 @@ int snd_task_name(struct task_struct *task, char *name, size_t size) name[idx] = '\0'; return 0; } + +#ifdef CONFIG_SND_VERBOSE_PRINTK +int snd_verbose_printk(const char *file, int line, const char *format) +{ + if (format[0] == '<' && format[1] >= '0' && format[1] <= '9' && format[2] == '>') { + char tmp[] = "<0>ALSA %s:%d: "; + tmp[1] = format[1]; + printk("%sALSA %s:%d: ", tmp, file, line); + return 1; + } else { + printk("ALSA %s:%d: ", file, line); + return 0; + } +} +#endif diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 3bedabf0ab3cf..051985195fd14 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -104,7 +104,7 @@ int snd_pcm_update_hw_ptr_interrupt(snd_pcm_substream_t *substream) snd_timestamp_now((snd_timestamp_t*)&runtime->status->tstamp); #ifdef CONFIG_SND_DEBUG if (pos > runtime->buffer_size) { - snd_printk("BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); + snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); } else #endif snd_runtime_check(pos <= runtime->buffer_size, return 0); @@ -170,7 +170,7 @@ int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream) snd_timestamp_now((snd_timestamp_t*)&runtime->status->tstamp); #ifdef CONFIG_SND_DEBUG if (pos > runtime->buffer_size) { - snd_printk("BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); + snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); } else #endif snd_runtime_check(pos <= runtime->buffer_size, return 0); diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 3cacd998dcc4a..88381f81154bf 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -837,6 +837,42 @@ static int snd_pcm_resume(snd_pcm_substream_t *substream) #endif /* CONFIG_PM */ +static int snd_pcm_xrun(snd_pcm_substream_t *substream) +{ + snd_card_t *card = substream->pcm->card; + snd_pcm_runtime_t *runtime = substream->runtime; + int result; + + snd_power_lock(card); + spin_lock_irq(&runtime->lock); + _xrun_recovery: + switch (runtime->status->state) { + case SNDRV_PCM_STATE_XRUN: + result = 0; /* already there */ + break; + case SNDRV_PCM_STATE_RUNNING: + result = snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); + break; + case SNDRV_PCM_STATE_SUSPENDED: + while (snd_power_get_state(card) != SNDRV_CTL_POWER_D0) { + if (substream->ffile->f_flags & O_NONBLOCK) { + result = -EAGAIN; + goto _end; + } + spin_unlock_irq(&runtime->lock); + snd_power_wait(card); + spin_lock_irq(&runtime->lock); + } + goto _xrun_recovery; + default: + result = -EBADFD; + } + _end: + spin_unlock_irq(&runtime->lock); + snd_power_unlock(card); + return result; +} + static inline int snd_pcm_pre_reset(snd_pcm_substream_t * substream, int state) { snd_pcm_runtime_t *runtime = substream->runtime; @@ -1999,6 +2035,10 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, return snd_pcm_link(substream, (long) arg); case SNDRV_PCM_IOCTL_UNLINK: return snd_pcm_unlink(substream); + case SNDRV_PCM_IOCTL_RESUME: + return snd_pcm_resume(substream); + case SNDRV_PCM_IOCTL_XRUN: + return snd_pcm_xrun(substream); } snd_printd("unknown ioctl = 0x%x\n", cmd); return -ENOTTY; @@ -2071,8 +2111,6 @@ static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream, return snd_pcm_playback_drop(substream); case SNDRV_PCM_IOCTL_DELAY: return snd_pcm_playback_delay(substream, (snd_pcm_sframes_t*) arg); - case SNDRV_PCM_IOCTL_RESUME: - return snd_pcm_resume(substream); } return snd_pcm_common_ioctl1(substream, cmd, arg); } @@ -2136,8 +2174,6 @@ static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream, return snd_pcm_capture_drop(substream); case SNDRV_PCM_IOCTL_DELAY: return snd_pcm_capture_delay(substream, (snd_pcm_sframes_t*) arg); - case SNDRV_PCM_IOCTL_RESUME: - return snd_pcm_resume(substream); } return snd_pcm_common_ioctl1(substream, cmd, arg); } diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 18f681589acbf..9c6a7c0a979f9 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -769,7 +769,7 @@ static int snd_rawmidi_ioctl(struct inode *inode, struct file *file, } #ifdef CONFIG_SND_DEBUG default: - snd_printk("rawmidi: unknown command = 0x%x\n", cmd); + snd_printk(KERN_WARNING "rawmidi: unknown command = 0x%x\n", cmd); #endif } return -ENOTTY; @@ -1408,7 +1408,7 @@ static int snd_rawmidi_dev_register(snd_device_t *device) if ((err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device, &snd_rawmidi_reg, name)) < 0) { - snd_printk("unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device); + snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device); snd_rawmidi_devices[idx] = NULL; up(®ister_mutex); return err; @@ -1425,7 +1425,7 @@ static int snd_rawmidi_dev_register(snd_device_t *device) if (rmidi->device == snd_midi_map[rmidi->card->number]) { if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, rmidi->card, 0, &snd_rawmidi_reg, name) < 0) { - snd_printk("unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0); + snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0); } else { rmidi->ossreg++; snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIDI, rmidi->card->number, rmidi->name); @@ -1434,7 +1434,7 @@ static int snd_rawmidi_dev_register(snd_device_t *device) if (rmidi->device == snd_amidi_map[rmidi->card->number]) { if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, rmidi->card, 1, &snd_rawmidi_reg, name) < 0) { - snd_printk("unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1); + snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1); } else { rmidi->ossreg++; } @@ -1532,11 +1532,11 @@ static int __init alsa_rawmidi_init(void) /* check device map table */ for (i = 0; i < SNDRV_CARDS; i++) { if (snd_midi_map[i] < 0 || snd_midi_map[i] >= SNDRV_RAWMIDI_DEVICES) { - snd_printk("invalid midi_map[%d] = %d\n", i, snd_midi_map[i]); + snd_printk(KERN_ERR "invalid midi_map[%d] = %d\n", i, snd_midi_map[i]); snd_midi_map[i] = 0; } if (snd_amidi_map[i] < 0 || snd_amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) { - snd_printk("invalid amidi_map[%d] = %d\n", i, snd_amidi_map[i]); + snd_printk(KERN_ERR "invalid amidi_map[%d] = %d\n", i, snd_amidi_map[i]); snd_amidi_map[i] = 1; } } diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index db1452cca6521..51005b69d76b1 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c @@ -156,13 +156,13 @@ static int __init rtctimer_init(void) snd_timer_t *timer; if (rtctimer_freq < 2 || rtctimer_freq > 8192) { - snd_printk("rtctimer: invalid frequency %d\n", rtctimer_freq); + snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); return -EINVAL; } for (order = 1; rtctimer_freq > order; order <<= 1) ; if (rtctimer_freq != order) { - snd_printk("rtctimer: invalid frequency %d\n", rtctimer_freq); + snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); return -EINVAL; } diff --git a/sound/core/seq/Makefile b/sound/core/seq/Makefile index 6e1c83bd886af..ef7fc7a9e5a54 100644 --- a/sound/core/seq/Makefile +++ b/sound/core/seq/Makefile @@ -32,6 +32,8 @@ snd-seq-instr-objs := seq_instr.o snd-seq-dummy-objs := seq_dummy.o snd-seq-virmidi-objs := seq_virmidi.o +obj-$(CONFIG_SND_SEQUENCER) += snd-seq.o snd-seq-device.o +obj-$(CONFIG_SND_SEQUENCER_OSS) += snd-seq-midi-event.o obj-$(CONFIG_SND_SEQ_DUMMY) += snd-seq-dummy.o # Toplevel Module Dependency @@ -56,7 +58,7 @@ obj-$(CONFIG_SND_INTERWAVE_STB) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd obj-$(CONFIG_SND_OPTI92X_AD1848) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_OPTI92X_CS4231) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_OPTI93X) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o -obj-$(CONFIG_SND_SB) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o +obj-$(CONFIG_SND_SB8) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_SB16) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_SBAWE) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o snd-seq-virmidi.o obj-$(CONFIG_SND_ES968) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o @@ -66,7 +68,7 @@ obj-$(CONFIG_SND_CMIPCI) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-mi obj-$(CONFIG_SND_CS4281) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_ENS1370) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o obj-$(CONFIG_SND_ENS1371) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o -obj-$(CONFIG_SND_ES1938) += snd-seq-device.o snd-seq-midi-emul.o snd-seq.o snd-seq-instr.o +obj-$(CONFIG_SND_ES1938) += snd-seq-device.o snd-seq-midi-emul.o snd-seq.o snd-seq-instr.o snd-seq-midi.o snd-seq-midi-event.o obj-$(CONFIG_SND_ES1968) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o obj-$(CONFIG_SND_FM801) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_ICE1712) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o @@ -76,7 +78,7 @@ obj-$(CONFIG_SND_ALI5451) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-m obj-$(CONFIG_SND_CS46XX) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o obj-$(CONFIG_SND_EMU10K1) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-virmidi.o obj-$(CONFIG_SND_TRIDENT) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o -obj-$(CONFIG_SND_YMFPCI) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o +obj-$(CONFIG_SND_YMFPCI) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o include $(TOPDIR)/Rules.make diff --git a/sound/core/seq/instr/Makefile b/sound/core/seq/instr/Makefile index 526f4842ffc5a..936a32ebda9de 100644 --- a/sound/core/seq/instr/Makefile +++ b/sound/core/seq/instr/Makefile @@ -33,7 +33,7 @@ obj-$(CONFIG_SND_INTERWAVE_STB) += snd-ainstr-iw.o snd-ainstr-gf1.o snd-ainstr-s obj-$(CONFIG_SND_OPTI92X_AD1848) += snd-ainstr-fm.o obj-$(CONFIG_SND_OPTI92X_CS4231) += snd-ainstr-fm.o obj-$(CONFIG_SND_OPTI93X) += snd-ainstr-fm.o -obj-$(CONFIG_SND_SB) += snd-ainstr-fm.o +obj-$(CONFIG_SND_SB8) += snd-ainstr-fm.o obj-$(CONFIG_SND_SB16) += snd-ainstr-fm.o obj-$(CONFIG_SND_SBAWE) += snd-ainstr-fm.o obj-$(CONFIG_SND_WAVEFRONT) += snd-ainstr-fm.o @@ -44,6 +44,7 @@ obj-$(CONFIG_SND_ES1938) += snd-ainstr-fm.o obj-$(CONFIG_SND_FM801) += snd-ainstr-fm.o obj-$(CONFIG_SND_SONICVIBES) += snd-ainstr-fm.o obj-$(CONFIG_SND_TRIDENT) += snd-ainstr-simple.o +obj-$(CONFIG_SND_YMFPCI) += snd-ainstr-fm.o include $(TOPDIR)/Rules.make diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c index 89804580198d9..da211db10470e 100644 --- a/sound/core/seq/oss/seq_oss.c +++ b/sound/core/seq/oss/seq_oss.c @@ -222,7 +222,7 @@ register_device(void) NULL, 0, &seq_oss_reg, SNDRV_SEQ_OSS_DEVNAME)) < 0) { - snd_printk("can't register device seq\n"); + snd_printk(KERN_ERR "can't register device seq\n"); up(®ister_mutex); return rc; } @@ -230,7 +230,7 @@ register_device(void) NULL, 0, &seq_oss_reg, SNDRV_SEQ_OSS_DEVNAME)) < 0) { - snd_printk("can't register device music\n"); + snd_printk(KERN_ERR "can't register device music\n"); snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0); up(®ister_mutex); return rc; @@ -245,11 +245,10 @@ unregister_device(void) { down(®ister_mutex); debug_printk(("device unregistered\n")); - if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0) - - snd_printk("error unregister device music\n"); + if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0) + snd_printk(KERN_ERR "error unregister device music\n"); if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0) - snd_printk("error unregister device seq\n"); + snd_printk(KERN_ERR "error unregister device seq\n"); up(®ister_mutex); } diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index 374d698adba1f..0026ff2236782 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -184,7 +184,7 @@ snd_seq_oss_open(struct file *file, int level) seq_oss_devinfo_t *dp; if ((dp = snd_kcalloc(sizeof(*dp), GFP_KERNEL)) == NULL) { - snd_printk("can't malloc device info\n"); + snd_printk(KERN_ERR "can't malloc device info\n"); return -ENOMEM; } @@ -193,7 +193,7 @@ snd_seq_oss_open(struct file *file, int level) break; } if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) { - snd_printk("too many applications\n"); + snd_printk(KERN_ERR "too many applications\n"); return -ENOMEM; } @@ -209,14 +209,14 @@ snd_seq_oss_open(struct file *file, int level) snd_seq_oss_midi_setup(dp); if (dp->synth_opened == 0 && dp->max_mididev == 0) { - snd_printk("no device found\n"); + snd_printk(KERN_ERR "no device found\n"); kfree(dp); return -ENODEV; } /* create port */ if ((rc = create_port(dp)) < 0) { - snd_printk("can't create port\n"); + snd_printk(KERN_ERR "can't create port\n"); free_devinfo(dp); return rc; } @@ -259,7 +259,7 @@ snd_seq_oss_open(struct file *file, int level) /* initialize timer */ if ((dp->timer = snd_seq_oss_timer_new(dp)) == NULL) { - snd_printk("can't alloc timer\n"); + snd_printk(KERN_ERR "can't alloc timer\n"); delete_seq_queue(dp); delete_port(dp); return -ENOMEM; diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c index 416f1f16fc2a1..fe3bfff2a8688 100644 --- a/sound/core/seq/oss/seq_oss_midi.c +++ b/sound/core/seq/oss/seq_oss_midi.c @@ -173,7 +173,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo) * allocate midi info record */ if ((mdev = snd_kcalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) { - snd_printk("can't malloc midi info\n"); + snd_printk(KERN_ERR "can't malloc midi info\n"); return -ENOMEM; } @@ -190,7 +190,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo) /* create MIDI coder */ if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) { - snd_printk("can't malloc midi coder\n"); + snd_printk(KERN_ERR "can't malloc midi coder\n"); kfree(mdev); return -ENOMEM; } diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c index 6005c65f606b9..3bb907d804b2e 100644 --- a/sound/core/seq/oss/seq_oss_readq.c +++ b/sound/core/seq/oss/seq_oss_readq.c @@ -47,12 +47,12 @@ snd_seq_oss_readq_new(seq_oss_devinfo_t *dp, int maxlen) seq_oss_readq_t *q; if ((q = snd_kcalloc(sizeof(*q), GFP_KERNEL)) == NULL) { - snd_printk("can't malloc read queue\n"); + snd_printk(KERN_ERR "can't malloc read queue\n"); return NULL; } if ((q->q = snd_kcalloc(sizeof(evrec_t) * maxlen, GFP_KERNEL)) == NULL) { - snd_printk("can't malloc read queue buffer\n"); + snd_printk(KERN_ERR "can't malloc read queue buffer\n"); kfree(q); return NULL; } diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index e017f2aee49f6..26a6924aaee30 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c @@ -111,7 +111,7 @@ snd_seq_oss_synth_register(snd_seq_device_t *dev) unsigned long flags; if ((rec = snd_kcalloc(sizeof(*rec), GFP_KERNEL)) == NULL) { - snd_printk("can't malloc synth info\n"); + snd_printk(KERN_ERR "can't malloc synth info\n"); return -ENOMEM; } rec->seq_device = -1; @@ -136,7 +136,7 @@ snd_seq_oss_synth_register(snd_seq_device_t *dev) if (i >= max_synth_devs) { if (max_synth_devs >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS) { spin_unlock_irqrestore(®ister_lock, flags); - snd_printk("no more synth slot\n"); + snd_printk(KERN_ERR "no more synth slot\n"); kfree(rec); return -ENOMEM; } @@ -165,7 +165,7 @@ snd_seq_oss_synth_unregister(snd_seq_device_t *dev) } if (index >= max_synth_devs) { spin_unlock_irqrestore(®ister_lock, flags); - snd_printk("can't unregister synth\n"); + snd_printk(KERN_ERR "can't unregister synth\n"); return -EINVAL; } synth_devs[index] = NULL; diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 88be3ab57afd9..880398d7c6c1a 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -265,7 +265,7 @@ static void seq_free_client(client_t * client) down(®ister_mutex); switch (client->type) { case NO_CLIENT: - snd_printk("Seq: Trying to free unused client %d\n", client->number); + snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", client->number); break; case USER_CLIENT: case KERNEL_CLIENT: @@ -274,7 +274,7 @@ static void seq_free_client(client_t * client) break; default: - snd_printk("Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); + snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); } up(®ister_mutex); diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c index 793bc164f9348..1798f2a6ec0cf 100644 --- a/sound/core/seq/seq_device.c +++ b/sound/core/seq/seq_device.c @@ -295,7 +295,7 @@ int snd_seq_device_register_driver(char *id, snd_seq_dev_ops_t *entry, int argsi if (ops == NULL) return -ENOMEM; if (ops->driver & DRIVER_LOADED) { - snd_printk("driver_register: driver '%s' already exists\n", id); + snd_printk(KERN_WARNING "driver_register: driver '%s' already exists\n", id); unlock_driver(ops); return -EBUSY; } @@ -363,7 +363,7 @@ int snd_seq_device_unregister_driver(char *id) return -ENXIO; if (! (ops->driver & DRIVER_LOADED) || (ops->driver & DRIVER_LOCKED)) { - snd_printk("driver_unregister: cannot unload driver '%s': status=%x\n", id, ops->driver); + snd_printk(KERN_ERR "driver_unregister: cannot unload driver '%s': status=%x\n", id, ops->driver); unlock_driver(ops); return -EBUSY; } @@ -378,7 +378,7 @@ int snd_seq_device_unregister_driver(char *id) ops->driver = 0; if (ops->num_init_devices > 0) - snd_printk("free_driver: init_devices > 0!! (%d)\n", ops->num_init_devices); + snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", ops->num_init_devices); up(&ops->reg_mutex); unlock_driver(ops); @@ -423,15 +423,14 @@ static int init_device(snd_seq_device_t *dev, ops_list_t *ops) if (dev->status != SNDRV_SEQ_DEVICE_FREE) return 0; /* already initialized */ if (ops->argsize != dev->argsize) { - snd_printk("incompatible device '%s' for plug-in '%s'\n", dev->name, ops->id); -printk(" %d %d\n", ops->argsize, dev->argsize); + snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); return -EINVAL; } if (ops->ops.init_device(dev) >= 0) { dev->status = SNDRV_SEQ_DEVICE_REGISTERED; ops->num_init_devices++; } else { - snd_printk("init_device failed: %s: %s\n", dev->name, dev->id); + snd_printk(KERN_ERR "init_device failed: %s: %s\n", dev->name, dev->id); } return 0; @@ -449,7 +448,7 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) if (dev->status != SNDRV_SEQ_DEVICE_REGISTERED) return 0; /* not registered */ if (ops->argsize != dev->argsize) { - snd_printk("incompatible device '%s' for plug-in '%s'\n", dev->name, ops->id); + snd_printk(KERN_ERR "incompatible device '%s' for plug-in '%s' (%d %d)\n", dev->name, ops->id, ops->argsize, dev->argsize); return -EINVAL; } if ((result = ops->ops.free_device(dev)) >= 0 || result == -ENXIO) { @@ -457,7 +456,7 @@ static int free_device(snd_seq_device_t *dev, ops_list_t *ops) dev->driver_data = NULL; ops->num_init_devices--; } else { - snd_printk("free_device failed: %s: %s\n", dev->name, dev->id); + snd_printk(KERN_ERR "free_device failed: %s: %s\n", dev->name, dev->id); } return 0; @@ -517,7 +516,7 @@ static void __exit alsa_seq_device_exit(void) remove_drivers(); snd_info_unregister(info_entry); if (num_ops) - snd_printk("drivers not released (%d)\n", num_ops); + snd_printk(KERN_ERR "drivers not released (%d)\n", num_ops); } module_init(alsa_seq_device_init) diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index ccd029612ddd6..fe259ff683606 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -206,7 +206,7 @@ register_client(void) int i; if (ports < 1) { - snd_printk("invalid number of ports %d\n", ports); + snd_printk(KERN_ERR "invalid number of ports %d\n", ports); return -EINVAL; } diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c index c7bb683882409..891aec5f2175c 100644 --- a/sound/core/seq/seq_instr.c +++ b/sound/core/seq/seq_instr.c @@ -132,7 +132,7 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr) } spin_unlock_irqrestore(&list->lock, flags); if (snd_seq_instr_free(instr, 0)<0) - snd_printk("instrument free problem\n"); + snd_printk(KERN_WARNING "instrument free problem\n"); } while ((cluster = list->chash[idx]) != NULL) { list->chash[idx] = cluster->next; @@ -221,7 +221,7 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, schedule_timeout(1); } if (snd_seq_instr_free(instr, atomic)<0) - snd_printk("instrument free problem\n"); + snd_printk(KERN_WARNING "instrument free problem\n"); instr = next; } } @@ -324,7 +324,7 @@ void snd_seq_instr_free_use(snd_seq_kinstr_list_t *list, return; spin_lock_irqsave(&list->lock, flags); if (instr->use <= 0) { - snd_printk("free_use: fatal!!! use = %i, name = '%s'\n", instr->use, instr->name); + snd_printk(KERN_ERR "free_use: fatal!!! use = %i, name = '%s'\n", instr->use, instr->name); } else { instr->use--; } diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c index d5802b77255eb..7490bd851ffd6 100644 --- a/sound/core/seq/seq_lock.c +++ b/sound/core/seq/seq_lock.c @@ -68,12 +68,12 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) int max_count = 5 * HZ; if (atomic_read(lockp) < 0) { - printk("seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line); + printk(KERN_WARNING "seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line); return; } while (atomic_read(lockp) > 0) { if (max_count == 0) { - snd_printk("seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); + snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); break; } set_current_state(TASK_UNINTERRUPTIBLE); diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index 5a6e21dfd250d..5da040eb18e77 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c @@ -423,7 +423,7 @@ int snd_seq_pool_done(pool_t *pool) while (atomic_read(&pool->counter) > 0) { if (max_count == 0) { - snd_printk("snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); + snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); break; } set_current_state(TASK_UNINTERRUPTIBLE); diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c index 9452ae22a6b3e..223385c3ff20b 100644 --- a/sound/core/seq/seq_ports.c +++ b/sound/core/seq/seq_ports.c @@ -143,7 +143,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port) snd_assert(client, return NULL); if (client->num_ports >= SNDRV_SEQ_MAX_PORTS - 1) { - snd_printk("too many ports for client %d\n", client->number); + snd_printk(KERN_WARNING "too many ports for client %d\n", client->number); return NULL; } diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 8c712d3ef08e1..f9bae3a58da16 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c @@ -285,7 +285,7 @@ int snd_seq_timer_open(queue_t *q) t = snd_timer_open(str, &tid, q->queue); } if (t == NULL) { - snd_printk("fatal error: cannot create timer\n"); + snd_printk(KERN_ERR "fatal error: cannot create timer\n"); return -ENODEV; } } diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index 55b00688bf5c4..df7d693256ab9 100644 --- a/sound/core/seq/seq_virmidi.c +++ b/sound/core/seq/seq_virmidi.c @@ -431,7 +431,7 @@ static int snd_virmidi_dev_register(snd_rawmidi_t *rmidi) /* should check presence of port more strictly.. */ break; default: - snd_printk("seq_mode is not set: %d\n", rdev->seq_mode); + snd_printk(KERN_ERR "seq_mode is not set: %d\n", rdev->seq_mode); return -EINVAL; } return 0; diff --git a/sound/core/sound.c b/sound/core/sound.c index 583266fcbd982..ea2c3afdf759a 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -319,7 +319,7 @@ static int __init alsa_sound_init(void) #else if (register_chrdev(snd_major, "alsa", &snd_fops)) { #endif - snd_printk("unable to register native major device number %d\n", snd_major); + snd_printk(KERN_ERR "unable to register native major device number %d\n", snd_major); #ifdef CONFIG_SND_OSSEMUL snd_oss_cleanup_module(); #endif @@ -349,7 +349,7 @@ static int __init alsa_sound_init(void) } #endif #ifndef MODULE - printk("Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"); + printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_APM) pm_init(); @@ -391,7 +391,7 @@ static void __exit alsa_sound_exit(void) #else if (unregister_chrdev(snd_major, "alsa") != 0) #endif - snd_printk("unable to unregister major device number %d\n", snd_major); + snd_printk(KERN_ERR "unable to unregister major device number %d\n", snd_major); #ifdef CONFIG_DEVFS_FS devfs_unregister(devfs_handle); #endif @@ -455,7 +455,7 @@ EXPORT_SYMBOL(snd_device_new); EXPORT_SYMBOL(snd_device_register); EXPORT_SYMBOL(snd_device_free); EXPORT_SYMBOL(snd_device_free_all); - /* misc.c */ + /* isadma.c */ #ifdef CONFIG_ISA EXPORT_SYMBOL(snd_dma_program); EXPORT_SYMBOL(snd_dma_disable); @@ -494,38 +494,10 @@ EXPORT_SYMBOL(snd_ctl_register_ioctl); EXPORT_SYMBOL(snd_ctl_unregister_ioctl); /* misc.c */ EXPORT_SYMBOL(snd_task_name); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -EXPORT_SYMBOL(try_inc_mod_count); -EXPORT_SYMBOL(snd_compat_mem_region); -EXPORT_SYMBOL(snd_compat_request_region); -EXPORT_SYMBOL(snd_compat_release_resource); -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_PCI) -EXPORT_SYMBOL(snd_pci_compat_match_device); -EXPORT_SYMBOL(snd_pci_compat_register_driver); -EXPORT_SYMBOL(snd_pci_compat_unregister_driver); -EXPORT_SYMBOL(snd_pci_compat_get_size); -EXPORT_SYMBOL(snd_pci_compat_get_flags); -EXPORT_SYMBOL(snd_pci_compat_set_power_state); -EXPORT_SYMBOL(snd_pci_compat_enable_device); -EXPORT_SYMBOL(snd_pci_compat_find_capability); -EXPORT_SYMBOL(snd_pci_compat_alloc_consistent); -EXPORT_SYMBOL(snd_pci_compat_free_consistent); -EXPORT_SYMBOL(snd_pci_compat_dma_supported); -EXPORT_SYMBOL(snd_pci_compat_get_dma_mask); -EXPORT_SYMBOL(snd_pci_compat_set_dma_mask); -EXPORT_SYMBOL(snd_pci_compat_get_driver_data); -EXPORT_SYMBOL(snd_pci_compat_set_driver_data); -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_PM) -EXPORT_SYMBOL(pm_register); -EXPORT_SYMBOL(pm_unregister); -EXPORT_SYMBOL(pm_send); +#ifdef CONFIG_SND_VERBOSE_PRINTK +EXPORT_SYMBOL(snd_verbose_printk); #endif /* wrappers */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -EXPORT_SYMBOL(snd_wrapper_kill_fasync); -#endif #ifdef CONFIG_SND_DEBUG_MEMORY EXPORT_SYMBOL(snd_wrapper_kmalloc); EXPORT_SYMBOL(snd_wrapper_kfree); diff --git a/sound/core/timer.c b/sound/core/timer.c index 0c6339716ac73..61ae6762905ad 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -681,7 +681,7 @@ int snd_timer_unregister(snd_timer_t *timer) snd_assert(timer != NULL, return -ENXIO); down(®ister_mutex); if (! list_empty(&timer->open_list_head)) { - snd_printk("timer 0x%lx is busy?\n", (long)timer); + snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer); list_for_each_safe(p, n, &timer->open_list_head) { list_del_init(p); ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); @@ -1318,10 +1318,10 @@ static int __init alsa_timer_init(void) } snd_timer_proc_entry = entry; if ((err = snd_timer_register_system()) < 0) - snd_printk("unable to register system timer (%i)\n", err); + snd_printk(KERN_ERR "unable to register system timer (%i)\n", err); if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, &snd_timer_reg, "timer"))<0) - snd_printk("unable to register timer device (%i)\n", err); + snd_printk(KERN_ERR "unable to register timer device (%i)\n", err); return 0; } diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 6a6d8fe7c9351..1fb03cf552878 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -562,7 +562,7 @@ static int __init alsa_card_dummy_init(void) for (dev = cards = 0; dev < SNDRV_CARDS && snd_enable[dev]; dev++) { if (snd_card_dummy_probe(dev) < 0) { #ifdef MODULE - snd_printk("Dummy soundcard #%i not found or device busy\n", dev + 1); + printk(KERN_ERR "Dummy soundcard #%i not found or device busy\n", dev + 1); #endif break; } @@ -570,7 +570,7 @@ static int __init alsa_card_dummy_init(void) } if (!cards) { #ifdef MODULE - snd_printk("Dummy soundcard not found or device busy\n"); + printk(KERN_ERR "Dummy soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 37deb3638664f..96de16f588185 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -81,7 +81,7 @@ static int __init snd_card_mpu401_probe(int dev) if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, snd_port[dev], 0, snd_irq[dev], snd_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) { - snd_printk("MPU401 not detected at 0x%lx\n", snd_port[dev]); + printk(KERN_ERR "MPU401 not detected at 0x%lx\n", snd_port[dev]); snd_card_free(card); return -ENODEV; } @@ -113,7 +113,7 @@ static int __init alsa_card_mpu401_init(void) } if (!cards) { #ifdef MODULE - snd_printk("MPU-401 device not found or device busy\n"); + printk(KERN_ERR "MPU-401 device not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 48ceaf178afc2..64913d5104ba5 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -761,7 +761,7 @@ static int __init alsa_card_mtpav_init(void) snd_mtpav_portscan(mtp_card); - snd_printk("Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port); + printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port); return 0; diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 4801f7bd16ad0..51668110b7721 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -891,7 +891,7 @@ static int __init snd_serial_probe(int dev) if ((err = snd_uart16550_detect(snd_port[dev])) <= 0) { snd_card_free(card); - snd_printk("no UART detected at 0x%lx\n", (long)snd_port[dev]); + printk(KERN_ERR "no UART detected at 0x%lx\n", (long)snd_port[dev]); return err; } @@ -940,7 +940,7 @@ static int __init alsa_card_serial_init(void) if (cards == 0) { #ifdef MODULE - snd_printk("serial midi soundcard not found or device busy\n"); + printk(KERN_ERR "serial midi soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 06d1f7146a26d..fa1fc68708bdc 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -136,7 +136,7 @@ static int __init alsa_card_virmidi_init(void) for (dev = cards = 0; dev < SNDRV_CARDS && snd_enable[dev]; dev++) { if (snd_card_virmidi_probe(dev) < 0) { #ifdef MODULE - snd_printk("Card-VirMIDI #%i not found or device busy\n", dev + 1); + printk(KERN_ERR "Card-VirMIDI #%i not found or device busy\n", dev + 1); #endif break; } @@ -144,7 +144,7 @@ static int __init alsa_card_virmidi_init(void) } if (!cards) { #ifdef MODULE - snd_printk("Card-VirMIDI soundcard not found or device busy\n"); + printk(KERN_ERR "Card-VirMIDI soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/Config.in b/sound/isa/Config.in index 9fc46d6c17a61..fc7bbc23ced11 100644 --- a/sound/isa/Config.in +++ b/sound/isa/Config.in @@ -3,13 +3,13 @@ mainmenu_option next_comment comment 'ISA devices' -dep_tristate 'Analog Devices SoundPort AD1816A' CONFIG_SND_AD1816A $CONFIG_SND +dep_tristate 'Analog Devices SoundPort AD1816A' CONFIG_SND_AD1816A $CONFIG_SND $CONFIG_ISAPNP dep_tristate 'Generic AD1848/CS4248 driver' CONFIG_SND_AD1848 $CONFIG_SND dep_tristate 'Generic Cirrus Logic CS4231 driver' CONFIG_SND_CS4231 $CONFIG_SND dep_tristate 'Generic Cirrus Logic CS4232 driver' CONFIG_SND_CS4232 $CONFIG_SND dep_tristate 'Generic Cirrus Logic CS4236+ driver' CONFIG_SND_CS4236 $CONFIG_SND -dep_tristate 'Generic ESS ES968 driver' CONFIG_SND_ES968 $CONFIG_SND -dep_tristate 'Generic ESS ES1688 driver' CONFIG_SND_ES1688 $CONFIG_SND +dep_tristate 'Generic ESS ES968 driver' CONFIG_SND_ES968 $CONFIG_SND $CONFIG_ISAPNP +dep_tristate 'Generic ESS ES688/ES1688 driver' CONFIG_SND_ES1688 $CONFIG_SND dep_tristate 'Generic ESS ES18xx driver' CONFIG_SND_ES18XX $CONFIG_SND dep_tristate 'Gravis UltraSound Classic' CONFIG_SND_GUSCLASSIC $CONFIG_SND dep_tristate 'Gravis UltraSound Extreme' CONFIG_SND_GUSEXTREME $CONFIG_SND @@ -26,10 +26,10 @@ if [ "$CONFIG_SND_SB16" != "n" -o "$CONFIG_SND_SBAWE" != "n" ]; then bool ' Sound Blaster 16/AWE CSP support' CONFIG_SND_SB16_CSP fi dep_tristate 'Turtle Beach Maui,Tropez,Tropez+ (Wavefront)' CONFIG_SND_WAVEFRONT $CONFIG_SND -dep_tristate 'Avance Logic ALS100/ALS120' CONFIG_SND_ALS100 $CONFIG_SND -dep_tristate 'Aztech Systems AZT2320' CONFIG_SND_AZT2320 $CONFIG_SND +dep_tristate 'Avance Logic ALS100/ALS120' CONFIG_SND_ALS100 $CONFIG_SND $CONFIG_ISAPNP +dep_tristate 'Aztech Systems AZT2320' CONFIG_SND_AZT2320 $CONFIG_SND $CONFIG_ISAPNP dep_tristate 'C-Media CMI8330' CONFIG_SND_CMI8330 $CONFIG_SND -dep_tristate 'Diamond Technologies DT-0197H' CONFIG_SND_DT0197H $CONFIG_SND +dep_tristate 'Diamond Technologies DT-0197H' CONFIG_SND_DT0197H $CONFIG_SND $CONFIG_ISAPNP dep_tristate 'Yamaha OPL3-SA2/SA3' CONFIG_SND_OPL3SA2 $CONFIG_SND dep_tristate 'Aztech Sound Galaxy' CONFIG_SND_SGALAXY $CONFIG_SND diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index d3fb93723f15c..29a62ca2d39e1 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -36,6 +36,8 @@ #define chip_t ad1816a_t +#define PFX "ad1816a: " + EXPORT_NO_SYMBOLS; MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); MODULE_DESCRIPTION("AD1816A, AD1815"); @@ -176,7 +178,7 @@ static int __init snd_card_ad1816a_isapnp(int dev, isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); if (pdev->activate(pdev) < 0) { - snd_printk("AUDIO isapnp configure failure\n"); + printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); return -EBUSY; } @@ -202,7 +204,7 @@ static int __init snd_card_ad1816a_isapnp(int dev, if (pdev->activate(pdev) < 0) { /* not fatal error */ - snd_printk("MPU-401 isapnp configure failure\n"); + printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); snd_mpu_port[dev] = -1; acard->devmpu = NULL; } else { @@ -257,7 +259,7 @@ static int __init snd_card_ad1816a_probe(int dev) return error; } #else - snd_printk("you have to enable ISA PnP support.\n"); + printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); return -ENOSYS; #endif /* __ISAPNP__ */ @@ -284,14 +286,14 @@ static int __init snd_card_ad1816a_probe(int dev) if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, snd_mpu_port[dev], 0, snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0) - snd_printk("no MPU-401 device at 0x%lx.\n", snd_mpu_port[dev]); + printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", snd_mpu_port[dev]); } if (snd_fm_port[dev] > 0) { if (snd_opl3_create(card, snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_AUTO, 0, &opl3) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx.\n", snd_fm_port[dev], snd_fm_port[dev] + 2); + printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx.\n", snd_fm_port[dev], snd_fm_port[dev] + 2); } else { if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) { snd_card_free(card); @@ -346,11 +348,11 @@ static int __init alsa_card_ad1816a_init(void) #ifdef __ISAPNP__ cards += isapnp_probe_cards(snd_ad1816a_pnpids, snd_ad1816a_isapnp_detect); #else - snd_printk("you have to enable ISA PnP support.\n"); + printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); #endif #ifdef MODULE if (!cards) - snd_printk("no AD1816A based soundcards found.\n"); + printk(KERN_ERR "no AD1816A based soundcards found.\n"); #endif /* MODULE */ return cards ? 0 : -ENODEV; } diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 6ec594af79b07..730338fcad5a4 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -135,7 +135,7 @@ static int __init alsa_card_ad1848_init(void) if (!cards) { #ifdef MODULE - snd_printk("AD1848 soundcard not found or device busy\n"); + printk(KERN_ERR "AD1848 soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/als100.c b/sound/isa/als100.c index 920209f04ebb9..72e52883fbc41 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c @@ -39,6 +39,8 @@ #define chip_t sb_t +#define PFX "als100: " + EXPORT_NO_SYMBOLS; MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); @@ -178,7 +180,7 @@ static int __init snd_card_als100_isapnp(int dev, struct snd_card_als100 *acard) isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); if (pdev->activate(pdev)<0) { - snd_printk("AUDIO isapnp configure failure\n"); + printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); return -EBUSY; } @@ -201,7 +203,7 @@ static int __init snd_card_als100_isapnp(int dev, struct snd_card_als100 *acard) 1); if (pdev->activate(pdev)<0) { - snd_printk("MPU-401 isapnp configure failure\n"); + printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); snd_mpu_port[dev] = -1; acard->devmpu = NULL; } else { @@ -219,7 +221,7 @@ static int __init snd_card_als100_isapnp(int dev, struct snd_card_als100 *acard) isapnp_resource_change(&pdev->resource[0], snd_fm_port[dev], 4); if (pdev->activate(pdev)<0) { - snd_printk("OPL isapnp configure failure\n"); + printk(KERN_ERR PFX "OPL isapnp configure failure\n"); snd_fm_port[dev] = -1; acard->devopl = NULL; } else { @@ -277,7 +279,7 @@ static int __init snd_card_als100_probe(int dev) return error; } #else - snd_printk("you have to enable PnP support ...\n"); + printk(KERN_ERR PFX "you have to enable PnP support ...\n"); snd_card_free(card); return -ENOSYS; #endif /* __ISAPNP__ */ @@ -307,14 +309,14 @@ static int __init snd_card_als100_probe(int dev) snd_mpu_port[dev], 0, snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0) - snd_printk("no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]); + printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]); } if (snd_fm_port[dev] > 0) { if (snd_opl3_create(card, snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_AUTO, 0, &opl3) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx\n", + printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", snd_fm_port[dev], snd_fm_port[dev] + 2); } else { if ((error = snd_opl3_timer_new(opl3, 0, 1)) < 0) { @@ -370,11 +372,11 @@ static int __init alsa_card_als100_init(void) #ifdef __ISAPNP__ cards += isapnp_probe_cards(snd_als100_pnpids, snd_als100_isapnp_detect); #else - snd_printk("you have to enable ISA PnP support.\n"); + printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); #endif #ifdef MODULE if (!cards) - snd_printk("no ALS100 based soundcards found\n"); + printk(KERN_ERR "no ALS100 based soundcards found\n"); #endif return cards ? 0 : -ENODEV; } diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index 98c2d413402e5..fa55a9fdf1203 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c @@ -50,6 +50,8 @@ #define chip_t cs4231_t +#define PFX "azt2320: " + EXPORT_NO_SYMBOLS; MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); @@ -191,7 +193,7 @@ static int __init snd_card_azt2320_isapnp(int dev, struct snd_card_azt2320 *acar isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); if (pdev->activate(pdev) < 0) { - snd_printk("AUDIO isapnp configure failure\n"); + printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); return -EBUSY; } @@ -217,7 +219,7 @@ static int __init snd_card_azt2320_isapnp(int dev, struct snd_card_azt2320 *acar if (pdev->activate(pdev) < 0) { /* not fatal error */ - snd_printk("MPU-401 isapnp configure failure\n"); + printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); snd_mpu_port[dev] = -1; acard->devmpu = NULL; } else { @@ -329,7 +331,7 @@ static int __init snd_card_azt2320_probe(int dev) snd_mpu_port[dev], 0, snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0) - snd_printk("no MPU-401 device at 0x%lx\n", + printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]); } @@ -337,7 +339,7 @@ static int __init snd_card_azt2320_probe(int dev) if (snd_opl3_create(card, snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_AUTO, 0, &opl3) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx\n", + printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", snd_fm_port[dev], snd_fm_port[dev] + 2); } else { if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) { @@ -393,11 +395,11 @@ static int __init alsa_card_azt2320_init(void) #ifdef __ISAPNP__ cards += isapnp_probe_cards(snd_azt2320_pnpids, snd_azt2320_isapnp_detect); #else - snd_printk("you have to enable ISA PnP support.\n"); + printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); #endif #ifdef MODULE if (!cards) - snd_printk("no AZT2320 based soundcards found\n"); + printk(KERN_ERR "no AZT2320 based soundcards found\n"); #endif return cards ? 0 : -ENODEV; } diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index c9ed3cb45b2d3..d49c82efa0c11 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -488,7 +488,7 @@ static int __init alsa_card_cmi8330_init(void) if (!cards) { #ifdef MODULE - snd_printk("CMI8330 not found or device busy\n"); + printk(KERN_ERR "CMI8330 not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 75ec75c67fc20..30bbc2e541204 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c @@ -135,7 +135,7 @@ static int __init snd_card_cs4231_probe(int dev) snd_mpu_port[dev], 0, snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0) - snd_printk("MPU401 not detected\n"); + printk(KERN_ERR "cs4231: MPU401 not detected\n"); } strcpy(card->driver, "CS4231"); strcpy(card->shortname, pcm->name); @@ -161,7 +161,7 @@ static int __init alsa_card_cs4231_init(void) } if (!cards) { #ifdef MODULE - snd_printk("CS4231 soundcard not found or device busy\n"); + printk(KERN_ERR "CS4231 soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 659a5495ce990..23236e5c11113 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c @@ -1335,7 +1335,7 @@ static int snd_cs4231_free(cs4231_t *chip) } if (chip->res_cport) { release_resource(chip->res_cport); - kfree_nocheck(chip->res_port); + kfree_nocheck(chip->res_cport); } if (chip->irq >= 0) { disable_irq(chip->irq); diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 5f3f80b484ec3..3e155d84cdbe9 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -309,7 +309,7 @@ static int __init snd_card_cs4236_isapnp(int dev, struct snd_card_cs4236 *acard) if (snd_dma2[dev] != SNDRV_AUTO_DMA) isapnp_resource_change(&pdev->dma_resource[1], snd_dma2[dev] < 0 ? 4 : snd_dma2[dev], 1); if (pdev->activate(pdev)<0) { - snd_printk(IDENT " isapnp configure failed for WSS (out of resources?)\n"); + printk(KERN_ERR IDENT " isapnp configure failed for WSS (out of resources?)\n"); return -EBUSY; } snd_port[dev] = pdev->resource[0].start; @@ -331,7 +331,7 @@ static int __init snd_card_cs4236_isapnp(int dev, struct snd_card_cs4236 *acard) if (snd_cport[dev] != SNDRV_AUTO_PORT) isapnp_resource_change(&pdev->resource[0], snd_cport[dev], 8); if (pdev->activate(pdev)<0) { - snd_printk(IDENT " isapnp configure failed for control (out of resources?)\n"); + printk(KERN_ERR IDENT " isapnp configure failed for control (out of resources?)\n"); acard->wss->deactivate(acard->wss); return -EBUSY; } @@ -352,7 +352,7 @@ static int __init snd_card_cs4236_isapnp(int dev, struct snd_card_cs4236 *acard) if (pdev->activate(pdev)<0) { snd_mpu_port[dev] = SNDRV_AUTO_PORT; snd_mpu_irq[dev] = SNDRV_AUTO_IRQ; - snd_printk(IDENT " isapnp configure failed for MPU (out of resources?)\n"); + printk(KERN_ERR IDENT " isapnp configure failed for MPU (out of resources?)\n"); } else { snd_mpu_port[dev] = pdev->resource[0].start; if (pdev->irq_resource[0].flags & IORESOURCE_IRQ) { @@ -429,7 +429,7 @@ static int __init snd_card_cs4236_probe(int dev) card->private_free = snd_card_cs4236_free; #ifdef __ISAPNP__ if (snd_isapnp[dev] && (err = snd_card_cs4236_isapnp(dev, acard))<0) { - snd_printk("isapnp detection failed and probing for " IDENT " is not supported\n"); + printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); snd_card_free(card); return -ENXIO; } @@ -442,7 +442,7 @@ static int __init snd_card_cs4236_probe(int dev) snd_sb_port[dev] = SNDRV_AUTO_PORT; if (snd_sb_port[dev] != SNDRV_AUTO_PORT) if ((acard->res_sb_port = request_region(snd_sb_port[dev], 16, IDENT " SB")) == NULL) { - snd_printk("unable to register SB port at 0x%lx\n", snd_sb_port[dev]); + printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", snd_sb_port[dev]); snd_card_free(card); return -ENOMEM; } @@ -501,7 +501,7 @@ static int __init snd_card_cs4236_probe(int dev) if (snd_opl3_create(card, snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_OPL3_CS, 0, &opl3) < 0) { - snd_printk(IDENT ": OPL3 not detected\n"); + printk(KERN_ERR IDENT ": OPL3 not detected\n"); } else { if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { snd_card_free(card); @@ -515,7 +515,7 @@ static int __init snd_card_cs4236_probe(int dev) snd_mpu_port[dev], 0, snd_mpu_irq[dev], snd_mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) - snd_printk(IDENT ": MPU401 not detected\n"); + printk(KERN_ERR IDENT ": MPU401 not detected\n"); } strcpy(card->driver, pcm->name); strcpy(card->shortname, pcm->name); @@ -575,7 +575,7 @@ static int __init alsa_card_cs423x_init(void) #endif if (!cards) { #ifdef MODULE - snd_printk(IDENT " soundcard not found or device busy\n"); + printk(KERN_ERR IDENT " soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/dt0197h.c b/sound/isa/dt0197h.c index 93d23d03f5dc1..e3c30768d1b87 100644 --- a/sound/isa/dt0197h.c +++ b/sound/isa/dt0197h.c @@ -36,6 +36,8 @@ #define chip_t sb_t +#define PFX "dt0197h: " + EXPORT_NO_SYMBOLS; MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); @@ -150,7 +152,7 @@ static int __init snd_card_dt0197h_isapnp(int dev, struct snd_card_dt0197h *acar isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); if (pdev->activate(pdev)<0) { - snd_printk("AUDIO isapnp configure failure\n"); + printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); return -EBUSY; } @@ -170,7 +172,7 @@ static int __init snd_card_dt0197h_isapnp(int dev, struct snd_card_dt0197h *acar 1); if (pdev->activate(pdev)<0) { - snd_printk("MPU-401 isapnp configure failure\n"); + printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); snd_mpu_port[dev] = -1; acard->devmpu = NULL; } else { @@ -186,7 +188,7 @@ static int __init snd_card_dt0197h_isapnp(int dev, struct snd_card_dt0197h *acar isapnp_resource_change(&pdev->resource[0], snd_fm_port[dev], 4); if (pdev->activate(pdev)<0) { - snd_printk("OPL isapnp configure failure\n"); + printk(KERN_ERR PFX "OPL isapnp configure failure\n"); snd_fm_port[dev] = -1; acard->devopl = NULL; } else { @@ -244,7 +246,7 @@ static int __init snd_card_dt0197h_probe(int dev) return error; } #else - snd_printk("you have to enable PnP support ...\n"); + printk(KERN_ERR PFX "you have to enable PnP support ...\n"); snd_card_free(card); return -ENOSYS; #endif /* __ISAPNP__ */ @@ -276,7 +278,7 @@ static int __init snd_card_dt0197h_probe(int dev) snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0) - snd_printk("no MPU-401 device at 0x%lx ?\n", + printk(KERN_ERR PFX "no MPU-401 device at 0x%lx ?\n", snd_mpu_port[dev]); } @@ -285,7 +287,7 @@ static int __init snd_card_dt0197h_probe(int dev) snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_AUTO, 0, &opl3) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx ?\n", + printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx ?\n", snd_fm_port[dev], snd_fm_port[dev] + 2); } else { if ((error = snd_opl3_timer_new(opl3, 0, 1)) < 0) { @@ -341,11 +343,11 @@ static int __init alsa_card_dt0197h_init(void) #ifdef __ISAPNP__ cards += isapnp_probe_cards(snd_dt0197h_pnpids, snd_dt0197h_isapnp_detect); #else - snd_printk("you have to enable ISA PnP support.\n"); + printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); #endif #ifdef MODULE if (!cards) - snd_printk("no DT-0197H based soundcards found\n"); + printk(KERN_ERR "no DT-0197H based soundcards found\n"); #endif return cards ? 0 : -ENODEV; } diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 40b2aa33c020a..8f2d23e0a2700 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -133,7 +133,7 @@ static int __init snd_audiodrive_probe(int dev) } if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { - snd_printk("opl3 not detected at 0x%lx\n", chip->port); + printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port); } else { if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { snd_card_free(card); @@ -194,7 +194,7 @@ static int __init alsa_card_es1688_init(void) cards += snd_legacy_auto_probe(possible_ports, snd_audiodrive_legacy_auto_probe); if (!cards) { #ifdef MODULE - snd_printk("ESS AudioDrive ES1688 soundcard not found or device busy\n"); + printk(KERN_ERR "ESS AudioDrive ES1688 soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 61f4aba6c18e9..f547355182237 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -86,6 +86,8 @@ #define SNDRV_GET_ID #include <sound/initval.h> +#define PFX "es18xx: " + struct _snd_es18xx { unsigned long port; /* port of ESS chip */ unsigned long mpu_port; /* MPU-401 port of ESS chip */ @@ -1510,7 +1512,7 @@ static int __init snd_es18xx_identify(es18xx_t *chip) static int __init snd_es18xx_probe(es18xx_t *chip) { if (snd_es18xx_identify(chip) < 0) { - snd_printk("[0x%lx] ESS chip not found\n", chip->port); + printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port); return -ENODEV; } @@ -1752,27 +1754,27 @@ static int __init snd_es18xx_new_device(snd_card_t * card, if ((chip->res_port = request_region(port, 16, "ES18xx")) == NULL) { snd_es18xx_free(chip); - snd_printk("unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); + printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); return -EBUSY; } if (request_irq(irq, snd_es18xx_interrupt, SA_INTERRUPT, "ES18xx", (void *) chip)) { snd_es18xx_free(chip); - snd_printk("unable to grap IRQ %d\n", irq); + printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq); return -EBUSY; } chip->irq = irq; if (request_dma(dma1, "ES18xx DMA 1")) { snd_es18xx_free(chip); - snd_printk("unable to grap DMA1 %d\n", dma1); + printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1); return -EBUSY; } chip->dma1 = dma1; if (request_dma(dma2, "ES18xx DMA 2")) { snd_es18xx_free(chip); - snd_printk("unable to grap DMA2 %d\n", dma2); + printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2); return -EBUSY; } chip->dma2 = dma2; @@ -2008,7 +2010,7 @@ static int __init snd_audiodrive_isapnp(int dev, struct snd_audiodrive *acard) if (acard->devc->prepare(acard->devc)<0) return -EAGAIN; if (acard->devc->activate(acard->devc)<0) { - snd_printk("isapnp control configure failure (out of resources?)\n"); + printk(KERN_ERR PFX "isapnp control configure failure (out of resources?)\n"); return -EAGAIN; } snd_printdd("isapnp: port=0x%lx\n", acard->devc->resource[0].start); @@ -2031,7 +2033,7 @@ static int __init snd_audiodrive_isapnp(int dev, struct snd_audiodrive *acard) if (snd_irq[dev] != SNDRV_AUTO_IRQ) isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); if (pdev->activate(pdev)<0) { - snd_printk("isapnp configure failure (out of resources?)\n"); + printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n"); acard->devc->deactivate(acard->devc); return -EBUSY; } @@ -2147,7 +2149,7 @@ static int __init snd_audiodrive_probe(int dev) } if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { - snd_printk("opl3 not detected at 0x%lx\n", chip->port); + printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->port); } else { if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { snd_card_free(card); @@ -2259,7 +2261,7 @@ static int __init alsa_card_es18xx_init(void) #endif if(!cards) { #ifdef MODULE - snd_printk("ESS AudioDrive ES18xx soundcard not found or device busy\n"); + printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 701a3210894b1..2c161f9797a2d 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -251,7 +251,7 @@ static int __init alsa_card_gusclassic_init(void) cards += snd_legacy_auto_probe(possible_ports, snd_gusclassic_legacy_auto_probe); if (!cards) { #ifdef MODULE - snd_printk("GUS Classic soundcard not found or device busy\n"); + printk(KERN_ERR "GUS Classic soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 37ea104f27c1f..3d6593e8e6f35 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -316,7 +316,7 @@ static int __init snd_gusextreme_probe(int dev) if (snd_opl3_create(card, es1688->port, es1688->port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { - snd_printk("opl3 not detected at 0x%lx\n", es1688->port); + printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); } else { if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) { snd_card_free(card); @@ -376,7 +376,7 @@ static int __init alsa_card_gusextreme_init(void) cards += snd_legacy_auto_probe(possible_ports, snd_gusextreme_legacy_auto_probe); if (!cards) { #ifdef MODULE - snd_printk("GUS Extreme soundcard not found or device busy\n"); + printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 1553e1230e6dc..eadc412dd5dcd 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -292,13 +292,13 @@ static int __init snd_gusmax_probe(int dev) } if (!gus->max_flag) { snd_card_free(card); - snd_printk("GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); + printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); return -ENODEV; } if (request_irq(irq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { snd_card_free(card); - snd_printk("unable to grab IRQ %d\n", irq); + printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", irq); return -EBUSY; } maxcard->irq = irq; @@ -387,7 +387,7 @@ static int __init alsa_card_gusmax_init(void) cards += snd_legacy_auto_probe(possible_ports, snd_gusmax_legacy_auto_probe); if (!cards) { #ifdef MODULE - snd_printk("GUS MAX soundcard not found or device busy\n"); + printk(KERN_ERR "GUS MAX soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 68d54e1edaf16..a28db1cd25aa3 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -948,7 +948,7 @@ static int __init alsa_card_interwave_init(void) continue; } #ifdef MODULE - snd_printk("InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]); + printk(KERN_ERR "InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]); #endif } /* legacy auto configured cards */ @@ -960,7 +960,7 @@ static int __init alsa_card_interwave_init(void) if (!cards) { #ifdef MODULE - snd_printk("InterWave soundcard not found or device busy\n"); + printk(KERN_ERR "InterWave soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index c92701db9229b..a389a6548c994 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -893,7 +893,7 @@ static int __init alsa_card_opl3sa2_init(void) #endif if (!cards) { #ifdef MODULE - snd_printk("Yamaha OPL3-SA soundcard not found or device busy\n"); + printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index ea99fc5983940..b6771fbc9e061 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -2154,9 +2154,9 @@ static int __init alsa_card_opti9xx_init(void) if ((error = snd_card_opti9xx_probe())) { #ifdef MODULE #ifdef OPTi93X - snd_printk("no OPTi 82C93x soundcard found\n"); + printk(KERN_ERR "no OPTi 82C93x soundcard found\n"); #else - snd_printk("no OPTi 82C92x soundcard found\n"); + printk(KERN_ERR "no OPTi 82C92x soundcard found\n"); #endif /* OPTi93X */ #endif return error; diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index b57b0bd7218df..30f5c3d762da5 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -43,6 +43,12 @@ #define chip_t sb_t +#ifdef SNDRV_SBAWE +#define PFX "sbawe: " +#else +#define PFX "sb16: " +#endif + #ifndef SNDRV_SBAWE EXPORT_NO_SYMBOLS; #endif @@ -296,7 +302,7 @@ static int __init snd_sb16_isapnp(int dev, struct snd_sb16 *acard) if (snd_irq[dev] != SNDRV_AUTO_IRQ) isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); if (pdev->activate(pdev) < 0) { - snd_printk("isapnp configure failure (out of resources?)\n"); + printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n"); return -EBUSY; } snd_port[dev] = pdev->resource[0].start; @@ -322,7 +328,7 @@ static int __init snd_sb16_isapnp(int dev, struct snd_sb16 *acard) isapnp_resource_change(&pdev->resource[2], snd_awe_port[dev] + 0x800, 4); } if (pdev->activate(pdev)<0) { - snd_printk("WaveTable isapnp configure failure (out of resources?)\n"); + printk(KERN_ERR PFX "WaveTable isapnp configure failure (out of resources?)\n"); acard->dev->deactivate(acard->dev); return -EBUSY; } @@ -402,21 +408,21 @@ static int __init snd_sb16_probe(int dev) if (irq == SNDRV_AUTO_IRQ) { if ((irq = snd_legacy_find_free_irq(possible_irqs)) < 0) { snd_card_free(card); - snd_printk("unable to find a free IRQ\n"); + printk(KERN_ERR PFX "unable to find a free IRQ\n"); return -EBUSY; } } if (dma8 == SNDRV_AUTO_DMA) { if ((dma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) { snd_card_free(card); - snd_printk("unable to find a free 8-bit DMA\n"); + printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); return -EBUSY; } } if (dma16 == SNDRV_AUTO_DMA) { if ((dma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) { snd_card_free(card); - snd_printk("unable to find a free 16-bit DMA\n"); + printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); return -EBUSY; } } @@ -475,7 +481,7 @@ static int __init snd_sb16_probe(int dev) if (snd_opl3_create(card, snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_OPL3, snd_fm_port[dev] == snd_port[dev], &opl3) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx\n", + printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", snd_fm_port[dev], snd_fm_port[dev] + 2); } else { #ifdef SNDRV_SBAWE_EMU8000 @@ -503,7 +509,7 @@ static int __init snd_sb16_probe(int dev) chip->csp = csp->private_data; chip->hardware = SB_HW_16CSP; } else { - snd_printk("warning - CSP chip not detected on soundcard #%i\n", dev + 1); + printk(KERN_INFO PFX "warning - CSP chip not detected on soundcard #%i\n", dev + 1); } } #endif @@ -511,7 +517,7 @@ static int __init snd_sb16_probe(int dev) if (snd_awe_port[dev] > 0) { if (snd_emu8000_new(card, 1, snd_awe_port[dev], snd_seq_ports[dev], NULL) < 0) { - snd_printk("fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", snd_awe_port[dev]); + printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", snd_awe_port[dev]); snd_card_free(card); return -ENXIO; } @@ -612,7 +618,7 @@ static int __init alsa_card_sb16_init(void) continue; } #ifdef MODULE - snd_printk("Sound Blaster 16+ soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]); + printk(KERN_ERR "Sound Blaster 16+ soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]); #endif } /* legacy auto configured cards */ @@ -624,11 +630,11 @@ static int __init alsa_card_sb16_init(void) if (!cards) { #ifdef MODULE - snd_printk("Sound Blaster 16 soundcard not found or device busy\n"); + printk(KERN_ERR "Sound Blaster 16 soundcard not found or device busy\n"); #ifdef SNDRV_SBAWE_EMU8000 - snd_printk("In case, if you have non-AWE card, try snd-card-sb16 module\n"); + printk(KERN_ERR "In case, if you have non-AWE card, try snd-card-sb16 module\n"); #else - snd_printk("In case, if you have AWE card, try snd-card-sbawe module\n"); + printk(KERN_ERR "In case, if you have AWE card, try snd-card-sbawe module\n"); #endif #endif return -ENODEV; diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index 320b9fa591015..d668a174621ad 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -144,13 +144,13 @@ static int __init snd_sb8_probe(int dev) if ((err = snd_opl3_create(card, chip->port + 8, 0, OPL3_HW_AUTO, 1, &opl3)) < 0) { - snd_printk("no OPL device at 0x%lx\n", chip->port + 8); + printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8); } } else { if ((err = snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_AUTO, 1, &opl3)) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx\n", + printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n", chip->port, chip->port + 2); } } @@ -211,7 +211,7 @@ static int __init alsa_card_sb8_init(void) cards += snd_legacy_auto_probe(possible_ports, snd_card_sb8_legacy_auto_probe); if (!cards) { #ifdef MODULE - snd_printk("Sound Blaster soundcard not found or device busy\n"); + printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 09ddf37c48c25..10f4fdf0edb50 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c @@ -305,7 +305,7 @@ static int __init alsa_card_sgalaxy_init(void) } if (!cards) { #ifdef MODULE - snd_printk("Sound Galaxy soundcard not found or device busy\n"); + printk(KERN_ERR "Sound Galaxy soundcard not found or device busy\n"); #endif return -ENODEV; } diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 59164bf908f9c..0e0ae3c795c9d 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -740,7 +740,7 @@ static int __init alsa_card_wavefront_init(void) #endif if (!cards) { #ifdef MODULE - snd_printk ("No cards found or devices busy\n"); + printk (KERN_ERR "No WaveFront cards found or devices busy\n"); #endif return -ENODEV; } diff --git a/sound/last.c b/sound/last.c index ec5416ab0ca8f..5e2c8d5422bf7 100644 --- a/sound/last.c +++ b/sound/last.c @@ -27,14 +27,14 @@ static int __init alsa_sound_last_init(void) { int idx, ok = 0; - printk("ALSA device list:\n"); + printk(KERN_INFO "ALSA device list:\n"); for (idx = 0; idx < SNDRV_CARDS; idx++) if (snd_cards[idx] != NULL) { - printk(" #%i: %s\n", idx, snd_cards[idx]->longname); + printk(KERN_INFO " #%i: %s\n", idx, snd_cards[idx]->longname); ok++; } if (ok == 0) - printk(" No soundcards found.\n"); + printk(KERN_INFO " No soundcards found.\n"); return 0; } diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index b8a2bf11d1f35..e722c3c1f759f 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -115,7 +115,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = { { 0x43525960, 0xfffffff8, "CS4291", NULL }, { 0x48525300, 0xffffff00, "HMP9701", NULL }, { 0x49434501, 0xffffffff, "ICE1230", NULL }, -{ 0x49434511, 0xffffffff, "ICE1232", NULL }, // only guess --jk +{ 0x49434511, 0xffffffff, "ICE1232", NULL }, // alias VIA VT1611A? { 0x4e534300, 0xffffffff, "LM4540/43/45/46/48", NULL }, // only guess --jk { 0x4e534331, 0xffffffff, "LM4549", NULL }, { 0x53494c22, 0xffffffff, "Si3036", NULL }, @@ -1393,28 +1393,31 @@ int snd_ac97_mixer(snd_card_t * card, ac97_t * _ac97, ac97_t ** rac97) ac97->card = card; spin_lock_init(&ac97->reg_lock); snd_ac97_write(ac97, AC97_RESET, 0); /* reset to defaults */ - udelay(50); - - /* it's necessary to wait awhile until registers are accessible after RESET */ - /* because the PCM or MASTER volume registers can be modified, */ - /* the REC_GAIN register is used for tests */ - end_time = jiffies + (HZ / 2); - do { - /* use preliminary reads to settle the communication */ - snd_ac97_read(ac97, AC97_RESET); - snd_ac97_read(ac97, AC97_VENDOR_ID1); - snd_ac97_read(ac97, AC97_VENDOR_ID2); - /* test if we can write to the PCM volume register */ - snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a05); - if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05) - goto __access_ok; - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(HZ/100); - } while (end_time - (signed long)jiffies >= 0); - snd_printd("AC'97 %d:%d does not respond - RESET [REC_GAIN = 0x%x]\n", ac97->num, ac97->addr, err); - snd_ac97_free(ac97); - return -ENXIO; - + if (ac97->wait) + ac97->wait(ac97); + else { + udelay(50); + + /* it's necessary to wait awhile until registers are accessible after RESET */ + /* because the PCM or MASTER volume registers can be modified, */ + /* the REC_GAIN register is used for tests */ + end_time = jiffies + HZ; + do { + /* use preliminary reads to settle the communication */ + snd_ac97_read(ac97, AC97_RESET); + snd_ac97_read(ac97, AC97_VENDOR_ID1); + snd_ac97_read(ac97, AC97_VENDOR_ID2); + /* test if we can write to the PCM volume register */ + snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a05); + if ((err = snd_ac97_read(ac97, AC97_REC_GAIN)) == 0x8a05) + goto __access_ok; + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(HZ/100); + } while (end_time - (signed long)jiffies >= 0); + snd_printd("AC'97 %d:%d does not respond - RESET [REC_GAIN = 0x%x]\n", ac97->num, ac97->addr, err); + snd_ac97_free(ac97); + return -ENXIO; + } __access_ok: ac97->caps = snd_ac97_read(ac97, AC97_RESET); ac97->id = snd_ac97_read(ac97, AC97_VENDOR_ID1) << 16; diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 200e61a9bccef..224d39d5d9097 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -2253,7 +2253,7 @@ static int __init alsa_card_ali_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("ALi pci audio not found or device busy.\n"); + printk(KERN_ERR "ALi pci audio not found or device busy.\n"); #endif return err; } diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 87322007c8ed0..0e937020dfbc9 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -635,7 +635,7 @@ static int __devinit snd_card_als4k_probe(struct pci_dev *pci, gcr+0x30, 1, pci->irq, 0, &chip->rmidi)) < 0) { snd_card_free(card); - snd_printk("no MPU-401device at 0x%lx ?\n", gcr+0x30); + printk(KERN_ERR "als4000: no MPU-401device at 0x%lx ?\n", gcr+0x30); return err; } @@ -650,7 +650,7 @@ static int __devinit snd_card_als4k_probe(struct pci_dev *pci, if (snd_opl3_create(card, gcr+0x10, gcr+0x12, OPL3_HW_AUTO, 1, &opl3) < 0) { - snd_printk("no OPL device at 0x%lx-0x%lx ?\n", + printk(KERN_ERR "als4000: no OPL device at 0x%lx-0x%lx ?\n", gcr+0x10, gcr+0x12 ); } else { if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { @@ -692,7 +692,7 @@ static int __init alsa_card_als4k_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("no ALS4000 based soundcards found or device busy\n"); + printk(KERN_ERR "no ALS4000 based soundcards found or device busy\n"); #endif return err; } diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index f60ca9a0e9853..926b5705b01a7 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -113,6 +113,7 @@ MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_ENABLED ",allows:{{-1},{0x388},{0x3c8},{0x #define CM_AC3EN1 0x00100000 /* enable AC3: model 037 */ #define CM_SPD24SEL 0x00020000 /* 24bit spdif: model 037 */ +#define CM_SPDIF_INVERSE 0x00010000 #define CM_ADCBITLEN_MASK 0x0000C000 #define CM_ADCBITLEN_16 0x00000000 @@ -131,6 +132,8 @@ MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_ENABLED ",allows:{{-1},{0x388},{0x3c8},{0x #define CM_CH0_SRATE_176K 0x00000200 #define CM_CH0_SRATE_88K 0x00000100 +#define CM_SPDIF_INVERSE2 0x00000080 /* model 055? */ + #define CM_CH1FMT_MASK 0x0000000C #define CM_CH1FMT_SHIFT 2 #define CM_CH0FMT_MASK 0x00000003 @@ -201,6 +204,7 @@ MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_ENABLED ",allows:{{-1},{0x388},{0x3c8},{0x #define CM_VIDWPPRT 0x00002000 #define CM_SFILENB 0x00001000 #define CM_MMODE_MASK 0x00000E00 +#define CM_SPDIF_SELECT 0x00000100 /* for model > 039 ? */ #define CM_ENCENTER 0x00000080 /* shared with FLINKON? */ #define CM_FLINKON 0x00000080 #define CM_FLINKOFF 0x00000040 @@ -347,7 +351,7 @@ struct snd_stru_cmipci_pcm { unsigned int offset; /* physical address of the buffer */ unsigned int fmt; /* format bits */ int ch; /* channel (0/1) */ - int is_dac; /* is dac? */ + unsigned int is_dac; /* is dac? */ int bytes_per_frame; int shift; int ac3_shift; /* extra shift: 1 on soft ac3 mode */ @@ -388,6 +392,9 @@ struct snd_stru_cmipci { unsigned int can_ac3_sw: 1; unsigned int can_ac3_hw: 1; unsigned int can_multi_ch: 1; + + unsigned int spdif_playback_avail: 1; /* spdif ready? */ + unsigned int spdif_playback_enabled: 1; /* spdif switch enabled? */ int spdif_counter; /* for software AC3 */ unsigned int dig_status; @@ -1133,11 +1140,13 @@ static void setup_spdif_playback(cmipci_t *cm, snd_pcm_substream_t *subs, int up save_mixer_state(cm); spin_lock_irqsave(&cm->reg_lock, flags); + cm->spdif_playback_avail = up; if (up) { /* they are controlled via "IEC958 Output Switch" */ /* snd_cmipci_set_bit(cm, CM_REG_LEGACY_CTRL, CM_ENSPDOUT); */ /* snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_SPDO2DAC); */ - snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_PLAYBACK_SPDF); + if (cm->spdif_playback_enabled) + snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_PLAYBACK_SPDF); setup_ac3(cm, do_ac3, rate); if (rate == 48000) @@ -2020,7 +2029,7 @@ static snd_kcontrol_new_t snd_cmipci_mixers[] __devinitdata = { CMIPCI_DOUBLE("Mic Capture Switch", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0, 1, 0, 0), CMIPCI_SB_VOL_MONO("PC Speaker Playback Volume", SB_DSP4_SPEAKER_DEV, 6, 3), CMIPCI_MIXER_VOL_STEREO("Aux Playback Volume", CM_REG_AUX_VOL, 4, 0, 15), - CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 0), + CMIPCI_MIXER_SW_STEREO("Aux Playback Switch", CM_REG_MIXER2, CM_VAUXLM_SHIFT, CM_VAUXRM_SHIFT, 1), CMIPCI_MIXER_SW_STEREO("Aux Capture Switch", CM_REG_MIXER2, CM_RAUXLEN_SHIFT, CM_RAUXREN_SHIFT, 0), CMIPCI_MIXER_SW_MONO("Mic Boost", CM_REG_MIXER2, CM_MICGAINZ_SHIFT, 1), CMIPCI_MIXER_VOL_MONO("Mic Capture Volume", CM_REG_MIXER2, CM_VADMIC_SHIFT, 7), @@ -2132,6 +2141,7 @@ DEFINE_BIT_SWITCH_ARG(spdif_in, CM_REG_FUNCTRL1, CM_SPDF_1, 0); DEFINE_BIT_SWITCH_ARG(spdif_0, CM_REG_FUNCTRL1, CM_SPDF_0, 0); DEFINE_BIT_SWITCH_ARG(spdo_48k, CM_REG_MISC_CTRL, CM_SPDF_AC97|CM_SPDIF48K, 0); #endif +DEFINE_BIT_SWITCH_ARG(spdif_in_1_2, CM_REG_MISC_CTRL, CM_SPDIF_SELECT, 0, 0); DEFINE_BIT_SWITCH_ARG(spdif_enable, CM_REG_LEGACY_CTRL, CM_ENSPDOUT, 0, 0); DEFINE_BIT_SWITCH_ARG(spdo2dac, CM_REG_FUNCTRL1, CM_SPDO2DAC, 0, 1); DEFINE_BIT_SWITCH_ARG(spdi_valid, CM_REG_MISC, CM_SPDVALID, 1, 0); @@ -2140,7 +2150,8 @@ DEFINE_BIT_SWITCH_ARG(spdif_dac_out, CM_REG_LEGACY_CTRL, CM_DAC2SPDO, 0, 1); DEFINE_SWITCH_ARG(spdo_5v, CM_REG_MISC_CTRL, CM_SPDO5V, 0, 0, 0); /* inverse: 0 = 5V */ DEFINE_BIT_SWITCH_ARG(spdif_loop, CM_REG_FUNCTRL1, CM_SPDFLOOP, 0, 1); DEFINE_BIT_SWITCH_ARG(spdi_monitor, CM_REG_MIXER1, CM_CDPLAY, 1, 0); -DEFINE_BIT_SWITCH_ARG(spdi_phase, CM_REG_MISC, 0x04, 0, 0); +DEFINE_BIT_SWITCH_ARG(spdi_phase, CM_REG_CHFORMAT, CM_SPDIF_INVERSE, 0, 0); +DEFINE_BIT_SWITCH_ARG(spdi_phase2, CM_REG_CHFORMAT, CM_SPDIF_INVERSE2, 0, 0); #if CM_CH_PLAY == 1 DEFINE_SWITCH_ARG(exchange_dac, CM_REG_MISC_CTRL, CM_XCHGDAC, 0, 0, 0); /* reversed */ #else @@ -2179,9 +2190,20 @@ static int snd_cmipci_spdout_enable_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_v static int snd_cmipci_spdout_enable_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) { + cmipci_t *chip = snd_kcontrol_chip(kcontrol); int changed; changed = _snd_cmipci_uswitch_put(kcontrol, ucontrol, &cmipci_switch_arg_spdif_enable); changed |= _snd_cmipci_uswitch_put(kcontrol, ucontrol, &cmipci_switch_arg_spdo2dac); + if (changed) { + if (ucontrol->value.integer.value[0]) { + if (chip->spdif_playback_avail) + snd_cmipci_set_bit(chip, CM_REG_FUNCTRL1, CM_PLAYBACK_SPDF); + } else { + if (chip->spdif_playback_avail) + snd_cmipci_clear_bit(chip, CM_REG_FUNCTRL1, CM_PLAYBACK_SPDF); + } + } + chip->spdif_playback_enabled = ucontrol->value.integer.value[0]; return changed; } @@ -2213,17 +2235,19 @@ static snd_kcontrol_new_t snd_cmipci_8738_mixer_switches[] __devinitdata = { DEFINE_MIXER_SWITCH("IEC958 5V", spdo_5v), DEFINE_MIXER_SWITCH("IEC958 Loop", spdif_loop), DEFINE_MIXER_SWITCH("IEC958 In Monitor", spdi_monitor), - DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase), }; /* only for model 033/037 */ static snd_kcontrol_new_t snd_cmipci_old_mixer_switches[] __devinitdata = { DEFINE_MIXER_SWITCH("IEC958 Mix Analog", spdif_dac_out), + DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase), }; -/* only for model 039 */ +/* only for model 039 or later */ static snd_kcontrol_new_t snd_cmipci_extra_mixer_switches[] __devinitdata = { DEFINE_MIXER_SWITCH("Line-In As Bass", line_bass), + DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_1_2), + DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase2), }; /* card control switches */ @@ -2283,7 +2307,7 @@ static int __devinit snd_cmipci_mixer_new(cmipci_t *cm, int pcm_spdif_device) cm->spdif_pcm_ctl = kctl; if (cm->chip_version <= 37) { sw = snd_cmipci_old_mixer_switches; - for (idx = 0; idx < num_controls(snd_cmipci_extra_mixer_switches); idx++, sw++) { + for (idx = 0; idx < num_controls(snd_cmipci_old_mixer_switches); idx++, sw++) { err = snd_ctl_add(cm->card, snd_ctl_new1(sw, cm)); if (err < 0) return err; @@ -2573,10 +2597,10 @@ static int __devinit snd_cmipci_create(snd_card_t *card, if (snd_opl3_create(card, iosynth, iosynth + 2, OPL3_HW_OPL3, 0, &cm->opl3) < 0) { - snd_printk("no OPL device at 0x%lx\n", iosynth); + printk(KERN_ERR "cmipci: no OPL device at 0x%lx\n", iosynth); } else { if ((err = snd_opl3_hwdep_new(cm->opl3, 0, 1, &cm->opl3hwdep)) < 0) - snd_printk("cannot create OPL3 hwdep\n"); + printk(KERN_ERR "cmipci: cannot create OPL3 hwdep\n"); } } @@ -2609,7 +2633,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI, iomidi, 0, cm->irq, 0, &cm->rmidi)) < 0) { - snd_printk("cmipci: no UART401 device at 0x%lx\n", iomidi); + printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi); } } @@ -2711,7 +2735,7 @@ static int __init alsa_card_cmipci_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("C-Media PCI soundcard not found or device busy\n"); + printk(KERN_ERR "C-Media PCI soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 5d0e5619e98fe..5aad9f4f905d4 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -268,7 +268,7 @@ MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC); #define BA0_SERC1_SO1EN (1<<0) /* Primary Output Port Enable */ #define BA0_SERC2 0x042c /* Serial Port Configuration 2 */ -#define BA0_SERC2_SI1F(x) (((x)&7)>>1) */ Primary Input Port Format */ +#define BA0_SERC2_SI1F(x) (((x)&7)>>1) /* Primary Input Port Format */ #define BA0_SERC2_AC97 (1<<1) #define BA0_SERC2_SI1EN (1<<0) /* Primary Input Port Enable */ @@ -1910,7 +1910,7 @@ static int __init alsa_card_cs4281_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("CS4281 soundcard not found or device busy\n"); + printk(KERN_ERR "CS4281 soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 14d4981f9a2eb..61a2120e8743a 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c @@ -183,7 +183,7 @@ static int __init alsa_card_cs46xx_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("Sound Fusion CS46xx soundcard not found or device busy\n"); + printk(KERN_ERR "Sound Fusion CS46xx soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index e7e501d6cd946..84e0f8fbfbab3 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c @@ -210,7 +210,7 @@ static int __init alsa_card_emu10k1_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("EMU10K1/Audigy soundcard not found or device busy\n"); + printk(KERN_ERR "EMU10K1/Audigy soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 241361a941454..25e08303ecbfc 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -218,6 +218,10 @@ static int __devinit snd_emu10k1_init(emu10k1_t * emu, int enable_ir) */ outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG); + /* Enable analog/digital outs on audigy */ + if (emu->audigy) + outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG); + #if 0 { unsigned int tmp; @@ -274,7 +278,7 @@ static int snd_emu10k1_done(emu10k1_t * emu) snd_emu10k1_ptr_write(emu, TCBS, 0, TCBS_BUFFSIZE_16K); snd_emu10k1_ptr_write(emu, TCB, 0, 0); if (emu->audigy) - snd_emu10k1_ptr_write(emu, A_DBG, 0, A_DBG_SINGLE_STEP_ADDR); + snd_emu10k1_ptr_write(emu, A_DBG, 0, A_DBG_SINGLE_STEP); else snd_emu10k1_ptr_write(emu, DBG, 0, 0x8000); @@ -625,18 +629,10 @@ int __devinit snd_emu10k1_create(snd_card_t * card, } emu->fx8010.fxbus_mask = 0x303f; - if (extin_mask == 0) { - if (emu->audigy) - extin_mask = 0x000f; - else - extin_mask = 0x1fcf; - } - if (extout_mask == 0) { - if (emu->audigy) - extout_mask = 0x3fff; - else - extout_mask = 0x3fff; - } + if (extin_mask == 0) + extin_mask = 0x1fcf; + if (extout_mask == 0) + extout_mask = 0x3fff; emu->fx8010.extin_mask = extin_mask; emu->fx8010.extout_mask = extout_mask; diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 96c3a83f80ce2..7393b029f5215 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -95,12 +95,12 @@ static char *audigy_ins[16] = { /* 0x05 */ NULL, /* 0x06 */ NULL, /* 0x07 */ NULL, - /* 0x08 */ NULL, - /* 0x09 */ NULL, + /* 0x08 */ "Line/Mic 2 Left", + /* 0x09 */ "Line/Mic 2 Right", /* 0x0a */ NULL, /* 0x0b */ NULL, - /* 0x0c */ NULL, - /* 0x0d */ NULL, + /* 0x0c */ "Aux2 Left", + /* 0x0d */ "Aux2 Right", /* 0x0e */ NULL, /* 0x0f */ NULL }; @@ -141,14 +141,14 @@ static char *creative_outs[32] = { }; static char *audigy_outs[32] = { - /* 0x00 */ NULL, - /* 0x01 */ NULL, - /* 0x02 */ NULL, - /* 0x03 */ NULL, + /* 0x00 */ "Digital Front Left", + /* 0x01 */ "Digital Front Right", + /* 0x02 */ "Digital Center", + /* 0x03 */ "Digital LEF", /* 0x04 */ "Headphone Left", /* 0x05 */ "Headphone Right", - /* 0x06 */ NULL, - /* 0x07 */ NULL, + /* 0x06 */ "Digital Rear Left", + /* 0x07 */ "Digital Rear Right", /* 0x08 */ "Front Left", /* 0x09 */ "Front Right", /* 0x0a */ "Center", @@ -157,14 +157,14 @@ static char *audigy_outs[32] = { /* 0x0d */ NULL, /* 0x0e */ "Rear Left", /* 0x0f */ "Rear Right", - /* 0x10 */ NULL, - /* 0x11 */ NULL, - /* 0x12 */ NULL, - /* 0x13 */ NULL, + /* 0x10 */ "AC97 Front Left", + /* 0x11 */ "AC97 Front Right", + /* 0x12 */ "ADC Caputre Left", + /* 0x13 */ "ADC Capture Right", /* 0x14 */ NULL, /* 0x15 */ NULL, - /* 0x16 */ "ADC Capture Left", - /* 0x17 */ "ADC Capture Right", + /* 0x16 */ NULL, + /* 0x17 */ NULL, /* 0x18 */ NULL, /* 0x19 */ NULL, /* 0x1a */ NULL, @@ -1034,7 +1034,7 @@ static int snd_emu10k1_icode_poke(emu10k1_t *emu, emu10k1_fx8010_code_t *icode) /* stop FX processor - this may be dangerous, but it's better to miss some samples than generate wrong ones - [jk] */ if (emu->audigy) - snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg | A_DBG_SINGLE_STEP_ADDR); + snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg | A_DBG_SINGLE_STEP); else snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg | EMU10K1_DBG_SINGLE_STEP); /* ok, do the main job */ @@ -1220,36 +1220,34 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu) ptr = 0; nctl = 0; playback = 10; - capture = playback + 6; /* 5+1 channels */ - gpr = capture + 2; /* so far only a stereo capture */ + capture = playback + 10; /* we reserve 10 voices */ + gpr = capture + 10; tmp = 0x80; /* stop FX processor */ - snd_emu10k1_ptr_write(emu, A_DBG, 0, (emu->fx8010.dbg = 0) | A_DBG_SINGLE_STEP_ADDR); - -#define A_C_ZERO 0x0c0 + snd_emu10k1_ptr_write(emu, A_DBG, 0, (emu->fx8010.dbg = 0) | A_DBG_SINGLE_STEP); /* Wave Playback */ - A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_ZERO, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT)); - A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_ZERO, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT)); snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Playback Volume", gpr, 100); gpr += 2; /* Wave Surround Playback */ - A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_C_ZERO, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_REAR)); - A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_C_ZERO, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_REAR)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT)); snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Surround Playback Volume", gpr, 0); gpr += 2; /* Wave Center Playback */ /* Center = sub = Left/2 + Right/2 */ A_OP(icode, &ptr, iINTERP, A_GPR(tmp), A_FXBUS(FXBUS_PCM_LEFT), 0xcd, A_FXBUS(FXBUS_PCM_RIGHT)); - A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_C_ZERO, A_GPR(gpr), A_GPR(tmp)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_C_00000000, A_GPR(gpr), A_GPR(tmp)); snd_emu10k1_init_mono_control(&controls[nctl++], "Wave Center Playback Volume", gpr, 0); gpr++; /* Wave LFE Playback */ - A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_C_ZERO, A_GPR(gpr), A_GPR(tmp)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_C_00000000, A_GPR(gpr), A_GPR(tmp)); snd_emu10k1_init_mono_control(&controls[nctl++], "Wave LFE Playback Volume", gpr, 0); gpr++; @@ -1260,8 +1258,8 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu) gpr += 2; /* Wave Capture */ - A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_C_ZERO, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT)); - A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_C_ZERO, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT)); + A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT)); + A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT)); snd_emu10k1_init_stereo_control(&controls[nctl++], "Wave Capture Volume", gpr, 0); gpr += 2; @@ -1271,14 +1269,20 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu) snd_emu10k1_init_stereo_control(&controls[nctl++], "Music Capture Volume", gpr, 0); gpr += 2; + /* Surround Playback */ + A_OP(icode, &ptr, iMAC0, A_GPR(playback+2), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT_REAR)); + A_OP(icode, &ptr, iMAC0, A_GPR(playback+3), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT_REAR)); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Surround Playback Volume", gpr, 80); + gpr += 2; + /* Center Playback */ A_OP(icode, &ptr, iMAC0, A_GPR(playback+4), A_GPR(playback+4), A_GPR(gpr), A_FXBUS(FXBUS_PCM_CENTER)); - snd_emu10k1_init_mono_control(&controls[nctl++], "Center Playback Volume", gpr, 0); + snd_emu10k1_init_mono_control(&controls[nctl++], "Center Playback Volume", gpr, 80); gpr++; /* LFE Playback */ A_OP(icode, &ptr, iMAC0, A_GPR(playback+5), A_GPR(playback+5), A_GPR(gpr), A_FXBUS(FXBUS_PCM_LFE)); - snd_emu10k1_init_mono_control(&controls[nctl++], "LFE Playback Volume", gpr, 0); + snd_emu10k1_init_mono_control(&controls[nctl++], "LFE Playback Volume", gpr, 80); gpr++; /* @@ -1286,54 +1290,70 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu) */ #define A_ADD_VOLUME_IN(var,vol,input) \ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) - if (emu->fx8010.extin_mask & ((1<<A_EXTIN_AC97_L)|(1<<A_EXTIN_AC97_R))) { - /* AC'97 Playback Volume */ - A_ADD_VOLUME_IN(playback, gpr, A_EXTIN_AC97_L); - A_ADD_VOLUME_IN(playback+1, gpr+1, A_EXTIN_AC97_R); - snd_emu10k1_init_stereo_control(&controls[nctl++], "AC97 Playback Volume", gpr, 0); - gpr += 2; - /* AC'97 Capture Volume */ - A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AC97_L); - A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AC97_R); - snd_emu10k1_init_stereo_control(&controls[nctl++], "AC97 Capture Volume", gpr, 100); - gpr += 2; - } - if (emu->fx8010.extin_mask & ((1<<A_EXTIN_SPDIF_CD_L)|(1<<A_EXTIN_SPDIF_CD_R))) { - /* Audigy CD Playback Volume */ - A_ADD_VOLUME_IN(playback, gpr, A_EXTIN_SPDIF_CD_L); - A_ADD_VOLUME_IN(playback+1, gpr+1, A_EXTIN_SPDIF_CD_R); - snd_emu10k1_init_stereo_control(&controls[nctl++], "Audigy CD Playback Volume", gpr, 0); - gpr += 2; - /* Audigy CD Capture Volume */ - A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_SPDIF_CD_L); - A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_SPDIF_CD_R); - snd_emu10k1_init_stereo_control(&controls[nctl++], "Audigy CD Capture Volume", gpr, 100); - gpr += 2; - } + /* AC'97 Playback Volume */ + A_ADD_VOLUME_IN(playback, gpr, A_EXTIN_AC97_L); + A_ADD_VOLUME_IN(playback+1, gpr+1, A_EXTIN_AC97_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "AC97 Playback Volume", gpr, 0); + gpr += 2; + /* AC'97 Capture Volume */ + A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AC97_L); + A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AC97_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "AC97 Capture Volume", gpr, 100); + gpr += 2; + + /* Audigy CD Playback Volume */ + A_ADD_VOLUME_IN(playback, gpr, A_EXTIN_SPDIF_CD_L); + A_ADD_VOLUME_IN(playback+1, gpr+1, A_EXTIN_SPDIF_CD_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Audigy CD Playback Volume", gpr, 0); + gpr += 2; + /* Audigy CD Capture Volume */ + A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_SPDIF_CD_L); + A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_SPDIF_CD_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Audigy CD Capture Volume", gpr, 0); + gpr += 2; + + /* Line2 Playback Volume */ + A_ADD_VOLUME_IN(playback, gpr, A_EXTIN_LINE2_L); + A_ADD_VOLUME_IN(playback+1, gpr+1, A_EXTIN_LINE2_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Line2 Playback Volume", gpr, 0); + gpr += 2; + /* Line2 Capture Volume */ + A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_LINE2_L); + A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_LINE2_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Line2 Capture Volume", gpr, 0); + gpr += 2; + + /* Aux2 Playback Volume */ + A_ADD_VOLUME_IN(playback, gpr, A_EXTIN_AUX2_L); + A_ADD_VOLUME_IN(playback+1, gpr+1, A_EXTIN_AUX2_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Aux2 Playback Volume", gpr, 0); + gpr += 2; + /* Aux2 Capture Volume */ + A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AUX2_L); + A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AUX2_R); + snd_emu10k1_init_stereo_control(&controls[nctl++], "Aux2 Capture Volume", gpr, 0); + gpr += 2; /* * outputs */ -#define A_PUT_OUTPUT(out,src) A_OP(icode, &ptr, iACC3, A_EXTOUT(out), A_C_ZERO, A_C_ZERO, A_GPR(src)) -#define A_PUT_MONO_OUTPUT(out,src) \ - if (emu->fx8010.extout_mask & (1<<(out))) A_PUT_OUTPUT(out,src) +#define A_PUT_OUTPUT(out,src) A_OP(icode, &ptr, iACC3, A_EXTOUT(out), A_C_00000000, A_C_00000000, A_GPR(src)) #define A_PUT_STEREO_OUTPUT(out1,out2,src) \ - if (emu->fx8010.extout_mask & ((1<<(out1))|(1<<(out2)))) {\ - A_PUT_OUTPUT(out1,src);\ - A_PUT_OUTPUT(out2,src+1);} + {A_PUT_OUTPUT(out1,src); A_PUT_OUTPUT(out2,src+1);} /* digital outputs */ A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback); A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2); - A_PUT_MONO_OUTPUT(A_EXTOUT_CENTER, playback+4); - A_PUT_MONO_OUTPUT(A_EXTOUT_LFE, playback+5); + A_PUT_OUTPUT(A_EXTOUT_CENTER, playback+4); + A_PUT_OUTPUT(A_EXTOUT_LFE, playback+5); /* analog speakers */ - A_PUT_STEREO_OUTPUT(A_EXTOUT_AFRONT_L, A_EXTOUT_AFRONT_R, playback); + //A_PUT_STEREO_OUTPUT(A_EXTOUT_AFRONT_L, A_EXTOUT_AFRONT_R, playback); + A_PUT_STEREO_OUTPUT(A_EXTOUT_AC97_L, A_EXTOUT_AC97_R, playback); A_PUT_STEREO_OUTPUT(A_EXTOUT_AREAR_L, A_EXTOUT_AREAR_R, playback+2); - A_PUT_MONO_OUTPUT(A_EXTOUT_ACENTER, playback+4); - A_PUT_MONO_OUTPUT(A_EXTOUT_ALFE, playback+5); + A_PUT_OUTPUT(A_EXTOUT_ACENTER, playback+4); + A_PUT_OUTPUT(A_EXTOUT_ALFE, playback+5); /* headphone */ A_PUT_STEREO_OUTPUT(A_EXTOUT_HEADPHONE_L, A_EXTOUT_HEADPHONE_R, playback); @@ -1946,7 +1966,7 @@ void snd_emu10k1_free_efx(emu10k1_t *emu) { /* stop processor */ if (emu->audigy) - snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg = A_DBG_SINGLE_STEP_ADDR); + snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg = A_DBG_SINGLE_STEP); else snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg = EMU10K1_DBG_SINGLE_STEP); } @@ -2127,7 +2147,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (emu->audigy) - snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP_ADDR); + snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP); else snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg |= EMU10K1_DBG_SINGLE_STEP); return 0; @@ -2160,12 +2180,12 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne if (addr > 0x1ff) return -EINVAL; if (emu->audigy) - snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP_ADDR | addr); + snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP | addr); else snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg |= EMU10K1_DBG_SINGLE_STEP | addr); udelay(10); if (emu->audigy) - snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP_ADDR | A_DBG_STEP_ADDR | addr); + snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP | A_DBG_STEP_ADDR | addr); else snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg |= EMU10K1_DBG_SINGLE_STEP | EMU10K1_DBG_STEP | addr); return 0; diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 9ff70781f6e6b..83bbf43d6993f 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -107,12 +107,40 @@ static snd_kcontrol_new_t snd_emu10k1_spdif_control = put: snd_emu10k1_spdif_put }; -/* FIXME: audigy has more routing/effects */ + +static void update_emu10k1_fxrt(emu10k1_t *emu, int voice, unsigned char *route) +{ + if (emu->audigy) { + snd_emu10k1_ptr_write(emu, A_FXRT1, voice, + snd_emu10k1_compose_audigy_fxrt1(route)); + snd_emu10k1_ptr_write(emu, A_FXRT2, voice, + snd_emu10k1_compose_audigy_fxrt2(route)); + } else { + snd_emu10k1_ptr_write(emu, FXRT, voice, + snd_emu10k1_compose_send_routing(route)); + } +} + +static void update_emu10k1_send_volume(emu10k1_t *emu, int voice, unsigned char *volume) +{ + snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, volume[0]); + snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, volume[1]); + snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, volume[2]); + snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, volume[3]); + if (emu->audigy) { + unsigned int val = ((unsigned int)volume[4] << 24) | + ((unsigned int)volume[5] << 16) | + ((unsigned int)volume[6] << 8) | + (unsigned int)volume[7]; + snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice, val); + } +} + static int snd_emu10k1_send_routing_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) { emu10k1_t *emu = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 3*4; + uinfo->count = emu->audigy ? 3*8 : 3*4; uinfo->value.integer.min = 0; uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; return 0; @@ -125,13 +153,14 @@ static int snd_emu10k1_send_routing_get(snd_kcontrol_t * kcontrol, emu10k1_pcm_mixer_t *mix = (emu10k1_pcm_mixer_t *)kcontrol->private_value; emu10k1_t *emu = snd_kcontrol_chip(kcontrol); int voice, idx; + int num_efx = emu->audigy ? 8 : 4; + int mask = emu->audigy ? 0x3f : 0x0f; spin_lock_irqsave(&emu->reg_lock, flags); for (voice = 0; voice < 3; voice++) - for (idx = 0; idx < 4; idx++) - ucontrol->value.integer.value[(voice * 4) + idx] = emu->audigy ? - ((mix->send_routing[voice] >> (idx * 8)) & 0x3f) : - ((mix->send_routing[voice] >> (idx * 4)) & 0x0f); + for (idx = 0; idx < num_efx; idx++) + ucontrol->value.integer.value[(voice * num_efx) + idx] = + mix->send_routing[voice][idx] & mask; spin_unlock_irqrestore(&emu->reg_lock, flags); return 0; } @@ -143,44 +172,27 @@ static int snd_emu10k1_send_routing_put(snd_kcontrol_t * kcontrol, emu10k1_pcm_mixer_t *mix = (emu10k1_pcm_mixer_t *)kcontrol->private_value; emu10k1_t *emu = snd_kcontrol_chip(kcontrol); int change = 0, voice, idx, val; + int num_efx = emu->audigy ? 8 : 4; + int mask = emu->audigy ? 0x3f : 0x0f; spin_lock_irqsave(&emu->reg_lock, flags); for (voice = 0; voice < 3; voice++) - for (idx = 0; idx < 4; idx++) { - val = ucontrol->value.integer.value[(voice * 4) + idx]; - if (emu->audigy) { - int shift = idx * 8; - val &= 0x3f; - if (((mix->send_routing[voice] >> shift) & 0x3f) != val) { - mix->send_routing[voice] &= ~(0x3f << shift); - mix->send_routing[voice] |= val << shift; - change = 1; - } - } else { - int shift = idx * 4; - val = ucontrol->value.integer.value[(voice * 4) + idx] & 15; - if (((mix->send_routing[voice] >> shift) & 15) != val) { - mix->send_routing[voice] &= ~(15 << shift); - mix->send_routing[voice] |= val << shift; - change = 1; - } + for (idx = 0; idx < num_efx; idx++) { + val = ucontrol->value.integer.value[(voice * num_efx) + idx] & mask; + if (mix->send_routing[voice][idx] != val) { + mix->send_routing[voice][idx] = val; + change = 1; } } if (change && mix->epcm) { if (mix->epcm->voices[0] && mix->epcm->voices[1]) { - if (emu->audigy) { - snd_emu10k1_ptr_write(emu, A_FXRT1, mix->epcm->voices[0]->number, mix->send_routing[1]); - snd_emu10k1_ptr_write(emu, A_FXRT1, mix->epcm->voices[1]->number, mix->send_routing[2]); - } else { - snd_emu10k1_ptr_write(emu, FXRT, mix->epcm->voices[0]->number, mix->send_routing[1] << 16); - snd_emu10k1_ptr_write(emu, FXRT, mix->epcm->voices[1]->number, mix->send_routing[2] << 16); - } + update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number, + &mix->send_routing[1][0]); + update_emu10k1_fxrt(emu, mix->epcm->voices[1]->number, + &mix->send_routing[2][0]); } else if (mix->epcm->voices[0]) { - if (emu->audigy) { - snd_emu10k1_ptr_write(emu, A_FXRT1, mix->epcm->voices[0]->number, mix->send_routing[0]); - } else { - snd_emu10k1_ptr_write(emu, FXRT, mix->epcm->voices[0]->number, mix->send_routing[0] << 16); - } + update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number, + &mix->send_routing[0][0]); } } spin_unlock_irqrestore(&emu->reg_lock, flags); @@ -199,8 +211,9 @@ static snd_kcontrol_new_t snd_emu10k1_send_routing_control = static int snd_emu10k1_send_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) { + emu10k1_t *emu = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 3*4; + uinfo->count = emu->audigy ? 3*8 : 3*4; uinfo->value.integer.min = 0; uinfo->value.integer.max = 255; return 0; @@ -213,10 +226,11 @@ static int snd_emu10k1_send_volume_get(snd_kcontrol_t * kcontrol, emu10k1_pcm_mixer_t *mix = (emu10k1_pcm_mixer_t *)kcontrol->private_value; emu10k1_t *emu = snd_kcontrol_chip(kcontrol); int idx; + int num_efx = emu->audigy ? 8 : 4; spin_lock_irqsave(&emu->reg_lock, flags); - for (idx = 0; idx < 3*4; idx++) - ucontrol->value.integer.value[idx] = mix->send_volume[idx/4][idx%4]; + for (idx = 0; idx < 3*num_efx; idx++) + ucontrol->value.integer.value[idx] = mix->send_volume[idx/num_efx][idx%num_efx]; spin_unlock_irqrestore(&emu->reg_lock, flags); return 0; } @@ -228,34 +242,25 @@ static int snd_emu10k1_send_volume_put(snd_kcontrol_t * kcontrol, emu10k1_pcm_mixer_t *mix = (emu10k1_pcm_mixer_t *)kcontrol->private_value; emu10k1_t *emu = snd_kcontrol_chip(kcontrol); int change = 0, idx, val; + int num_efx = emu->audigy ? 8 : 4; spin_lock_irqsave(&emu->reg_lock, flags); - for (idx = 0; idx < 3*4; idx++) { + for (idx = 0; idx < 3*num_efx; idx++) { val = ucontrol->value.integer.value[idx] & 255; - if (mix->send_volume[idx/4][idx%4] != val) { - mix->send_volume[idx/4][idx%4] = val; + if (mix->send_volume[idx/num_efx][idx%num_efx] != val) { + mix->send_volume[idx/num_efx][idx%num_efx] = val; change = 1; } } if (change && mix->epcm) { - u32 voice; if (mix->epcm->voices[0] && mix->epcm->voices[1]) { - voice = mix->epcm->voices[0]->number; - snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, mix->send_volume[1][0]); - snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, mix->send_volume[1][1]); - snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, mix->send_volume[1][2]); - snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, mix->send_volume[1][3]); - voice = mix->epcm->voices[1]->number; - snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, mix->send_volume[2][0]); - snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, mix->send_volume[2][1]); - snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, mix->send_volume[2][2]); - snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, mix->send_volume[2][3]); + update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number, + &mix->send_volume[1][0]); + update_emu10k1_send_volume(emu, mix->epcm->voices[1]->number, + &mix->send_volume[2][0]); } else if (mix->epcm->voices[0]) { - voice = mix->epcm->voices[0]->number; - snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, mix->send_volume[0][0]); - snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, mix->send_volume[0][1]); - snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, mix->send_volume[0][2]); - snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, mix->send_volume[0][3]); + update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number, + &mix->send_volume[0][0]); } } spin_unlock_irqrestore(&emu->reg_lock, flags); @@ -380,6 +385,71 @@ static snd_kcontrol_new_t snd_emu10k1_shared_spdif = put: snd_emu10k1_shared_spdif_put }; +#if 0 // XXX: not working yet.. +/* + * Audigy analog / digital switches + */ +static int audigy_output_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +{ + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + uinfo->count = 1; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = 1; + return 0; +} + +static int audigy_output_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +{ + emu10k1_t *emu = snd_kcontrol_chip(kcontrol); + unsigned int mask = (unsigned int)kcontrol->private_value; + + ucontrol->value.integer.value[0] = inl(emu->port + A_IOCFG) & mask ? 0 : 1; + return 0; +} + +static int audigy_output_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +{ + unsigned long flags; + emu10k1_t *emu = snd_kcontrol_chip(kcontrol); + unsigned int mask = (unsigned int)kcontrol->private_value; + unsigned int reg, oreg; + int change; + + spin_lock_irqsave(&emu->reg_lock, flags); + reg = oreg = inl(emu->port + A_IOCFG); + reg &= ~mask; + reg |= ucontrol->value.integer.value[0] & 1 ? 0 : mask; + change = (reg != oreg); + if (change) + outl(reg, emu->port + A_IOCFG); + spin_unlock_irqrestore(&emu->reg_lock, flags); + return change; +} + +static snd_kcontrol_new_t audigy_output_analog = +{ + iface: SNDRV_CTL_ELEM_IFACE_MIXER, + name: "Audigy Analog Output Switch", + info: audigy_output_info, + get: audigy_output_get, + put: audigy_output_put, + private_value: 0x40, +}; + +static snd_kcontrol_new_t audigy_output_digital = +{ + iface: SNDRV_CTL_ELEM_IFACE_MIXER, + name: "Audigy Digital Output Switch", + info: audigy_output_info, + get: audigy_output_get, + put: audigy_output_put, + private_value: 0x04, +}; +#endif // XXX + + +/* + */ static void snd_emu10k1_mixer_free_ac97(ac97_t *ac97) { emu10k1_t *emu = snd_magic_cast(emu10k1_t, ac97->private_data, return); @@ -407,6 +477,7 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) for (pcm = 0; pcm < 32; pcm++) { emu10k1_pcm_mixer_t *mix; + int v; mix = &emu->pcm_mixer[pcm]; mix->epcm = NULL; @@ -417,11 +488,10 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) kctl->id.index = pcm; if ((err = snd_ctl_add(card, kctl))) return err; - if (emu->audigy) { - mix->send_routing[0] = mix->send_routing[1] = mix->send_routing[2] = 0x3210; - } else { - mix->send_routing[0] = mix->send_routing[1] = mix->send_routing[2] = 0x03020100; - } + for (v = 0; v < 4; v++) + mix->send_routing[0][v] = + mix->send_routing[1][v] = + mix->send_routing[2][v] = v; if ((kctl = mix->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL) return -ENOMEM; @@ -457,10 +527,23 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu) return err; } - if ((kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu)) == NULL) - return -ENOMEM; - if ((err = snd_ctl_add(card, kctl))) - return err; + if (emu->audigy) { +#if 0 // XXX + if ((kctl = snd_ctl_new1(&audigy_output_analog, emu)) == NULL) + return -ENOMEM; + if ((err = snd_ctl_add(card, kctl))) + return err; + if ((kctl = snd_ctl_new1(&audigy_output_digital, emu)) == NULL) + return -ENOMEM; + if ((err = snd_ctl_add(card, kctl))) + return err; +#endif // XXX + } else { + if ((kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu)) == NULL) + return -ENOMEM; + if ((err = snd_ctl_add(card, kctl))) + return err; + } return 0; } diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 44037bb6fd224..3e92d39c86593 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -237,8 +237,8 @@ static void snd_emu10k1_pcm_init_voice(emu10k1_t *emu, emu10k1_pcm_mixer_t *mix = &emu->pcm_mixer[substream->number]; unsigned int silent_page, tmp; int voice, stereo, w_16; - unsigned char attn, send_a, send_b, send_c, send_d; - unsigned short send_routing; + unsigned char attn, send_amount[8]; + unsigned char send_routing[8]; unsigned long flags; unsigned int pitch_target; @@ -260,15 +260,16 @@ static void snd_emu10k1_pcm_init_voice(emu10k1_t *emu, /* volume parameters */ if (extra) { attn = 0; - send_routing = emu->audigy ? 0x03020100 : 0x3210; - send_a = send_b = send_c = send_d = 0x00; + memset(send_routing, 0, sizeof(send_routing)); + send_routing[0] = 0; + send_routing[1] = 1; + send_routing[2] = 2; + send_routing[3] = 3; + memset(send_amount, 0, sizeof(send_amount)); } else { tmp = stereo ? (master ? 1 : 2) : 0; - send_a = mix->send_volume[tmp][0]; - send_b = mix->send_volume[tmp][1]; - send_c = mix->send_volume[tmp][2]; - send_d = mix->send_volume[tmp][3]; - send_routing = mix->send_routing[tmp]; + memcpy(send_routing, &mix->send_routing[tmp][0], 8); + memcpy(send_amount, &mix->send_volume[tmp][0], 8); } if (master) { @@ -290,16 +291,29 @@ static void snd_emu10k1_pcm_init_voice(emu10k1_t *emu, // setup routing if (emu->audigy) { - snd_emu10k1_ptr_write(emu, A_FXRT1, voice, send_routing); - snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice, 0); /* no effects */ - snd_emu10k1_ptr_write(emu, A_FXRT2, voice, 0); /* channels EFGH */ + snd_emu10k1_ptr_write(emu, A_FXRT1, voice, + ((unsigned int)send_routing[3] << 24) | + ((unsigned int)send_routing[2] << 16) | + ((unsigned int)send_routing[1] << 8) | + (unsigned int)send_routing[0]); + snd_emu10k1_ptr_write(emu, A_FXRT2, voice, + ((unsigned int)send_routing[7] << 24) | + ((unsigned int)send_routing[6] << 16) | + ((unsigned int)send_routing[5] << 8) | + (unsigned int)send_routing[4]); + snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice, + ((unsigned int)send_amount[4] << 24) | + ((unsigned int)send_amount[5] << 16) | + ((unsigned int)send_amount[6] << 8) | + (unsigned int)send_amount[7]); } else - snd_emu10k1_ptr_write(emu, FXRT, voice, send_routing << 16); + snd_emu10k1_ptr_write(emu, FXRT, voice, + snd_emu10k1_compose_send_routing(send_routing)); // Stop CA // Assumption that PT is already 0 so no harm overwriting - snd_emu10k1_ptr_write(emu, PTRX, voice, (send_a << 8) | send_b); - snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_d << 24)); - snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_c << 24)); + snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]); + snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24)); + snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24)); pitch_target = emu10k1_calc_pitch_target(runtime->rate); snd_emu10k1_ptr_write(emu, CCCA, voice, evoice->epcm->ccca_start_addr | emu10k1_select_interprom(pitch_target) | @@ -753,7 +767,7 @@ static int snd_emu10k1_playback_open(snd_pcm_substream_t * substream) emu10k1_pcm_t *epcm; emu10k1_pcm_mixer_t *mix; snd_pcm_runtime_t *runtime = substream->runtime; - int err; + int i, err; epcm = snd_magic_kcalloc(emu10k1_pcm_t, 0, GFP_KERNEL); if (epcm == NULL) @@ -773,8 +787,8 @@ static int snd_emu10k1_playback_open(snd_pcm_substream_t * substream) return err; } mix = &emu->pcm_mixer[substream->number]; - mix->send_routing[0] = mix->send_routing[1] = mix->send_routing[2] = - emu->audigy ? 0x03020100 : 0x3210; + for (i = 0; i < 4; i++) + mix->send_routing[0][i] = mix->send_routing[1][i] = mix->send_routing[2][i] = i; memset(&mix->send_volume, 0, sizeof(mix->send_volume)); mix->send_volume[0][0] = mix->send_volume[0][1] = mix->send_volume[1][0] = mix->send_volume[2][1] = 255; diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index d128b339a208a..a522736355b58 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -250,6 +250,7 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu) } } emu->proc_entry = entry; + entry = NULL; if ((entry = snd_info_create_card_entry(emu->card, "fx8010_gpr", emu->card->proc_root)) != NULL) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = emu; @@ -262,6 +263,7 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu) } } emu->proc_entry_fx8010_gpr = entry; + entry = NULL; if (!emu->audigy && (entry = snd_info_create_card_entry(emu->card, "fx8010_tram_data", emu->card->proc_root)) != NULL) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = emu; @@ -274,6 +276,7 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu) } } emu->proc_entry_fx8010_tram_data = entry; + entry = NULL; if (!emu->audigy && (entry = snd_info_create_card_entry(emu->card, "fx8010_tram_addr", emu->card->proc_root)) != NULL) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = emu; @@ -286,6 +289,7 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu) } } emu->proc_entry_fx8010_tram_addr = entry; + entry = NULL; if ((entry = snd_info_create_card_entry(emu->card, "fx8010_code", emu->card->proc_root)) != NULL) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = emu; @@ -298,6 +302,7 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu) } } emu->proc_entry_fx8010_code = entry; + entry = NULL; if ((entry = snd_info_create_card_entry(emu->card, "fx8010_acode", emu->card->proc_root)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = emu; diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 9d6df8b552dfb..64e94e63a398f 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -2049,7 +2049,7 @@ static int __init alsa_card_ens137x_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("Ensoniq AudioPCI soundcard not found or device busy\n"); + printk(KERN_ERR "Ensoniq AudioPCI soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index e8a254a62403d..0aaa38c0f18fb 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -1626,7 +1626,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, SLSB_REG(chip, FMLOWADDR), SLSB_REG(chip, FMHIGHADDR), OPL3_HW_OPL3, 1, &opl3) < 0) { - snd_printk("OPL3 not detected at 0x%lx\n", + printk(KERN_ERR "es1938: OPL3 not detected at 0x%lx\n", SLSB_REG(chip, FMLOWADDR)); } else { if ((err = snd_opl3_timer_new(opl3, 0, 1)) < 0) { @@ -1640,7 +1640,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, } if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, chip->mpu_port, 1, chip->irq, 0, &chip->rmidi) < 0) { - snd_printk("unable to initialize MPU-401\n"); + printk(KERN_ERR "es1938: unable to initialize MPU-401\n"); } #ifndef LINUX_2_2 chip->gameport.io = chip->game_port; @@ -1683,7 +1683,7 @@ static int __init alsa_card_es1938_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("ESS Solo-1 soundcard not found or device busy\n"); + printk(KERN_ERR "ESS Solo-1 soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index aa0bdc5896094..905e176d272d8 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -2720,7 +2720,7 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci, if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, chip->io_port + ESM_MPU401_PORT, 1, chip->irq, 0, &chip->rmidi)) < 0) { - printk(KERN_INFO "es1968: skipping MPU-401 MIDI support..\n"); + printk(KERN_WARNING "es1968: skipping MPU-401 MIDI support..\n"); } /* card switches */ @@ -2783,7 +2783,7 @@ static int __init alsa_card_es1968_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("ESS Maestro soundcard not found or device busy\n"); + printk(KERN_ERR "ESS Maestro soundcard not found or device busy\n"); #endif return err; } @@ -2792,7 +2792,7 @@ static int __init alsa_card_es1968_init(void) leave the speaking emitting an annoying noise, so we catch shutdown events. */ if (register_reboot_notifier(&snd_es1968_nb)) { - snd_printk("reboot notifier registration failed; may make noise at shutdown.\n"); + printk(KERN_ERR "reboot notifier registration failed; may make noise at shutdown.\n"); } #endif return 0; diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 469f537e92020..c8432ef994775 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -1104,7 +1104,7 @@ static int __init alsa_card_fm801_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("ForteMedia FM801 soundcard not found or device busy\n"); + printk(KERN_ERR "ForteMedia FM801 soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/ice1712.c b/sound/pci/ice1712.c index 71cf7916ad0d2..6cf4a16cac2e8 100644 --- a/sound/pci/ice1712.c +++ b/sound/pci/ice1712.c @@ -1718,7 +1718,7 @@ static int __devinit snd_ice1712_pcm(ice1712_t * ice, int device, snd_pcm_t ** r if (rpcm) *rpcm = pcm; - printk("Consumer PCM code does not work well at the moment --jk\n"); + printk(KERN_WARNING "Consumer PCM code does not work well at the moment --jk\n"); return 0; } @@ -2410,7 +2410,7 @@ static int __devinit snd_ice1712_ac97_mixer(ice1712_t * ice) ac97.private_data = ice; ac97.private_free = snd_ice1712_mixer_free_ac97; if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0) { - snd_printk("ice1712: cannot initialize ac97 for consumer, skipped\n"); + printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); // return err; } else { if ((err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice))) < 0) @@ -2428,7 +2428,7 @@ static int __devinit snd_ice1712_ac97_mixer(ice1712_t * ice) ac97.private_data = ice; ac97.private_free = snd_ice1712_mixer_free_ac97; if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0) { - snd_printk("ice1712: cannot initialize pro ac97, skipped\n"); + printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); // return err; } return 0; @@ -4329,7 +4329,7 @@ static int __init alsa_card_ice1712_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("ICE1712 soundcard not found or device busy\n"); + printk(KERN_ERR "ICE1712 soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index a22598cfc3455..26bc53ed12cd8 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -35,6 +35,7 @@ #include <sound/pcm.h> #include <sound/ac97_codec.h> #include <sound/info.h> +#include <sound/mpu401.h> #define SNDRV_GET_ID #include <sound/initval.h> @@ -52,10 +53,24 @@ MODULE_DEVICES("{{Intel,82801AA}," "{SiS,SI7012}," "{NVidia,NForce Audio}}"); +#define SUPPORT_JOYSTICK 1 +#define SUPPORT_MIDI 1 + static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int snd_ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; +#ifdef SUPPORT_JOYSTICK +static int snd_joystick_port[SNDRV_CARDS] = +#ifdef CONFIG_ISA + {0x200}; /* enable as default */ +#else + {0}; /* disabled */ +#endif +#endif +#ifdef SUPPORT_MIDI +static int snd_mpu_port[SNDRV_CARDS]; /* disabled */ +#endif MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); MODULE_PARM_DESC(snd_index, "Index value for Intel i8x0 soundcard."); @@ -69,6 +84,16 @@ MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC); MODULE_PARM(snd_ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); MODULE_PARM_DESC(snd_ac97_clock, "AC'97 codec clock (0 = auto-detect)."); MODULE_PARM_SYNTAX(snd_ac97_clock, SNDRV_ENABLED ",default:0"); +#ifdef SUPPORT_JOYSTICK +MODULE_PARM(snd_joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); +MODULE_PARM_DESC(snd_joystick_port, "Joystick port address for Intel i8x0 soundcard. (0 = disabled)"); +MODULE_PARM_SYNTAX(snd_joystick_port, SNDRV_ENABLED ",allows:{{0},{0x200}},dialog:list"); +#endif +#ifdef SUPPORT_MIDI +MODULE_PARM(snd_mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); +MODULE_PARM_DESC(snd_mpu_port, "MPU401 port # for Intel i8x0 driver."); +MODULE_PARM_SYNTAX(snd_mpu_port, SNDRV_ENABLED ",allows:{{0},{0x330},{0x300}},dialog:list"); +#endif /* * Direct registers @@ -231,6 +256,8 @@ struct _snd_intel8x0 { ac97_t *ac97; ac97_t *ac97sec; + snd_rawmidi_t *rmidi; + spinlock_t reg_lock; spinlock_t ac97_lock; snd_info_entry_t *proc_entry; @@ -256,9 +283,9 @@ static struct pci_device_id snd_intel8x0_ids[] __devinitdata = { { 0x8086, 0x2445, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 82801BA */ { 0x8086, 0x2485, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* ICH3 */ { 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 440MX */ - { 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* 440MX */ { 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_SIS }, /* SI7012 */ { 0x10de, 0x01b1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* NFORCE */ + { 0x764d, 0x1022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DEVICE_INTEL }, /* AMD8111 */ { 0, } }; @@ -1087,6 +1114,7 @@ static void intel8x0_suspend(intel8x0_t *chip) { snd_card_t *card = chip->card; + chip->in_suspend = 1; snd_power_lock(card); if (card->power_state == SNDRV_CTL_POWER_D3hot) goto __skip; @@ -1364,6 +1392,7 @@ static struct shortname_table { { PCI_DEVICE_ID_INTEL_ICH3, "Intel ICH3" }, { PCI_DEVICE_ID_SI_7012, "SiS SI7012" }, { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia NForce" }, + { 0x1022, "AMD-8111" }, { 0, 0 }, }; @@ -1416,6 +1445,16 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, } } + if (snd_mpu_port[dev] == 0x300 || snd_mpu_port[dev] == 0x330) { + if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI, + snd_mpu_port[dev], 0, + -1, 0, &chip->rmidi)) < 0) { + printk(KERN_ERR "intel8x0: no UART401 device at 0x%x, skipping.\n", snd_mpu_port[dev]); + snd_mpu_port[dev] = 0; + } + } else + snd_mpu_port[dev] = 0; + sprintf(card->longname, "%s at 0x%lx, irq %i", card->shortname, chip->port, chip->irq); @@ -1450,16 +1489,77 @@ static struct pci_driver driver = { #endif }; + +#if defined(SUPPORT_JOYSTICK) || defined(SUPPORT_MIDI) +/* + * initialize joystick/midi addresses + */ + +static int __devinit snd_intel8x0_joystick_probe(struct pci_dev *pci, + const struct pci_device_id *id) +{ + static int dev = 0; + if (dev >= SNDRV_CARDS) + return -ENODEV; + if (!snd_enable[dev]) { + dev++; + return -ENOENT; + } + + if (snd_joystick_port[dev] > 0 || snd_mpu_port[dev] > 0) { + u16 val; + pci_read_config_word(pci, 0xe6, &val); + if (snd_joystick_port[dev] > 0) + val |= 0x100; + if (snd_mpu_port[dev] == 0x300 || snd_mpu_port[dev] == 0x330) + val |= 0x20; + pci_write_config_word(pci, 0xe6, val | 0x100); + + if (snd_mpu_port[dev] == 0x300 || snd_mpu_port[dev] == 0x330) { + u8 b; + pci_read_config_byte(pci, 0xe2, &b); + if (snd_mpu_port[dev] == 0x300) + b |= 0x08; + else + b &= ~0x08; + pci_write_config_byte(pci, 0xe2, b); + } + } + return 0; +} + +static struct pci_device_id snd_intel8x0_joystick_ids[] __devinitdata = { + { 0x8086, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 82801AA */ + { 0x8086, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 82901AB */ + { 0x8086, 0x2440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH2 */ + { 0x8086, 0x244c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH2M */ + { 0x8086, 0x248c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH3 */ + // { 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 440MX */ + // { 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SI7012 */ + { 0x10de, 0x01b2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE */ + { 0, } +}; + +static struct pci_driver joystick_driver = { + name: "Intel ICH Joystick", + id_table: snd_intel8x0_joystick_ids, + probe: snd_intel8x0_joystick_probe, +}; +#endif + static int __init alsa_card_intel8x0_init(void) { int err; if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("Intel ICH soundcard not found or device busy\n"); + printk(KERN_ERR "Intel ICH soundcard not found or device busy\n"); #endif return err; } +#if defined(SUPPORT_JOYSTICK) || defined(SUPPORT_MIDI) + pci_module_init(&joystick_driver); +#endif return 0; } @@ -1467,6 +1567,9 @@ static int __init alsa_card_intel8x0_init(void) static void __exit alsa_card_intel8x0_exit(void) { pci_unregister_driver(&driver); +#if defined(SUPPORT_JOYSTICK) || defined(SUPPORT_MIDI) + pci_unregister_driver(&joystick_driver); +#endif } module_init(alsa_card_intel8x0_init) diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index e7cdc347eed14..655b36921451d 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -1953,27 +1953,27 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) korg1212->res_iomem = request_mem_region(korg1212->iomem, iomem_size, "korg1212"); if (korg1212->res_iomem == NULL) { - PRINTK("unable to grab region 0x%lx-0x%lx\n", + snd_printk("unable to grab region 0x%lx-0x%lx\n", korg1212->iomem, korg1212->iomem + iomem_size - 1); return -EBUSY; } korg1212->res_ioport = request_region(korg1212->ioport, ioport_size, "korg1212"); if (korg1212->res_ioport == NULL) { - PRINTK("unable to grab region 0x%lx-0x%lx\n", + snd_printk("unable to grab region 0x%lx-0x%lx\n", korg1212->ioport, korg1212->ioport + ioport_size - 1); return -EBUSY; } korg1212->res_iomem2 = request_mem_region(korg1212->iomem2, iomem2_size, "korg1212"); if (korg1212->res_iomem2 == NULL) { - PRINTK("unable to grab region 0x%lx-0x%lx\n", + snd_printk("unable to grab region 0x%lx-0x%lx\n", korg1212->iomem2, korg1212->iomem2 + iomem2_size - 1); return -EBUSY; } if ((korg1212->iobase = (unsigned long) ioremap(korg1212->iomem, iomem_size)) == 0) { - PRINTK("unable to remap memory region 0x%lx-0x%lx\n", korg1212->iobase, + snd_printk("unable to remap memory region 0x%lx-0x%lx\n", korg1212->iobase, korg1212->iobase + iomem_size - 1); return -EBUSY; } @@ -1983,7 +1983,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) "korg1212", (void *) korg1212); if (err) { - PRINTK("unable to grab IRQ %d\n", pci->irq); + snd_printk("unable to grab IRQ %d\n", pci->irq); return -EBUSY; } @@ -2034,7 +2034,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) korg1212->sharedBufferPhy = (unsigned long)phys_addr; if (korg1212->sharedBufferPtr == NULL) { - PRINTK("can not allocate shared buffer memory (%d bytes)\n", sizeof(KorgSharedBuffer)); + snd_printk("can not allocate shared buffer memory (%d bytes)\n", sizeof(KorgSharedBuffer)); return -ENOMEM; } @@ -2050,7 +2050,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) korg1212->PlayDataPhy = (u32)phys_addr; if (korg1212->playDataBufsPtr == NULL) { - PRINTK("can not allocate play data buffer memory (%d bytes)\n", korg1212->DataBufsSize); + snd_printk("can not allocate play data buffer memory (%d bytes)\n", korg1212->DataBufsSize); return -ENOMEM; } @@ -2063,7 +2063,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) korg1212->RecDataPhy = (u32)phys_addr; if (korg1212->recordDataBufsPtr == NULL) { - PRINTK("can not allocate record data buffer memory (%d bytes)\n", korg1212->DataBufsSize); + snd_printk("can not allocate record data buffer memory (%d bytes)\n", korg1212->DataBufsSize); return -ENOMEM; } @@ -2091,7 +2091,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) korg1212->dspMemPhy = (u32)phys_addr; if (korg1212->dspMemPtr == NULL) { - PRINTK("can not allocate dsp code memory (%d bytes)\n", korg1212->dspCodeSize); + snd_printk("can not allocate dsp code memory (%d bytes)\n", korg1212->dspCodeSize); return -ENOMEM; } @@ -2114,7 +2114,7 @@ static int __init snd_korg1212_create(korg1212_t *korg1212) if (snd_korg1212_downloadDSPCode(korg1212)) return -EBUSY; - PRINTK("dspMemPhy = %08x U[%08x]\n" + printk(KERN_INFO "dspMemPhy = %08x U[%08x]\n" "PlayDataPhy = %08x L[%08x]\n" "RecDataPhy = %08x L[%08x]\n" "VolumeTablePhy = %08x L[%08x]\n" @@ -2312,7 +2312,7 @@ static int __init alsa_card_korg1212_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - PRINTK("No Korg 1212IO cards found\n"); + printk(KERN_ERR "No Korg 1212IO cards found\n"); #endif return err; } diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index c4174290171e3..310ec07efff08 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -2676,7 +2676,7 @@ static int __init alsa_card_m3_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("Maestro3/Allegro soundcard not found or device busy\n"); + printk(KERN_ERR "Maestro3/Allegro soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 7deb6598c0965..8912c62b6fe00 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -331,7 +331,7 @@ snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size) offset -= chip->buffer_start; #ifdef SNDRV_CONFIG_DEBUG if (offset < 0 || offset >= chip->buffer_size) { - printk("nm256: write_buffer invalid offset = %d size = %d\n", offset, size); + snd_printk("write_buffer invalid offset = %d size = %d\n", offset, size); return; } #endif @@ -1436,10 +1436,10 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, pval = snd_nm256_readw(chip, NM_MIXER_PRESENCE); if ((pval & NM_PRESENCE_MASK) != NM_PRESENCE_VALUE) { if (! force_load) { - printk(KERN_INFO "nm256: no ac97 is found!\n"); - printk(KERN_INFO " force the driver to load by passing in the module parameter\n"); - printk(KERN_INFO " snd_force_ac97=1\n"); - printk(KERN_INFO " or try sb16 or cs423x drivers instead.\n"); + printk(KERN_ERR "nm256: no ac97 is found!\n"); + printk(KERN_ERR " force the driver to load by passing in the module parameter\n"); + printk(KERN_ERR " snd_force_ac97=1\n"); + printk(KERN_ERR " or try sb16 or cs423x drivers instead.\n"); err = -ENXIO; goto __error; } @@ -1477,8 +1477,8 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, chip->buffer_start = chip->buffer_end - chip->buffer_size; chip->buffer_addr += chip->buffer_start; - snd_printd("NM256: Mapping port 1 from 0x%x - 0x%x\n", - chip->buffer_start, chip->buffer_end); + printk(KERN_INFO "nm256: Mapping port 1 from 0x%x - 0x%x\n", + chip->buffer_start, chip->buffer_end); chip->res_buffer = request_mem_region(chip->buffer_addr, chip->buffer_size, @@ -1652,7 +1652,7 @@ static int __init alsa_card_nm256_init(void) int err; if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("NeoMagic 256 audio soundchip not found or device busy\n"); + printk(KERN_ERR "NeoMagic 256 audio soundchip not found or device busy\n"); #endif return err; } diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 31446b1b52a1a..18891a0065302 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -2486,7 +2486,7 @@ static int __init alsa_card_rme96_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("No RME Digi96 cards found\n"); + printk(KERN_ERR "No RME Digi96 cards found\n"); #endif return err; } diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 9d8d1ab49fffb..c4c7162528342 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -392,7 +392,7 @@ static snd_pcm_uframes_t rme9652_hw_pointer(rme9652_t *rme9652) if (offset < period_size) { if (offset > rme9652->max_jitter) { if (frag) - printk("Unexpected hw_pointer position (bufid == 0): status: %x offset: %d\n", status, offset); + printk(KERN_ERR "Unexpected hw_pointer position (bufid == 0): status: %x offset: %d\n", status, offset); } else if (!frag) return 0; offset -= rme9652->max_jitter; @@ -401,7 +401,7 @@ static snd_pcm_uframes_t rme9652_hw_pointer(rme9652_t *rme9652) } else { if (offset > period_size + rme9652->max_jitter) { if (!frag) - printk("Unexpected hw_pointer position (bufid == 1): status: %x offset: %d\n", status, offset); + printk(KERN_ERR "Unexpected hw_pointer position (bufid == 1): status: %x offset: %d\n", status, offset); } else if (frag) return period_size; offset -= rme9652->max_jitter; @@ -1887,8 +1887,7 @@ static int __init snd_rme9652_initialize_memory(rme9652_t *rme9652) #endif } - snd_printk("%s: no buffers available\n", - rme9652->card_name); + printk(KERN_ERR "%s: no buffers available\n", rme9652->card_name); return -ENOMEM; } @@ -1901,24 +1900,16 @@ static int __init snd_rme9652_initialize_memory(rme9652_t *rme9652) /* Align to bus-space 64K boundary */ - cb_bus = cb_addr; - cb_bus = (cb_bus + 0xFFFF) & ~0xFFFFl; - - pb_bus = pb_addr; - pb_bus = (pb_bus + 0xFFFF) & ~0xFFFFl; + cb_bus = (cb_addr + 0xFFFF) & ~0xFFFFl; + pb_bus = (pb_addr + 0xFFFF) & ~0xFFFFl; /* Tell the card where it is */ rme9652_write(rme9652, RME9652_rec_buffer, cb_bus); rme9652_write(rme9652, RME9652_play_buffer, pb_bus); -#if 0 // not all architectures have this macro - rme9652->capture_buffer = bus_to_virt(cb_bus); - rme9652->playback_buffer = bus_to_virt(pb_bus); -#else - rme9652->capture_buffer += cb_bus - cb_addr; - rme9652->playback_buffer += pb_bus - pb_addr; -#endif + rme9652->capture_buffer = cb + (cb_bus - cb_addr); + rme9652->playback_buffer = pb + (pb_bus - pb_addr); return 0; } @@ -2732,7 +2723,7 @@ static int __init alsa_card_hammerfall_init(void) { if (pci_module_init(&driver) < 0) { #ifdef MODULE - snd_printk("RME Digi9652/Digi9636: no cards found\n"); + printk(KERN_ERR "RME Digi9652/Digi9636: no cards found\n"); #endif return -ENODEV; } diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index a3316e7caa951..d204ae0b7953a 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -1551,7 +1551,7 @@ static int __init alsa_card_sonicvibes_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("S3 SonicVibes soundcard not found or device busy\n"); + printk(KERN_ERR "S3 SonicVibes soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index a352379b201a9..127b0513a93e9 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c @@ -223,7 +223,7 @@ static int __init alsa_card_trident_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("Trident 4DWave PCI soundcard not found or device busy\n"); + printk(KERN_ERR "Trident 4DWave PCI soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/via686.c b/sound/pci/via686.c index 9378a6adf003a..a0fe9c1617d25 100644 --- a/sound/pci/via686.c +++ b/sound/pci/via686.c @@ -246,6 +246,16 @@ static int snd_via686a_codec_valid(via686a_t *chip, int secondary) return -EIO; } +static void snd_via686a_codec_wait(ac97_t *ac97) +{ + via686a_t *chip = snd_magic_cast(via686a_t, ac97->private_data, return); + int err; + err = snd_via686a_codec_ready(chip, ac97->num); + /* here we need to wait fairly for long time.. */ + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(HZ/2); +} + static void snd_via686a_codec_write(ac97_t *ac97, unsigned short reg, unsigned short val) @@ -811,6 +821,7 @@ static int __devinit snd_via686a_mixer(via686a_t *chip) ac97.write = snd_via686a_codec_write; ac97.read = snd_via686a_codec_read; ac97.init = snd_via686a_codec_init; + ac97.wait = snd_via686a_codec_wait; ac97.private_data = chip; ac97.private_free = snd_via686a_mixer_free_ac97; ac97.clock = chip->ac97_clock; @@ -1178,7 +1189,7 @@ static int __devinit snd_via686a_probe(struct pci_dev *pci, pci_write_config_byte(pci, 0x43, legacy_cfg); if (legacy & 0x02) { if (check_region(snd_mpu_port[dev], 2)) { - snd_printk("unable to get MPU-401 port at 0x%lx, skipping\n", snd_mpu_port[dev]); + printk(KERN_WARNING "unable to get MPU-401 port at 0x%lx, skipping\n", snd_mpu_port[dev]); legacy &= ~0x02; pci_write_config_byte(pci, 0x42, legacy); goto __skip_mpu; @@ -1187,7 +1198,7 @@ static int __devinit snd_via686a_probe(struct pci_dev *pci, snd_mpu_port[dev], 0, pci->irq, 0, &chip->rmidi) < 0) { - snd_printk("unable to initialize MPU-401 at 0x%lx, skipping\n", snd_mpu_port[dev]); + printk(KERN_WARNING "unable to initialize MPU-401 at 0x%lx, skipping\n", snd_mpu_port[dev]); legacy &= ~0x02; pci_write_config_byte(pci, 0x42, legacy); goto __skip_mpu; @@ -1239,7 +1250,7 @@ static int __init alsa_card_via686a_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("VIA 82C686A soundcard not found or device busy\n"); + printk(KERN_ERR "VIA 82C686A soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/via8233.c b/sound/pci/via8233.c index 7ee583aa0b85d..61409bfb8b745 100644 --- a/sound/pci/via8233.c +++ b/sound/pci/via8233.c @@ -877,7 +877,7 @@ static int __init alsa_card_via8233_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("VIA 8233 soundcard not found or device busy\n"); + printk(KERN_ERR "VIA 8233 soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 66c2059f9da3f..1bfa2b6e4a65a 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c @@ -197,7 +197,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, snd_mpu_port[dev], 0, pci->irq, 0, &chip->rawmidi)) < 0) { - printk(KERN_INFO "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", snd_mpu_port[dev]); + printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", snd_mpu_port[dev]); } else { legacy_ctrl &= ~0x10; /* disable MPU401 irq */ pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); @@ -208,7 +208,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, snd_fm_port[dev], snd_fm_port[dev] + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { - printk(KERN_INFO "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", snd_fm_port[dev]); + printk(KERN_WARNING "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", snd_fm_port[dev]); } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { snd_card_free(card); snd_printk("cannot create opl3 hwdep\n"); @@ -216,7 +216,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, } } if ((err = snd_ymfpci_joystick(chip)) < 0) { - printk(KERN_INFO "ymfpci: cannot initialize joystick, skipping...\n"); + printk(KERN_WARNING "ymfpci: cannot initialize joystick, skipping...\n"); } strcpy(card->driver, str); sprintf(card->shortname, "Yamaha DS-XG PCI (%s)", str); @@ -287,7 +287,7 @@ static int __init alsa_card_ymfpci_init(void) if ((err = pci_module_init(&driver)) < 0) { #ifdef MODULE - snd_printk("Yamaha DS-XG PCI soundcard not found or device busy\n"); + printk(KERN_ERR "Yamaha DS-XG PCI soundcard not found or device busy\n"); #endif return err; } diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 028640618cdcd..d688606dbebd5 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -179,7 +179,7 @@ int snd_pmac_keywest_find(pmac_t *chip, pmac_keywest_t *i2c, int addr, i2c_device = find_compatible_devices("i2c", "keywest"); if (i2c_device == 0) { - snd_printk("No Keywest i2c devices found.\n"); + printk(KERN_ERR "pmac: No Keywest i2c devices found.\n"); return -ENODEV; } diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index 6957e959a3561..06e2c718509cc 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -150,7 +150,7 @@ static int __init alsa_card_pmac_init(void) int err; if ((err = snd_pmac_probe() < 0)) { #ifdef MODULE - snd_printk("no PMac soundchip found\n"); + printk(KERN_ERR "no PMac soundchip found\n"); #endif return err; } diff --git a/sound/sound_core.c b/sound/sound_core.c index 9fd55621ad240..45350b7cafb2c 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c @@ -17,7 +17,7 @@ * plug into this. The fact they dont all go via OSS doesn't mean * they don't have to implement the OSS API. There is a lot of logic * to keeping much of the OSS weight out of the code in a compatibility - * module, but its up to the driver to rember to load it... + * module, but it's up to the driver to rember to load it... * * The code provides a set of functions for registration of devices * by type. This is done rather than providing a single call so that @@ -171,10 +171,10 @@ static int sound_insert_unit(struct sound_unit **list, struct file_operations *f return r; } - if (r == low) + if (r < SOUND_STEP) sprintf (name_buf, "%s", name); else - sprintf (name_buf, "%s%d", name, (r - low) / SOUND_STEP); + sprintf (name_buf, "%s%d", name, r / SOUND_STEP); s->de = devfs_register (devfs_handle, name_buf, DEVFS_FL_NONE, SOUND_MAJOR, s->unit_minor, S_IFCHR | mode, fops, NULL); @@ -215,7 +215,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit) * 15 *16 unused */ -static struct sound_unit *chains[16]; +static struct sound_unit *chains[SOUND_STEP]; /** * register_sound_special - register a special sound node @@ -229,17 +229,22 @@ static struct sound_unit *chains[16]; int register_sound_special(struct file_operations *fops, int unit) { - char *name; + const int chain = unit % (SOUND_STEP-1); + int max_unit = 128 + chain; + const char *name; + char _name[16]; - switch (unit) { + switch (chain) { case 0: name = "mixer"; break; case 1: name = "sequencer"; - break; + if (unit >= SOUND_STEP) + goto __unknown; + max_unit = unit + 1; case 2: - name = "midi00"; + name = "midi"; break; case 3: name = "dsp"; @@ -247,17 +252,11 @@ int register_sound_special(struct file_operations *fops, int unit) case 4: name = "audio"; break; - case 5: - name = "unknown5"; - break; - case 6: /* Was once sndstat */ - name = "unknown6"; - break; - case 7: - name = "unknown7"; - break; case 8: name = "sequencer2"; + if (unit >= SOUND_STEP) + goto __unknown; + max_unit = unit + 1; break; case 9: name = "dmmidi"; @@ -265,9 +264,6 @@ int register_sound_special(struct file_operations *fops, int unit) case 10: name = "dmfm"; break; - case 11: - name = "unknown11"; - break; case 12: name = "adsp"; break; @@ -278,10 +274,16 @@ int register_sound_special(struct file_operations *fops, int unit) name = "admmidi"; break; default: - name = "unknown"; + { + __unknown: + sprintf(_name, "unknown%d", chain); + if (unit >= SOUND_STEP) + strcat(_name, "-"); + name = _name; + } break; } - return sound_insert_unit(&chains[unit&15], fops, -1, unit, unit+1, + return sound_insert_unit(&chains[chain], fops, -1, unit, max_unit, name, S_IRUSR | S_IWUSR); } diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index 7c4a972e5b747..ee8c3270b3c5f 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c @@ -629,6 +629,25 @@ setup_voice(snd_emux_voice_t *vp) /* * calculate pitch parameter */ +static unsigned char pan_volumes[256] = { +0x00,0x03,0x06,0x09,0x0c,0x0f,0x12,0x14,0x17,0x1a,0x1d,0x20,0x22,0x25,0x28,0x2a, +0x2d,0x30,0x32,0x35,0x37,0x3a,0x3c,0x3f,0x41,0x44,0x46,0x49,0x4b,0x4d,0x50,0x52, +0x54,0x57,0x59,0x5b,0x5d,0x60,0x62,0x64,0x66,0x68,0x6a,0x6c,0x6f,0x71,0x73,0x75, +0x77,0x79,0x7b,0x7c,0x7e,0x80,0x82,0x84,0x86,0x88,0x89,0x8b,0x8d,0x8f,0x90,0x92, +0x94,0x96,0x97,0x99,0x9a,0x9c,0x9e,0x9f,0xa1,0xa2,0xa4,0xa5,0xa7,0xa8,0xaa,0xab, +0xad,0xae,0xaf,0xb1,0xb2,0xb3,0xb5,0xb6,0xb7,0xb9,0xba,0xbb,0xbc,0xbe,0xbf,0xc0, +0xc1,0xc2,0xc3,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1, +0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdc,0xdd,0xde,0xdf, +0xdf,0xe0,0xe1,0xe2,0xe2,0xe3,0xe4,0xe4,0xe5,0xe6,0xe6,0xe7,0xe8,0xe8,0xe9,0xe9, +0xea,0xeb,0xeb,0xec,0xec,0xed,0xed,0xee,0xee,0xef,0xef,0xf0,0xf0,0xf1,0xf1,0xf1, +0xf2,0xf2,0xf3,0xf3,0xf3,0xf4,0xf4,0xf5,0xf5,0xf5,0xf6,0xf6,0xf6,0xf7,0xf7,0xf7, +0xf7,0xf8,0xf8,0xf8,0xf9,0xf9,0xf9,0xf9,0xf9,0xfa,0xfa,0xfa,0xfa,0xfb,0xfb,0xfb, +0xfb,0xfb,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd,0xfd, +0xfd,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, +}; + static int calc_pan(snd_emux_voice_t *vp) { @@ -646,6 +665,16 @@ calc_pan(snd_emux_voice_t *vp) } LIMITVALUE(pan, 0, 255); +#if 1 + /* using volume table */ + if (vp->apan != (int)pan_volumes[pan]) { + vp->apan = pan_volumes[pan]; + vp->aaux = pan_volumes[255 - pan]; + return 1; + } + return 0; +#else + /* assuming linear volume */ if (pan != vp->apan) { vp->apan = pan; if (pan == 0) @@ -655,6 +684,7 @@ calc_pan(snd_emux_voice_t *vp) return 1; } else return 0; +#endif } |