diff options
Diffstat (limited to 'sound/drivers')
26 files changed, 1350 insertions, 1187 deletions
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index efcb4eb..395c4ef 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig @@ -6,7 +6,6 @@ menu "Generic devices" config SND_MPU401_UART tristate - select SND_TIMER select SND_RAWMIDI config SND_OPL3_LIB @@ -24,12 +23,19 @@ config SND_VX_LIB select SND_HWDEP select SND_PCM +config SND_AC97_CODEC + tristate + select SND_PCM + select SND_AC97_BUS + +config SND_AC97_BUS + tristate + config SND_DUMMY tristate "Dummy (/dev/null) soundcard" depends on SND select SND_PCM - select SND_GENERIC_DRIVER help Say Y here to include the dummy driver. This driver does nothing, but emulates various mixer controls and PCM devices. @@ -45,7 +51,6 @@ config SND_VIRMIDI depends on SND_SEQUENCER select SND_TIMER select SND_RAWMIDI - select SND_GENERIC_DRIVER help Say Y here to include the virtual MIDI driver. This driver allows to connect applications using raw MIDI devices to @@ -59,9 +64,7 @@ config SND_VIRMIDI config SND_MTPAV tristate "MOTU MidiTimePiece AV multiport MIDI" depends on SND - select SND_TIMER select SND_RAWMIDI - select SND_GENERIC_DRIVER help To use a MOTU MidiTimePiece AV multiport MIDI adapter connected to the parallel port, say Y here and make sure that @@ -73,9 +76,7 @@ config SND_MTPAV config SND_SERIAL_U16550 tristate "UART16550 serial MIDI driver" depends on SND - select SND_TIMER select SND_RAWMIDI - select SND_GENERIC_DRIVER help To include support for MIDI serial port interfaces, say Y here and read <file:Documentation/sound/alsa/serial-u16550.txt>. @@ -92,7 +93,6 @@ config SND_MPU401 tristate "Generic MPU-401 UART driver" depends on SND select SND_MPU401_UART - select SND_GENERIC_DRIVER help Say Y here to include support for MIDI ports compatible with the Roland MPU-401 interface in UART mode. diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 64ef7f6..14e1a67 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -20,6 +20,8 @@ #include <sound/driver.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/jiffies.h> #include <linux/slab.h> #include <linux/time.h> @@ -42,7 +44,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}"); #if 0 /* emu10k1 emulation */ #define MAX_BUFFER_SIZE (128 * 1024) -static int emu10k1_playback_constraints(snd_pcm_runtime_t *runtime) +static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime) { int err; if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) @@ -90,11 +92,27 @@ static int emu10k1_playback_constraints(snd_pcm_runtime_t *runtime) #define USE_RATE_MAX 48000 #endif +#if 0 /* CA0106 */ +#define USE_FORMATS SNDRV_PCM_FMTBIT_S16_LE +#define USE_CHANNELS_MIN 2 +#define USE_CHANNELS_MAX 2 +#define USE_RATE (SNDRV_PCM_RATE_48000|SNDRV_PCM_RATE_96000|SNDRV_PCM_RATE_192000) +#define USE_RATE_MIN 48000 +#define USE_RATE_MAX 192000 +#define MAX_BUFFER_SIZE ((65536-64)*8) +#define MAX_PERIOD_SIZE (65536-64) +#define USE_PERIODS_MIN 2 +#define USE_PERIODS_MAX 8 +#endif + /* defaults */ #ifndef MAX_BUFFER_SIZE #define MAX_BUFFER_SIZE (64*1024) #endif +#ifndef MAX_PERIOD_SIZE +#define MAX_PERIOD_SIZE MAX_BUFFER_SIZE +#endif #ifndef USE_FORMATS #define USE_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE) #endif @@ -142,6 +160,8 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-16) for dummy driver."); //module_param_array(midi_devs, int, NULL, 0444); //MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver."); +static struct platform_device *devices[SNDRV_CARDS]; + #define MIXER_ADDR_MASTER 0 #define MIXER_ADDR_LINE 1 #define MIXER_ADDR_MIC 2 @@ -149,15 +169,16 @@ MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-16) for dummy driver."); #define MIXER_ADDR_CD 4 #define MIXER_ADDR_LAST 4 -typedef struct snd_card_dummy { - snd_card_t *card; +struct snd_dummy { + struct snd_card *card; + struct snd_pcm *pcm; spinlock_t mixer_lock; int mixer_volume[MIXER_ADDR_LAST+1][2]; int capture_source[MIXER_ADDR_LAST+1][2]; -} snd_card_dummy_t; +}; -typedef struct snd_card_dummy_pcm { - snd_card_dummy_t *dummy; +struct snd_dummy_pcm { + struct snd_dummy *dummy; spinlock_t lock; struct timer_list timer; unsigned int pcm_size; @@ -166,59 +187,49 @@ typedef struct snd_card_dummy_pcm { unsigned int pcm_jiffie; /* bytes per one jiffie */ unsigned int pcm_irq_pos; /* IRQ position */ unsigned int pcm_buf_pos; /* position in buffer */ - snd_pcm_substream_t *substream; -} snd_card_dummy_pcm_t; - -static snd_card_t *snd_dummy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; + struct snd_pcm_substream *substream; +}; -static void snd_card_dummy_pcm_timer_start(snd_pcm_substream_t * substream) +static inline void snd_card_dummy_pcm_timer_start(struct snd_dummy_pcm *dpcm) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm = runtime->private_data; - dpcm->timer.expires = 1 + jiffies; add_timer(&dpcm->timer); } -static void snd_card_dummy_pcm_timer_stop(snd_pcm_substream_t * substream) +static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm = runtime->private_data; - del_timer(&dpcm->timer); } -static int snd_card_dummy_playback_trigger(snd_pcm_substream_t * substream, - int cmd) -{ - if (cmd == SNDRV_PCM_TRIGGER_START) { - snd_card_dummy_pcm_timer_start(substream); - } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { - snd_card_dummy_pcm_timer_stop(substream); - } else { - return -EINVAL; - } - return 0; -} - -static int snd_card_dummy_capture_trigger(snd_pcm_substream_t * substream, - int cmd) +static int snd_card_dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { - if (cmd == SNDRV_PCM_TRIGGER_START) { - snd_card_dummy_pcm_timer_start(substream); - } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { - snd_card_dummy_pcm_timer_stop(substream); - } else { - return -EINVAL; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_dummy_pcm *dpcm = runtime->private_data; + int err = 0; + + spin_lock(&dpcm->lock); + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + snd_card_dummy_pcm_timer_start(dpcm); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + snd_card_dummy_pcm_timer_stop(dpcm); + break; + default: + err = -EINVAL; + break; } + spin_unlock(&dpcm->lock); return 0; } -static int snd_card_dummy_pcm_prepare(snd_pcm_substream_t * substream) +static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_dummy_pcm *dpcm = runtime->private_data; unsigned int bps; bps = runtime->rate * runtime->channels; @@ -235,53 +246,37 @@ static int snd_card_dummy_pcm_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_card_dummy_playback_prepare(snd_pcm_substream_t * substream) -{ - return snd_card_dummy_pcm_prepare(substream); -} - -static int snd_card_dummy_capture_prepare(snd_pcm_substream_t * substream) -{ - return snd_card_dummy_pcm_prepare(substream); -} - static void snd_card_dummy_pcm_timer_function(unsigned long data) { - snd_card_dummy_pcm_t *dpcm = (snd_card_dummy_pcm_t *)data; + struct snd_dummy_pcm *dpcm = (struct snd_dummy_pcm *)data; + unsigned long flags; + spin_lock_irqsave(&dpcm->lock, flags); dpcm->timer.expires = 1 + jiffies; add_timer(&dpcm->timer); - spin_lock_irq(&dpcm->lock); dpcm->pcm_irq_pos += dpcm->pcm_jiffie; dpcm->pcm_buf_pos += dpcm->pcm_jiffie; dpcm->pcm_buf_pos %= dpcm->pcm_size; if (dpcm->pcm_irq_pos >= dpcm->pcm_count) { dpcm->pcm_irq_pos %= dpcm->pcm_count; + spin_unlock_irqrestore(&dpcm->lock, flags); snd_pcm_period_elapsed(dpcm->substream); - } - spin_unlock_irq(&dpcm->lock); + } else + spin_unlock_irqrestore(&dpcm->lock, flags); } -static snd_pcm_uframes_t snd_card_dummy_playback_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm = runtime->private_data; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_dummy_pcm *dpcm = runtime->private_data; return bytes_to_frames(runtime, dpcm->pcm_buf_pos); } -static snd_pcm_uframes_t snd_card_dummy_capture_pointer(snd_pcm_substream_t * substream) -{ - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm = runtime->private_data; - - return bytes_to_frames(runtime, dpcm->pcm_buf_pos); -} - -static snd_pcm_hardware_t snd_card_dummy_playback = +static struct snd_pcm_hardware snd_card_dummy_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID), .formats = USE_FORMATS, .rates = USE_RATE, .rate_min = USE_RATE_MIN, @@ -296,10 +291,10 @@ static snd_pcm_hardware_t snd_card_dummy_playback = .fifo_size = 0, }; -static snd_pcm_hardware_t snd_card_dummy_capture = +static struct snd_pcm_hardware snd_card_dummy_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP_VALID), + SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID), .formats = USE_FORMATS, .rates = USE_RATE, .rate_min = USE_RATE_MIN, @@ -308,43 +303,51 @@ static snd_pcm_hardware_t snd_card_dummy_capture = .channels_max = USE_CHANNELS_MAX, .buffer_bytes_max = MAX_BUFFER_SIZE, .period_bytes_min = 64, - .period_bytes_max = MAX_BUFFER_SIZE, + .period_bytes_max = MAX_PERIOD_SIZE, .periods_min = USE_PERIODS_MIN, .periods_max = USE_PERIODS_MAX, .fifo_size = 0, }; -static void snd_card_dummy_runtime_free(snd_pcm_runtime_t *runtime) +static void snd_card_dummy_runtime_free(struct snd_pcm_runtime *runtime) { - snd_card_dummy_pcm_t *dpcm = runtime->private_data; - kfree(dpcm); + kfree(runtime->private_data); } -static int snd_card_dummy_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_card_dummy_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); } -static int snd_card_dummy_hw_free(snd_pcm_substream_t * substream) +static int snd_card_dummy_hw_free(struct snd_pcm_substream *substream) { return snd_pcm_lib_free_pages(substream); } -static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream) +static struct snd_dummy_pcm *new_pcm_stream(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm; - int err; + struct snd_dummy_pcm *dpcm; dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); - if (dpcm == NULL) - return -ENOMEM; + if (! dpcm) + return dpcm; init_timer(&dpcm->timer); dpcm->timer.data = (unsigned long) dpcm; dpcm->timer.function = snd_card_dummy_pcm_timer_function; spin_lock_init(&dpcm->lock); dpcm->substream = substream; + return dpcm; +} + +static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_dummy_pcm *dpcm; + int err; + + if ((dpcm = new_pcm_stream(substream)) == NULL) + return -ENOMEM; runtime->private_data = dpcm; runtime->private_free = snd_card_dummy_runtime_free; runtime->hw = snd_card_dummy_playback; @@ -362,20 +365,14 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream) return 0; } -static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream) +static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream) { - snd_pcm_runtime_t *runtime = substream->runtime; - snd_card_dummy_pcm_t *dpcm; + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_dummy_pcm *dpcm; int err; - dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); - if (dpcm == NULL) + if ((dpcm = new_pcm_stream(substream)) == NULL) return -ENOMEM; - init_timer(&dpcm->timer); - dpcm->timer.data = (unsigned long) dpcm; - dpcm->timer.function = snd_card_dummy_pcm_timer_function; - spin_lock_init(&dpcm->lock); - dpcm->substream = substream; runtime->private_data = dpcm; runtime->private_free = snd_card_dummy_runtime_free; runtime->hw = snd_card_dummy_capture; @@ -393,45 +390,47 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream) return 0; } -static int snd_card_dummy_playback_close(snd_pcm_substream_t * substream) +static int snd_card_dummy_playback_close(struct snd_pcm_substream *substream) { return 0; } -static int snd_card_dummy_capture_close(snd_pcm_substream_t * substream) +static int snd_card_dummy_capture_close(struct snd_pcm_substream *substream) { return 0; } -static snd_pcm_ops_t snd_card_dummy_playback_ops = { +static struct snd_pcm_ops snd_card_dummy_playback_ops = { .open = snd_card_dummy_playback_open, .close = snd_card_dummy_playback_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_card_dummy_hw_params, .hw_free = snd_card_dummy_hw_free, - .prepare = snd_card_dummy_playback_prepare, - .trigger = snd_card_dummy_playback_trigger, - .pointer = snd_card_dummy_playback_pointer, + .prepare = snd_card_dummy_pcm_prepare, + .trigger = snd_card_dummy_pcm_trigger, + .pointer = snd_card_dummy_pcm_pointer, }; -static snd_pcm_ops_t snd_card_dummy_capture_ops = { +static struct snd_pcm_ops snd_card_dummy_capture_ops = { .open = snd_card_dummy_capture_open, .close = snd_card_dummy_capture_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = snd_card_dummy_hw_params, .hw_free = snd_card_dummy_hw_free, - .prepare = snd_card_dummy_capture_prepare, - .trigger = snd_card_dummy_capture_trigger, - .pointer = snd_card_dummy_capture_pointer, + .prepare = snd_card_dummy_pcm_prepare, + .trigger = snd_card_dummy_pcm_trigger, + .pointer = snd_card_dummy_pcm_pointer, }; -static int __init snd_card_dummy_pcm(snd_card_dummy_t *dummy, int device, int substreams) +static int __init snd_card_dummy_pcm(struct snd_dummy *dummy, int device, int substreams) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; - if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device, substreams, substreams, &pcm)) < 0) + if ((err = snd_pcm_new(dummy->card, "Dummy PCM", device, + substreams, substreams, &pcm)) < 0) return err; + dummy->pcm = pcm; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_dummy_capture_ops); pcm->private_data = dummy; @@ -449,7 +448,8 @@ static int __init snd_card_dummy_pcm(snd_card_dummy_t *dummy, int device, int su .get = snd_dummy_volume_get, .put = snd_dummy_volume_put, \ .private_value = addr } -static int snd_dummy_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_dummy_volume_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -458,23 +458,23 @@ static int snd_dummy_volume_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_dummy_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); - unsigned long flags; + struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol); int addr = kcontrol->private_value; - spin_lock_irqsave(&dummy->mixer_lock, flags); + spin_lock_irq(&dummy->mixer_lock); ucontrol->value.integer.value[0] = dummy->mixer_volume[addr][0]; ucontrol->value.integer.value[1] = dummy->mixer_volume[addr][1]; - spin_unlock_irqrestore(&dummy->mixer_lock, flags); + spin_unlock_irq(&dummy->mixer_lock); return 0; } -static int snd_dummy_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); - unsigned long flags; + struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol); int change, addr = kcontrol->private_value; int left, right; @@ -488,12 +488,12 @@ static int snd_dummy_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t right = -50; if (right > 100) right = 100; - spin_lock_irqsave(&dummy->mixer_lock, flags); + spin_lock_irq(&dummy->mixer_lock); change = dummy->mixer_volume[addr][0] != left || dummy->mixer_volume[addr][1] != right; dummy->mixer_volume[addr][0] = left; dummy->mixer_volume[addr][1] = right; - spin_unlock_irqrestore(&dummy->mixer_lock, flags); + spin_unlock_irq(&dummy->mixer_lock); return change; } @@ -503,7 +503,8 @@ static int snd_dummy_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t .get = snd_dummy_capsrc_get, .put = snd_dummy_capsrc_put, \ .private_value = addr } -static int snd_dummy_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_dummy_capsrc_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 2; @@ -512,38 +513,37 @@ static int snd_dummy_capsrc_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_dummy_capsrc_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); - unsigned long flags; + struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol); int addr = kcontrol->private_value; - spin_lock_irqsave(&dummy->mixer_lock, flags); + spin_lock_irq(&dummy->mixer_lock); ucontrol->value.integer.value[0] = dummy->capture_source[addr][0]; ucontrol->value.integer.value[1] = dummy->capture_source[addr][1]; - spin_unlock_irqrestore(&dummy->mixer_lock, flags); + spin_unlock_irq(&dummy->mixer_lock); return 0; } -static int snd_dummy_capsrc_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - snd_card_dummy_t *dummy = snd_kcontrol_chip(kcontrol); - unsigned long flags; + struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol); int change, addr = kcontrol->private_value; int left, right; left = ucontrol->value.integer.value[0] & 1; right = ucontrol->value.integer.value[1] & 1; - spin_lock_irqsave(&dummy->mixer_lock, flags); + spin_lock_irq(&dummy->mixer_lock); change = dummy->capture_source[addr][0] != left && dummy->capture_source[addr][1] != right; dummy->capture_source[addr][0] = left; dummy->capture_source[addr][1] = right; - spin_unlock_irqrestore(&dummy->mixer_lock, flags); + spin_unlock_irq(&dummy->mixer_lock); return change; } -static snd_kcontrol_new_t snd_dummy_controls[] = { +static struct snd_kcontrol_new snd_dummy_controls[] = { DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER), DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH), @@ -556,9 +556,9 @@ DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD), DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_MASTER) }; -static int __init snd_card_dummy_new_mixer(snd_card_dummy_t * dummy) +static int __init snd_card_dummy_new_mixer(struct snd_dummy *dummy) { - snd_card_t *card = dummy->card; + struct snd_card *card = dummy->card; unsigned int idx; int err; @@ -573,19 +573,18 @@ static int __init snd_card_dummy_new_mixer(snd_card_dummy_t * dummy) return 0; } -static int __init snd_card_dummy_probe(int dev) +static int __init snd_dummy_probe(struct platform_device *devptr) { - snd_card_t *card; - struct snd_card_dummy *dummy; + struct snd_card *card; + struct snd_dummy *dummy; int idx, err; + int dev = devptr->id; - if (!enable[dev]) - return -ENODEV; card = snd_card_new(index[dev], id[dev], THIS_MODULE, - sizeof(struct snd_card_dummy)); + sizeof(struct snd_dummy)); if (card == NULL) return -ENOMEM; - dummy = (struct snd_card_dummy *)card->private_data; + dummy = card->private_data; dummy->card = card; for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { if (pcm_substreams[dev] < 1) @@ -601,11 +600,10 @@ static int __init snd_card_dummy_probe(int dev) strcpy(card->shortname, "Dummy"); sprintf(card->longname, "Dummy %i", dev + 1); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto __nodev; + snd_card_set_dev(card, &devptr->dev); if ((err = snd_card_register(card)) == 0) { - snd_dummy_cards[dev] = card; + platform_set_drvdata(devptr, card); return 0; } __nodev: @@ -613,34 +611,92 @@ static int __init snd_card_dummy_probe(int dev) return err; } -static int __init alsa_card_dummy_init(void) +static int snd_dummy_remove(struct platform_device *devptr) { - int dev, cards; + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} - for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) { - if (snd_card_dummy_probe(dev) < 0) { -#ifdef MODULE - printk(KERN_ERR "Dummy soundcard #%i not found or device busy\n", dev + 1); +#ifdef CONFIG_PM +static int snd_dummy_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct snd_dummy *dummy = card->private_data; + + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + snd_pcm_suspend_all(dummy->pcm); + return 0; +} + +static int snd_dummy_resume(struct platform_device *pdev) +{ + struct snd_card *card = platform_get_drvdata(pdev); + + snd_power_change_state(card, SNDRV_CTL_POWER_D0); + return 0; +} +#endif + +#define SND_DUMMY_DRIVER "snd_dummy" + +static struct platform_driver snd_dummy_driver = { + .probe = snd_dummy_probe, + .remove = snd_dummy_remove, +#ifdef CONFIG_PM + .suspend = snd_dummy_suspend, + .resume = snd_dummy_resume, #endif - break; + .driver = { + .name = SND_DUMMY_DRIVER + }, +}; + +static void __init_or_module snd_dummy_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_dummy_driver); +} + +static int __init alsa_card_dummy_init(void) +{ + int i, cards, err; + + if ((err = platform_driver_register(&snd_dummy_driver)) < 0) + return err; + + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(SND_DUMMY_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; } + devices[i] = device; cards++; } if (!cards) { #ifdef MODULE printk(KERN_ERR "Dummy soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_dummy_unregister_all(); + return err; } static void __exit alsa_card_dummy_exit(void) { - int idx; - - for (idx = 0; idx < SNDRV_CARDS; idx++) - snd_card_free(snd_dummy_cards[idx]); + snd_dummy_unregister_all(); } module_init(alsa_card_dummy_init) diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 54e2ff9..915589a 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -23,6 +23,8 @@ #include <sound/driver.h> #include <linux/init.h> #include <linux/pnp.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/moduleparam.h> #include <sound/core.h> #include <sound/mpu401.h> @@ -56,12 +58,12 @@ MODULE_PARM_DESC(port, "Port # for MPU-401 device."); module_param_array(irq, int, NULL, 0444); MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device."); -static snd_card_t *snd_mpu401_legacy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static struct platform_device *platform_devices[SNDRV_CARDS]; static int pnp_registered = 0; -static int snd_mpu401_create(int dev, snd_card_t **rcard) +static int snd_mpu401_create(int dev, struct snd_card **rcard) { - snd_card_t *card; + struct snd_card *card; int err; *rcard = NULL; @@ -85,12 +87,6 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard) goto _err; } - if ((err = snd_card_set_generic_dev(card)) < 0) - goto _err; - - if ((err = snd_card_register(card)) < 0) - goto _err; - *rcard = card; return 0; @@ -99,8 +95,12 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard) return err; } -static int __devinit snd_mpu401_probe(int dev) +static int __devinit snd_mpu401_probe(struct platform_device *devptr) { + int dev = devptr->id; + int err; + struct snd_card *card; + if (port[dev] == SNDRV_AUTO_PORT) { snd_printk(KERN_ERR "specify port\n"); return -EINVAL; @@ -109,9 +109,36 @@ static int __devinit snd_mpu401_probe(int dev) snd_printk(KERN_ERR "specify or disable IRQ\n"); return -EINVAL; } - return snd_mpu401_create(dev, &snd_mpu401_legacy_cards[dev]); + err = snd_mpu401_create(dev, &card); + if (err < 0) + return err; + snd_card_set_dev(card, &devptr->dev); + if ((err = snd_card_register(card)) < 0) { + snd_card_free(card); + return err; + } + platform_set_drvdata(devptr, card); + return 0; } +static int __devexit snd_mpu401_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#define SND_MPU401_DRIVER "snd_mpu401" + +static struct platform_driver snd_mpu401_driver = { + .probe = snd_mpu401_probe, + .remove = __devexit_p(snd_mpu401_remove), + .driver = { + .name = SND_MPU401_DRIVER + }, +}; + + #ifdef CONFIG_PNP #define IO_EXTENT 2 @@ -152,7 +179,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) { static int dev; - snd_card_t *card; + struct snd_card *card; int err; for ( ; dev < SNDRV_CARDS; ++dev) { @@ -164,6 +191,10 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, err = snd_mpu401_create(dev, &card); if (err < 0) return err; + if ((err = snd_card_register(card)) < 0) { + snd_card_free(card); + return err; + } snd_card_set_dev(card, &pnp_dev->dev); pnp_set_drvdata(pnp_dev, card); ++dev; @@ -174,7 +205,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, static void __devexit snd_mpu401_pnp_remove(struct pnp_dev *dev) { - snd_card_t *card = (snd_card_t *) pnp_get_drvdata(dev); + struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev); snd_card_disconnect(card); snd_card_free_in_thread(card); @@ -190,20 +221,39 @@ static struct pnp_driver snd_mpu401_pnp_driver = { static struct pnp_driver snd_mpu401_pnp_driver; #endif +static void __init_or_module snd_mpu401_unregister_all(void) +{ + int i; + + if (pnp_registered) + pnp_unregister_driver(&snd_mpu401_pnp_driver); + for (i = 0; i < ARRAY_SIZE(platform_devices); ++i) + platform_device_unregister(platform_devices[i]); + platform_driver_unregister(&snd_mpu401_driver); +} + static int __init alsa_card_mpu401_init(void) { - int dev, devices = 0; - int err; + int i, err, devices; - for (dev = 0; dev < SNDRV_CARDS; dev++) { - if (!enable[dev]) - continue; + if ((err = platform_driver_register(&snd_mpu401_driver)) < 0) + return err; + + devices = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; #ifdef CONFIG_PNP - if (pnp[dev]) + if (pnp[i]) continue; #endif - if (snd_mpu401_probe(dev) >= 0) - devices++; + device = platform_device_register_simple(SND_MPU401_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; + } + platform_devices[i] = device; + devices++; } if ((err = pnp_register_driver(&snd_mpu401_pnp_driver)) >= 0) { pnp_registered = 1; @@ -214,21 +264,19 @@ static int __init alsa_card_mpu401_init(void) #ifdef MODULE printk(KERN_ERR "MPU-401 device not found or device busy\n"); #endif - if (pnp_registered) - pnp_unregister_driver(&snd_mpu401_pnp_driver); - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_mpu401_unregister_all(); + return err; } static void __exit alsa_card_mpu401_exit(void) { - int idx; - - if (pnp_registered) - pnp_unregister_driver(&snd_mpu401_pnp_driver); - for (idx = 0; idx < SNDRV_CARDS; idx++) - snd_card_free(snd_mpu401_legacy_cards[idx]); + snd_mpu401_unregister_all(); } module_init(alsa_card_mpu401_init) diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index bdeb2c0..8687ae3 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -43,8 +43,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); MODULE_DESCRIPTION("Routines for control of MPU-401 in UART mode"); MODULE_LICENSE("GPL"); -static void snd_mpu401_uart_input_read(mpu401_t * mpu); -static void snd_mpu401_uart_output_write(mpu401_t * mpu); +static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu); +static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu); /* @@ -58,28 +58,28 @@ static void snd_mpu401_uart_output_write(mpu401_t * mpu); #define MPU401_ACK 0xfe /* Build in lowlevel io */ -static void mpu401_write_port(mpu401_t *mpu, unsigned char data, unsigned long addr) +static void mpu401_write_port(struct snd_mpu401 *mpu, unsigned char data, unsigned long addr) { outb(data, addr); } -static unsigned char mpu401_read_port(mpu401_t *mpu, unsigned long addr) +static unsigned char mpu401_read_port(struct snd_mpu401 *mpu, unsigned long addr) { return inb(addr); } -static void mpu401_write_mmio(mpu401_t *mpu, unsigned char data, unsigned long addr) +static void mpu401_write_mmio(struct snd_mpu401 *mpu, unsigned char data, unsigned long addr) { writeb(data, (void __iomem *)addr); } -static unsigned char mpu401_read_mmio(mpu401_t *mpu, unsigned long addr) +static unsigned char mpu401_read_mmio(struct snd_mpu401 *mpu, unsigned long addr) { return readb((void __iomem *)addr); } /* */ -static void snd_mpu401_uart_clear_rx(mpu401_t *mpu) +static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu) { int timeout = 100000; for (; timeout > 0 && snd_mpu401_input_avail(mpu); timeout--) @@ -90,7 +90,7 @@ static void snd_mpu401_uart_clear_rx(mpu401_t *mpu) #endif } -static void _snd_mpu401_uart_interrupt(mpu401_t *mpu) +static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu) { spin_lock(&mpu->input_lock); if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { @@ -118,7 +118,7 @@ static void _snd_mpu401_uart_interrupt(mpu401_t *mpu) */ irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - mpu401_t *mpu = dev_id; + struct snd_mpu401 *mpu = dev_id; if (mpu == NULL) return IRQ_NONE; @@ -132,13 +132,14 @@ irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *reg */ static void snd_mpu401_uart_timer(unsigned long data) { - mpu401_t *mpu = (mpu401_t *)data; + struct snd_mpu401 *mpu = (struct snd_mpu401 *)data; + unsigned long flags; - spin_lock(&mpu->timer_lock); + spin_lock_irqsave(&mpu->timer_lock, flags); /*mpu->mode |= MPU401_MODE_TIMER;*/ mpu->timer.expires = 1 + jiffies; add_timer(&mpu->timer); - spin_unlock(&mpu->timer_lock); + spin_unlock_irqrestore(&mpu->timer_lock, flags); if (mpu->rmidi) _snd_mpu401_uart_interrupt(mpu); } @@ -146,7 +147,7 @@ static void snd_mpu401_uart_timer(unsigned long data) /* * initialize the timer callback if not programmed yet */ -static void snd_mpu401_uart_add_timer (mpu401_t *mpu, int input) +static void snd_mpu401_uart_add_timer (struct snd_mpu401 *mpu, int input) { unsigned long flags; @@ -165,7 +166,7 @@ static void snd_mpu401_uart_add_timer (mpu401_t *mpu, int input) /* * remove the timer callback if still active */ -static void snd_mpu401_uart_remove_timer (mpu401_t *mpu, int input) +static void snd_mpu401_uart_remove_timer (struct snd_mpu401 *mpu, int input) { unsigned long flags; @@ -182,7 +183,7 @@ static void snd_mpu401_uart_remove_timer (mpu401_t *mpu, int input) */ -static void snd_mpu401_uart_cmd(mpu401_t * mpu, unsigned char cmd, int ack) +static void snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, int ack) { unsigned long flags; int timeout, ok; @@ -225,9 +226,9 @@ static void snd_mpu401_uart_cmd(mpu401_t * mpu, unsigned char cmd, int ack) /* * input/output open/close - protected by open_mutex in rawmidi.c */ -static int snd_mpu401_uart_input_open(snd_rawmidi_substream_t * substream) +static int snd_mpu401_uart_input_open(struct snd_rawmidi_substream *substream) { - mpu401_t *mpu; + struct snd_mpu401 *mpu; int err; mpu = substream->rmidi->private_data; @@ -242,9 +243,9 @@ static int snd_mpu401_uart_input_open(snd_rawmidi_substream_t * substream) return 0; } -static int snd_mpu401_uart_output_open(snd_rawmidi_substream_t * substream) +static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream) { - mpu401_t *mpu; + struct snd_mpu401 *mpu; int err; mpu = substream->rmidi->private_data; @@ -259,9 +260,9 @@ static int snd_mpu401_uart_output_open(snd_rawmidi_substream_t * substream) return 0; } -static int snd_mpu401_uart_input_close(snd_rawmidi_substream_t * substream) +static int snd_mpu401_uart_input_close(struct snd_rawmidi_substream *substream) { - mpu401_t *mpu; + struct snd_mpu401 *mpu; mpu = substream->rmidi->private_data; clear_bit(MPU401_MODE_BIT_INPUT, &mpu->mode); @@ -273,9 +274,9 @@ static int snd_mpu401_uart_input_close(snd_rawmidi_substream_t * substream) return 0; } -static int snd_mpu401_uart_output_close(snd_rawmidi_substream_t * substream) +static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream) { - mpu401_t *mpu; + struct snd_mpu401 *mpu; mpu = substream->rmidi->private_data; clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode); @@ -290,10 +291,10 @@ static int snd_mpu401_uart_output_close(snd_rawmidi_substream_t * substream) /* * trigger input callback */ -static void snd_mpu401_uart_input_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up) { unsigned long flags; - mpu401_t *mpu; + struct snd_mpu401 *mpu; int max = 64; mpu = substream->rmidi->private_data; @@ -321,7 +322,7 @@ static void snd_mpu401_uart_input_trigger(snd_rawmidi_substream_t * substream, i * transfer input pending data * call with input_lock spinlock held */ -static void snd_mpu401_uart_input_read(mpu401_t * mpu) +static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu) { int max = 128; unsigned char byte; @@ -349,7 +350,7 @@ static void snd_mpu401_uart_input_read(mpu401_t * mpu) * write output pending bytes * call with output_lock spinlock held */ -static void snd_mpu401_uart_output_write(mpu401_t * mpu) +static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu) { unsigned char byte; int max = 256, timeout; @@ -375,10 +376,10 @@ static void snd_mpu401_uart_output_write(mpu401_t * mpu) /* * output trigger callback */ -static void snd_mpu401_uart_output_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_mpu401_uart_output_trigger(struct snd_rawmidi_substream *substream, int up) { unsigned long flags; - mpu401_t *mpu; + struct snd_mpu401 *mpu; mpu = substream->rmidi->private_data; if (up) { @@ -404,23 +405,23 @@ static void snd_mpu401_uart_output_trigger(snd_rawmidi_substream_t * substream, */ -static snd_rawmidi_ops_t snd_mpu401_uart_output = +static struct snd_rawmidi_ops snd_mpu401_uart_output = { .open = snd_mpu401_uart_output_open, .close = snd_mpu401_uart_output_close, .trigger = snd_mpu401_uart_output_trigger, }; -static snd_rawmidi_ops_t snd_mpu401_uart_input = +static struct snd_rawmidi_ops snd_mpu401_uart_input = { .open = snd_mpu401_uart_input_open, .close = snd_mpu401_uart_input_close, .trigger = snd_mpu401_uart_input_trigger, }; -static void snd_mpu401_uart_free(snd_rawmidi_t *rmidi) +static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi) { - mpu401_t *mpu = rmidi->private_data; + struct snd_mpu401 *mpu = rmidi->private_data; if (mpu->irq_flags && mpu->irq >= 0) free_irq(mpu->irq, (void *) mpu); release_and_free_resource(mpu->res); @@ -442,18 +443,18 @@ static void snd_mpu401_uart_free(snd_rawmidi_t *rmidi) * * Note that the rawmidi instance is returned on the rrawmidi argument, * not the mpu401 instance itself. To access to the mpu401 instance, - * cast from rawmidi->private_data (with mpu401_t magic-cast). + * cast from rawmidi->private_data (with struct snd_mpu401 magic-cast). * * Returns zero if successful, or a negative error code. */ -int snd_mpu401_uart_new(snd_card_t * card, int device, +int snd_mpu401_uart_new(struct snd_card *card, int device, unsigned short hardware, unsigned long port, int integrated, int irq, int irq_flags, - snd_rawmidi_t ** rrawmidi) + struct snd_rawmidi ** rrawmidi) { - mpu401_t *mpu; - snd_rawmidi_t *rmidi; + struct snd_mpu401 *mpu; + struct snd_rawmidi *rmidi; int err; if (rrawmidi) @@ -462,6 +463,7 @@ int snd_mpu401_uart_new(snd_card_t * card, int device, return err; mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); if (mpu == NULL) { + snd_printk(KERN_ERR "mpu401_uart: cannot allocate\n"); snd_device_free(card, rmidi); return -ENOMEM; } diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index e9d52c6..b7a0b42 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -53,6 +53,8 @@ #include <sound/driver.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/ioport.h> #include <linux/moduleparam.h> @@ -93,6 +95,8 @@ MODULE_PARM_DESC(irq, "Parallel IRQ # for MotuMTPAV MIDI."); module_param(hwports, int, 0444); MODULE_PARM_DESC(hwports, "Hardware ports # for MotuMTPAV MIDI."); +static struct platform_device *device; + /* * defines */ @@ -125,17 +129,17 @@ MODULE_PARM_DESC(hwports, "Hardware ports # for MotuMTPAV MIDI."); /* */ -typedef struct mtpav_port { +struct mtpav_port { u8 number; u8 hwport; u8 mode; u8 running_status; - snd_rawmidi_substream_t *input; - snd_rawmidi_substream_t *output; -} mtpav_port_t; + struct snd_rawmidi_substream *input; + struct snd_rawmidi_substream *output; +}; -typedef struct mtpav { - snd_card_t *card; +struct mtpav { + struct snd_card *card; unsigned long port; struct resource *res_port; int irq; /* interrupt (for inputs) */ @@ -143,24 +147,18 @@ typedef struct mtpav { int share_irq; /* number of accesses to input interrupts */ int istimer; /* number of accesses to timer interrupts */ struct timer_list timer; /* timer interrupts for outputs */ - snd_rawmidi_t *rmidi; + struct snd_rawmidi *rmidi; int num_ports; /* number of hw ports (1-8) */ - mtpav_port_t ports[NUMPORTS]; /* all ports including computer, adat and bc */ + struct mtpav_port ports[NUMPORTS]; /* all ports including computer, adat and bc */ u32 inmidiport; /* selected input midi port */ u32 inmidistate; /* during midi command 0xf5 */ u32 outmidihwport; /* selected output midi hw port */ -} mtpav_t; +}; /* - * global instance - * hey, we handle at most only one card.. - */ -static mtpav_t *mtp_card; - -/* * possible hardware ports (selected by 0xf5 port message) * 0x00 all ports * 0x01 .. 0x08 this MTP's ports 1..8 @@ -183,7 +181,7 @@ static mtpav_t *mtp_card; #define MTPAV_PIDX_BROADCAST 2 -static int translate_subdevice_to_hwport(mtpav_t *chip, int subdev) +static int translate_subdevice_to_hwport(struct mtpav *chip, int subdev) { if (subdev < 0) return 0x01; /* invalid - use port 0 as default */ @@ -198,7 +196,7 @@ static int translate_subdevice_to_hwport(mtpav_t *chip, int subdev) return 0; /* all ports */ } -static int translate_hwport_to_subdevice(mtpav_t *chip, int hwport) +static int translate_hwport_to_subdevice(struct mtpav *chip, int hwport) { int p; if (hwport <= 0x00) /* all ports */ @@ -223,7 +221,7 @@ static int translate_hwport_to_subdevice(mtpav_t *chip, int hwport) /* */ -static u8 snd_mtpav_getreg(mtpav_t *chip, u16 reg) +static u8 snd_mtpav_getreg(struct mtpav *chip, u16 reg) { u8 rval = 0; @@ -241,19 +239,16 @@ static u8 snd_mtpav_getreg(mtpav_t *chip, u16 reg) /* */ -static void snd_mtpav_mputreg(mtpav_t *chip, u16 reg, u8 val) +static inline void snd_mtpav_mputreg(struct mtpav *chip, u16 reg, u8 val) { - if (reg == DREG) { - outb(val, chip->port + DREG); - } else if (reg == CREG) { - outb(val, chip->port + CREG); - } + if (reg == DREG || reg == CREG) + outb(val, chip->port + reg); } /* */ -static void snd_mtpav_wait_rfdhi(mtpav_t *chip) +static void snd_mtpav_wait_rfdhi(struct mtpav *chip) { int counts = 10000; u8 sbyte; @@ -265,7 +260,7 @@ static void snd_mtpav_wait_rfdhi(mtpav_t *chip) } } -static void snd_mtpav_send_byte(mtpav_t *chip, u8 byte) +static void snd_mtpav_send_byte(struct mtpav *chip, u8 byte) { u8 tcbyt; u8 clrwrite; @@ -291,8 +286,9 @@ static void snd_mtpav_send_byte(mtpav_t *chip, u8 byte) */ /* call this with spin lock held */ -static void snd_mtpav_output_port_write(mtpav_port_t *port, - snd_rawmidi_substream_t *substream) +static void snd_mtpav_output_port_write(struct mtpav *mtp_card, + struct mtpav_port *portp, + struct snd_rawmidi_substream *substream) { u8 outbyte; @@ -303,34 +299,35 @@ static void snd_mtpav_output_port_write(mtpav_port_t *port, // send port change command if necessary - if (port->hwport != mtp_card->outmidihwport) { - mtp_card->outmidihwport = port->hwport; + if (portp->hwport != mtp_card->outmidihwport) { + mtp_card->outmidihwport = portp->hwport; snd_mtpav_send_byte(mtp_card, 0xf5); - snd_mtpav_send_byte(mtp_card, port->hwport); - //snd_printk("new outport: 0x%x\n", (unsigned int) port->hwport); + snd_mtpav_send_byte(mtp_card, portp->hwport); + //snd_printk("new outport: 0x%x\n", (unsigned int) portp->hwport); - if (!(outbyte & 0x80) && port->running_status) - snd_mtpav_send_byte(mtp_card, port->running_status); + if (!(outbyte & 0x80) && portp->running_status) + snd_mtpav_send_byte(mtp_card, portp->running_status); } // send data do { if (outbyte & 0x80) - port->running_status = outbyte; + portp->running_status = outbyte; snd_mtpav_send_byte(mtp_card, outbyte); } while (snd_rawmidi_transmit(substream, &outbyte, 1) == 1); } -static void snd_mtpav_output_write(snd_rawmidi_substream_t * substream) +static void snd_mtpav_output_write(struct snd_rawmidi_substream *substream) { - mtpav_port_t *port = &mtp_card->ports[substream->number]; + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; spin_lock_irqsave(&mtp_card->spinlock, flags); - snd_mtpav_output_port_write(port, substream); + snd_mtpav_output_port_write(mtp_card, portp, substream); spin_unlock_irqrestore(&mtp_card->spinlock, flags); } @@ -339,7 +336,7 @@ static void snd_mtpav_output_write(snd_rawmidi_substream_t * substream) * mtpav control */ -static void snd_mtpav_portscan(mtpav_t *chip) // put mtp into smart routing mode +static void snd_mtpav_portscan(struct mtpav *chip) // put mtp into smart routing mode { u8 p; @@ -353,12 +350,12 @@ static void snd_mtpav_portscan(mtpav_t *chip) // put mtp into smart routing mode /* */ -static int snd_mtpav_input_open(snd_rawmidi_substream_t * substream) +static int snd_mtpav_input_open(struct snd_rawmidi_substream *substream) { + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; - mtpav_port_t *portp = &mtp_card->ports[substream->number]; - //printk("mtpav port: %d opened\n", (int) substream->number); spin_lock_irqsave(&mtp_card->spinlock, flags); portp->mode |= MTPAV_MODE_INPUT_OPENED; portp->input = substream; @@ -371,20 +368,17 @@ static int snd_mtpav_input_open(snd_rawmidi_substream_t * substream) /* */ -static int snd_mtpav_input_close(snd_rawmidi_substream_t *substream) +static int snd_mtpav_input_close(struct snd_rawmidi_substream *substream) { + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; - mtpav_port_t *portp = &mtp_card->ports[substream->number]; - - //printk("mtpav port: %d closed\n", (int) portp); spin_lock_irqsave(&mtp_card->spinlock, flags); - - portp->mode &= (~MTPAV_MODE_INPUT_OPENED); + portp->mode &= ~MTPAV_MODE_INPUT_OPENED; portp->input = NULL; if (--mtp_card->share_irq == 0) snd_mtpav_mputreg(mtp_card, CREG, 0); // disable pport interrupts - spin_unlock_irqrestore(&mtp_card->spinlock, flags); return 0; } @@ -392,10 +386,11 @@ static int snd_mtpav_input_close(snd_rawmidi_substream_t *substream) /* */ -static void snd_mtpav_input_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_mtpav_input_trigger(struct snd_rawmidi_substream *substream, int up) { + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; - mtpav_port_t *portp = &mtp_card->ports[substream->number]; spin_lock_irqsave(&mtp_card->spinlock, flags); if (up) @@ -414,7 +409,7 @@ static void snd_mtpav_input_trigger(snd_rawmidi_substream_t * substream, int up) static void snd_mtpav_output_timer(unsigned long data) { unsigned long flags; - mtpav_t *chip = (mtpav_t *)data; + struct mtpav *chip = (struct mtpav *)data; int p; spin_lock_irqsave(&chip->spinlock, flags); @@ -423,25 +418,22 @@ static void snd_mtpav_output_timer(unsigned long data) add_timer(&chip->timer); /* process each port */ for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) { - mtpav_port_t *portp = &mtp_card->ports[p]; + struct mtpav_port *portp = &chip->ports[p]; if ((portp->mode & MTPAV_MODE_OUTPUT_TRIGGERED) && portp->output) - snd_mtpav_output_port_write(portp, portp->output); + snd_mtpav_output_port_write(chip, portp, portp->output); } spin_unlock_irqrestore(&chip->spinlock, flags); } /* spinlock held! */ -static void snd_mtpav_add_output_timer(mtpav_t *chip) +static void snd_mtpav_add_output_timer(struct mtpav *chip) { - init_timer(&chip->timer); - chip->timer.function = snd_mtpav_output_timer; - chip->timer.data = (unsigned long) mtp_card; chip->timer.expires = 1 + jiffies; add_timer(&chip->timer); } /* spinlock held! */ -static void snd_mtpav_remove_output_timer(mtpav_t *chip) +static void snd_mtpav_remove_output_timer(struct mtpav *chip) { del_timer(&chip->timer); } @@ -449,10 +441,11 @@ static void snd_mtpav_remove_output_timer(mtpav_t *chip) /* */ -static int snd_mtpav_output_open(snd_rawmidi_substream_t * substream) +static int snd_mtpav_output_open(struct snd_rawmidi_substream *substream) { + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; - mtpav_port_t *portp = &mtp_card->ports[substream->number]; spin_lock_irqsave(&mtp_card->spinlock, flags); portp->mode |= MTPAV_MODE_OUTPUT_OPENED; @@ -464,13 +457,14 @@ static int snd_mtpav_output_open(snd_rawmidi_substream_t * substream) /* */ -static int snd_mtpav_output_close(snd_rawmidi_substream_t * substream) +static int snd_mtpav_output_close(struct snd_rawmidi_substream *substream) { + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; - mtpav_port_t *portp = &mtp_card->ports[substream->number]; spin_lock_irqsave(&mtp_card->spinlock, flags); - portp->mode &= (~MTPAV_MODE_OUTPUT_OPENED); + portp->mode &= ~MTPAV_MODE_OUTPUT_OPENED; portp->output = NULL; spin_unlock_irqrestore(&mtp_card->spinlock, flags); return 0; @@ -479,14 +473,15 @@ static int snd_mtpav_output_close(snd_rawmidi_substream_t * substream) /* */ -static void snd_mtpav_output_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_mtpav_output_trigger(struct snd_rawmidi_substream *substream, int up) { + struct mtpav *mtp_card = substream->rmidi->private_data; + struct mtpav_port *portp = &mtp_card->ports[substream->number]; unsigned long flags; - mtpav_port_t *portp = &mtp_card->ports[substream->number]; spin_lock_irqsave(&mtp_card->spinlock, flags); if (up) { - if (! (portp->mode & MTPAV_MODE_OUTPUT_TRIGGERED)) { + if (! (portp->mode & MTPAV_MODE_OUTPUT_TRIGGERED)) { if (mtp_card->istimer++ == 0) snd_mtpav_add_output_timer(mtp_card); portp->mode |= MTPAV_MODE_OUTPUT_TRIGGERED; @@ -506,23 +501,20 @@ static void snd_mtpav_output_trigger(snd_rawmidi_substream_t * substream, int up * midi interrupt for inputs */ -static void snd_mtpav_inmidi_process(mtpav_t *mcrd, u8 inbyte) +static void snd_mtpav_inmidi_process(struct mtpav *mcrd, u8 inbyte) { - mtpav_port_t *portp; + struct mtpav_port *portp; if ((int)mcrd->inmidiport > mcrd->num_ports * 2 + MTPAV_PIDX_BROADCAST) return; portp = &mcrd->ports[mcrd->inmidiport]; - if (portp->mode & MTPAV_MODE_INPUT_TRIGGERED) { + if (portp->mode & MTPAV_MODE_INPUT_TRIGGERED) snd_rawmidi_receive(portp->input, &inbyte, 1); - } } -static void snd_mtpav_inmidi_h(mtpav_t * mcrd, u8 inbyte) +static void snd_mtpav_inmidi_h(struct mtpav *mcrd, u8 inbyte) { - snd_assert(mcrd, return); - if (inbyte >= 0xf8) { /* real-time midi code */ snd_mtpav_inmidi_process(mcrd, inbyte); @@ -540,7 +532,7 @@ static void snd_mtpav_inmidi_h(mtpav_t * mcrd, u8 inbyte) } } -static void snd_mtpav_read_bytes(mtpav_t * mcrd) +static void snd_mtpav_read_bytes(struct mtpav *mcrd) { u8 clrread, setread; u8 mtp_read_byte; @@ -580,9 +572,8 @@ static void snd_mtpav_read_bytes(mtpav_t * mcrd) static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id, struct pt_regs *regs) { - mtpav_t *mcard = dev_id; + struct mtpav *mcard = dev_id; - //printk("irqh()\n"); spin_lock(&mcard->spinlock); snd_mtpav_read_bytes(mcard); spin_unlock(&mcard->spinlock); @@ -592,14 +583,14 @@ static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id, struct pt_regs *regs) /* * get ISA resources */ -static int snd_mtpav_get_ISA(mtpav_t * mcard) +static int __init snd_mtpav_get_ISA(struct mtpav * mcard) { if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) { snd_printk("MTVAP port 0x%lx is busy\n", port); return -EBUSY; } mcard->port = port; - if (request_irq(irq, snd_mtpav_irqh, SA_INTERRUPT, "MOTU MTPAV", (void *)mcard)) { + if (request_irq(irq, snd_mtpav_irqh, SA_INTERRUPT, "MOTU MTPAV", mcard)) { snd_printk("MTVAP IRQ %d busy\n", irq); return -EBUSY; } @@ -611,13 +602,13 @@ static int snd_mtpav_get_ISA(mtpav_t * mcard) /* */ -static snd_rawmidi_ops_t snd_mtpav_output = { +static struct snd_rawmidi_ops snd_mtpav_output = { .open = snd_mtpav_output_open, .close = snd_mtpav_output_close, .trigger = snd_mtpav_output_trigger, }; -static snd_rawmidi_ops_t snd_mtpav_input = { +static struct snd_rawmidi_ops snd_mtpav_input = { .open = snd_mtpav_input_open, .close = snd_mtpav_input_close, .trigger = snd_mtpav_input_trigger, @@ -628,7 +619,8 @@ static snd_rawmidi_ops_t snd_mtpav_input = { * get RAWMIDI resources */ -static void snd_mtpav_set_name(mtpav_t *chip, snd_rawmidi_substream_t *substream) +static void __init snd_mtpav_set_name(struct mtpav *chip, + struct snd_rawmidi_substream *substream) { if (substream->number >= 0 && substream->number < chip->num_ports) sprintf(substream->name, "MTP direct %d", (substream->number % chip->num_ports) + 1); @@ -642,21 +634,18 @@ static void snd_mtpav_set_name(mtpav_t *chip, snd_rawmidi_substream_t *substream strcpy(substream->name, "MTP broadcast"); } -static int snd_mtpav_get_RAWMIDI(mtpav_t * mcard) +static int __init snd_mtpav_get_RAWMIDI(struct mtpav *mcard) { - int rval = 0; - snd_rawmidi_t *rawmidi; - snd_rawmidi_substream_t *substream; + int rval; + struct snd_rawmidi *rawmidi; + struct snd_rawmidi_substream *substream; struct list_head *list; - //printk("entering snd_mtpav_get_RAWMIDI\n"); - if (hwports < 1) - mcard->num_ports = 1; + hwports = 1; else if (hwports > 8) - mcard->num_ports = 8; - else - mcard->num_ports = hwports; + hwports = 8; + mcard->num_ports = hwports; if ((rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0, mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1, @@ -664,14 +653,15 @@ static int snd_mtpav_get_RAWMIDI(mtpav_t * mcard) &mcard->rmidi)) < 0) return rval; rawmidi = mcard->rmidi; + rawmidi->private_data = mcard; list_for_each(list, &rawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) { - substream = list_entry(list, snd_rawmidi_substream_t, list); + substream = list_entry(list, struct snd_rawmidi_substream, list); snd_mtpav_set_name(mcard, substream); substream->ops = &snd_mtpav_input; } list_for_each(list, &rawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { - substream = list_entry(list, snd_rawmidi_substream_t, list); + substream = list_entry(list, struct snd_rawmidi_substream, list); snd_mtpav_set_name(mcard, substream); substream->ops = &snd_mtpav_output; mcard->ports[substream->number].hwport = translate_subdevice_to_hwport(mcard, substream->number); @@ -679,36 +669,15 @@ static int snd_mtpav_get_RAWMIDI(mtpav_t * mcard) rawmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; sprintf(rawmidi->name, "MTP AV MIDI"); - //printk("exiting snd_mtpav_get_RAWMIDI() \n"); return 0; } /* */ -static mtpav_t *new_mtpav(void) -{ - mtpav_t *ncrd = kzalloc(sizeof(*ncrd), GFP_KERNEL); - if (ncrd != NULL) { - spin_lock_init(&ncrd->spinlock); - - init_timer(&ncrd->timer); - ncrd->card = NULL; - ncrd->irq = -1; - ncrd->share_irq = 0; - - ncrd->inmidiport = 0xffffffff; - ncrd->inmidistate = 0; - ncrd->outmidihwport = 0xffffffff; - } - return ncrd; -} - -/* - */ - -static void free_mtpav(mtpav_t * crd) +static void snd_mtpav_free(struct snd_card *card) { + struct mtpav *crd = card->private_data; unsigned long flags; spin_lock_irqsave(&crd->spinlock, flags); @@ -718,78 +687,101 @@ static void free_mtpav(mtpav_t * crd) if (crd->irq >= 0) free_irq(crd->irq, (void *)crd); release_and_free_resource(crd->res_port); - kfree(crd); } /* */ - -static int __init alsa_card_mtpav_init(void) +static int __init snd_mtpav_probe(struct platform_device *dev) { - int err = 0; - char longname_buffer[80]; + struct snd_card *card; + int err; + struct mtpav *mtp_card; - mtp_card = new_mtpav(); - if (mtp_card == NULL) + card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card)); + if (! card) return -ENOMEM; - mtp_card->card = snd_card_new(index, id, THIS_MODULE, 0); - if (mtp_card->card == NULL) { - free_mtpav(mtp_card); - return -ENOMEM; - } + mtp_card = card->private_data; + spin_lock_init(&mtp_card->spinlock); + init_timer(&mtp_card->timer); + mtp_card->card = card; + mtp_card->irq = -1; + mtp_card->share_irq = 0; + mtp_card->inmidiport = 0xffffffff; + mtp_card->inmidistate = 0; + mtp_card->outmidihwport = 0xffffffff; + init_timer(&mtp_card->timer); + mtp_card->timer.function = snd_mtpav_output_timer; + mtp_card->timer.data = (unsigned long) mtp_card; + + card->private_free = snd_mtpav_free; err = snd_mtpav_get_ISA(mtp_card); - //printk("snd_mtpav_get_ISA returned: %d\n", err); if (err < 0) goto __error; - strcpy(mtp_card->card->driver, "MTPAV"); - strcpy(mtp_card->card->shortname, "MTPAV on parallel port"); - memset(longname_buffer, 0, sizeof(longname_buffer)); - sprintf(longname_buffer, "MTPAV on parallel port at"); + strcpy(card->driver, "MTPAV"); + strcpy(card->shortname, "MTPAV on parallel port"); + snprintf(card->longname, sizeof(card->longname), + "MTPAV on parallel port at 0x%lx", port); err = snd_mtpav_get_RAWMIDI(mtp_card); - //snd_printk("snd_mtapv_get_RAWMIDI returned: %d\n", err); if (err < 0) goto __error; - if ((err = snd_card_set_generic_dev(mtp_card->card)) < 0) - goto __error; - - err = snd_card_register(mtp_card->card); // don't snd_card_register until AFTER all cards reources done! + snd_mtpav_portscan(mtp_card); - //printk("snd_card_register returned %d\n", err); + snd_card_set_dev(card, &dev->dev); + err = snd_card_register(mtp_card->card); if (err < 0) goto __error; - - snd_mtpav_portscan(mtp_card); - + platform_set_drvdata(dev, card); printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", irq, port); - return 0; - __error: - snd_card_free(mtp_card->card); - free_mtpav(mtp_card); + __error: + snd_card_free(card); return err; } -/* - */ +static int snd_mtpav_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} -static void __exit alsa_card_mtpav_exit(void) +#define SND_MTPAV_DRIVER "snd_mtpav" + +static struct platform_driver snd_mtpav_driver = { + .probe = snd_mtpav_probe, + .remove = snd_mtpav_remove, + .driver = { + .name = SND_MTPAV_DRIVER + }, +}; + +static int __init alsa_card_mtpav_init(void) { - if (mtp_card == NULL) - return; - if (mtp_card->card) - snd_card_free(mtp_card->card); - free_mtpav(mtp_card); + int err; + + if ((err = platform_driver_register(&snd_mtpav_driver)) < 0) + return err; + + device = platform_device_register_simple(SND_MTPAV_DRIVER, -1, NULL, 0); + if (IS_ERR(device)) { + platform_driver_unregister(&snd_mtpav_driver); + return PTR_ERR(device); + } + return 0; } -/* - */ +static void __exit alsa_card_mtpav_exit(void) +{ + platform_device_unregister(device); + platform_driver_unregister(&snd_mtpav_driver); +} module_init(alsa_card_mtpav_init) module_exit(alsa_card_mtpav_exit) diff --git a/sound/drivers/opl3/opl3_drums.c b/sound/drivers/opl3/opl3_drums.c index f263326..7369438 100644 --- a/sound/drivers/opl3/opl3_drums.c +++ b/sound/drivers/opl3/opl3_drums.c @@ -45,7 +45,7 @@ static char snd_opl3_drum_table[47] = OPL3_CYMBAL_ON, OPL3_CYMBAL_ON /* 80 - 81 */ }; -typedef struct snd_opl3_drum_voice { +struct snd_opl3_drum_voice { int voice; int op; unsigned char am_vib; @@ -54,33 +54,34 @@ typedef struct snd_opl3_drum_voice { unsigned char sustain_release; unsigned char feedback_connection; unsigned char wave_select; -} snd_opl3_drum_voice_t; +}; -typedef struct snd_opl3_drum_note { +struct snd_opl3_drum_note { int voice; unsigned char fnum; unsigned char octave_f; unsigned char feedback_connection; -} snd_opl3_drum_note_t; +}; -static snd_opl3_drum_voice_t bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00}; -static snd_opl3_drum_voice_t bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00}; -static snd_opl3_drum_note_t bass_note = {6, 0x90, 0x09}; +static struct snd_opl3_drum_voice bass_op0 = {6, 0, 0x00, 0x32, 0xf8, 0x66, 0x30, 0x00}; +static struct snd_opl3_drum_voice bass_op1 = {6, 1, 0x00, 0x03, 0xf6, 0x57, 0x30, 0x00}; +static struct snd_opl3_drum_note bass_note = {6, 0x90, 0x09}; -static snd_opl3_drum_voice_t hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00}; +static struct snd_opl3_drum_voice hihat = {7, 0, 0x00, 0x03, 0xf0, 0x06, 0x20, 0x00}; -static snd_opl3_drum_voice_t snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02}; -static snd_opl3_drum_note_t snare_note = {7, 0xf4, 0x0d}; +static struct snd_opl3_drum_voice snare = {7, 1, 0x00, 0x03, 0xf0, 0x07, 0x20, 0x02}; +static struct snd_opl3_drum_note snare_note = {7, 0xf4, 0x0d}; -static snd_opl3_drum_voice_t tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00}; -static snd_opl3_drum_note_t tomtom_note = {8, 0xf4, 0x09}; +static struct snd_opl3_drum_voice tomtom = {8, 0, 0x02, 0x03, 0xf0, 0x06, 0x10, 0x00}; +static struct snd_opl3_drum_note tomtom_note = {8, 0xf4, 0x09}; -static snd_opl3_drum_voice_t cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00}; +static struct snd_opl3_drum_voice cymbal = {8, 1, 0x04, 0x03, 0xf0, 0x06, 0x10, 0x00}; /* * set drum voice characteristics */ -static void snd_opl3_drum_voice_set(opl3_t *opl3, snd_opl3_drum_voice_t *data) +static void snd_opl3_drum_voice_set(struct snd_opl3 *opl3, + struct snd_opl3_drum_voice *data) { unsigned char op_offset = snd_opl3_regmap[data->voice][data->op]; unsigned char voice_offset = data->voice; @@ -114,7 +115,8 @@ static void snd_opl3_drum_voice_set(opl3_t *opl3, snd_opl3_drum_voice_t *data) /* * Set drum voice pitch */ -static void snd_opl3_drum_note_set(opl3_t *opl3, snd_opl3_drum_note_t *data) +static void snd_opl3_drum_note_set(struct snd_opl3 *opl3, + struct snd_opl3_drum_note *data) { unsigned char voice_offset = data->voice; unsigned short opl3_reg; @@ -131,8 +133,9 @@ static void snd_opl3_drum_note_set(opl3_t *opl3, snd_opl3_drum_note_t *data) /* * Set drum voice volume and position */ -static void snd_opl3_drum_vol_set(opl3_t *opl3, snd_opl3_drum_voice_t *data, - int vel, snd_midi_channel_t *chan) +static void snd_opl3_drum_vol_set(struct snd_opl3 *opl3, + struct snd_opl3_drum_voice *data, + int vel, struct snd_midi_channel *chan) { unsigned char op_offset = snd_opl3_regmap[data->voice][data->op]; unsigned char voice_offset = data->voice; @@ -159,7 +162,7 @@ static void snd_opl3_drum_vol_set(opl3_t *opl3, snd_opl3_drum_voice_t *data, /* * Loads drum voices at init time */ -void snd_opl3_load_drums(opl3_t *opl3) +void snd_opl3_load_drums(struct snd_opl3 *opl3) { snd_opl3_drum_voice_set(opl3, &bass_op0); snd_opl3_drum_voice_set(opl3, &bass_op1); @@ -179,11 +182,11 @@ void snd_opl3_load_drums(opl3_t *opl3) /* * Switch drum voice on or off */ -void snd_opl3_drum_switch(opl3_t *opl3, int note, int vel, int on_off, - snd_midi_channel_t *chan) +void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int vel, int on_off, + struct snd_midi_channel *chan) { unsigned char drum_mask; - snd_opl3_drum_voice_t *drum_voice; + struct snd_opl3_drum_voice *drum_voice; if (!(opl3->drum_reg & OPL3_PERCUSSION_ENABLE)) return; diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index 0624650..1e0c76b 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c @@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; -static void snd_opl2_command(opl3_t * opl3, unsigned short cmd, unsigned char val) +static void snd_opl2_command(struct snd_opl3 * opl3, unsigned short cmd, unsigned char val) { unsigned long flags; unsigned long port; @@ -60,7 +60,7 @@ static void snd_opl2_command(opl3_t * opl3, unsigned short cmd, unsigned char va spin_unlock_irqrestore(&opl3->reg_lock, flags); } -static void snd_opl3_command(opl3_t * opl3, unsigned short cmd, unsigned char val) +static void snd_opl3_command(struct snd_opl3 * opl3, unsigned short cmd, unsigned char val) { unsigned long flags; unsigned long port; @@ -85,7 +85,7 @@ static void snd_opl3_command(opl3_t * opl3, unsigned short cmd, unsigned char va spin_unlock_irqrestore(&opl3->reg_lock, flags); } -static int snd_opl3_detect(opl3_t * opl3) +static int snd_opl3_detect(struct snd_opl3 * opl3) { /* * This function returns 1 if the FM chip is present at the given I/O port @@ -153,12 +153,12 @@ static int snd_opl3_detect(opl3_t * opl3) * Timer 1 - 80us */ -static int snd_opl3_timer1_start(snd_timer_t * timer) +static int snd_opl3_timer1_start(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; unsigned int ticks; - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = snd_timer_chip(timer); spin_lock_irqsave(&opl3->timer_lock, flags); @@ -171,11 +171,11 @@ static int snd_opl3_timer1_start(snd_timer_t * timer) return 0; } -static int snd_opl3_timer1_stop(snd_timer_t * timer) +static int snd_opl3_timer1_stop(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = snd_timer_chip(timer); spin_lock_irqsave(&opl3->timer_lock, flags); @@ -190,12 +190,12 @@ static int snd_opl3_timer1_stop(snd_timer_t * timer) * Timer 2 - 320us */ -static int snd_opl3_timer2_start(snd_timer_t * timer) +static int snd_opl3_timer2_start(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; unsigned int ticks; - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = snd_timer_chip(timer); spin_lock_irqsave(&opl3->timer_lock, flags); @@ -208,11 +208,11 @@ static int snd_opl3_timer2_start(snd_timer_t * timer) return 0; } -static int snd_opl3_timer2_stop(snd_timer_t * timer) +static int snd_opl3_timer2_stop(struct snd_timer * timer) { unsigned long flags; unsigned char tmp; - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = snd_timer_chip(timer); spin_lock_irqsave(&opl3->timer_lock, flags); @@ -227,7 +227,7 @@ static int snd_opl3_timer2_stop(snd_timer_t * timer) */ -static struct _snd_timer_hardware snd_opl3_timer1 = +static struct snd_timer_hardware snd_opl3_timer1 = { .flags = SNDRV_TIMER_HW_STOP, .resolution = 80000, @@ -236,7 +236,7 @@ static struct _snd_timer_hardware snd_opl3_timer1 = .stop = snd_opl3_timer1_stop, }; -static struct _snd_timer_hardware snd_opl3_timer2 = +static struct snd_timer_hardware snd_opl3_timer2 = { .flags = SNDRV_TIMER_HW_STOP, .resolution = 320000, @@ -245,10 +245,10 @@ static struct _snd_timer_hardware snd_opl3_timer2 = .stop = snd_opl3_timer2_stop, }; -static int snd_opl3_timer1_init(opl3_t * opl3, int timer_no) +static int snd_opl3_timer1_init(struct snd_opl3 * opl3, int timer_no) { - snd_timer_t *timer = NULL; - snd_timer_id_t tid; + struct snd_timer *timer = NULL; + struct snd_timer_id tid; int err; tid.dev_class = SNDRV_TIMER_CLASS_CARD; @@ -265,10 +265,10 @@ static int snd_opl3_timer1_init(opl3_t * opl3, int timer_no) return err; } -static int snd_opl3_timer2_init(opl3_t * opl3, int timer_no) +static int snd_opl3_timer2_init(struct snd_opl3 * opl3, int timer_no) { - snd_timer_t *timer = NULL; - snd_timer_id_t tid; + struct snd_timer *timer = NULL; + struct snd_timer_id tid; int err; tid.dev_class = SNDRV_TIMER_CLASS_CARD; @@ -289,11 +289,11 @@ static int snd_opl3_timer2_init(opl3_t * opl3, int timer_no) */ -void snd_opl3_interrupt(snd_hwdep_t * hw) +void snd_opl3_interrupt(struct snd_hwdep * hw) { unsigned char status; - opl3_t *opl3; - snd_timer_t *timer; + struct snd_opl3 *opl3; + struct snd_timer *timer; if (hw == NULL) return; @@ -320,7 +320,7 @@ void snd_opl3_interrupt(snd_hwdep_t * hw) */ -static int snd_opl3_free(opl3_t *opl3) +static int snd_opl3_free(struct snd_opl3 *opl3) { snd_assert(opl3 != NULL, return -ENXIO); if (opl3->private_free) @@ -331,26 +331,28 @@ static int snd_opl3_free(opl3_t *opl3) return 0; } -static int snd_opl3_dev_free(snd_device_t *device) +static int snd_opl3_dev_free(struct snd_device *device) { - opl3_t *opl3 = device->device_data; + struct snd_opl3 *opl3 = device->device_data; return snd_opl3_free(opl3); } -int snd_opl3_new(snd_card_t *card, +int snd_opl3_new(struct snd_card *card, unsigned short hardware, - opl3_t **ropl3) + struct snd_opl3 **ropl3) { - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_opl3_dev_free, }; - opl3_t *opl3; + struct snd_opl3 *opl3; int err; *ropl3 = NULL; opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL); - if (opl3 == NULL) + if (opl3 == NULL) { + snd_printk(KERN_ERR "opl3: cannot allocate\n"); return -ENOMEM; + } opl3->card = card; opl3->hardware = hardware; @@ -367,7 +369,7 @@ int snd_opl3_new(snd_card_t *card, return 0; } -int snd_opl3_init(opl3_t *opl3) +int snd_opl3_init(struct snd_opl3 *opl3) { if (! opl3->command) { printk(KERN_ERR "snd_opl3_init: command not defined!\n"); @@ -391,14 +393,14 @@ int snd_opl3_init(opl3_t *opl3) return 0; } -int snd_opl3_create(snd_card_t * card, +int snd_opl3_create(struct snd_card *card, unsigned long l_port, unsigned long r_port, unsigned short hardware, int integrated, - opl3_t ** ropl3) + struct snd_opl3 ** ropl3) { - opl3_t *opl3; + struct snd_opl3 *opl3; int err; *ropl3 = NULL; @@ -407,13 +409,13 @@ int snd_opl3_create(snd_card_t * card, if (! integrated) { if ((opl3->res_l_port = request_region(l_port, 2, "OPL2/3 (left)")) == NULL) { snd_printk(KERN_ERR "opl3: can't grab left port 0x%lx\n", l_port); - snd_opl3_free(opl3); + snd_device_free(card, opl3); return -EBUSY; } if (r_port != 0 && (opl3->res_r_port = request_region(r_port, 2, "OPL2/3 (right)")) == NULL) { snd_printk(KERN_ERR "opl3: can't grab right port 0x%lx\n", r_port); - snd_opl3_free(opl3); + snd_device_free(card, opl3); return -EBUSY; } } @@ -432,7 +434,7 @@ int snd_opl3_create(snd_card_t * card, if ((err = snd_opl3_detect(opl3)) < 0) { snd_printd("OPL2/3 chip not detected at 0x%lx/0x%lx\n", opl3->l_port, opl3->r_port); - snd_opl3_free(opl3); + snd_device_free(card, opl3); return err; } /* detect routine returns correct hardware type */ @@ -449,7 +451,7 @@ int snd_opl3_create(snd_card_t * card, return 0; } -int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev) +int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev) { int err; @@ -466,12 +468,12 @@ int snd_opl3_timer_new(opl3_t * opl3, int timer1_dev, int timer2_dev) return 0; } -int snd_opl3_hwdep_new(opl3_t * opl3, +int snd_opl3_hwdep_new(struct snd_opl3 * opl3, int device, int seq_device, - snd_hwdep_t ** rhwdep) + struct snd_hwdep ** rhwdep) { - snd_hwdep_t *hw; - snd_card_t *card = opl3->card; + struct snd_hwdep *hw; + struct snd_card *card = opl3->card; int err; if (rhwdep) @@ -514,9 +516,9 @@ int snd_opl3_hwdep_new(opl3_t * opl3, opl3->seq_dev_num = seq_device; #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3, - sizeof(opl3_t*), &opl3->seq_dev) >= 0) { + sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) { strcpy(opl3->seq_dev->name, hw->name); - *(opl3_t**)SNDRV_SEQ_DEVICE_ARGPTR(opl3->seq_dev) = opl3; + *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(opl3->seq_dev) = opl3; } #endif if (rhwdep) diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 93d6740..1b6f227 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -60,7 +60,7 @@ static char opl3_volume_table[128] = }; void snd_opl3_calc_volume(unsigned char *volbyte, int vel, - snd_midi_channel_t *chan) + struct snd_midi_channel *chan) { int oldvol, newvol, n; int volume; @@ -93,7 +93,7 @@ static short opl3_note_table[16] = }; static void snd_opl3_calc_pitch(unsigned char *fnum, unsigned char *blocknum, - int note, snd_midi_channel_t *chan) + int note, struct snd_midi_channel *chan) { int block = ((note / 12) & 0x07) - 1; int idx = (note % 12) + 2; @@ -121,7 +121,7 @@ static void snd_opl3_calc_pitch(unsigned char *fnum, unsigned char *blocknum, #ifdef DEBUG_ALLOC -static void debug_alloc(opl3_t *opl3, char *s, int voice) { +static void debug_alloc(struct snd_opl3 *opl3, char *s, int voice) { int i; char *str = "x.24"; @@ -135,12 +135,12 @@ static void debug_alloc(opl3_t *opl3, char *s, int voice) { /* * Get a FM voice (channel) to play a note on. */ -static int opl3_get_voice(opl3_t *opl3, int instr_4op, - snd_midi_channel_t *chan) { +static int opl3_get_voice(struct snd_opl3 *opl3, int instr_4op, + struct snd_midi_channel *chan) { int chan_4op_1; /* first voice for 4op instrument */ int chan_4op_2; /* second voice for 4op instrument */ - snd_opl3_voice_t *vp, *vp2; + struct snd_opl3_voice *vp, *vp2; unsigned int voice_time; int i; @@ -237,13 +237,14 @@ static int opl3_get_voice(opl3_t *opl3, int instr_4op, void snd_opl3_timer_func(unsigned long data) { - opl3_t *opl3 = (opl3_t *)data; + struct snd_opl3 *opl3 = (struct snd_opl3 *)data; + unsigned long flags; int again = 0; int i; - spin_lock(&opl3->sys_timer_lock); + spin_lock_irqsave(&opl3->sys_timer_lock, flags); for (i = 0; i < opl3->max_voices; i++) { - snd_opl3_voice_t *vp = &opl3->voices[i]; + struct snd_opl3_voice *vp = &opl3->voices[i]; if (vp->state > 0 && vp->note_off_check) { if (vp->note_off == jiffies) snd_opl3_note_off(opl3, vp->note, 0, vp->chan); @@ -257,13 +258,13 @@ void snd_opl3_timer_func(unsigned long data) } else { opl3->sys_timer_status = 0; } - spin_unlock(&opl3->sys_timer_lock); + spin_unlock_irqrestore(&opl3->sys_timer_lock, flags); } /* * Start system timer */ -static void snd_opl3_start_timer(opl3_t *opl3) +static void snd_opl3_start_timer(struct snd_opl3 *opl3) { unsigned long flags; spin_lock_irqsave(&opl3->sys_timer_lock, flags); @@ -285,15 +286,15 @@ static int snd_opl3_oss_map[MAX_OPL3_VOICES] = { /* * Start a note. */ -void snd_opl3_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) +void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan) { - opl3_t *opl3; - snd_seq_instr_t wanted; - snd_seq_kinstr_t *kinstr; + struct snd_opl3 *opl3; + struct snd_seq_instr wanted; + struct snd_seq_kinstr *kinstr; int instr_4op; int voice; - snd_opl3_voice_t *vp, *vp2; + struct snd_opl3_voice *vp, *vp2; unsigned short connect_mask; unsigned char connection; unsigned char vol_op[4]; @@ -310,7 +311,7 @@ void snd_opl3_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) unsigned char fnum, blocknum; int i; - fm_instrument_t *fm; + struct fm_instrument *fm; unsigned long flags; opl3 = p; @@ -615,13 +616,13 @@ void snd_opl3_note_on(void *p, int note, int vel, snd_midi_channel_t *chan) spin_unlock_irqrestore(&opl3->voice_lock, flags); } -static void snd_opl3_kill_voice(opl3_t *opl3, int voice) +static void snd_opl3_kill_voice(struct snd_opl3 *opl3, int voice) { unsigned short reg_side; unsigned char voice_offset; unsigned short opl3_reg; - snd_opl3_voice_t *vp, *vp2; + struct snd_opl3_voice *vp, *vp2; snd_assert(voice < MAX_OPL3_VOICES, return); @@ -663,12 +664,12 @@ static void snd_opl3_kill_voice(opl3_t *opl3, int voice) /* * Release a note in response to a midi note off. */ -void snd_opl3_note_off(void *p, int note, int vel, snd_midi_channel_t *chan) +void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan) { - opl3_t *opl3; + struct snd_opl3 *opl3; int voice; - snd_opl3_voice_t *vp; + struct snd_opl3_voice *vp; unsigned long flags; @@ -708,9 +709,9 @@ void snd_opl3_note_off(void *p, int note, int vel, snd_midi_channel_t *chan) /* * key pressure change */ -void snd_opl3_key_press(void *p, int note, int vel, snd_midi_channel_t *chan) +void snd_opl3_key_press(void *p, int note, int vel, struct snd_midi_channel *chan) { - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = p; #ifdef DEBUG_MIDI @@ -722,9 +723,9 @@ void snd_opl3_key_press(void *p, int note, int vel, snd_midi_channel_t *chan) /* * terminate note */ -void snd_opl3_terminate_note(void *p, int note, snd_midi_channel_t *chan) +void snd_opl3_terminate_note(void *p, int note, struct snd_midi_channel *chan) { - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = p; #ifdef DEBUG_MIDI @@ -733,7 +734,7 @@ void snd_opl3_terminate_note(void *p, int note, snd_midi_channel_t *chan) #endif } -static void snd_opl3_update_pitch(opl3_t *opl3, int voice) +static void snd_opl3_update_pitch(struct snd_opl3 *opl3, int voice) { unsigned short reg_side; unsigned char voice_offset; @@ -741,7 +742,7 @@ static void snd_opl3_update_pitch(opl3_t *opl3, int voice) unsigned char fnum, blocknum; - snd_opl3_voice_t *vp; + struct snd_opl3_voice *vp; snd_assert(voice < MAX_OPL3_VOICES, return); @@ -780,10 +781,10 @@ static void snd_opl3_update_pitch(opl3_t *opl3, int voice) /* * Update voice pitch controller */ -static void snd_opl3_pitch_ctrl(opl3_t *opl3, snd_midi_channel_t *chan) +static void snd_opl3_pitch_ctrl(struct snd_opl3 *opl3, struct snd_midi_channel *chan) { int voice; - snd_opl3_voice_t *vp; + struct snd_opl3_voice *vp; unsigned long flags; @@ -810,9 +811,9 @@ static void snd_opl3_pitch_ctrl(opl3_t *opl3, snd_midi_channel_t *chan) * Deal with a controler type event. This includes all types of * control events, not just the midi controllers */ -void snd_opl3_control(void *p, int type, snd_midi_channel_t *chan) +void snd_opl3_control(void *p, int type, struct snd_midi_channel *chan) { - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = p; #ifdef DEBUG_MIDI @@ -846,10 +847,10 @@ void snd_opl3_control(void *p, int type, snd_midi_channel_t *chan) /* * NRPN events */ -void snd_opl3_nrpn(void *p, snd_midi_channel_t *chan, - snd_midi_channel_set_t *chset) +void snd_opl3_nrpn(void *p, struct snd_midi_channel *chan, + struct snd_midi_channel_set *chset) { - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = p; #ifdef DEBUG_MIDI @@ -862,9 +863,9 @@ void snd_opl3_nrpn(void *p, snd_midi_channel_t *chan, * receive sysex */ void snd_opl3_sysex(void *p, unsigned char *buf, int len, - int parsed, snd_midi_channel_set_t *chset) + int parsed, struct snd_midi_channel_set *chset) { - opl3_t *opl3; + struct snd_opl3 *opl3; opl3 = p; #ifdef DEBUG_MIDI diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c index 21a2b40..31f1f2e 100644 --- a/sound/drivers/opl3/opl3_oss.c +++ b/sound/drivers/opl3/opl3_oss.c @@ -21,11 +21,11 @@ #include "opl3_voice.h" #include <linux/slab.h> -static int snd_opl3_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure); -static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg); -static int snd_opl3_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg); -static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count); -static int snd_opl3_reset_seq_oss(snd_seq_oss_arg_t *arg); +static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure); +static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg); +static int snd_opl3_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg); +static int snd_opl3_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format, const char __user *buf, int offs, int count); +static int snd_opl3_reset_seq_oss(struct snd_seq_oss_arg *arg); /* */ @@ -43,9 +43,9 @@ static inline void snd_leave_user(mm_segment_t fs) /* operators */ -extern snd_midi_op_t opl3_ops; +extern struct snd_midi_op opl3_ops; -static snd_seq_oss_callback_t oss_callback = { +static struct snd_seq_oss_callback oss_callback = { .owner = THIS_MODULE, .open = snd_opl3_open_seq_oss, .close = snd_opl3_close_seq_oss, @@ -54,10 +54,10 @@ static snd_seq_oss_callback_t oss_callback = { .reset = snd_opl3_reset_seq_oss, }; -static int snd_opl3_oss_event_input(snd_seq_event_t *ev, int direct, +static int snd_opl3_oss_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop) { - opl3_t *opl3 = private_data; + struct snd_opl3 *opl3 = private_data; if (ev->type != SNDRV_SEQ_EVENT_OSS) snd_midi_process_event(&opl3_ops, ev, opl3->oss_chset); @@ -68,14 +68,14 @@ static int snd_opl3_oss_event_input(snd_seq_event_t *ev, int direct, static void snd_opl3_oss_free_port(void *private_data) { - opl3_t *opl3 = private_data; + struct snd_opl3 *opl3 = private_data; snd_midi_channel_free_set(opl3->oss_chset); } -static int snd_opl3_oss_create_port(opl3_t * opl3) +static int snd_opl3_oss_create_port(struct snd_opl3 * opl3) { - snd_seq_port_callback_t callbacks; + struct snd_seq_port_callback callbacks; char name[32]; int voices, opl_ver; @@ -113,13 +113,13 @@ static int snd_opl3_oss_create_port(opl3_t * opl3) /* ------------------------------ */ /* register OSS synth */ -void snd_opl3_init_seq_oss(opl3_t *opl3, char *name) +void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name) { - snd_seq_oss_reg_t *arg; - snd_seq_device_t *dev; + struct snd_seq_oss_reg *arg; + struct snd_seq_device *dev; if (snd_seq_device_new(opl3->card, 0, SNDRV_SEQ_DEV_ID_OSS, - sizeof(snd_seq_oss_reg_t), &dev) < 0) + sizeof(struct snd_seq_oss_reg), &dev) < 0) return; opl3->oss_seq_dev = dev; @@ -143,7 +143,7 @@ void snd_opl3_init_seq_oss(opl3_t *opl3, char *name) } /* unregister */ -void snd_opl3_free_seq_oss(opl3_t *opl3) +void snd_opl3_free_seq_oss(struct snd_opl3 *opl3) { if (opl3->oss_seq_dev) { snd_device_free(opl3->card, opl3->oss_seq_dev); @@ -154,9 +154,9 @@ void snd_opl3_free_seq_oss(opl3_t *opl3) /* ------------------------------ */ /* open OSS sequencer */ -static int snd_opl3_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure) +static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) { - opl3_t *opl3 = closure; + struct snd_opl3 *opl3 = closure; int err; snd_assert(arg != NULL, return -ENXIO); @@ -177,9 +177,9 @@ static int snd_opl3_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure) } /* close OSS sequencer */ -static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg) +static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg) { - opl3_t *opl3; + struct snd_opl3 *opl3; snd_assert(arg != NULL, return -ENXIO); opl3 = arg->private_data; @@ -206,10 +206,10 @@ static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg) /* from sound_config.h */ #define SBFM_MAXINSTR 256 -static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, +static int snd_opl3_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format, const char __user *buf, int offs, int count) { - opl3_t *opl3; + struct snd_opl3 *opl3; int err = -EINVAL; snd_assert(arg != NULL, return -ENXIO); @@ -219,11 +219,11 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, struct sbi_instrument sbi; size_t size; - snd_seq_instr_header_t *put; - snd_seq_instr_data_t *data; - fm_xinstrument_t *xinstr; + struct snd_seq_instr_header *put; + struct snd_seq_instr_data *data; + struct fm_xinstrument *xinstr; - snd_seq_event_t ev; + struct snd_seq_event ev; int i; mm_segment_t fs; @@ -240,7 +240,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, return -EINVAL; } - size = sizeof(*put) + sizeof(fm_xinstrument_t); + size = sizeof(*put) + sizeof(struct fm_xinstrument); put = kzalloc(size, GFP_KERNEL); if (put == NULL) return -ENOMEM; @@ -249,7 +249,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, data->type = SNDRV_SEQ_INSTR_ATYPE_DATA; strcpy(data->data.format, SNDRV_SEQ_INSTR_ID_OPL2_3); /* build data section */ - xinstr = (fm_xinstrument_t *)(data + 1); + xinstr = (struct fm_xinstrument *)(data + 1); xinstr->stype = FM_STRU_INSTR; for (i = 0; i < 2; i++) { @@ -296,7 +296,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, err = snd_seq_instr_event(&opl3->fm_ops, opl3->ilist, &ev, opl3->seq_client, 0, 0); if (err == -EBUSY) { - snd_seq_instr_header_t remove; + struct snd_seq_instr_header remove; memset (&remove, 0, sizeof(remove)); remove.cmd = SNDRV_SEQ_INSTR_FREE_CMD_SINGLE; @@ -319,10 +319,10 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, } /* ioctl */ -static int snd_opl3_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, +static int snd_opl3_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg) { - opl3_t *opl3; + struct snd_opl3 *opl3; snd_assert(arg != NULL, return -ENXIO); opl3 = arg->private_data; @@ -345,9 +345,9 @@ static int snd_opl3_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, } /* reset device */ -static int snd_opl3_reset_seq_oss(snd_seq_oss_arg_t *arg) +static int snd_opl3_reset_seq_oss(struct snd_seq_oss_arg *arg) { - opl3_t *opl3; + struct snd_opl3 *opl3; snd_assert(arg != NULL, return -ENXIO); opl3 = arg->private_data; diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index 136964b..c4ead79 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c @@ -35,7 +35,7 @@ int use_internal_drums = 0; module_param(use_internal_drums, bool, 0444); MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums."); -int snd_opl3_synth_use_inc(opl3_t * opl3) +int snd_opl3_synth_use_inc(struct snd_opl3 * opl3) { if (!try_module_get(opl3->card->module)) return -EFAULT; @@ -43,12 +43,12 @@ int snd_opl3_synth_use_inc(opl3_t * opl3) } -void snd_opl3_synth_use_dec(opl3_t * opl3) +void snd_opl3_synth_use_dec(struct snd_opl3 * opl3) { module_put(opl3->card->module); } -int snd_opl3_synth_setup(opl3_t * opl3) +int snd_opl3_synth_setup(struct snd_opl3 * opl3) { int idx; @@ -78,7 +78,7 @@ int snd_opl3_synth_setup(opl3_t * opl3) return 0; } -void snd_opl3_synth_cleanup(opl3_t * opl3) +void snd_opl3_synth_cleanup(struct snd_opl3 * opl3) { unsigned long flags; @@ -96,9 +96,9 @@ void snd_opl3_synth_cleanup(opl3_t * opl3) up(&opl3->access_mutex); } -static int snd_opl3_synth_use(void *private_data, snd_seq_port_subscribe_t * info) +static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info) { - opl3_t *opl3 = private_data; + struct snd_opl3 *opl3 = private_data; int err; if ((err = snd_opl3_synth_setup(opl3)) < 0) @@ -123,9 +123,9 @@ static int snd_opl3_synth_use(void *private_data, snd_seq_port_subscribe_t * inf return 0; } -static int snd_opl3_synth_unuse(void *private_data, snd_seq_port_subscribe_t * info) +static int snd_opl3_synth_unuse(void *private_data, struct snd_seq_port_subscribe * info) { - opl3_t *opl3 = private_data; + struct snd_opl3 *opl3 = private_data; snd_opl3_synth_cleanup(opl3); @@ -137,7 +137,7 @@ static int snd_opl3_synth_unuse(void *private_data, snd_seq_port_subscribe_t * i /* * MIDI emulation operators */ -snd_midi_op_t opl3_ops = { +struct snd_midi_op opl3_ops = { .note_on = snd_opl3_note_on, .note_off = snd_opl3_note_off, .key_press = snd_opl3_key_press, @@ -147,10 +147,10 @@ snd_midi_op_t opl3_ops = { .sysex = snd_opl3_sysex, }; -static int snd_opl3_synth_event_input(snd_seq_event_t * ev, int direct, +static int snd_opl3_synth_event_input(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop) { - opl3_t *opl3 = private_data; + struct snd_opl3 *opl3 = private_data; if (ev->type >= SNDRV_SEQ_EVENT_INSTR_BEGIN && ev->type <= SNDRV_SEQ_EVENT_INSTR_CHANGE) { @@ -168,14 +168,14 @@ static int snd_opl3_synth_event_input(snd_seq_event_t * ev, int direct, static void snd_opl3_synth_free_port(void *private_data) { - opl3_t *opl3 = private_data; + struct snd_opl3 *opl3 = private_data; snd_midi_channel_free_set(opl3->chset); } -static int snd_opl3_synth_create_port(opl3_t * opl3) +static int snd_opl3_synth_create_port(struct snd_opl3 * opl3) { - snd_seq_port_callback_t callbacks; + struct snd_seq_port_callback callbacks; char name[32]; int voices, opl_ver; @@ -215,15 +215,14 @@ static int snd_opl3_synth_create_port(opl3_t * opl3) /* ------------------------------ */ -static int snd_opl3_seq_new_device(snd_seq_device_t *dev) +static int snd_opl3_seq_new_device(struct snd_seq_device *dev) { - opl3_t *opl3; + struct snd_opl3 *opl3; int client; - snd_seq_client_callback_t callbacks; - snd_seq_client_info_t cinfo; + char name[32]; int opl_ver; - opl3 = *(opl3_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev); + opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); if (opl3 == NULL) return -EINVAL; @@ -232,22 +231,14 @@ static int snd_opl3_seq_new_device(snd_seq_device_t *dev) opl3->seq_client = -1; /* allocate new client */ - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.private_data = opl3; - callbacks.allow_output = callbacks.allow_input = 1; + opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8; + sprintf(name, "OPL%i FM synth", opl_ver); client = opl3->seq_client = - snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num, &callbacks); + snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num, + name); if (client < 0) return client; - /* change name of client */ - memset(&cinfo, 0, sizeof(cinfo)); - cinfo.client = client; - cinfo.type = KERNEL_CLIENT; - opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8; - sprintf(cinfo.name, "OPL%i FM synth", opl_ver); - snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); - snd_opl3_synth_create_port(opl3); /* initialize instrument list */ @@ -268,16 +259,16 @@ static int snd_opl3_seq_new_device(snd_seq_device_t *dev) opl3->sys_timer_status = 0; #ifdef CONFIG_SND_SEQUENCER_OSS - snd_opl3_init_seq_oss(opl3, cinfo.name); + snd_opl3_init_seq_oss(opl3, name); #endif return 0; } -static int snd_opl3_seq_delete_device(snd_seq_device_t *dev) +static int snd_opl3_seq_delete_device(struct snd_seq_device *dev) { - opl3_t *opl3; + struct snd_opl3 *opl3; - opl3 = *(opl3_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev); + opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); if (opl3 == NULL) return -EINVAL; @@ -295,14 +286,14 @@ static int snd_opl3_seq_delete_device(snd_seq_device_t *dev) static int __init alsa_opl3_seq_init(void) { - static snd_seq_dev_ops_t ops = + static struct snd_seq_dev_ops ops = { snd_opl3_seq_new_device, snd_opl3_seq_delete_device }; return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_OPL3, &ops, - sizeof(opl3_t*)); + sizeof(struct snd_opl3 *)); } static void __exit alsa_opl3_seq_exit(void) diff --git a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c index 04f9f95..3534a0e 100644 --- a/sound/drivers/opl3/opl3_synth.c +++ b/sound/drivers/opl3/opl3_synth.c @@ -61,20 +61,20 @@ char snd_opl3_regmap[MAX_OPL2_VOICES][4] = /* * prototypes */ -static int snd_opl3_play_note(opl3_t * opl3, snd_dm_fm_note_t * note); -static int snd_opl3_set_voice(opl3_t * opl3, snd_dm_fm_voice_t * voice); -static int snd_opl3_set_params(opl3_t * opl3, snd_dm_fm_params_t * params); -static int snd_opl3_set_mode(opl3_t * opl3, int mode); -static int snd_opl3_set_connection(opl3_t * opl3, int connection); +static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note); +static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice); +static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params); +static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode); +static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection); /* ------------------------------ */ /* * open the device exclusively */ -int snd_opl3_open(snd_hwdep_t * hw, struct file *file) +int snd_opl3_open(struct snd_hwdep * hw, struct file *file) { - opl3_t *opl3 = hw->private_data; + struct snd_opl3 *opl3 = hw->private_data; down(&opl3->access_mutex); if (opl3->used) { @@ -90,10 +90,10 @@ int snd_opl3_open(snd_hwdep_t * hw, struct file *file) /* * ioctl for hwdep device: */ -int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, +int snd_opl3_ioctl(struct snd_hwdep * hw, struct file *file, unsigned int cmd, unsigned long arg) { - opl3_t *opl3 = hw->private_data; + struct snd_opl3 *opl3 = hw->private_data; void __user *argp = (void __user *)arg; snd_assert(opl3 != NULL, return -EINVAL); @@ -102,11 +102,11 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, /* get information */ case SNDRV_DM_FM_IOCTL_INFO: { - snd_dm_fm_info_t info; + struct snd_dm_fm_info info; info.fm_mode = opl3->fm_mode; info.rhythm = opl3->rhythm; - if (copy_to_user(argp, &info, sizeof(snd_dm_fm_info_t))) + if (copy_to_user(argp, &info, sizeof(struct snd_dm_fm_info))) return -EFAULT; return 0; } @@ -123,8 +123,8 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, case SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE: #endif { - snd_dm_fm_note_t note; - if (copy_from_user(¬e, argp, sizeof(snd_dm_fm_note_t))) + struct snd_dm_fm_note note; + if (copy_from_user(¬e, argp, sizeof(struct snd_dm_fm_note))) return -EFAULT; return snd_opl3_play_note(opl3, ¬e); } @@ -134,8 +134,8 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, case SNDRV_DM_FM_OSS_IOCTL_SET_VOICE: #endif { - snd_dm_fm_voice_t voice; - if (copy_from_user(&voice, argp, sizeof(snd_dm_fm_voice_t))) + struct snd_dm_fm_voice voice; + if (copy_from_user(&voice, argp, sizeof(struct snd_dm_fm_voice))) return -EFAULT; return snd_opl3_set_voice(opl3, &voice); } @@ -145,8 +145,8 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, case SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS: #endif { - snd_dm_fm_params_t params; - if (copy_from_user(¶ms, argp, sizeof(snd_dm_fm_params_t))) + struct snd_dm_fm_params params; + if (copy_from_user(¶ms, argp, sizeof(struct snd_dm_fm_params))) return -EFAULT; return snd_opl3_set_params(opl3, ¶ms); } @@ -174,9 +174,9 @@ int snd_opl3_ioctl(snd_hwdep_t * hw, struct file *file, /* * close the device */ -int snd_opl3_release(snd_hwdep_t * hw, struct file *file) +int snd_opl3_release(struct snd_hwdep * hw, struct file *file) { - opl3_t *opl3 = hw->private_data; + struct snd_opl3 *opl3 = hw->private_data; snd_opl3_reset(opl3); down(&opl3->access_mutex); @@ -188,7 +188,7 @@ int snd_opl3_release(snd_hwdep_t * hw, struct file *file) /* ------------------------------ */ -void snd_opl3_reset(opl3_t * opl3) +void snd_opl3_reset(struct snd_opl3 * opl3) { unsigned short opl3_reg; @@ -229,7 +229,7 @@ void snd_opl3_reset(opl3_t * opl3) } -static int snd_opl3_play_note(opl3_t * opl3, snd_dm_fm_note_t * note) +static int snd_opl3_play_note(struct snd_opl3 * opl3, struct snd_dm_fm_note * note) { unsigned short reg_side; unsigned char voice_offset; @@ -276,7 +276,7 @@ static int snd_opl3_play_note(opl3_t * opl3, snd_dm_fm_note_t * note) } -static int snd_opl3_set_voice(opl3_t * opl3, snd_dm_fm_voice_t * voice) +static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * voice) { unsigned short reg_side; unsigned char op_offset; @@ -378,7 +378,7 @@ static int snd_opl3_set_voice(opl3_t * opl3, snd_dm_fm_voice_t * voice) return 0; } -static int snd_opl3_set_params(opl3_t * opl3, snd_dm_fm_params_t * params) +static int snd_opl3_set_params(struct snd_opl3 * opl3, struct snd_dm_fm_params * params) { unsigned char reg_val; @@ -418,7 +418,7 @@ static int snd_opl3_set_params(opl3_t * opl3, snd_dm_fm_params_t * params) return 0; } -static int snd_opl3_set_mode(opl3_t * opl3, int mode) +static int snd_opl3_set_mode(struct snd_opl3 * opl3, int mode) { if ((mode == SNDRV_DM_FM_MODE_OPL3) && (opl3->hardware < OPL3_HW_OPL3)) return -EINVAL; @@ -430,7 +430,7 @@ static int snd_opl3_set_mode(opl3_t * opl3, int mode) return 0; } -static int snd_opl3_set_connection(opl3_t * opl3, int connection) +static int snd_opl3_set_connection(struct snd_opl3 * opl3, int connection) { unsigned char reg_val; diff --git a/sound/drivers/opl3/opl3_voice.h b/sound/drivers/opl3/opl3_voice.h index 63346a5..a371c075 100644 --- a/sound/drivers/opl3/opl3_voice.h +++ b/sound/drivers/opl3/opl3_voice.h @@ -22,31 +22,31 @@ #include <sound/opl3.h> /* Prototypes for opl3_seq.c */ -int snd_opl3_synth_use_inc(opl3_t * opl3); -void snd_opl3_synth_use_dec(opl3_t * opl3); -int snd_opl3_synth_setup(opl3_t * opl3); -void snd_opl3_synth_cleanup(opl3_t * opl3); +int snd_opl3_synth_use_inc(struct snd_opl3 * opl3); +void snd_opl3_synth_use_dec(struct snd_opl3 * opl3); +int snd_opl3_synth_setup(struct snd_opl3 * opl3); +void snd_opl3_synth_cleanup(struct snd_opl3 * opl3); /* Prototypes for opl3_midi.c */ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan); void snd_opl3_note_off(void *p, int note, int vel, struct snd_midi_channel *chan); void snd_opl3_key_press(void *p, int note, int vel, struct snd_midi_channel *chan); -void snd_opl3_terminate_note(void *p, int note, snd_midi_channel_t *chan); +void snd_opl3_terminate_note(void *p, int note, struct snd_midi_channel *chan); void snd_opl3_control(void *p, int type, struct snd_midi_channel *chan); -void snd_opl3_nrpn(void *p, snd_midi_channel_t *chan, snd_midi_channel_set_t *chset); -void snd_opl3_sysex(void *p, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); +void snd_opl3_nrpn(void *p, struct snd_midi_channel *chan, struct snd_midi_channel_set *chset); +void snd_opl3_sysex(void *p, unsigned char *buf, int len, int parsed, struct snd_midi_channel_set *chset); -void snd_opl3_calc_volume(unsigned char *reg, int vel, snd_midi_channel_t *chan); +void snd_opl3_calc_volume(unsigned char *reg, int vel, struct snd_midi_channel *chan); void snd_opl3_timer_func(unsigned long data); /* Prototypes for opl3_drums.c */ -void snd_opl3_load_drums(opl3_t *opl3); -void snd_opl3_drum_switch(opl3_t *opl3, int note, int on_off, int vel, snd_midi_channel_t *chan); +void snd_opl3_load_drums(struct snd_opl3 *opl3); +void snd_opl3_drum_switch(struct snd_opl3 *opl3, int note, int on_off, int vel, struct snd_midi_channel *chan); /* Prototypes for opl3_oss.c */ #ifdef CONFIG_SND_SEQUENCER_OSS -void snd_opl3_init_seq_oss(opl3_t *opl3, char *name); -void snd_opl3_free_seq_oss(opl3_t *opl3); +void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name); +void snd_opl3_free_seq_oss(struct snd_opl3 *opl3); #endif #endif diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c index 4ae5dd8..ddfc10d 100644 --- a/sound/drivers/opl4/opl4_lib.c +++ b/sound/drivers/opl4/opl4_lib.c @@ -27,14 +27,14 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_DESCRIPTION("OPL4 driver"); MODULE_LICENSE("GPL"); -static void inline snd_opl4_wait(opl4_t *opl4) +static void inline snd_opl4_wait(struct snd_opl4 *opl4) { int timeout = 10; while ((inb(opl4->fm_port) & OPL4_STATUS_BUSY) && --timeout > 0) ; } -void snd_opl4_write(opl4_t *opl4, u8 reg, u8 value) +void snd_opl4_write(struct snd_opl4 *opl4, u8 reg, u8 value) { snd_opl4_wait(opl4); outb(reg, opl4->pcm_port); @@ -43,7 +43,7 @@ void snd_opl4_write(opl4_t *opl4, u8 reg, u8 value) outb(value, opl4->pcm_port + 1); } -u8 snd_opl4_read(opl4_t *opl4, u8 reg) +u8 snd_opl4_read(struct snd_opl4 *opl4, u8 reg) { snd_opl4_wait(opl4); outb(reg, opl4->pcm_port); @@ -52,7 +52,7 @@ u8 snd_opl4_read(opl4_t *opl4, u8 reg) return inb(opl4->pcm_port + 1); } -void snd_opl4_read_memory(opl4_t *opl4, char *buf, int offset, int size) +void snd_opl4_read_memory(struct snd_opl4 *opl4, char *buf, int offset, int size) { unsigned long flags; u8 memcfg; @@ -76,7 +76,7 @@ void snd_opl4_read_memory(opl4_t *opl4, char *buf, int offset, int size) spin_unlock_irqrestore(&opl4->reg_lock, flags); } -void snd_opl4_write_memory(opl4_t *opl4, const char *buf, int offset, int size) +void snd_opl4_write_memory(struct snd_opl4 *opl4, const char *buf, int offset, int size) { unsigned long flags; u8 memcfg; @@ -100,7 +100,7 @@ void snd_opl4_write_memory(opl4_t *opl4, const char *buf, int offset, int size) spin_unlock_irqrestore(&opl4->reg_lock, flags); } -static void snd_opl4_enable_opl4(opl4_t *opl4) +static void snd_opl4_enable_opl4(struct snd_opl4 *opl4) { outb(OPL3_REG_MODE, opl4->fm_port + 2); inb(opl4->fm_port); @@ -110,7 +110,7 @@ static void snd_opl4_enable_opl4(opl4_t *opl4) inb(opl4->fm_port); } -static int snd_opl4_detect(opl4_t *opl4) +static int snd_opl4_detect(struct snd_opl4 *opl4) { u8 id1, id2; @@ -144,19 +144,19 @@ static int snd_opl4_detect(opl4_t *opl4) } #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) -static void snd_opl4_seq_dev_free(snd_seq_device_t *seq_dev) +static void snd_opl4_seq_dev_free(struct snd_seq_device *seq_dev) { - opl4_t *opl4 = seq_dev->private_data; + struct snd_opl4 *opl4 = seq_dev->private_data; opl4->seq_dev = NULL; } -static int snd_opl4_create_seq_dev(opl4_t *opl4, int seq_device) +static int snd_opl4_create_seq_dev(struct snd_opl4 *opl4, int seq_device) { opl4->seq_dev_num = seq_device; if (snd_seq_device_new(opl4->card, seq_device, SNDRV_SEQ_DEV_ID_OPL4, - sizeof(opl4_t *), &opl4->seq_dev) >= 0) { + sizeof(struct snd_opl4 *), &opl4->seq_dev) >= 0) { strcpy(opl4->seq_dev->name, "OPL4 Wavetable"); - *(opl4_t **)SNDRV_SEQ_DEVICE_ARGPTR(opl4->seq_dev) = opl4; + *(struct snd_opl4 **)SNDRV_SEQ_DEVICE_ARGPTR(opl4->seq_dev) = opl4; opl4->seq_dev->private_data = opl4; opl4->seq_dev->private_free = snd_opl4_seq_dev_free; } @@ -164,7 +164,7 @@ static int snd_opl4_create_seq_dev(opl4_t *opl4, int seq_device) } #endif -static void snd_opl4_free(opl4_t *opl4) +static void snd_opl4_free(struct snd_opl4 *opl4) { #ifdef CONFIG_PROC_FS snd_opl4_free_proc(opl4); @@ -174,22 +174,22 @@ static void snd_opl4_free(opl4_t *opl4) kfree(opl4); } -static int snd_opl4_dev_free(snd_device_t *device) +static int snd_opl4_dev_free(struct snd_device *device) { - opl4_t *opl4 = device->device_data; + struct snd_opl4 *opl4 = device->device_data; snd_opl4_free(opl4); return 0; } -int snd_opl4_create(snd_card_t *card, +int snd_opl4_create(struct snd_card *card, unsigned long fm_port, unsigned long pcm_port, int seq_device, - opl3_t **ropl3, opl4_t **ropl4) + struct snd_opl3 **ropl3, struct snd_opl4 **ropl4) { - opl4_t *opl4; - opl3_t *opl3; + struct snd_opl4 *opl4; + struct snd_opl3 *opl3; int err; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_opl4_dev_free }; diff --git a/sound/drivers/opl4/opl4_local.h b/sound/drivers/opl4/opl4_local.h index c455680..7e088a4 100644 --- a/sound/drivers/opl4/opl4_local.h +++ b/sound/drivers/opl4/opl4_local.h @@ -131,7 +131,7 @@ #define SNDRV_SEQ_DEV_ID_OPL4 "opl4-synth" -typedef struct opl4_sound { +struct opl4_sound { u16 tone; s16 pitch_offset; u8 key_scaling; @@ -144,42 +144,42 @@ typedef struct opl4_sound { u8 reg_level_decay2; u8 reg_release_correction; u8 reg_tremolo; -} opl4_sound_t; +}; -typedef struct opl4_region { +struct opl4_region { u8 key_min, key_max; - opl4_sound_t sound; -} opl4_region_t; + struct opl4_sound sound; +}; -typedef struct opl4_region_ptr { +struct opl4_region_ptr { int count; - const opl4_region_t *regions; -} opl4_region_ptr_t; + const struct opl4_region *regions; +}; -typedef struct opl4_voice { +struct opl4_voice { struct list_head list; int number; - snd_midi_channel_t *chan; + struct snd_midi_channel *chan; int note; int velocity; - const opl4_sound_t *sound; + const struct opl4_sound *sound; u8 level_direct; u8 reg_f_number; u8 reg_misc; u8 reg_lfo_vibrato; -} opl4_voice_t; +}; -struct opl4 { +struct snd_opl4 { unsigned long fm_port; unsigned long pcm_port; struct resource *res_fm_port; struct resource *res_pcm_port; unsigned short hardware; spinlock_t reg_lock; - snd_card_t *card; + struct snd_card *card; #ifdef CONFIG_PROC_FS - snd_info_entry_t *proc_entry; + struct snd_info_entry *proc_entry; int memory_access; #endif struct semaphore access_mutex; @@ -189,44 +189,44 @@ struct opl4 { int seq_dev_num; int seq_client; - snd_seq_device_t *seq_dev; + struct snd_seq_device *seq_dev; - snd_midi_channel_set_t *chset; - opl4_voice_t voices[OPL4_MAX_VOICES]; + struct snd_midi_channel_set *chset; + struct opl4_voice voices[OPL4_MAX_VOICES]; struct list_head off_voices; struct list_head on_voices; #endif }; /* opl4_lib.c */ -void snd_opl4_write(opl4_t *opl4, u8 reg, u8 value); -u8 snd_opl4_read(opl4_t *opl4, u8 reg); -void snd_opl4_read_memory(opl4_t *opl4, char *buf, int offset, int size); -void snd_opl4_write_memory(opl4_t *opl4, const char *buf, int offset, int size); +void snd_opl4_write(struct snd_opl4 *opl4, u8 reg, u8 value); +u8 snd_opl4_read(struct snd_opl4 *opl4, u8 reg); +void snd_opl4_read_memory(struct snd_opl4 *opl4, char *buf, int offset, int size); +void snd_opl4_write_memory(struct snd_opl4 *opl4, const char *buf, int offset, int size); /* opl4_mixer.c */ -int snd_opl4_create_mixer(opl4_t *opl4); +int snd_opl4_create_mixer(struct snd_opl4 *opl4); #ifdef CONFIG_PROC_FS /* opl4_proc.c */ -int snd_opl4_create_proc(opl4_t *opl4); -void snd_opl4_free_proc(opl4_t *opl4); +int snd_opl4_create_proc(struct snd_opl4 *opl4); +void snd_opl4_free_proc(struct snd_opl4 *opl4); #endif /* opl4_seq.c */ extern int volume_boost; /* opl4_synth.c */ -void snd_opl4_synth_reset(opl4_t *opl4); -void snd_opl4_synth_shutdown(opl4_t *opl4); -void snd_opl4_note_on(void *p, int note, int vel, snd_midi_channel_t *chan); -void snd_opl4_note_off(void *p, int note, int vel, snd_midi_channel_t *chan); -void snd_opl4_terminate_note(void *p, int note, snd_midi_channel_t *chan); -void snd_opl4_control(void *p, int type, snd_midi_channel_t *chan); -void snd_opl4_sysex(void *p, unsigned char *buf, int len, int parsed, snd_midi_channel_set_t *chset); +void snd_opl4_synth_reset(struct snd_opl4 *opl4); +void snd_opl4_synth_shutdown(struct snd_opl4 *opl4); +void snd_opl4_note_on(void *p, int note, int vel, struct snd_midi_channel *chan); +void snd_opl4_note_off(void *p, int note, int vel, struct snd_midi_channel *chan); +void snd_opl4_terminate_note(void *p, int note, struct snd_midi_channel *chan); +void snd_opl4_control(void *p, int type, struct snd_midi_channel *chan); +void snd_opl4_sysex(void *p, unsigned char *buf, int len, int parsed, struct snd_midi_channel_set *chset); /* yrw801.c */ -int snd_yrw801_detect(opl4_t *opl4); -extern const opl4_region_ptr_t snd_yrw801_regions[]; +int snd_yrw801_detect(struct snd_opl4 *opl4); +extern const struct opl4_region_ptr snd_yrw801_regions[]; #endif /* __OPL4_LOCAL_H */ diff --git a/sound/drivers/opl4/opl4_mixer.c b/sound/drivers/opl4/opl4_mixer.c index ec7a228..04079de4 100644 --- a/sound/drivers/opl4/opl4_mixer.c +++ b/sound/drivers/opl4/opl4_mixer.c @@ -20,7 +20,7 @@ #include "opl4_local.h" #include <sound/control.h> -static int snd_opl4_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int snd_opl4_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -29,9 +29,9 @@ static int snd_opl4_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf return 0; } -static int snd_opl4_ctl_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_opl4_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - opl4_t *opl4 = snd_kcontrol_chip(kcontrol); + struct snd_opl4 *opl4 = snd_kcontrol_chip(kcontrol); unsigned long flags; u8 reg = kcontrol->private_value; u8 value; @@ -44,9 +44,9 @@ static int snd_opl4_ctl_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon return 0; } -static int snd_opl4_ctl_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int snd_opl4_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - opl4_t *opl4 = snd_kcontrol_chip(kcontrol); + struct snd_opl4 *opl4 = snd_kcontrol_chip(kcontrol); unsigned long flags; u8 reg = kcontrol->private_value; u8 value, old_value; @@ -60,7 +60,7 @@ static int snd_opl4_ctl_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon return value != old_value; } -static snd_kcontrol_new_t snd_opl4_controls[] = { +static struct snd_kcontrol_new snd_opl4_controls[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "FM Playback Volume", @@ -79,9 +79,9 @@ static snd_kcontrol_new_t snd_opl4_controls[] = { } }; -int snd_opl4_create_mixer(opl4_t *opl4) +int snd_opl4_create_mixer(struct snd_opl4 *opl4) { - snd_card_t *card = opl4->card; + struct snd_card *card = opl4->card; int i, err; strcat(card->mixername, ",OPL4"); diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c index 6a14862..f4b4e74 100644 --- a/sound/drivers/opl4/opl4_proc.c +++ b/sound/drivers/opl4/opl4_proc.c @@ -23,10 +23,10 @@ #ifdef CONFIG_PROC_FS -static int snd_opl4_mem_proc_open(snd_info_entry_t *entry, +static int snd_opl4_mem_proc_open(struct snd_info_entry *entry, unsigned short mode, void **file_private_data) { - opl4_t *opl4 = entry->private_data; + struct snd_opl4 *opl4 = entry->private_data; down(&opl4->access_mutex); if (opl4->memory_access) { @@ -38,10 +38,10 @@ static int snd_opl4_mem_proc_open(snd_info_entry_t *entry, return 0; } -static int snd_opl4_mem_proc_release(snd_info_entry_t *entry, +static int snd_opl4_mem_proc_release(struct snd_info_entry *entry, unsigned short mode, void *file_private_data) { - opl4_t *opl4 = entry->private_data; + struct snd_opl4 *opl4 = entry->private_data; down(&opl4->access_mutex); opl4->memory_access--; @@ -49,11 +49,11 @@ static int snd_opl4_mem_proc_release(snd_info_entry_t *entry, return 0; } -static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_data, +static long snd_opl4_mem_proc_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *_buf, unsigned long count, unsigned long pos) { - opl4_t *opl4 = entry->private_data; + struct snd_opl4 *opl4 = entry->private_data; long size; char* buf; @@ -75,11 +75,11 @@ static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_d return 0; } -static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_data, +static long snd_opl4_mem_proc_write(struct snd_info_entry *entry, void *file_private_data, struct file *file, const char __user *_buf, unsigned long count, unsigned long pos) { - opl4_t *opl4 = entry->private_data; + struct snd_opl4 *opl4 = entry->private_data; long size; char *buf; @@ -101,7 +101,7 @@ static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_ return 0; } -static long long snd_opl4_mem_proc_llseek(snd_info_entry_t *entry, void *file_private_data, +static long long snd_opl4_mem_proc_llseek(struct snd_info_entry *entry, void *file_private_data, struct file *file, long long offset, int orig) { switch (orig) { @@ -130,9 +130,9 @@ static struct snd_info_entry_ops snd_opl4_mem_proc_ops = { .llseek = snd_opl4_mem_proc_llseek, }; -int snd_opl4_create_proc(opl4_t *opl4) +int snd_opl4_create_proc(struct snd_opl4 *opl4) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; entry = snd_info_create_card_entry(opl4->card, "opl4-mem", opl4->card->proc_root); if (entry) { @@ -157,7 +157,7 @@ int snd_opl4_create_proc(opl4_t *opl4) return 0; } -void snd_opl4_free_proc(opl4_t *opl4) +void snd_opl4_free_proc(struct snd_opl4 *opl4) { if (opl4->proc_entry) snd_info_unregister(opl4->proc_entry); diff --git a/sound/drivers/opl4/opl4_seq.c b/sound/drivers/opl4/opl4_seq.c index 958dfe8..e348032 100644 --- a/sound/drivers/opl4/opl4_seq.c +++ b/sound/drivers/opl4/opl4_seq.c @@ -45,21 +45,21 @@ int volume_boost = 8; module_param(volume_boost, int, 0644); MODULE_PARM_DESC(volume_boost, "Additional volume for OPL4 wavetable sounds."); -static int snd_opl4_seq_use_inc(opl4_t *opl4) +static int snd_opl4_seq_use_inc(struct snd_opl4 *opl4) { if (!try_module_get(opl4->card->module)) return -EFAULT; return 0; } -static void snd_opl4_seq_use_dec(opl4_t *opl4) +static void snd_opl4_seq_use_dec(struct snd_opl4 *opl4) { module_put(opl4->card->module); } -static int snd_opl4_seq_use(void *private_data, snd_seq_port_subscribe_t *info) +static int snd_opl4_seq_use(void *private_data, struct snd_seq_port_subscribe *info) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; int err; down(&opl4->access_mutex); @@ -84,9 +84,9 @@ static int snd_opl4_seq_use(void *private_data, snd_seq_port_subscribe_t *info) return 0; } -static int snd_opl4_seq_unuse(void *private_data, snd_seq_port_subscribe_t *info) +static int snd_opl4_seq_unuse(void *private_data, struct snd_seq_port_subscribe *info) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; snd_opl4_synth_shutdown(opl4); @@ -99,7 +99,7 @@ static int snd_opl4_seq_unuse(void *private_data, snd_seq_port_subscribe_t *info return 0; } -static snd_midi_op_t opl4_ops = { +static struct snd_midi_op opl4_ops = { .note_on = snd_opl4_note_on, .note_off = snd_opl4_note_off, .note_terminate = snd_opl4_terminate_note, @@ -107,10 +107,10 @@ static snd_midi_op_t opl4_ops = { .sysex = snd_opl4_sysex, }; -static int snd_opl4_seq_event_input(snd_seq_event_t *ev, int direct, +static int snd_opl4_seq_event_input(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; snd_midi_process_event(&opl4_ops, ev, opl4->chset); return 0; @@ -118,20 +118,18 @@ static int snd_opl4_seq_event_input(snd_seq_event_t *ev, int direct, static void snd_opl4_seq_free_port(void *private_data) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; snd_midi_channel_free_set(opl4->chset); } -static int snd_opl4_seq_new_device(snd_seq_device_t *dev) +static int snd_opl4_seq_new_device(struct snd_seq_device *dev) { - opl4_t *opl4; + struct snd_opl4 *opl4; int client; - snd_seq_client_callback_t callbacks; - snd_seq_client_info_t cinfo; - snd_seq_port_callback_t pcallbacks; + struct snd_seq_port_callback pcallbacks; - opl4 = *(opl4_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev); + opl4 = *(struct snd_opl4 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); if (!opl4) return -EINVAL; @@ -144,10 +142,8 @@ static int snd_opl4_seq_new_device(snd_seq_device_t *dev) opl4->chset->private_data = opl4; /* allocate new client */ - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.private_data = opl4; - callbacks.allow_output = callbacks.allow_input = 1; - client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num, &callbacks); + client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num, + "OPL4 Wavetable"); if (client < 0) { snd_midi_channel_free_set(opl4->chset); return client; @@ -155,13 +151,6 @@ static int snd_opl4_seq_new_device(snd_seq_device_t *dev) opl4->seq_client = client; opl4->chset->client = client; - /* change name of client */ - memset(&cinfo, 0, sizeof(cinfo)); - cinfo.client = client; - cinfo.type = KERNEL_CLIENT; - strcpy(cinfo.name, "OPL4 Wavetable"); - snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); - /* create new port */ memset(&pcallbacks, 0, sizeof(pcallbacks)); pcallbacks.owner = THIS_MODULE; @@ -188,11 +177,11 @@ static int snd_opl4_seq_new_device(snd_seq_device_t *dev) return 0; } -static int snd_opl4_seq_delete_device(snd_seq_device_t *dev) +static int snd_opl4_seq_delete_device(struct snd_seq_device *dev) { - opl4_t *opl4; + struct snd_opl4 *opl4; - opl4 = *(opl4_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev); + opl4 = *(struct snd_opl4 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); if (!opl4) return -EINVAL; @@ -205,13 +194,13 @@ static int snd_opl4_seq_delete_device(snd_seq_device_t *dev) static int __init alsa_opl4_synth_init(void) { - static snd_seq_dev_ops_t ops = { + static struct snd_seq_dev_ops ops = { snd_opl4_seq_new_device, snd_opl4_seq_delete_device }; return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_OPL4, &ops, - sizeof(opl4_t*)); + sizeof(struct snd_opl4 *)); } static void __exit alsa_opl4_synth_exit(void) diff --git a/sound/drivers/opl4/opl4_synth.c b/sound/drivers/opl4/opl4_synth.c index b146a1c99..74f6e53 100644 --- a/sound/drivers/opl4/opl4_synth.c +++ b/sound/drivers/opl4/opl4_synth.c @@ -270,7 +270,7 @@ static unsigned char snd_opl4_volume_table[128] = { /* * Initializes all voices. */ -void snd_opl4_synth_reset(opl4_t *opl4) +void snd_opl4_synth_reset(struct snd_opl4 *opl4) { unsigned long flags; int i; @@ -294,7 +294,7 @@ void snd_opl4_synth_reset(opl4_t *opl4) /* * Shuts down all voices. */ -void snd_opl4_synth_shutdown(opl4_t *opl4) +void snd_opl4_synth_shutdown(struct snd_opl4 *opl4) { unsigned long flags; int i; @@ -309,12 +309,12 @@ void snd_opl4_synth_shutdown(opl4_t *opl4) /* * Executes the callback for all voices playing the specified note. */ -static void snd_opl4_do_for_note(opl4_t *opl4, int note, snd_midi_channel_t *chan, - void (*func)(opl4_t *opl4, opl4_voice_t *voice)) +static void snd_opl4_do_for_note(struct snd_opl4 *opl4, int note, struct snd_midi_channel *chan, + void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) { int i; unsigned long flags; - opl4_voice_t *voice; + struct opl4_voice *voice; spin_lock_irqsave(&opl4->reg_lock, flags); for (i = 0; i < OPL4_MAX_VOICES; i++) { @@ -329,12 +329,13 @@ static void snd_opl4_do_for_note(opl4_t *opl4, int note, snd_midi_channel_t *cha /* * Executes the callback for all voices of to the specified channel. */ -static void snd_opl4_do_for_channel(opl4_t *opl4, snd_midi_channel_t *chan, - void (*func)(opl4_t *opl4, opl4_voice_t *voice)) +static void snd_opl4_do_for_channel(struct snd_opl4 *opl4, + struct snd_midi_channel *chan, + void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) { int i; unsigned long flags; - opl4_voice_t *voice; + struct opl4_voice *voice; spin_lock_irqsave(&opl4->reg_lock, flags); for (i = 0; i < OPL4_MAX_VOICES; i++) { @@ -349,12 +350,12 @@ static void snd_opl4_do_for_channel(opl4_t *opl4, snd_midi_channel_t *chan, /* * Executes the callback for all active voices. */ -static void snd_opl4_do_for_all(opl4_t *opl4, - void (*func)(opl4_t *opl4, opl4_voice_t *voice)) +static void snd_opl4_do_for_all(struct snd_opl4 *opl4, + void (*func)(struct snd_opl4 *opl4, struct opl4_voice *voice)) { int i; unsigned long flags; - opl4_voice_t *voice; + struct opl4_voice *voice; spin_lock_irqsave(&opl4->reg_lock, flags); for (i = 0; i < OPL4_MAX_VOICES; i++) { @@ -365,7 +366,7 @@ static void snd_opl4_do_for_all(opl4_t *opl4, spin_unlock_irqrestore(&opl4->reg_lock, flags); } -static void snd_opl4_update_volume(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_update_volume(struct snd_opl4 *opl4, struct opl4_voice *voice) { int att; @@ -384,7 +385,7 @@ static void snd_opl4_update_volume(opl4_t *opl4, opl4_voice_t *voice) voice->level_direct = 0; } -static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_update_pan(struct snd_opl4 *opl4, struct opl4_voice *voice) { int pan = voice->sound->panpot; @@ -399,7 +400,8 @@ static void snd_opl4_update_pan(opl4_t *opl4, opl4_voice_t *voice) snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); } -static void snd_opl4_update_vibrato_depth(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_update_vibrato_depth(struct snd_opl4 *opl4, + struct opl4_voice *voice) { int depth; @@ -414,9 +416,10 @@ static void snd_opl4_update_vibrato_depth(opl4_t *opl4, opl4_voice_t *voice) voice->reg_lfo_vibrato); } -static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_update_pitch(struct snd_opl4 *opl4, + struct opl4_voice *voice) { - snd_midi_channel_t *chan = voice->chan; + struct snd_midi_channel *chan = voice->chan; int note, pitch, octave; note = chan->drum_channel ? 60 : voice->note; @@ -444,7 +447,8 @@ static void snd_opl4_update_pitch(opl4_t *opl4, opl4_voice_t *voice) snd_opl4_write(opl4, OPL4_REG_F_NUMBER + voice->number, voice->reg_f_number); } -static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_update_tone_parameters(struct snd_opl4 *opl4, + struct opl4_voice *voice) { snd_opl4_write(opl4, OPL4_REG_ATTACK_DECAY1 + voice->number, voice->sound->reg_attack_decay1); @@ -457,17 +461,17 @@ static void snd_opl4_update_tone_parameters(opl4_t *opl4, opl4_voice_t *voice) } /* allocate one voice */ -static opl4_voice_t *snd_opl4_get_voice(opl4_t *opl4) +static struct opl4_voice *snd_opl4_get_voice(struct snd_opl4 *opl4) { /* first, try to get the oldest key-off voice */ if (!list_empty(&opl4->off_voices)) - return list_entry(opl4->off_voices.next, opl4_voice_t, list); + return list_entry(opl4->off_voices.next, struct opl4_voice, list); /* then get the oldest key-on voice */ snd_assert(!list_empty(&opl4->on_voices), ); - return list_entry(opl4->on_voices.next, opl4_voice_t, list); + return list_entry(opl4->on_voices.next, struct opl4_voice, list); } -static void snd_opl4_wait_for_wave_headers(opl4_t *opl4) +static void snd_opl4_wait_for_wave_headers(struct snd_opl4 *opl4) { int timeout = 200; @@ -475,12 +479,12 @@ static void snd_opl4_wait_for_wave_headers(opl4_t *opl4) udelay(10); } -void snd_opl4_note_on(void *private_data, int note, int vel, snd_midi_channel_t *chan) +void snd_opl4_note_on(void *private_data, int note, int vel, struct snd_midi_channel *chan) { - opl4_t *opl4 = private_data; - const opl4_region_ptr_t *regions; - opl4_voice_t *voice[2]; - const opl4_sound_t *sound[2]; + struct snd_opl4 *opl4 = private_data; + const struct opl4_region_ptr *regions; + struct opl4_voice *voice[2]; + const struct opl4_sound *sound[2]; int voices = 0, i; unsigned long flags; @@ -549,7 +553,7 @@ void snd_opl4_note_on(void *private_data, int note, int vel, snd_midi_channel_t spin_unlock_irqrestore(&opl4->reg_lock, flags); } -static void snd_opl4_voice_off(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_voice_off(struct snd_opl4 *opl4, struct opl4_voice *voice) { list_del(&voice->list); list_add_tail(&voice->list, &opl4->off_voices); @@ -558,14 +562,14 @@ static void snd_opl4_voice_off(opl4_t *opl4, opl4_voice_t *voice) snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); } -void snd_opl4_note_off(void *private_data, int note, int vel, snd_midi_channel_t *chan) +void snd_opl4_note_off(void *private_data, int note, int vel, struct snd_midi_channel *chan) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; snd_opl4_do_for_note(opl4, note, chan, snd_opl4_voice_off); } -static void snd_opl4_terminate_voice(opl4_t *opl4, opl4_voice_t *voice) +static void snd_opl4_terminate_voice(struct snd_opl4 *opl4, struct opl4_voice *voice) { list_del(&voice->list); list_add_tail(&voice->list, &opl4->off_voices); @@ -574,16 +578,16 @@ static void snd_opl4_terminate_voice(opl4_t *opl4, opl4_voice_t *voice) snd_opl4_write(opl4, OPL4_REG_MISC + voice->number, voice->reg_misc); } -void snd_opl4_terminate_note(void *private_data, int note, snd_midi_channel_t *chan) +void snd_opl4_terminate_note(void *private_data, int note, struct snd_midi_channel *chan) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; snd_opl4_do_for_note(opl4, note, chan, snd_opl4_terminate_voice); } -void snd_opl4_control(void *private_data, int type, snd_midi_channel_t *chan) +void snd_opl4_control(void *private_data, int type, struct snd_midi_channel *chan) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; switch (type) { case MIDI_CTL_MSB_MODWHEEL: @@ -621,9 +625,9 @@ void snd_opl4_control(void *private_data, int type, snd_midi_channel_t *chan) } void snd_opl4_sysex(void *private_data, unsigned char *buf, int len, - int parsed, snd_midi_channel_set_t *chset) + int parsed, struct snd_midi_channel_set *chset) { - opl4_t *opl4 = private_data; + struct snd_opl4 *opl4 = private_data; if (parsed == SNDRV_MIDI_SYSEX_GS_MASTER_VOLUME) snd_opl4_do_for_all(opl4, snd_opl4_update_volume); diff --git a/sound/drivers/opl4/yrw801.c b/sound/drivers/opl4/yrw801.c index a51174d..6c33549 100644 --- a/sound/drivers/opl4/yrw801.c +++ b/sound/drivers/opl4/yrw801.c @@ -33,7 +33,7 @@ #include "opl4_local.h" -int snd_yrw801_detect(opl4_t *opl4) +int snd_yrw801_detect(struct snd_opl4 *opl4) { char buf[15]; @@ -54,7 +54,7 @@ int snd_yrw801_detect(opl4_t *opl4) * by this driver. */ -static const opl4_region_t regions_00[] = { /* Acoustic Grand Piano */ +static const struct opl4_region regions_00[] = { /* Acoustic Grand Piano */ {0x14, 0x27, {0x12c,7474,100, 0,0,0x00,0xc8,0x20,0xf2,0x13,0x08,0x0}}, {0x28, 0x2d, {0x12d,6816,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}}, {0x2e, 0x33, {0x12e,5899,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}}, @@ -66,7 +66,7 @@ static const opl4_region_t regions_00[] = { /* Acoustic Grand Piano */ {0x53, 0x58, {0x134,1444,100, 0,0,0x07,0xc8,0x20,0xf3,0x14,0x18,0x0}}, {0x59, 0x6d, {0x135,1915,100, 0,0,0x00,0xc8,0x20,0xf4,0x15,0x08,0x0}} }; -static const opl4_region_t regions_01[] = { /* Bright Acoustic Piano */ +static const struct opl4_region regions_01[] = { /* Bright Acoustic Piano */ {0x14, 0x2d, {0x12c,7474,100, 0,0,0x00,0xc8,0x20,0xf2,0x13,0x08,0x0}}, {0x2e, 0x33, {0x12d,6816,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}}, {0x34, 0x39, {0x12e,5899,100, 0,0,0x00,0xc8,0x20,0xf2,0x14,0x08,0x0}}, @@ -78,7 +78,7 @@ static const opl4_region_t regions_01[] = { /* Bright Acoustic Piano */ {0x59, 0x5e, {0x134,1444,100, 0,0,0x0a,0xc8,0x20,0xf3,0x14,0x18,0x0}}, {0x5f, 0x6d, {0x135,1915,100, 0,0,0x00,0xc8,0x20,0xf4,0x15,0x08,0x0}} }; -static const opl4_region_t regions_02[] = { /* Electric Grand Piano */ +static const struct opl4_region regions_02[] = { /* Electric Grand Piano */ {0x14, 0x2d, {0x12c,7476,100, 1,0,0x00,0xae,0x20,0xf2,0x13,0x07,0x0}}, {0x2e, 0x33, {0x12d,6818,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}}, {0x34, 0x39, {0x12e,5901,100, 1,0,0x00,0xae,0x20,0xf2,0x14,0x07,0x0}}, @@ -91,7 +91,7 @@ static const opl4_region_t regions_02[] = { /* Electric Grand Piano */ {0x5f, 0x6d, {0x135,1917,100, 1,0,0x00,0xae,0x20,0xf4,0x15,0x07,0x0}}, {0x00, 0x7f, {0x06c,6375,100,-1,0,0x00,0xc2,0x28,0xf4,0x23,0x18,0x0}} }; -static const opl4_region_t regions_03[] = { /* Honky-Tonk Piano */ +static const struct opl4_region regions_03[] = { /* Honky-Tonk Piano */ {0x14, 0x27, {0x12c,7474,100, 0,0,0x00,0xb4,0x20,0xf2,0x13,0x08,0x0}}, {0x28, 0x2d, {0x12d,6816,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}}, {0x2e, 0x33, {0x12e,5899,100, 0,0,0x00,0xb4,0x20,0xf2,0x14,0x08,0x0}}, @@ -113,11 +113,11 @@ static const opl4_region_t regions_03[] = { /* Honky-Tonk Piano */ {0x53, 0x58, {0x134,1457,100, 0,0,0x01,0xb4,0x20,0xf3,0x14,0x18,0x0}}, {0x59, 0x6d, {0x135,1903,100, 0,0,0x00,0xb4,0x20,0xf4,0x15,0x08,0x0}} }; -static const opl4_region_t regions_04[] = { /* Electric Piano 1 */ +static const struct opl4_region regions_04[] = { /* Electric Piano 1 */ {0x15, 0x6c, {0x00b,6570,100, 0,0,0x00,0x28,0x38,0xf0,0x00,0x0c,0x0}}, {0x00, 0x7f, {0x06c,6375,100, 0,2,0x00,0xb0,0x22,0xf4,0x23,0x19,0x0}} }; -static const opl4_region_t regions_05[] = { /* Electric Piano 2 */ +static const struct opl4_region regions_05[] = { /* Electric Piano 2 */ {0x14, 0x27, {0x12c,7476,100, 0,3,0x00,0xa2,0x1b,0xf2,0x13,0x08,0x0}}, {0x28, 0x2d, {0x12d,6818,100, 0,3,0x00,0xa2,0x1b,0xf2,0x14,0x08,0x0}}, {0x2e, 0x33, {0x12e,5901,100, 0,3,0x00,0xa2,0x1b,0xf2,0x14,0x08,0x0}}, @@ -139,103 +139,103 @@ static const opl4_region_t regions_05[] = { /* Electric Piano 2 */ {0x59, 0x5e, {0x134,1442,100, 0,0,0x0a,0xa2,0x18,0xf3,0x14,0x18,0x0}}, {0x5f, 0x6d, {0x135,1913,100, 0,0,0x00,0xa2,0x18,0xf4,0x15,0x08,0x0}} }; -static const opl4_region_t regions_06[] = { /* Harpsichord */ +static const struct opl4_region regions_06[] = { /* Harpsichord */ {0x15, 0x39, {0x080,5158,100, 0,0,0x00,0xb2,0x20,0xf5,0x24,0x19,0x0}}, {0x3a, 0x3f, {0x081,4408,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x09,0x0}}, {0x40, 0x45, {0x082,3622,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x09,0x0}}, {0x46, 0x4d, {0x083,2843,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x19,0x0}}, {0x4e, 0x6c, {0x084,1307,100, 0,0,0x00,0xb2,0x20,0xf5,0x25,0x29,0x0}} }; -static const opl4_region_t regions_07[] = { /* Clavinet */ +static const struct opl4_region regions_07[] = { /* Clavinet */ {0x15, 0x51, {0x027,5009,100, 0,0,0x00,0xd2,0x28,0xf5,0x13,0x2b,0x0}}, {0x52, 0x6c, {0x028,3495,100, 0,0,0x00,0xd2,0x28,0xf5,0x13,0x3b,0x0}} }; -static const opl4_region_t regions_08[] = { /* Celesta */ +static const struct opl4_region regions_08[] = { /* Celesta */ {0x15, 0x6c, {0x02b,3267,100, 0,0,0x00,0xdc,0x20,0xf4,0x15,0x07,0x3}} }; -static const opl4_region_t regions_09[] = { /* Glockenspiel */ +static const struct opl4_region regions_09[] = { /* Glockenspiel */ {0x15, 0x78, {0x0f3, 285,100, 0,0,0x00,0xc2,0x28,0xf6,0x25,0x25,0x0}} }; -static const opl4_region_t regions_0a[] = { /* Music Box */ +static const struct opl4_region regions_0a[] = { /* Music Box */ {0x15, 0x6c, {0x0f3,3362,100, 0,0,0x00,0xb6,0x20,0xa6,0x25,0x25,0x0}}, {0x15, 0x6c, {0x101,4773,100, 0,0,0x00,0xaa,0x20,0xd4,0x14,0x16,0x0}} }; -static const opl4_region_t regions_0b[] = { /* Vibraphone */ +static const struct opl4_region regions_0b[] = { /* Vibraphone */ {0x15, 0x6c, {0x101,4778,100, 0,0,0x00,0xc0,0x28,0xf4,0x14,0x16,0x4}} }; -static const opl4_region_t regions_0c[] = { /* Marimba */ +static const struct opl4_region regions_0c[] = { /* Marimba */ {0x15, 0x3f, {0x0f4,4778,100, 0,0,0x00,0xc4,0x38,0xf7,0x47,0x08,0x0}}, {0x40, 0x4c, {0x0f5,3217,100, 0,0,0x00,0xc4,0x38,0xf7,0x47,0x08,0x0}}, {0x4d, 0x5a, {0x0f5,3217,100, 0,0,0x00,0xc4,0x38,0xf7,0x48,0x08,0x0}}, {0x5b, 0x7f, {0x0f5,3218,100, 0,0,0x00,0xc4,0x38,0xf7,0x48,0x18,0x0}} }; -static const opl4_region_t regions_0d[] = { /* Xylophone */ +static const struct opl4_region regions_0d[] = { /* Xylophone */ {0x00, 0x7f, {0x136,1729,100, 0,0,0x00,0xd2,0x38,0xf0,0x06,0x36,0x0}} }; -static const opl4_region_t regions_0e[] = { /* Tubular Bell */ +static const struct opl4_region regions_0e[] = { /* Tubular Bell */ {0x01, 0x7f, {0x0ff,3999,100, 0,1,0x00,0x90,0x21,0xf4,0xa3,0x25,0x1}} }; -static const opl4_region_t regions_0f[] = { /* Dulcimer */ +static const struct opl4_region regions_0f[] = { /* Dulcimer */ {0x00, 0x7f, {0x03f,4236,100, 0,1,0x00,0xbc,0x29,0xf5,0x16,0x07,0x0}}, {0x00, 0x7f, {0x040,4236,100, 0,2,0x0e,0x94,0x2a,0xf5,0x16,0x07,0x0}} }; -static const opl4_region_t regions_10[] = { /* Drawbar Organ */ +static const struct opl4_region regions_10[] = { /* Drawbar Organ */ {0x01, 0x7f, {0x08e,4394,100, 0,2,0x14,0xc2,0x3a,0xf0,0x00,0x0a,0x0}} }; -static const opl4_region_t regions_11[] = { /* Percussive Organ */ +static const struct opl4_region regions_11[] = { /* Percussive Organ */ {0x15, 0x3b, {0x08c,6062,100, 0,3,0x00,0xbe,0x3b,0xf0,0x00,0x09,0x0}}, {0x3c, 0x6c, {0x08d,2984,100, 0,3,0x00,0xbe,0x3b,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_12[] = { /* Rock Organ */ +static const struct opl4_region regions_12[] = { /* Rock Organ */ {0x15, 0x30, {0x128,6574,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}}, {0x31, 0x3c, {0x129,5040,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}}, {0x3d, 0x48, {0x12a,3498,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}}, {0x49, 0x54, {0x12b,1957,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}}, {0x55, 0x6c, {0x127, 423,100, 0,1,0x00,0xcc,0x39,0xf0,0x00,0x0a,0x0}} }; -static const opl4_region_t regions_13[] = { /* Church Organ */ +static const struct opl4_region regions_13[] = { /* Church Organ */ {0x15, 0x29, {0x087,7466,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}}, {0x2a, 0x30, {0x088,6456,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}}, {0x31, 0x38, {0x089,5428,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}}, {0x39, 0x41, {0x08a,4408,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}}, {0x42, 0x6c, {0x08b,3406,100, 0,1,0x00,0xc4,0x11,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_14[] = { /* Reed Organ */ +static const struct opl4_region regions_14[] = { /* Reed Organ */ {0x00, 0x53, {0x0ac,5570,100, 0,0,0x06,0xc0,0x38,0xf0,0x00,0x09,0x1}}, {0x54, 0x7f, {0x0ad,2497,100, 0,0,0x00,0xc0,0x38,0xf0,0x00,0x09,0x1}} }; -static const opl4_region_t regions_15[] = { /* Accordion */ +static const struct opl4_region regions_15[] = { /* Accordion */ {0x15, 0x4c, {0x006,4261,100, 0,2,0x00,0xa4,0x22,0x90,0x00,0x09,0x0}}, {0x4d, 0x6c, {0x007,1530,100, 0,2,0x00,0xa4,0x22,0x90,0x00,0x09,0x0}}, {0x15, 0x6c, {0x070,4391,100, 0,3,0x00,0x8a,0x23,0xa0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_16[] = { /* Harmonica */ +static const struct opl4_region regions_16[] = { /* Harmonica */ {0x15, 0x6c, {0x070,4408,100, 0,0,0x00,0xae,0x30,0xa0,0x00,0x09,0x2}} }; -static const opl4_region_t regions_17[] = { /* Tango Accordion */ +static const struct opl4_region regions_17[] = { /* Tango Accordion */ {0x00, 0x53, {0x0ac,5573,100, 0,0,0x00,0xae,0x38,0xf0,0x00,0x09,0x0}}, {0x54, 0x7f, {0x0ad,2500,100, 0,0,0x00,0xae,0x38,0xf0,0x00,0x09,0x0}}, {0x15, 0x6c, {0x041,8479,100, 0,2,0x00,0x6a,0x3a,0x75,0x20,0x0a,0x0}} }; -static const opl4_region_t regions_18[] = { /* Nylon Guitar */ +static const struct opl4_region regions_18[] = { /* Nylon Guitar */ {0x15, 0x2f, {0x0b3,6964,100, 0,0,0x05,0xca,0x28,0xf5,0x34,0x09,0x0}}, {0x30, 0x36, {0x0b7,5567,100, 0,0,0x0c,0xca,0x28,0xf5,0x34,0x09,0x0}}, {0x37, 0x3c, {0x0b5,4653,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}}, {0x3d, 0x43, {0x0b4,3892,100, 0,0,0x00,0xca,0x28,0xf6,0x35,0x09,0x0}}, {0x44, 0x60, {0x0b6,2723,100, 0,0,0x00,0xca,0x28,0xf6,0x35,0x19,0x0}} }; -static const opl4_region_t regions_19[] = { /* Steel Guitar */ +static const struct opl4_region regions_19[] = { /* Steel Guitar */ {0x15, 0x31, {0x00c,6937,100, 0,0,0x00,0xbc,0x28,0xf0,0x04,0x19,0x0}}, {0x32, 0x38, {0x00d,5410,100, 0,0,0x00,0xbc,0x28,0xf0,0x05,0x09,0x0}}, {0x39, 0x47, {0x00e,4379,100, 0,0,0x00,0xbc,0x28,0xf5,0x94,0x09,0x0}}, {0x48, 0x6c, {0x00f,2843,100, 0,0,0x00,0xbc,0x28,0xf6,0x95,0x09,0x0}} }; -static const opl4_region_t regions_1a[] = { /* Jazz Guitar */ +static const struct opl4_region regions_1a[] = { /* Jazz Guitar */ {0x15, 0x31, {0x05a,6832,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}}, {0x32, 0x3f, {0x05b,4897,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}}, {0x40, 0x6c, {0x05c,3218,100, 0,0,0x00,0xca,0x28,0xf6,0x34,0x09,0x0}} }; -static const opl4_region_t regions_1b[] = { /* Clean Guitar */ +static const struct opl4_region regions_1b[] = { /* Clean Guitar */ {0x15, 0x2c, {0x061,7053,100, 0,1,0x00,0xb4,0x29,0xf5,0x54,0x0a,0x0}}, {0x2d, 0x31, {0x060,6434,100, 0,1,0x00,0xb4,0x29,0xf5,0x54,0x0a,0x0}}, {0x32, 0x38, {0x063,5764,100, 0,1,0x00,0xbe,0x29,0xf5,0x55,0x0a,0x0}}, @@ -245,14 +245,14 @@ static const opl4_region_t regions_1b[] = { /* Clean Guitar */ {0x4c, 0x54, {0x066,2462,100, 0,1,0x00,0xb4,0x29,0xf5,0x55,0x2a,0x0}}, {0x55, 0x6c, {0x067,1307,100, 0,1,0x00,0xb4,0x29,0xf6,0x56,0x0a,0x0}} }; -static const opl4_region_t regions_1c[] = { /* Muted Guitar */ +static const struct opl4_region regions_1c[] = { /* Muted Guitar */ {0x01, 0x7f, {0x068,4408,100, 0,0,0x00,0xcc,0x28,0xf6,0x15,0x09,0x0}} }; -static const opl4_region_t regions_1d[] = { /* Overdriven Guitar */ +static const struct opl4_region regions_1d[] = { /* Overdriven Guitar */ {0x00, 0x40, {0x0a5,6589,100, 0,1,0x00,0xc0,0x29,0xf2,0x11,0x09,0x0}}, {0x41, 0x7f, {0x0a6,5428,100, 0,1,0x00,0xc0,0x29,0xf2,0x11,0x09,0x0}} }; -static const opl4_region_t regions_1e[] = { /* Distortion Guitar */ +static const struct opl4_region regions_1e[] = { /* Distortion Guitar */ {0x15, 0x2a, {0x051,6928,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}}, {0x2b, 0x2e, {0x052,6433,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}}, {0x2f, 0x32, {0x053,5944,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}}, @@ -263,44 +263,44 @@ static const opl4_region_t regions_1e[] = { /* Distortion Guitar */ {0x43, 0x46, {0x058,3361,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}}, {0x47, 0x6c, {0x059,2784,100, 0,1,0x00,0xbc,0x21,0xa2,0x12,0x0a,0x0}} }; -static const opl4_region_t regions_1f[] = { /* Guitar Harmonics */ +static const struct opl4_region regions_1f[] = { /* Guitar Harmonics */ {0x15, 0x44, {0x05e,5499,100, 0,0,0x00,0xce,0x28,0xf4,0x24,0x09,0x0}}, {0x45, 0x49, {0x05d,4850,100, 0,0,0x00,0xe2,0x28,0xf4,0x24,0x09,0x0}}, {0x4a, 0x6c, {0x05f,4259,100, 0,0,0x00,0xce,0x28,0xf4,0x24,0x09,0x0}} }; -static const opl4_region_t regions_20[] = { /* Acoustic Bass */ +static const struct opl4_region regions_20[] = { /* Acoustic Bass */ {0x15, 0x30, {0x004,8053,100, 0,0,0x00,0xe2,0x18,0xf5,0x15,0x09,0x0}}, {0x31, 0x6c, {0x005,4754,100, 0,0,0x00,0xe2,0x18,0xf5,0x15,0x09,0x0}} }; -static const opl4_region_t regions_21[] = { /* Fingered Bass */ +static const struct opl4_region regions_21[] = { /* Fingered Bass */ {0x01, 0x20, {0x04a,8762,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}}, {0x21, 0x25, {0x04b,8114,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}}, {0x26, 0x2a, {0x04c,7475,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}}, {0x2b, 0x7f, {0x04d,6841,100, 0,0,0x00,0xde,0x18,0xf6,0x14,0x09,0x0}} }; -static const opl4_region_t regions_22[] = { /* Picked Bass */ +static const struct opl4_region regions_22[] = { /* Picked Bass */ {0x15, 0x23, {0x04f,7954,100, 0,0,0x00,0xcc,0x18,0xf3,0x90,0x0a,0x0}}, {0x24, 0x2a, {0x050,7318,100, 0,0,0x05,0xcc,0x18,0xf3,0x90,0x1a,0x0}}, {0x2b, 0x2f, {0x06b,6654,100, 0,0,0x00,0xcc,0x18,0xf3,0x90,0x2a,0x0}}, {0x30, 0x47, {0x069,6031,100, 0,0,0x00,0xcc,0x18,0xf5,0xb0,0x0a,0x0}}, {0x48, 0x6c, {0x06a,5393,100, 0,0,0x00,0xcc,0x18,0xf5,0xb0,0x0a,0x0}} }; -static const opl4_region_t regions_23[] = { /* Fretless Bass */ +static const struct opl4_region regions_23[] = { /* Fretless Bass */ {0x01, 0x7f, {0x04e,5297,100, 0,0,0x00,0xd2,0x10,0xf3,0x63,0x19,0x0}} }; -static const opl4_region_t regions_24[] = { /* Slap Bass 1 */ +static const struct opl4_region regions_24[] = { /* Slap Bass 1 */ {0x15, 0x6c, {0x0a3,7606,100, 0,1,0x00,0xde,0x19,0xf5,0x32,0x1a,0x0}} }; -static const opl4_region_t regions_25[] = { /* Slap Bass 2 */ +static const struct opl4_region regions_25[] = { /* Slap Bass 2 */ {0x01, 0x7f, {0x0a2,6694,100, 0,0,0x00,0xda,0x20,0xb0,0x02,0x09,0x0}} }; -static const opl4_region_t regions_26[] = { /* Synth Bass 1 */ +static const struct opl4_region regions_26[] = { /* Synth Bass 1 */ {0x15, 0x6c, {0x0be,7466,100, 0,1,0x00,0xb8,0x39,0xf4,0x14,0x09,0x0}} }; -static const opl4_region_t regions_27[] = { /* Synth Bass 2 */ +static const struct opl4_region regions_27[] = { /* Synth Bass 2 */ {0x00, 0x7f, {0x117,8103,100, 0,1,0x00,0xca,0x39,0xf3,0x50,0x08,0x0}} }; -static const opl4_region_t regions_28[] = { /* Violin */ +static const struct opl4_region regions_28[] = { /* Violin */ {0x15, 0x3a, {0x105,5158,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}}, {0x3b, 0x3f, {0x102,4754,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}}, {0x40, 0x41, {0x106,4132,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}}, @@ -312,7 +312,7 @@ static const opl4_region_t regions_28[] = { /* Violin */ {0x4f, 0x51, {0x10d,2166,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}}, {0x52, 0x6c, {0x109,1825,100, 0,3,0x00,0xcc,0x3b,0xf3,0x20,0x09,0x0}} }; -static const opl4_region_t regions_29[] = { /* Viola */ +static const struct opl4_region regions_29[] = { /* Viola */ {0x15, 0x32, {0x103,5780,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}}, {0x33, 0x35, {0x104,5534,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}}, {0x36, 0x38, {0x105,5158,100, 0,3,0x00,0xc4,0x3b,0xa3,0x20,0x09,0x0}}, @@ -326,76 +326,76 @@ static const opl4_region_t regions_29[] = { /* Viola */ {0x4d, 0x4f, {0x10d,2166,100, 0,3,0x00,0xd0,0x3b,0xa3,0x20,0x09,0x0}}, {0x50, 0x6c, {0x109,1825,100, 0,3,0x00,0xd0,0x3b,0xa3,0x20,0x09,0x0}} }; -static const opl4_region_t regions_2a[] = { /* Cello */ +static const struct opl4_region regions_2a[] = { /* Cello */ {0x15, 0x2d, {0x112,6545,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x08,0x0}}, {0x2e, 0x37, {0x113,5764,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x08,0x0}}, {0x38, 0x3e, {0x115,4378,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x18,0x0}}, {0x3f, 0x44, {0x116,3998,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x18,0x0}}, {0x45, 0x6c, {0x114,3218,100, 0,3,0x00,0xc0,0x33,0xa0,0x00,0x18,0x0}} }; -static const opl4_region_t regions_2b[] = { /* Contrabass */ +static const struct opl4_region regions_2b[] = { /* Contrabass */ {0x15, 0x29, {0x110,7713,100, 0,1,0x00,0xc2,0x19,0x90,0x00,0x09,0x0}}, {0x2a, 0x6c, {0x111,6162,100, 0,1,0x00,0xc2,0x19,0x90,0x00,0x09,0x0}} }; -static const opl4_region_t regions_2c[] = { /* Tremolo Strings */ +static const struct opl4_region regions_2c[] = { /* Tremolo Strings */ {0x15, 0x3b, {0x0b0,4810,100, 0,0,0x0a,0xde,0x38,0xf0,0x00,0x07,0x6}}, {0x3c, 0x41, {0x035,4035,100, 0,0,0x05,0xde,0x38,0xf0,0x00,0x07,0x6}}, {0x42, 0x47, {0x033,3129,100, 0,0,0x05,0xde,0x38,0xf0,0x00,0x07,0x6}}, {0x48, 0x52, {0x034,2625,100, 0,0,0x05,0xde,0x38,0xf0,0x00,0x07,0x6}}, {0x53, 0x6c, {0x0af, 936,100, 0,0,0x00,0xde,0x38,0xf0,0x00,0x07,0x6}} }; -static const opl4_region_t regions_2d[] = { /* Pizzicato Strings */ +static const struct opl4_region regions_2d[] = { /* Pizzicato Strings */ {0x15, 0x32, {0x0b8,6186,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}}, {0x33, 0x3b, {0x0b9,5031,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}}, {0x3c, 0x42, {0x0bb,4146,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}}, {0x43, 0x48, {0x0ba,3245,100, 0,0,0x00,0xc2,0x28,0xf0,0x00,0x05,0x0}}, {0x49, 0x6c, {0x0bc,2352,100, 0,0,0x00,0xbc,0x28,0xf0,0x00,0x05,0x0}} }; -static const opl4_region_t regions_2e[] = { /* Harp */ +static const struct opl4_region regions_2e[] = { /* Harp */ {0x15, 0x46, {0x07e,3740,100, 0,1,0x00,0xd2,0x29,0xf5,0x25,0x07,0x0}}, {0x47, 0x6c, {0x07f,2319,100, 0,1,0x00,0xd2,0x29,0xf5,0x25,0x07,0x0}} }; -static const opl4_region_t regions_2f[] = { /* Timpani */ +static const struct opl4_region regions_2f[] = { /* Timpani */ {0x15, 0x6c, {0x100,6570,100, 0,0,0x00,0xf8,0x28,0xf0,0x05,0x16,0x0}} }; -static const opl4_region_t regions_30[] = { /* Strings */ +static const struct opl4_region regions_30[] = { /* Strings */ {0x15, 0x3b, {0x13c,4806,100, 0,0,0x00,0xc8,0x20,0x80,0x00,0x07,0x0}}, {0x3c, 0x41, {0x13e,4035,100, 0,0,0x00,0xc8,0x20,0x80,0x00,0x07,0x0}}, {0x42, 0x47, {0x13d,3122,100, 0,0,0x00,0xc8,0x20,0x80,0x00,0x07,0x0}}, {0x48, 0x52, {0x13f,2629,100, 0,0,0x00,0xbe,0x20,0x80,0x00,0x07,0x0}}, {0x53, 0x6c, {0x140, 950,100, 0,0,0x00,0xbe,0x20,0x80,0x00,0x07,0x0}} }; -static const opl4_region_t regions_31[] = { /* Slow Strings */ +static const struct opl4_region regions_31[] = { /* Slow Strings */ {0x15, 0x3b, {0x0b0,4810,100, 0,1,0x0a,0xbe,0x19,0xf0,0x00,0x07,0x0}}, {0x3c, 0x41, {0x035,4035,100, 0,1,0x05,0xbe,0x19,0xf0,0x00,0x07,0x0}}, {0x42, 0x47, {0x033,3129,100, 0,1,0x05,0xbe,0x19,0xf0,0x00,0x07,0x0}}, {0x48, 0x52, {0x034,2625,100, 0,1,0x05,0xbe,0x19,0xf0,0x00,0x07,0x0}}, {0x53, 0x6c, {0x0af, 936,100, 0,1,0x00,0xbe,0x19,0xf0,0x00,0x07,0x0}} }; -static const opl4_region_t regions_32[] = { /* Synth Strings 1 */ +static const struct opl4_region regions_32[] = { /* Synth Strings 1 */ {0x05, 0x71, {0x002,6045,100,-2,0,0x00,0xa6,0x20,0x93,0x22,0x06,0x0}}, {0x15, 0x6c, {0x0ae,3261,100, 2,0,0x00,0xc6,0x20,0x70,0x01,0x06,0x0}} }; -static const opl4_region_t regions_33[] = { /* Synth Strings 2 */ +static const struct opl4_region regions_33[] = { /* Synth Strings 2 */ {0x15, 0x6c, {0x002,4513,100, 5,1,0x00,0xb4,0x19,0x70,0x00,0x06,0x0}}, {0x15, 0x6c, {0x002,4501,100,-5,1,0x00,0xb4,0x19,0x70,0x00,0x06,0x0}} }; -static const opl4_region_t regions_34[] = { /* Choir Aahs */ +static const struct opl4_region regions_34[] = { /* Choir Aahs */ {0x15, 0x3a, {0x018,5010,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}}, {0x3b, 0x40, {0x019,4370,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}}, {0x41, 0x47, {0x01a,3478,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}}, {0x48, 0x6c, {0x01b,2197,100, 0,2,0x00,0xc2,0x1a,0x70,0x00,0x08,0x0}} }; -static const opl4_region_t regions_35[] = { /* Voice Oohs */ +static const struct opl4_region regions_35[] = { /* Voice Oohs */ {0x15, 0x6c, {0x029,3596,100, 0,0,0x00,0xe6,0x20,0xf7,0x20,0x08,0x0}} }; -static const opl4_region_t regions_36[] = { /* Synth Voice */ +static const struct opl4_region regions_36[] = { /* Synth Voice */ {0x15, 0x6c, {0x02a,3482,100, 0,1,0x00,0xc2,0x19,0x85,0x21,0x07,0x0}} }; -static const opl4_region_t regions_37[] = { /* Orchestra Hit */ +static const struct opl4_region regions_37[] = { /* Orchestra Hit */ {0x15, 0x6c, {0x049,4394,100, 0,0,0x00,0xfe,0x30,0x80,0x05,0x05,0x0}} }; -static const opl4_region_t regions_38[] = { /* Trumpet */ +static const struct opl4_region regions_38[] = { /* Trumpet */ {0x15, 0x3c, {0x0f6,4706,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}}, {0x3d, 0x43, {0x0f8,3894,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}}, {0x44, 0x48, {0x0f7,3118,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}}, @@ -403,28 +403,28 @@ static const opl4_region_t regions_38[] = { /* Trumpet */ {0x4f, 0x55, {0x0f9,1634,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}}, {0x56, 0x6c, {0x0fb, 786,100, 0,2,0x00,0xd6,0x32,0xf3,0x20,0x0a,0x0}} }; -static const opl4_region_t regions_39[] = { /* Trombone */ +static const struct opl4_region regions_39[] = { /* Trombone */ {0x15, 0x3a, {0x0f0,5053,100, 0,1,0x00,0xd6,0x21,0xf0,0x00,0x09,0x0}}, {0x3b, 0x3f, {0x0f1,4290,100, 0,1,0x00,0xd6,0x21,0xf0,0x00,0x09,0x0}}, {0x40, 0x6c, {0x0f2,3580,100, 0,1,0x00,0xd6,0x21,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_3a[] = { /* Tuba */ +static const struct opl4_region regions_3a[] = { /* Tuba */ {0x15, 0x2d, {0x085,7096,100, 0,1,0x00,0xde,0x21,0xf5,0x10,0x09,0x0}}, {0x2e, 0x6c, {0x086,6014,100, 0,1,0x00,0xde,0x21,0xf5,0x10,0x09,0x0}} }; -static const opl4_region_t regions_3b[] = { /* Muted Trumpet */ +static const struct opl4_region regions_3b[] = { /* Muted Trumpet */ {0x15, 0x45, {0x0b1,4135,100, 0,0,0x00,0xcc,0x28,0xf3,0x10,0x0a,0x1}}, {0x46, 0x6c, {0x0b2,2599,100, 0,0,0x00,0xcc,0x28,0x83,0x10,0x0a,0x1}} }; -static const opl4_region_t regions_3c[] = { /* French Horns */ +static const struct opl4_region regions_3c[] = { /* French Horns */ {0x15, 0x49, {0x07c,3624,100, 0,2,0x00,0xd0,0x1a,0xf0,0x00,0x09,0x0}}, {0x4a, 0x6c, {0x07d,2664,100, 0,2,0x00,0xd0,0x1a,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_3d[] = { /* Brass Section */ +static const struct opl4_region regions_3d[] = { /* Brass Section */ {0x15, 0x42, {0x0fc,4375,100, 0,0,0x00,0xd6,0x28,0xf0,0x00,0x0a,0x0}}, {0x43, 0x6c, {0x0fd,2854,100, 0,0,0x00,0xd6,0x28,0xf0,0x00,0x0a,0x0}} }; -static const opl4_region_t regions_3e[] = { /* Synth Brass 1 */ +static const struct opl4_region regions_3e[] = { /* Synth Brass 1 */ {0x01, 0x27, {0x0d3,9094,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}}, {0x28, 0x2d, {0x0da,8335,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}}, {0x2e, 0x33, {0x0d4,7558,100,-1,0,0x00,0xbe,0x18,0xa5,0x11,0x08,0x0}}, @@ -450,7 +450,7 @@ static const opl4_region_t regions_3e[] = { /* Synth Brass 1 */ {0x5e, 0x64, {0x122,1421,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}}, {0x65, 0x7f, {0x123,-115,100, 1,1,0x00,0xbe,0x19,0x85,0x23,0x08,0x0}} }; -static const opl4_region_t regions_3f[] = { /* Synth Brass 2 */ +static const struct opl4_region regions_3f[] = { /* Synth Brass 2 */ {0x01, 0x27, {0x118,9113,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}}, {0x28, 0x2d, {0x119,8350,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}}, {0x2e, 0x33, {0x11a,7575,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}}, @@ -465,7 +465,7 @@ static const opl4_region_t regions_3f[] = { /* Synth Brass 2 */ {0x65, 0x7f, {0x123,-105,100, 3,6,0x00,0xae,0x26,0x85,0x23,0x08,0x0}}, {0x00, 0x7f, {0x124,4034,100,-3,2,0x00,0xea,0x22,0x85,0x23,0x08,0x0}} }; -static const opl4_region_t regions_40[] = { /* Soprano Sax */ +static const struct opl4_region regions_40[] = { /* Soprano Sax */ {0x15, 0x3f, {0x0e3,4228,100, 0,1,0x00,0xc8,0x21,0xf5,0x20,0x0a,0x0}}, {0x40, 0x45, {0x0e4,3495,100, 0,1,0x00,0xc8,0x21,0xf5,0x20,0x0a,0x0}}, {0x46, 0x4b, {0x0e5,2660,100, 0,1,0x00,0xd6,0x21,0xf5,0x20,0x0a,0x0}}, @@ -473,7 +473,7 @@ static const opl4_region_t regions_40[] = { /* Soprano Sax */ {0x52, 0x59, {0x0e7,1186,100, 0,1,0x00,0xd6,0x21,0xf5,0x20,0x0a,0x0}}, {0x59, 0x6c, {0x0e8,1730,100, 0,1,0x00,0xc8,0x21,0xf5,0x20,0x0a,0x0}} }; -static const opl4_region_t regions_41[] = { /* Alto Sax */ +static const struct opl4_region regions_41[] = { /* Alto Sax */ {0x15, 0x32, {0x092,6204,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}}, {0x33, 0x35, {0x096,5812,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}}, {0x36, 0x3a, {0x099,5318,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}}, @@ -488,7 +488,7 @@ static const opl4_region_t regions_41[] = { /* Alto Sax */ {0x51, 0x53, {0x091,2088,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}}, {0x54, 0x6c, {0x095,1732,100, 0,1,0x00,0xbe,0x19,0xf5,0x20,0x0b,0x0}} }; -static const opl4_region_t regions_42[] = { /* Tenor Sax */ +static const struct opl4_region regions_42[] = { /* Tenor Sax */ {0x24, 0x30, {0x0e9,6301,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}}, {0x31, 0x34, {0x0ea,5781,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}}, {0x35, 0x3a, {0x0eb,5053,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}}, @@ -497,13 +497,13 @@ static const opl4_region_t regions_42[] = { /* Tenor Sax */ {0x48, 0x51, {0x0ee,2462,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}}, {0x52, 0x6c, {0x0ef,1421,100, 0,1,0x00,0xbc,0x19,0xf4,0x10,0x0b,0x0}} }; -static const opl4_region_t regions_43[] = { /* Baritone Sax */ +static const struct opl4_region regions_43[] = { /* Baritone Sax */ {0x15, 0x2d, {0x0df,6714,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}}, {0x2e, 0x34, {0x0e1,5552,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}}, {0x35, 0x39, {0x0e2,5178,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}}, {0x3a, 0x6c, {0x0e0,4437,100, 0,1,0x00,0xce,0x19,0xf0,0x00,0x0a,0x0}} }; -static const opl4_region_t regions_44[] = { /* Oboe */ +static const struct opl4_region regions_44[] = { /* Oboe */ {0x15, 0x3c, {0x042,4493,100, 0,1,0x00,0xe6,0x39,0xf4,0x10,0x0a,0x0}}, {0x3d, 0x43, {0x044,3702,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}}, {0x44, 0x49, {0x043,2956,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}}, @@ -511,55 +511,55 @@ static const opl4_region_t regions_44[] = { /* Oboe */ {0x50, 0x55, {0x045,1420,100, 0,1,0x00,0xdc,0x39,0xf4,0x10,0x0a,0x0}}, {0x56, 0x6c, {0x047, 630,100, 0,1,0x00,0xe6,0x39,0xf4,0x10,0x0a,0x0}} }; -static const opl4_region_t regions_45[] = { /* English Horn */ +static const struct opl4_region regions_45[] = { /* English Horn */ {0x15, 0x38, {0x03c,5098,100, 0,1,0x00,0xc4,0x31,0xf0,0x00,0x09,0x0}}, {0x39, 0x3e, {0x03b,4291,100, 0,1,0x00,0xc4,0x31,0xf0,0x00,0x09,0x0}}, {0x3f, 0x6c, {0x03d,3540,100, 0,1,0x00,0xc4,0x31,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_46[] = { /* Bassoon */ +static const struct opl4_region regions_46[] = { /* Bassoon */ {0x15, 0x22, {0x038,7833,100, 0,1,0x00,0xc6,0x31,0xf0,0x00,0x0b,0x0}}, {0x23, 0x2e, {0x03a,7070,100, 0,1,0x00,0xc6,0x31,0xf0,0x00,0x0b,0x0}}, {0x2f, 0x6c, {0x039,6302,100, 0,1,0x00,0xc6,0x31,0xf0,0x00,0x0b,0x0}} }; -static const opl4_region_t regions_47[] = { /* Clarinet */ +static const struct opl4_region regions_47[] = { /* Clarinet */ {0x15, 0x3b, {0x09e,5900,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}}, {0x3c, 0x41, {0x0a0,5158,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}}, {0x42, 0x4a, {0x09f,4260,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}}, {0x4b, 0x6c, {0x0a1,2957,100, 0,1,0x00,0xc8,0x29,0xf3,0x20,0x0a,0x0}} }; -static const opl4_region_t regions_48[] = { /* Piccolo */ +static const struct opl4_region regions_48[] = { /* Piccolo */ {0x15, 0x40, {0x071,4803,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}}, {0x41, 0x4d, {0x072,3314,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}}, {0x4e, 0x53, {0x073,1731,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}}, {0x54, 0x5f, {0x074,2085,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}}, {0x60, 0x6c, {0x075,1421,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}} }; -static const opl4_region_t regions_49[] = { /* Flute */ +static const struct opl4_region regions_49[] = { /* Flute */ {0x15, 0x40, {0x071,4803,100, 0,0,0x00,0xdc,0x38,0xf0,0x00,0x0a,0x2}}, {0x41, 0x4d, {0x072,3314,100, 0,0,0x00,0xdc,0x38,0xf0,0x00,0x0a,0x2}}, {0x4e, 0x6c, {0x073,1731,100, 0,0,0x00,0xe6,0x38,0xf0,0x00,0x0a,0x2}} }; -static const opl4_region_t regions_4a[] = { /* Recorder */ +static const struct opl4_region regions_4a[] = { /* Recorder */ {0x15, 0x6f, {0x0bd,4897,100, 0,0,0x00,0xec,0x30,0x70,0x00,0x09,0x1}} }; -static const opl4_region_t regions_4b[] = { /* Pan Flute */ +static const struct opl4_region regions_4b[] = { /* Pan Flute */ {0x15, 0x6c, {0x077,2359,100, 0,0,0x00,0xde,0x38,0xf0,0x00,0x09,0x3}} }; -static const opl4_region_t regions_4c[] = { /* Bottle Blow */ +static const struct opl4_region regions_4c[] = { /* Bottle Blow */ {0x15, 0x6c, {0x077,2359,100, 0,0,0x00,0xc8,0x38,0xf0,0x00,0x09,0x1}}, {0x01, 0x7f, {0x125,7372,100, 0,0,0x1e,0x80,0x00,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_4d[] = { /* Shakuhachi */ +static const struct opl4_region regions_4d[] = { /* Shakuhachi */ {0x00, 0x7f, {0x0ab,4548,100, 0,0,0x00,0xd6,0x30,0xf0,0x00,0x0a,0x3}}, {0x15, 0x6c, {0x076,3716,100, 0,0,0x00,0xa2,0x28,0x70,0x00,0x09,0x2}} }; -static const opl4_region_t regions_4e[] = { /* Whistle */ +static const struct opl4_region regions_4e[] = { /* Whistle */ {0x00, 0x7f, {0x0aa,1731,100, 0,4,0x00,0xd2,0x2c,0x70,0x00,0x0a,0x0}} }; -static const opl4_region_t regions_4f[] = { /* Ocarina */ +static const struct opl4_region regions_4f[] = { /* Ocarina */ {0x00, 0x7f, {0x0aa,1731,100, 0,1,0x00,0xce,0x29,0x90,0x00,0x0a,0x1}} }; -static const opl4_region_t regions_50[] = { /* Square Lead */ +static const struct opl4_region regions_50[] = { /* Square Lead */ {0x01, 0x2a, {0x0cc,9853,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}}, {0x2b, 0x36, {0x0cd,6785,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}}, {0x37, 0x42, {0x0ca,5248,100, 3,0,0x00,0xac,0x38,0xc6,0x21,0x09,0x0}}, @@ -573,7 +573,7 @@ static const opl4_region_t regions_50[] = { /* Square Lead */ {0x4f, 0x5a, {0x0ce,2167,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}}, {0x5b, 0x7f, {0x0cb, 631,100,-3,0,0x00,0xac,0x08,0xc6,0x21,0x09,0x0}} }; -static const opl4_region_t regions_51[] = { /* Sawtooth Lead */ +static const struct opl4_region regions_51[] = { /* Sawtooth Lead */ {0x01, 0x27, {0x118,9108,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}}, {0x28, 0x2d, {0x119,8345,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}}, {0x2e, 0x33, {0x11a,7570,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}}, @@ -599,15 +599,15 @@ static const opl4_region_t regions_51[] = { /* Sawtooth Lead */ {0x5e, 0x66, {0x122,1416,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}}, {0x67, 0x7f, {0x123,-120,100, 0,0,0x00,0xc8,0x30,0xf2,0x22,0x0a,0x0}} }; -static const opl4_region_t regions_52[] = { /* Calliope Lead */ +static const struct opl4_region regions_52[] = { /* Calliope Lead */ {0x00, 0x7f, {0x0aa,1731,100, 0,0,0x00,0xc2,0x28,0x90,0x00,0x0a,0x2}}, {0x15, 0x6c, {0x076,3716,100, 0,0,0x00,0xb6,0x28,0xb0,0x00,0x09,0x2}} }; -static const opl4_region_t regions_53[] = { /* Chiffer Lead */ +static const struct opl4_region regions_53[] = { /* Chiffer Lead */ {0x00, 0x7f, {0x13a,3665,100, 0,2,0x00,0xcc,0x2a,0xf0,0x10,0x09,0x1}}, {0x01, 0x7f, {0x0fe,3660,100, 0,0,0x00,0xbe,0x28,0xf3,0x10,0x17,0x0}} }; -static const opl4_region_t regions_54[] = { /* Charang Lead */ +static const struct opl4_region regions_54[] = { /* Charang Lead */ {0x00, 0x40, {0x0a5,6594,100, 0,3,0x00,0xba,0x33,0xf2,0x11,0x09,0x0}}, {0x41, 0x7f, {0x0a6,5433,100, 0,3,0x00,0xba,0x33,0xf2,0x11,0x09,0x0}}, {0x01, 0x27, {0x118,9098,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}}, @@ -623,11 +623,11 @@ static const opl4_region_t regions_54[] = { /* Charang Lead */ {0x5e, 0x66, {0x122,1416,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}}, {0x67, 0x7f, {0x123,-120,100, 0,2,0x00,0xa4,0x2a,0xf2,0x22,0x0e,0x0}} }; -static const opl4_region_t regions_55[] = { /* Voice Lead */ +static const struct opl4_region regions_55[] = { /* Voice Lead */ {0x00, 0x7f, {0x0aa,1739,100, 0,6,0x00,0x8c,0x2e,0x90,0x00,0x0a,0x0}}, {0x15, 0x6c, {0x02a,3474,100, 0,1,0x00,0xd8,0x29,0xf0,0x05,0x0a,0x0}} }; -static const opl4_region_t regions_56[] = { /* 5ths Lead */ +static const struct opl4_region regions_56[] = { /* 5ths Lead */ {0x01, 0x27, {0x118,8468,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}}, {0x28, 0x2d, {0x119,7705,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}}, {0x2e, 0x33, {0x11a,6930,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}}, @@ -642,7 +642,7 @@ static const opl4_region_t regions_56[] = { /* 5ths Lead */ {0x65, 0x7f, {0x123,-750,100, 0,2,0x00,0xd0,0x32,0xf5,0x20,0x08,0x0}}, {0x05, 0x71, {0x002,4503,100, 0,1,0x00,0xb8,0x31,0xb3,0x20,0x0b,0x0}} }; -static const opl4_region_t regions_57[] = { /* Bass & Lead */ +static const struct opl4_region regions_57[] = { /* Bass & Lead */ {0x00, 0x7f, {0x117,8109,100, 0,1,0x00,0xbc,0x29,0xf3,0x50,0x08,0x0}}, {0x01, 0x27, {0x118,9097,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}}, {0x28, 0x2d, {0x119,8334,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}}, @@ -657,15 +657,15 @@ static const opl4_region_t regions_57[] = { /* Bass & Lead */ {0x5e, 0x66, {0x122,1415,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}}, {0x67, 0x7f, {0x123,-121,100, 0,2,0x00,0xbc,0x2a,0xf2,0x20,0x0a,0x0}} }; -static const opl4_region_t regions_58[] = { /* New Age Pad */ +static const struct opl4_region regions_58[] = { /* New Age Pad */ {0x15, 0x6c, {0x002,4501,100, 0,4,0x00,0xa4,0x24,0x80,0x01,0x05,0x0}}, {0x15, 0x6c, {0x0f3,4253,100, 0,3,0x00,0x8c,0x23,0xa2,0x14,0x06,0x1}} }; -static const opl4_region_t regions_59[] = { /* Warm Pad */ +static const struct opl4_region regions_59[] = { /* Warm Pad */ {0x15, 0x6c, {0x04e,5306,100, 2,2,0x00,0x92,0x2a,0x34,0x23,0x05,0x2}}, {0x15, 0x6c, {0x029,3575,100,-2,2,0x00,0xbe,0x22,0x31,0x23,0x06,0x0}} }; -static const opl4_region_t regions_5a[] = { /* Polysynth Pad */ +static const struct opl4_region regions_5a[] = { /* Polysynth Pad */ {0x01, 0x27, {0x118,9111,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}}, {0x28, 0x2d, {0x119,8348,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}}, {0x2e, 0x33, {0x11a,7573,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}}, @@ -680,29 +680,29 @@ static const opl4_region_t regions_5a[] = { /* Polysynth Pad */ {0x67, 0x7f, {0x123,-107,100, 0,3,0x00,0xae,0x23,0xf2,0x20,0x07,0x1}}, {0x00, 0x7f, {0x124,4024,100, 0,2,0x00,0xae,0x22,0xe5,0x20,0x08,0x0}} }; -static const opl4_region_t regions_5b[] = { /* Choir Pad */ +static const struct opl4_region regions_5b[] = { /* Choir Pad */ {0x15, 0x3a, {0x018,5010,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}}, {0x3b, 0x40, {0x019,4370,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}}, {0x41, 0x47, {0x01a,3478,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}}, {0x48, 0x6c, {0x01b,2197,100, 0,5,0x00,0xb0,0x25,0x70,0x00,0x06,0x0}}, {0x15, 0x6c, {0x02a,3482,100, 0,4,0x00,0x98,0x24,0x65,0x21,0x06,0x0}} }; -static const opl4_region_t regions_5c[] = { /* Bowed Pad */ +static const struct opl4_region regions_5c[] = { /* Bowed Pad */ {0x15, 0x6c, {0x101,4790,100,-1,1,0x00,0xbe,0x19,0x44,0x14,0x16,0x0}}, {0x00, 0x7f, {0x0aa,1720,100, 1,1,0x00,0x94,0x19,0x40,0x00,0x06,0x0}} }; -static const opl4_region_t regions_5d[] = { /* Metallic Pad */ +static const struct opl4_region regions_5d[] = { /* Metallic Pad */ {0x15, 0x31, {0x00c,6943,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}}, {0x32, 0x38, {0x00d,5416,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}}, {0x39, 0x47, {0x00e,4385,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}}, {0x48, 0x6c, {0x00f,2849,100, 0,2,0x00,0xa0,0x0a,0x60,0x03,0x06,0x0}}, {0x00, 0x7f, {0x03f,4224,100, 0,1,0x00,0x9c,0x31,0x65,0x16,0x07,0x0}} }; -static const opl4_region_t regions_5e[] = { /* Halo Pad */ +static const struct opl4_region regions_5e[] = { /* Halo Pad */ {0x00, 0x7f, {0x124,4038,100, 0,2,0x00,0xa6,0x1a,0x85,0x23,0x08,0x0}}, {0x15, 0x6c, {0x02a,3471,100, 0,3,0x00,0xc0,0x1b,0xc0,0x05,0x06,0x0}} }; -static const opl4_region_t regions_5f[] = { /* Sweep Pad */ +static const struct opl4_region regions_5f[] = { /* Sweep Pad */ {0x01, 0x27, {0x0d3,9100,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}}, {0x28, 0x2d, {0x0da,8341,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}}, {0x2e, 0x33, {0x0d4,7564,100, 0,1,0x00,0xce,0x19,0x13,0x11,0x06,0x0}}, @@ -728,21 +728,21 @@ static const opl4_region_t regions_5f[] = { /* Sweep Pad */ {0x5e, 0x63, {0x0d8,1415,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}}, {0x64, 0x7f, {0x0d9,-121,100, 0,0,0x00,0xce,0x18,0x13,0x11,0x06,0x0}} }; -static const opl4_region_t regions_60[] = { /* Ice Rain */ +static const struct opl4_region regions_60[] = { /* Ice Rain */ {0x01, 0x7f, {0x04e,9345,100, 0,2,0x00,0xcc,0x22,0xa3,0x63,0x17,0x0}}, {0x00, 0x7f, {0x143,5586, 20, 0,2,0x00,0x6e,0x2a,0xf0,0x05,0x05,0x0}} }; -static const opl4_region_t regions_61[] = { /* Soundtrack */ +static const struct opl4_region regions_61[] = { /* Soundtrack */ {0x15, 0x6c, {0x002,4501,100, 0,2,0x00,0xb6,0x2a,0x60,0x01,0x05,0x0}}, {0x15, 0x6c, {0x0f3,1160,100, 0,5,0x00,0xa8,0x2d,0x52,0x14,0x06,0x2}} }; -static const opl4_region_t regions_62[] = { /* Crystal */ +static const struct opl4_region regions_62[] = { /* Crystal */ {0x15, 0x6c, {0x0f3,1826,100, 0,3,0x00,0xb8,0x33,0xf6,0x25,0x25,0x0}}, {0x15, 0x2c, {0x06d,7454,100, 0,3,0x00,0xac,0x3b,0x85,0x24,0x06,0x0}}, {0x2d, 0x36, {0x06e,5925,100, 0,3,0x00,0xac,0x3b,0x85,0x24,0x06,0x0}}, {0x37, 0x6c, {0x06f,4403,100, 0,3,0x09,0xac,0x3b,0x85,0x24,0x06,0x0}} }; -static const opl4_region_t regions_63[] = { /* Atmosphere */ +static const struct opl4_region regions_63[] = { /* Atmosphere */ {0x05, 0x71, {0x002,4509,100, 0,2,0x00,0xc8,0x32,0x73,0x22,0x06,0x1}}, {0x15, 0x2f, {0x0b3,6964,100, 0,2,0x05,0xc2,0x32,0xf5,0x34,0x07,0x2}}, {0x30, 0x36, {0x0b7,5567,100, 0,2,0x0c,0xc2,0x32,0xf5,0x34,0x07,0x2}}, @@ -750,29 +750,29 @@ static const opl4_region_t regions_63[] = { /* Atmosphere */ {0x3d, 0x43, {0x0b4,3892,100, 0,2,0x00,0xc2,0x32,0xf6,0x35,0x07,0x2}}, {0x44, 0x60, {0x0b6,2723,100, 0,2,0x00,0xc2,0x32,0xf6,0x35,0x17,0x2}} }; -static const opl4_region_t regions_64[] = { /* Brightness */ +static const struct opl4_region regions_64[] = { /* Brightness */ {0x00, 0x7f, {0x137,5285,100, 0,2,0x00,0xbe,0x2a,0xa5,0x18,0x08,0x0}}, {0x15, 0x6c, {0x02a,3481,100, 0,1,0x00,0xc8,0x29,0x80,0x05,0x05,0x0}} }; -static const opl4_region_t regions_65[] = { /* Goblins */ +static const struct opl4_region regions_65[] = { /* Goblins */ {0x15, 0x6c, {0x002,4501,100,-1,2,0x00,0xca,0x2a,0x40,0x01,0x05,0x0}}, {0x15, 0x6c, {0x009,9679, 20, 1,4,0x00,0x3c,0x0c,0x22,0x11,0x06,0x0}} }; -static const opl4_region_t regions_66[] = { /* Echoes */ +static const struct opl4_region regions_66[] = { /* Echoes */ {0x15, 0x6c, {0x02a,3487,100, 0,3,0x00,0xae,0x2b,0xf5,0x21,0x06,0x0}}, {0x00, 0x7f, {0x124,4027,100, 0,3,0x00,0xae,0x2b,0x85,0x23,0x07,0x0}} }; -static const opl4_region_t regions_67[] = { /* Sci-Fi */ +static const struct opl4_region regions_67[] = { /* Sci-Fi */ {0x15, 0x31, {0x00c,6940,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}}, {0x32, 0x38, {0x00d,5413,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}}, {0x39, 0x47, {0x00e,4382,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}}, {0x48, 0x6c, {0x00f,2846,100, 0,3,0x00,0xc8,0x2b,0x90,0x05,0x06,0x3}}, {0x15, 0x6c, {0x002,4498,100, 0,2,0x00,0xd4,0x22,0x80,0x01,0x05,0x0}} }; -static const opl4_region_t regions_68[] = { /* Sitar */ +static const struct opl4_region regions_68[] = { /* Sitar */ {0x00, 0x7f, {0x10f,4408,100, 0,2,0x00,0xc4,0x32,0xf4,0x15,0x16,0x1}} }; -static const opl4_region_t regions_69[] = { /* Banjo */ +static const struct opl4_region regions_69[] = { /* Banjo */ {0x15, 0x34, {0x013,5685,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}}, {0x35, 0x38, {0x014,5009,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}}, {0x39, 0x3c, {0x012,4520,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}}, @@ -780,21 +780,21 @@ static const opl4_region_t regions_69[] = { /* Banjo */ {0x45, 0x4c, {0x017,2661,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}}, {0x4d, 0x6d, {0x016,1632,100, 0,0,0x00,0xdc,0x38,0xf6,0x15,0x09,0x0}} }; -static const opl4_region_t regions_6a[] = { /* Shamisen */ +static const struct opl4_region regions_6a[] = { /* Shamisen */ {0x15, 0x6c, {0x10e,3273,100, 0,0,0x00,0xc0,0x28,0xf7,0x76,0x08,0x0}} }; -static const opl4_region_t regions_6b[] = { /* Koto */ +static const struct opl4_region regions_6b[] = { /* Koto */ {0x00, 0x7f, {0x0a9,4033,100, 0,0,0x00,0xc6,0x20,0xf0,0x06,0x07,0x0}} }; -static const opl4_region_t regions_6c[] = { /* Kalimba */ +static const struct opl4_region regions_6c[] = { /* Kalimba */ {0x00, 0x7f, {0x137,3749,100, 0,0,0x00,0xce,0x38,0xf5,0x18,0x08,0x0}} }; -static const opl4_region_t regions_6d[] = { /* Bagpipe */ +static const struct opl4_region regions_6d[] = { /* Bagpipe */ {0x15, 0x39, {0x0a4,7683,100, 0,4,0x00,0xc0,0x1c,0xf0,0x00,0x09,0x0}}, {0x15, 0x39, {0x0a7,7680,100, 0,1,0x00,0xaa,0x19,0xf0,0x00,0x09,0x0}}, {0x3a, 0x6c, {0x0a8,3697,100, 0,1,0x00,0xaa,0x19,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_6e[] = { /* Fiddle */ +static const struct opl4_region regions_6e[] = { /* Fiddle */ {0x15, 0x3a, {0x105,5158,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}}, {0x3b, 0x3f, {0x102,4754,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}}, {0x40, 0x41, {0x106,4132,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}}, @@ -806,64 +806,64 @@ static const opl4_region_t regions_6e[] = { /* Fiddle */ {0x4f, 0x51, {0x10d,2166,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}}, {0x52, 0x6c, {0x109,1825,100, 0,1,0x00,0xca,0x31,0xf3,0x20,0x09,0x0}} }; -static const opl4_region_t regions_6f[] = { /* Shanai */ +static const struct opl4_region regions_6f[] = { /* Shanai */ {0x15, 0x6c, {0x041,6946,100, 0,1,0x00,0xc4,0x31,0x95,0x20,0x09,0x0}} }; -static const opl4_region_t regions_70[] = { /* Tinkle Bell */ +static const struct opl4_region regions_70[] = { /* Tinkle Bell */ {0x15, 0x73, {0x0f3,1821,100, 0,3,0x00,0xc8,0x3b,0xd6,0x25,0x25,0x0}}, {0x00, 0x7f, {0x137,5669,100, 0,3,0x00,0x66,0x3b,0xf5,0x18,0x08,0x0}} }; -static const opl4_region_t regions_71[] = { /* Agogo */ +static const struct opl4_region regions_71[] = { /* Agogo */ {0x15, 0x74, {0x00b,2474,100, 0,0,0x00,0xd2,0x38,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_72[] = { /* Steel Drums */ +static const struct opl4_region regions_72[] = { /* Steel Drums */ {0x01, 0x7f, {0x0fe,3670,100, 0,0,0x00,0xca,0x38,0xf3,0x06,0x17,0x1}}, {0x15, 0x6c, {0x100,9602,100, 0,0,0x00,0x54,0x38,0xb0,0x05,0x16,0x1}} }; -static const opl4_region_t regions_73[] = { /* Woodblock */ +static const struct opl4_region regions_73[] = { /* Woodblock */ {0x15, 0x6c, {0x02c,2963, 50, 0,0,0x07,0xd4,0x00,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_74[] = { /* Taiko Drum */ +static const struct opl4_region regions_74[] = { /* Taiko Drum */ {0x13, 0x6c, {0x03e,1194, 50, 0,0,0x00,0xaa,0x38,0xf0,0x04,0x04,0x0}} }; -static const opl4_region_t regions_75[] = { /* Melodic Tom */ +static const struct opl4_region regions_75[] = { /* Melodic Tom */ {0x15, 0x6c, {0x0c7,6418, 50, 0,0,0x00,0xe4,0x38,0xf0,0x05,0x01,0x0}} }; -static const opl4_region_t regions_76[] = { /* Synth Drum */ +static const struct opl4_region regions_76[] = { /* Synth Drum */ {0x15, 0x6c, {0x026,3898, 50, 0,0,0x00,0xd0,0x38,0xf0,0x04,0x04,0x0}} }; -static const opl4_region_t regions_77[] = { /* Reverse Cymbal */ +static const struct opl4_region regions_77[] = { /* Reverse Cymbal */ {0x15, 0x6c, {0x031,4138, 50, 0,0,0x00,0xfe,0x38,0x3a,0xf0,0x09,0x0}} }; -static const opl4_region_t regions_78[] = { /* Guitar Fret Noise */ +static const struct opl4_region regions_78[] = { /* Guitar Fret Noise */ {0x15, 0x6c, {0x138,5266,100, 0,0,0x00,0xa0,0x38,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_79[] = { /* Breath Noise */ +static const struct opl4_region regions_79[] = { /* Breath Noise */ {0x01, 0x7f, {0x125,4269,100, 0,0,0x1e,0xd0,0x38,0xf0,0x00,0x09,0x0}} }; -static const opl4_region_t regions_7a[] = { /* Seashore */ +static const struct opl4_region regions_7a[] = { /* Seashore */ {0x15, 0x6c, {0x008,2965, 20,-2,0,0x00,0xfe,0x00,0x20,0x03,0x04,0x0}}, {0x01, 0x7f, {0x037,4394, 20, 2,0,0x14,0xfe,0x00,0x20,0x04,0x05,0x0}} }; -static const opl4_region_t regions_7b[] = { /* Bird Tweet */ +static const struct opl4_region regions_7b[] = { /* Bird Tweet */ {0x15, 0x6c, {0x009,8078, 5,-4,7,0x00,0xc2,0x0f,0x22,0x12,0x07,0x0}}, {0x15, 0x6c, {0x009,3583, 5, 4,5,0x00,0xae,0x15,0x72,0x12,0x07,0x0}} }; -static const opl4_region_t regions_7c[] = { /* Telephone Ring */ +static const struct opl4_region regions_7c[] = { /* Telephone Ring */ {0x15, 0x6c, {0x003,3602, 10, 0,0,0x00,0xce,0x00,0xf0,0x00,0x0f,0x0}} }; -static const opl4_region_t regions_7d[] = { /* Helicopter */ +static const struct opl4_region regions_7d[] = { /* Helicopter */ {0x0c, 0x7f, {0x001,2965, 10,-2,0,0x00,0xe0,0x08,0x30,0x01,0x07,0x0}}, {0x01, 0x7f, {0x037,4394, 10, 2,0,0x44,0x76,0x00,0x30,0x01,0x07,0x0}} }; -static const opl4_region_t regions_7e[] = { /* Applause */ +static const struct opl4_region regions_7e[] = { /* Applause */ {0x15, 0x6c, {0x036,8273, 20,-6,7,0x00,0xc4,0x0f,0x70,0x01,0x05,0x0}}, {0x15, 0x6c, {0x036,8115, 5, 6,7,0x00,0xc6,0x07,0x70,0x01,0x05,0x0}} }; -static const opl4_region_t regions_7f[] = { /* Gun Shot */ +static const struct opl4_region regions_7f[] = { /* Gun Shot */ {0x15, 0x6c, {0x139,2858, 20, 0,0,0x00,0xbe,0x38,0xf0,0x03,0x00,0x0}} }; -static const opl4_region_t regions_drums[] = { +static const struct opl4_region regions_drums[] = { {0x18, 0x18, {0x0cb,6397,100, 3,0,0x00,0xf4,0x38,0xc9,0x1c,0x0c,0x0}}, {0x19, 0x19, {0x0c4,3714,100, 0,0,0x00,0xe0,0x00,0x97,0x19,0x09,0x0}}, {0x1a, 0x1a, {0x0c4,3519,100, 0,0,0x00,0xea,0x00,0x61,0x01,0x07,0x0}}, @@ -924,7 +924,7 @@ static const opl4_region_t regions_drums[] = { }; #define REGION(num) { ARRAY_SIZE(regions ## num), regions ## num } -const opl4_region_ptr_t snd_yrw801_regions[0x81] = { +const struct opl4_region_ptr snd_yrw801_regions[0x81] = { REGION(_00), REGION(_01), REGION(_02), REGION(_03), REGION(_04), REGION(_05), REGION(_06), REGION(_07), REGION(_08), REGION(_09), REGION(_0a), REGION(_0b), diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 1ed58df..29676d8 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -33,6 +33,8 @@ #include <sound/driver.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/slab.h> #include <linux/ioport.h> #include <linux/moduleparam.h> @@ -116,10 +118,10 @@ MODULE_PARM_DESC(adaptor, "Type of adaptor."); #define SERIAL_MODE_OUTPUT_TRIGGERED (1 << 3) typedef struct _snd_uart16550 { - snd_card_t *card; - snd_rawmidi_t *rmidi; - snd_rawmidi_substream_t *midi_output[SNDRV_SERIAL_MAX_OUTS]; - snd_rawmidi_substream_t *midi_input[SNDRV_SERIAL_MAX_INS]; + struct snd_card *card; + struct snd_rawmidi *rmidi; + struct snd_rawmidi_substream *midi_output[SNDRV_SERIAL_MAX_OUTS]; + struct snd_rawmidi_substream *midi_input[SNDRV_SERIAL_MAX_INS]; int filemode; //open status of file @@ -166,7 +168,7 @@ typedef struct _snd_uart16550 { } snd_uart16550_t; -static snd_card_t *snd_serial_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static struct platform_device *devices[SNDRV_CARDS]; static inline void snd_uart16550_add_timer(snd_uart16550_t *uart) { @@ -509,7 +511,7 @@ static void snd_uart16550_do_close(snd_uart16550_t * uart) } } -static int snd_uart16550_input_open(snd_rawmidi_substream_t * substream) +static int snd_uart16550_input_open(struct snd_rawmidi_substream *substream) { unsigned long flags; snd_uart16550_t *uart = substream->rmidi->private_data; @@ -523,7 +525,7 @@ static int snd_uart16550_input_open(snd_rawmidi_substream_t * substream) return 0; } -static int snd_uart16550_input_close(snd_rawmidi_substream_t * substream) +static int snd_uart16550_input_close(struct snd_rawmidi_substream *substream) { unsigned long flags; snd_uart16550_t *uart = substream->rmidi->private_data; @@ -537,7 +539,7 @@ static int snd_uart16550_input_close(snd_rawmidi_substream_t * substream) return 0; } -static void snd_uart16550_input_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_uart16550_input_trigger(struct snd_rawmidi_substream *substream, int up) { unsigned long flags; snd_uart16550_t *uart = substream->rmidi->private_data; @@ -551,7 +553,7 @@ static void snd_uart16550_input_trigger(snd_rawmidi_substream_t * substream, int spin_unlock_irqrestore(&uart->open_lock, flags); } -static int snd_uart16550_output_open(snd_rawmidi_substream_t * substream) +static int snd_uart16550_output_open(struct snd_rawmidi_substream *substream) { unsigned long flags; snd_uart16550_t *uart = substream->rmidi->private_data; @@ -565,7 +567,7 @@ static int snd_uart16550_output_open(snd_rawmidi_substream_t * substream) return 0; }; -static int snd_uart16550_output_close(snd_rawmidi_substream_t * substream) +static int snd_uart16550_output_close(struct snd_rawmidi_substream *substream) { unsigned long flags; snd_uart16550_t *uart = substream->rmidi->private_data; @@ -603,7 +605,7 @@ static inline int snd_uart16550_write_buffer(snd_uart16550_t *uart, unsigned cha return 0; } -static int snd_uart16550_output_byte(snd_uart16550_t *uart, snd_rawmidi_substream_t * substream, unsigned char midi_byte) +static int snd_uart16550_output_byte(snd_uart16550_t *uart, struct snd_rawmidi_substream *substream, unsigned char midi_byte) { if (uart->buff_in_count == 0 /* Buffer empty? */ && ((uart->adaptor != SNDRV_SERIAL_MS124W_SA && @@ -636,7 +638,7 @@ static int snd_uart16550_output_byte(snd_uart16550_t *uart, snd_rawmidi_substrea return 1; } -static void snd_uart16550_output_write(snd_rawmidi_substream_t * substream) +static void snd_uart16550_output_write(struct snd_rawmidi_substream *substream) { unsigned long flags; unsigned char midi_byte, addr_byte; @@ -715,7 +717,7 @@ static void snd_uart16550_output_write(snd_rawmidi_substream_t * substream) spin_unlock_irqrestore(&uart->open_lock, flags); } -static void snd_uart16550_output_trigger(snd_rawmidi_substream_t * substream, int up) +static void snd_uart16550_output_trigger(struct snd_rawmidi_substream *substream, int up) { unsigned long flags; snd_uart16550_t *uart = substream->rmidi->private_data; @@ -731,14 +733,14 @@ static void snd_uart16550_output_trigger(snd_rawmidi_substream_t * substream, in snd_uart16550_output_write(substream); } -static snd_rawmidi_ops_t snd_uart16550_output = +static struct snd_rawmidi_ops snd_uart16550_output = { .open = snd_uart16550_output_open, .close = snd_uart16550_output_close, .trigger = snd_uart16550_output_trigger, }; -static snd_rawmidi_ops_t snd_uart16550_input = +static struct snd_rawmidi_ops snd_uart16550_input = { .open = snd_uart16550_input_open, .close = snd_uart16550_input_close, @@ -754,13 +756,13 @@ static int snd_uart16550_free(snd_uart16550_t *uart) return 0; }; -static int snd_uart16550_dev_free(snd_device_t *device) +static int snd_uart16550_dev_free(struct snd_device *device) { snd_uart16550_t *uart = device->device_data; return snd_uart16550_free(uart); } -static int __init snd_uart16550_create(snd_card_t * card, +static int __init snd_uart16550_create(struct snd_card *card, unsigned long iobase, int irq, unsigned int speed, @@ -769,7 +771,7 @@ static int __init snd_uart16550_create(snd_card_t * card, int droponfull, snd_uart16550_t **ruart) { - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_uart16550_dev_free, }; snd_uart16550_t *uart; @@ -838,19 +840,19 @@ static int __init snd_uart16550_create(snd_card_t * card, return 0; } -static void __init snd_uart16550_substreams(snd_rawmidi_str_t *stream) +static void __init snd_uart16550_substreams(struct snd_rawmidi_str *stream) { struct list_head *list; list_for_each(list, &stream->substreams) { - snd_rawmidi_substream_t *substream = list_entry(list, snd_rawmidi_substream_t, list); + struct snd_rawmidi_substream *substream = list_entry(list, struct snd_rawmidi_substream, list); sprintf(substream->name, "Serial MIDI %d", substream->number + 1); } } -static int __init snd_uart16550_rmidi(snd_uart16550_t *uart, int device, int outs, int ins, snd_rawmidi_t **rmidi) +static int __init snd_uart16550_rmidi(snd_uart16550_t *uart, int device, int outs, int ins, struct snd_rawmidi **rmidi) { - snd_rawmidi_t *rrawmidi; + struct snd_rawmidi *rrawmidi; int err; if ((err = snd_rawmidi_new(uart->card, "UART Serial MIDI", device, outs, ins, &rrawmidi)) < 0) @@ -869,14 +871,12 @@ static int __init snd_uart16550_rmidi(snd_uart16550_t *uart, int device, int out return 0; } -static int __init snd_serial_probe(int dev) +static int __init snd_serial_probe(struct platform_device *devptr) { - snd_card_t *card; + struct snd_card *card; snd_uart16550_t *uart; int err; - - if (!enable[dev]) - return -ENOENT; + int dev = devptr->id; switch (adaptor[dev]) { case SNDRV_SERIAL_SOUNDCANVAS: @@ -942,13 +942,12 @@ static int __init snd_serial_probe(int dev) adaptor_names[uart->adaptor], uart->drop_on_full); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto _err; + snd_card_set_dev(card, &devptr->dev); if ((err = snd_card_register(card)) < 0) goto _err; - snd_serial_cards[dev] = card; + platform_set_drvdata(devptr, card); return 0; _err: @@ -956,33 +955,68 @@ static int __init snd_serial_probe(int dev) return err; } +static int snd_serial_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#define SND_SERIAL_DRIVER "snd_serial_u16550" + +static struct platform_driver snd_serial_driver = { + .probe = snd_serial_probe, + .remove = snd_serial_remove, + .driver = { + .name = SND_SERIAL_DRIVER + }, +}; + +static void __init_or_module snd_serial_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_serial_driver); +} + static int __init alsa_card_serial_init(void) { - int dev = 0; - int cards = 0; + int i, cards, err; - for (dev = 0; dev < SNDRV_CARDS; dev++) { - if (snd_serial_probe(dev) == 0) - cards++; - } + if ((err = platform_driver_register(&snd_serial_driver)) < 0) + return err; - if (cards == 0) { + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(SND_SERIAL_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; + } + devices[i] = device; + cards++; + } + if (! cards) { #ifdef MODULE printk(KERN_ERR "serial midi soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_serial_unregister_all(); + return err; } static void __exit alsa_card_serial_exit(void) { - int dev; - - for (dev = 0; dev < SNDRV_CARDS; dev++) { - if (snd_serial_cards[dev] != NULL) - snd_card_free(snd_serial_cards[dev]); - } + snd_serial_unregister_all(); } module_init(alsa_card_serial_init) diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index af12185..4258723 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -45,6 +45,8 @@ #include <linux/init.h> #include <linux/wait.h> #include <linux/sched.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/moduleparam.h> #include <sound/core.h> #include <sound/seq_kernel.h> @@ -59,7 +61,7 @@ MODULE_DESCRIPTION("Dummy soundcard for virtual rawmidi devices"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual rawmidi device}}"); -#define MAX_MIDI_DEVICES 8 +#define MAX_MIDI_DEVICES 4 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ @@ -73,24 +75,23 @@ MODULE_PARM_DESC(id, "ID string for virmidi soundcard."); module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable this soundcard."); module_param_array(midi_devs, int, NULL, 0444); -MODULE_PARM_DESC(midi_devs, "MIDI devices # (1-8)"); +MODULE_PARM_DESC(midi_devs, "MIDI devices # (1-4)"); -typedef struct snd_card_virmidi { - snd_card_t *card; - snd_rawmidi_t *midi[MAX_MIDI_DEVICES]; -} snd_card_virmidi_t; +struct snd_card_virmidi { + struct snd_card *card; + struct snd_rawmidi *midi[MAX_MIDI_DEVICES]; +}; -static snd_card_t *snd_virmidi_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static struct platform_device *devices[SNDRV_CARDS]; -static int __init snd_card_virmidi_probe(int dev) +static int __init snd_virmidi_probe(struct platform_device *devptr) { - snd_card_t *card; + struct snd_card *card; struct snd_card_virmidi *vmidi; int idx, err; + int dev = devptr->id; - if (!enable[dev]) - return -ENODEV; card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_card_virmidi)); if (card == NULL) @@ -103,8 +104,8 @@ static int __init snd_card_virmidi_probe(int dev) midi_devs[dev] = MAX_MIDI_DEVICES; } for (idx = 0; idx < midi_devs[dev]; idx++) { - snd_rawmidi_t *rmidi; - snd_virmidi_dev_t *rdev; + struct snd_rawmidi *rmidi; + struct snd_virmidi_dev *rdev; if ((err = snd_virmidi_new(card, idx, &rmidi)) < 0) goto __nodev; rdev = rmidi->private_data; @@ -117,11 +118,10 @@ static int __init snd_card_virmidi_probe(int dev) strcpy(card->shortname, "VirMIDI"); sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto __nodev; + snd_card_set_dev(card, &devptr->dev); if ((err = snd_card_register(card)) == 0) { - snd_virmidi_cards[dev] = card; + platform_set_drvdata(devptr, card); return 0; } __nodev: @@ -129,34 +129,68 @@ static int __init snd_card_virmidi_probe(int dev) return err; } -static int __init alsa_card_virmidi_init(void) +static int snd_virmidi_remove(struct platform_device *devptr) { - int dev, cards; + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} - for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) { - if (snd_card_virmidi_probe(dev) < 0) { -#ifdef MODULE - printk(KERN_ERR "Card-VirMIDI #%i not found or device busy\n", dev + 1); -#endif - break; +#define SND_VIRMIDI_DRIVER "snd_virmidi" + +static struct platform_driver snd_virmidi_driver = { + .probe = snd_virmidi_probe, + .remove = snd_virmidi_remove, + .driver = { + .name = SND_VIRMIDI_DRIVER + }, +}; + +static void __init_or_module snd_virmidi_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_virmidi_driver); +} + +static int __init alsa_card_virmidi_init(void) +{ + int i, cards, err; + + if ((err = platform_driver_register(&snd_virmidi_driver)) < 0) + return err; + + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(SND_VIRMIDI_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; } + devices[i] = device; cards++; } if (!cards) { #ifdef MODULE printk(KERN_ERR "Card-VirMIDI soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_virmidi_unregister_all(); + return err; } static void __exit alsa_card_virmidi_exit(void) { - int dev; - - for (dev = 0; dev < SNDRV_CARDS; dev++) - snd_card_free(snd_virmidi_cards[dev]); + snd_virmidi_unregister_all(); } module_init(alsa_card_virmidi_init) diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index 4697b1d..43f615d 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c @@ -41,18 +41,6 @@ MODULE_LICENSE("GPL"); /* - * snd_vx_delay - delay for the specified time - * @xmsec: the time to delay in msec - */ -void snd_vx_delay(vx_core_t *chip, int xmsec) -{ - if (! in_interrupt() && xmsec >= 1000 / HZ) - msleep(xmsec); - else - mdelay(xmsec); -} - -/* * vx_check_reg_bit - wait for the specified bit is set/reset on a register * @reg: register to check * @mask: bit mask @@ -61,7 +49,7 @@ void snd_vx_delay(vx_core_t *chip, int xmsec) * * returns zero if a bit matches, or a negative error code. */ -int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time) +int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time) { unsigned long end_time = jiffies + (time * HZ + 999) / 1000; #ifdef CONFIG_SND_DEBUG @@ -76,7 +64,7 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time) do { if ((snd_vx_inb(chip, reg) & mask) == bit) return 0; - //snd_vx_delay(chip, 10); + //msleep(10); } while (time_after_eq(end_time, jiffies)); snd_printd(KERN_DEBUG "vx_check_reg_bit: timeout, reg=%s, mask=0x%x, val=0x%x\n", reg_names[reg], mask, snd_vx_inb(chip, reg)); return -EIO; @@ -90,7 +78,7 @@ int snd_vx_check_reg_bit(vx_core_t *chip, int reg, int mask, int bit, int time) * returns 0 if successful, or a negative error code. * */ -static int vx_send_irq_dsp(vx_core_t *chip, int num) +static int vx_send_irq_dsp(struct vx_core *chip, int num) { int nirq; @@ -111,7 +99,7 @@ static int vx_send_irq_dsp(vx_core_t *chip, int num) * * returns 0 if successful, or a negative error code. */ -static int vx_reset_chk(vx_core_t *chip) +static int vx_reset_chk(struct vx_core *chip) { /* Reset irq CHK */ if (vx_send_irq_dsp(chip, IRQ_RESET_CHK) < 0) @@ -130,7 +118,7 @@ static int vx_reset_chk(vx_core_t *chip) * the error code can be VX-specific, retrieved via vx_get_error(). * NB: call with spinlock held! */ -static int vx_transfer_end(vx_core_t *chip, int cmd) +static int vx_transfer_end(struct vx_core *chip, int cmd) { int err; @@ -168,7 +156,7 @@ static int vx_transfer_end(vx_core_t *chip, int cmd) * the error code can be VX-specific, retrieved via vx_get_error(). * NB: call with spinlock held! */ -static int vx_read_status(vx_core_t *chip, struct vx_rmh *rmh) +static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh) { int i, err, val, size; @@ -248,7 +236,7 @@ static int vx_read_status(vx_core_t *chip, struct vx_rmh *rmh) * * this function doesn't call spinlock at all. */ -int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh) +int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh) { int i, err; @@ -353,7 +341,7 @@ int vx_send_msg_nolock(vx_core_t *chip, struct vx_rmh *rmh) * returns 0 if successful, or a negative error code. * see vx_send_msg_nolock(). */ -int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh) +int vx_send_msg(struct vx_core *chip, struct vx_rmh *rmh) { unsigned long flags; int err; @@ -376,7 +364,7 @@ int vx_send_msg(vx_core_t *chip, struct vx_rmh *rmh) * * unlike RMH, no command is sent to DSP. */ -int vx_send_rih_nolock(vx_core_t *chip, int cmd) +int vx_send_rih_nolock(struct vx_core *chip, int cmd) { int err; @@ -413,7 +401,7 @@ int vx_send_rih_nolock(vx_core_t *chip, int cmd) * * see vx_send_rih_nolock(). */ -int vx_send_rih(vx_core_t *chip, int cmd) +int vx_send_rih(struct vx_core *chip, int cmd) { unsigned long flags; int err; @@ -430,7 +418,7 @@ int vx_send_rih(vx_core_t *chip, int cmd) * snd_vx_boot_xilinx - boot up the xilinx interface * @boot: the boot record to load */ -int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *boot) +int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *boot) { unsigned int i; int no_fillup = vx_has_new_dsp(chip); @@ -482,7 +470,7 @@ int snd_vx_load_boot_image(vx_core_t *chip, const struct firmware *boot) * * called from irq handler only */ -static int vx_test_irq_src(vx_core_t *chip, unsigned int *ret) +static int vx_test_irq_src(struct vx_core *chip, unsigned int *ret) { int err; @@ -503,7 +491,7 @@ static int vx_test_irq_src(vx_core_t *chip, unsigned int *ret) */ static void vx_interrupt(unsigned long private_data) { - vx_core_t *chip = (vx_core_t *) private_data; + struct vx_core *chip = (struct vx_core *) private_data; unsigned int events; if (chip->chip_status & VX_STAT_IS_STALE) @@ -547,7 +535,7 @@ static void vx_interrupt(unsigned long private_data) */ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs) { - vx_core_t *chip = dev; + struct vx_core *chip = dev; if (! (chip->chip_status & VX_STAT_CHIP_INIT) || (chip->chip_status & VX_STAT_IS_STALE)) @@ -560,7 +548,7 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev, struct pt_regs *regs) /* */ -static void vx_reset_board(vx_core_t *chip, int cold_reset) +static void vx_reset_board(struct vx_core *chip, int cold_reset) { snd_assert(chip->ops->reset_board, return); @@ -599,9 +587,9 @@ static void vx_reset_board(vx_core_t *chip, int cold_reset) * proc interface */ -static void vx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) +static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - vx_core_t *chip = entry->private_data; + struct vx_core *chip = entry->private_data; static char *audio_src_vxp[] = { "Line", "Mic", "Digital" }; static char *audio_src_vx2[] = { "Analog", "Analog", "Digital" }; static char *clock_mode[] = { "Auto", "Internal", "External" }; @@ -642,9 +630,9 @@ static void vx_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) chip->ibl.granularity); } -static void vx_proc_init(vx_core_t *chip) +static void vx_proc_init(struct vx_core *chip) { - snd_info_entry_t *entry; + struct snd_info_entry *entry; if (! snd_card_proc_new(chip->card, "vx-status", &entry)) snd_info_set_text_ops(entry, chip, 1024, vx_proc_read); @@ -654,7 +642,7 @@ static void vx_proc_init(vx_core_t *chip) /** * snd_vx_dsp_boot - load the DSP boot */ -int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *boot) +int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *boot) { int err; int cold_reset = !(chip->chip_status & VX_STAT_DEVICE_INIT); @@ -664,7 +652,7 @@ int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *boot) if ((err = snd_vx_load_boot_image(chip, boot)) < 0) return err; - snd_vx_delay(chip, 10); + msleep(10); return 0; } @@ -672,7 +660,7 @@ int snd_vx_dsp_boot(vx_core_t *chip, const struct firmware *boot) /** * snd_vx_dsp_load - load the DSP image */ -int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp) +int snd_vx_dsp_load(struct vx_core *chip, const struct firmware *dsp) { unsigned int i; int err; @@ -704,7 +692,7 @@ int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp) } snd_printdd(KERN_DEBUG "checksum = 0x%08x\n", csum); - snd_vx_delay(chip, 200); + msleep(200); if ((err = vx_wait_isr_bit(chip, ISR_CHK)) < 0) return err; @@ -721,13 +709,11 @@ int snd_vx_dsp_load(vx_core_t *chip, const struct firmware *dsp) /* * suspend */ -static int snd_vx_suspend(snd_card_t *card, pm_message_t state) +int snd_vx_suspend(struct vx_core *chip, pm_message_t state) { - vx_core_t *chip = card->pm_private_data; unsigned int i; - snd_assert(chip, return -EINVAL); - + snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); chip->chip_status |= VX_STAT_IN_SUSPEND; for (i = 0; i < chip->hw->num_codecs; i++) snd_pcm_suspend_all(chip->pcm[i]); @@ -738,13 +724,10 @@ static int snd_vx_suspend(snd_card_t *card, pm_message_t state) /* * resume */ -static int snd_vx_resume(snd_card_t *card) +int snd_vx_resume(struct vx_core *chip) { - vx_core_t *chip = card->pm_private_data; int i, err; - snd_assert(chip, return -EINVAL); - chip->chip_status &= ~VX_STAT_CHIP_INIT; for (i = 0; i < 4; i++) { @@ -760,13 +743,14 @@ static int snd_vx_resume(snd_card_t *card) chip->chip_status |= VX_STAT_CHIP_INIT; chip->chip_status &= ~VX_STAT_IN_SUSPEND; + snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); return 0; } #endif /** - * snd_vx_create - constructor for vx_core_t + * snd_vx_create - constructor for struct vx_core * @hw: hardware specific record * * this function allocates the instance and prepare for the hardware @@ -774,11 +758,11 @@ static int snd_vx_resume(snd_card_t *card) * * return the instance pointer if successful, NULL in error. */ -vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, - struct snd_vx_ops *ops, - int extra_size) +struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, + struct snd_vx_ops *ops, + int extra_size) { - vx_core_t *chip; + struct vx_core *chip; snd_assert(card && hw && ops, return NULL); @@ -801,8 +785,6 @@ vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw, strcpy(card->driver, hw->name); sprintf(card->shortname, "Digigram %s", hw->name); - snd_card_set_pm_callback(card, snd_vx_suspend, snd_vx_resume, chip); - vx_proc_init(chip); return chip; @@ -831,7 +813,10 @@ EXPORT_SYMBOL(snd_vx_create); EXPORT_SYMBOL(snd_vx_setup_firmware); EXPORT_SYMBOL(snd_vx_free_firmware); EXPORT_SYMBOL(snd_vx_irq_handler); -EXPORT_SYMBOL(snd_vx_delay); EXPORT_SYMBOL(snd_vx_dsp_boot); EXPORT_SYMBOL(snd_vx_dsp_load); EXPORT_SYMBOL(snd_vx_load_boot_image); +#ifdef CONFIG_PM +EXPORT_SYMBOL(snd_vx_suspend); +EXPORT_SYMBOL(snd_vx_resume); +#endif diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c index c4993b0..d837783 100644 --- a/sound/drivers/vx/vx_hwdep.c +++ b/sound/drivers/vx/vx_hwdep.c @@ -30,7 +30,7 @@ #ifdef SND_VX_FW_LOADER -int snd_vx_setup_firmware(vx_core_t *chip) +int snd_vx_setup_firmware(struct vx_core *chip) { static char *fw_files[VX_TYPE_NUMS][4] = { [VX_TYPE_BOARD] = { @@ -95,7 +95,7 @@ int snd_vx_setup_firmware(vx_core_t *chip) } /* exported */ -void snd_vx_free_firmware(vx_core_t *chip) +void snd_vx_free_firmware(struct vx_core *chip) { #ifdef CONFIG_PM int i; @@ -106,17 +106,18 @@ void snd_vx_free_firmware(vx_core_t *chip) #else /* old style firmware loading */ -static int vx_hwdep_open(snd_hwdep_t *hw, struct file *file) +static int vx_hwdep_open(struct snd_hwdep *hw, struct file *file) { return 0; } -static int vx_hwdep_release(snd_hwdep_t *hw, struct file *file) +static int vx_hwdep_release(struct snd_hwdep *hw, struct file *file) { return 0; } -static int vx_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *info) +static int vx_hwdep_dsp_status(struct snd_hwdep *hw, + struct snd_hwdep_dsp_status *info) { static char *type_ids[VX_TYPE_NUMS] = { [VX_TYPE_BOARD] = "vxboard", @@ -125,7 +126,7 @@ static int vx_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *info) [VX_TYPE_VXPOCKET] = "vxpocket", [VX_TYPE_VXP440] = "vxp440", }; - vx_core_t *vx = hw->private_data; + struct vx_core *vx = hw->private_data; snd_assert(type_ids[vx->type], return -EINVAL); strcpy(info->id, type_ids[vx->type]); @@ -147,9 +148,10 @@ static void free_fw(const struct firmware *fw) } } -static int vx_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) +static int vx_hwdep_dsp_load(struct snd_hwdep *hw, + struct snd_hwdep_dsp_image *dsp) { - vx_core_t *vx = hw->private_data; + struct vx_core *vx = hw->private_data; int index, err; struct firmware *fw; @@ -216,10 +218,10 @@ static int vx_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) /* exported */ -int snd_vx_setup_firmware(vx_core_t *chip) +int snd_vx_setup_firmware(struct vx_core *chip) { int err; - snd_hwdep_t *hw; + struct snd_hwdep *hw; if ((err = snd_hwdep_new(chip->card, SND_VX_HWDEP_ID, 0, &hw)) < 0) return err; @@ -238,7 +240,7 @@ int snd_vx_setup_firmware(vx_core_t *chip) } /* exported */ -void snd_vx_free_firmware(vx_core_t *chip) +void snd_vx_free_firmware(struct vx_core *chip) { #ifdef CONFIG_PM int i; diff --git a/sound/drivers/vx/vx_mixer.c b/sound/drivers/vx/vx_mixer.c index 19fc68c..8ec2c60 100644 --- a/sound/drivers/vx/vx_mixer.c +++ b/sound/drivers/vx/vx_mixer.c @@ -30,7 +30,7 @@ /* * write a codec data (24bit) */ -static void vx_write_codec_reg(vx_core_t *chip, int codec, unsigned int data) +static void vx_write_codec_reg(struct vx_core *chip, int codec, unsigned int data) { unsigned long flags; @@ -47,7 +47,7 @@ static void vx_write_codec_reg(vx_core_t *chip, int codec, unsigned int data) /* * Data type used to access the Codec */ -typedef union { +union vx_codec_data { u32 l; #ifdef SNDRV_BIG_ENDIAN struct w { @@ -72,7 +72,7 @@ typedef union { u8 hh; } b; #endif -} vx_codec_data_t; +}; #define SET_CDC_DATA_SEL(di,s) ((di).b.mh = (u8) (s)) #define SET_CDC_DATA_REG(di,r) ((di).b.ml = (u8) (r)) @@ -85,9 +85,9 @@ typedef union { * @reg: register index * @val: data value */ -static void vx_set_codec_reg(vx_core_t *chip, int codec, int reg, int val) +static void vx_set_codec_reg(struct vx_core *chip, int codec, int reg, int val) { - vx_codec_data_t data; + union vx_codec_data data; /* DAC control register */ SET_CDC_DATA_INIT(data); SET_CDC_DATA_REG(data, reg); @@ -102,7 +102,7 @@ static void vx_set_codec_reg(vx_core_t *chip, int codec, int reg, int val) * @left: left output level, 0 = mute * @right: right output level */ -static void vx_set_analog_output_level(vx_core_t *chip, int codec, int left, int right) +static void vx_set_analog_output_level(struct vx_core *chip, int codec, int left, int right) { left = chip->hw->output_level_max - left; right = chip->hw->output_level_max - right; @@ -126,7 +126,7 @@ static void vx_set_analog_output_level(vx_core_t *chip, int codec, int left, int #define DAC_ATTEN_MIN 0x08 #define DAC_ATTEN_MAX 0x38 -void vx_toggle_dac_mute(vx_core_t *chip, int mute) +void vx_toggle_dac_mute(struct vx_core *chip, int mute) { unsigned int i; for (i = 0; i < chip->hw->num_codecs; i++) { @@ -141,7 +141,7 @@ void vx_toggle_dac_mute(vx_core_t *chip, int mute) /* * vx_reset_codec - reset and initialize the codecs */ -void vx_reset_codec(vx_core_t *chip, int cold_reset) +void vx_reset_codec(struct vx_core *chip, int cold_reset) { unsigned int i; int port = chip->type >= VX_TYPE_VXPOCKET ? 0x75 : 0x65; @@ -175,7 +175,7 @@ void vx_reset_codec(vx_core_t *chip, int cold_reset) * change the audio input source * @src: the target source (VX_AUDIO_SRC_XXX) */ -static void vx_change_audio_source(vx_core_t *chip, int src) +static void vx_change_audio_source(struct vx_core *chip, int src) { unsigned long flags; @@ -192,7 +192,7 @@ static void vx_change_audio_source(vx_core_t *chip, int src) * change the audio source if necessary and possible * returns 1 if the source is actually changed. */ -int vx_sync_audio_source(vx_core_t *chip) +int vx_sync_audio_source(struct vx_core *chip) { if (chip->audio_source_target == chip->audio_source || chip->pcm_running) @@ -217,7 +217,7 @@ struct vx_audio_level { short monitor_level; }; -static int vx_adjust_audio_level(vx_core_t *chip, int audio, int capture, +static int vx_adjust_audio_level(struct vx_core *chip, int audio, int capture, struct vx_audio_level *info) { struct vx_rmh rmh; @@ -256,7 +256,7 @@ static int vx_adjust_audio_level(vx_core_t *chip, int audio, int capture, #if 0 // not used -static int vx_read_audio_level(vx_core_t *chip, int audio, int capture, +static int vx_read_audio_level(struct vx_core *chip, int audio, int capture, struct vx_audio_level *info) { int err; @@ -283,7 +283,7 @@ static int vx_read_audio_level(vx_core_t *chip, int audio, int capture, * set the monitoring level and mute state of the given audio * no more static, because must be called from vx_pcm to demute monitoring */ -int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active) +int vx_set_monitor_level(struct vx_core *chip, int audio, int level, int active) { struct vx_audio_level info; @@ -301,7 +301,7 @@ int vx_set_monitor_level(vx_core_t *chip, int audio, int level, int active) /* * set the mute status of the given audio */ -static int vx_set_audio_switch(vx_core_t *chip, int audio, int active) +static int vx_set_audio_switch(struct vx_core *chip, int audio, int active) { struct vx_audio_level info; @@ -315,7 +315,7 @@ static int vx_set_audio_switch(vx_core_t *chip, int audio, int active) /* * set the mute status of the given audio */ -static int vx_set_audio_gain(vx_core_t *chip, int audio, int capture, int level) +static int vx_set_audio_gain(struct vx_core *chip, int audio, int capture, int level) { struct vx_audio_level info; @@ -329,7 +329,7 @@ static int vx_set_audio_gain(vx_core_t *chip, int audio, int capture, int level) /* * reset all audio levels */ -static void vx_reset_audio_levels(vx_core_t *chip) +static void vx_reset_audio_levels(struct vx_core *chip) { unsigned int i, c; struct vx_audio_level info; @@ -375,7 +375,7 @@ struct vx_vu_meter { * @capture: 0 = playback, 1 = capture operation * @info: the array of vx_vu_meter records (size = 2). */ -static int vx_get_audio_vu_meter(vx_core_t *chip, int audio, int capture, struct vx_vu_meter *info) +static int vx_get_audio_vu_meter(struct vx_core *chip, int audio, int capture, struct vx_vu_meter *info) { struct vx_rmh rmh; int i, err; @@ -413,9 +413,9 @@ static int vx_get_audio_vu_meter(vx_core_t *chip, int audio, int capture, struct /* * output level control */ -static int vx_output_level_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_output_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; @@ -423,9 +423,9 @@ static int vx_output_level_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u return 0; } -static int vx_output_level_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_output_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int codec = kcontrol->id.index; down(&chip->mixer_mutex); ucontrol->value.integer.value[0] = chip->output_level[codec][0]; @@ -434,9 +434,9 @@ static int vx_output_level_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u return 0; } -static int vx_output_level_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_output_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int codec = kcontrol->id.index; down(&chip->mixer_mutex); if (ucontrol->value.integer.value[0] != chip->output_level[codec][0] || @@ -453,7 +453,7 @@ static int vx_output_level_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u return 0; } -static snd_kcontrol_new_t vx_control_output_level = { +static struct snd_kcontrol_new vx_control_output_level = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Master Playback Volume", .info = vx_output_level_info, @@ -464,7 +464,7 @@ static snd_kcontrol_new_t vx_control_output_level = { /* * audio source select */ -static int vx_audio_src_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_audio_src_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts_mic[3] = { "Digital", "Line", "Mic" @@ -472,7 +472,7 @@ static int vx_audio_src_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf static char *texts_vx2[2] = { "Digital", "Analog" }; - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; @@ -492,16 +492,16 @@ static int vx_audio_src_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf return 0; } -static int vx_audio_src_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); ucontrol->value.enumerated.item[0] = chip->audio_source_target; return 0; } -static int vx_audio_src_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); down(&chip->mixer_mutex); if (chip->audio_source_target != ucontrol->value.enumerated.item[0]) { chip->audio_source_target = ucontrol->value.enumerated.item[0]; @@ -513,7 +513,7 @@ static int vx_audio_src_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon return 0; } -static snd_kcontrol_new_t vx_control_audio_src = { +static struct snd_kcontrol_new vx_control_audio_src = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Capture Source", .info = vx_audio_src_info, @@ -524,7 +524,7 @@ static snd_kcontrol_new_t vx_control_audio_src = { /* * clock mode selection */ -static int vx_clock_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_clock_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[3] = { "Auto", "Internal", "External" @@ -540,16 +540,16 @@ static int vx_clock_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin return 0; } -static int vx_clock_mode_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); ucontrol->value.enumerated.item[0] = chip->clock_mode; return 0; } -static int vx_clock_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); down(&chip->mixer_mutex); if (chip->clock_mode != ucontrol->value.enumerated.item[0]) { chip->clock_mode = ucontrol->value.enumerated.item[0]; @@ -561,7 +561,7 @@ static int vx_clock_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static snd_kcontrol_new_t vx_control_clock_mode = { +static struct snd_kcontrol_new vx_control_clock_mode = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Clock Mode", .info = vx_clock_mode_info, @@ -572,7 +572,7 @@ static snd_kcontrol_new_t vx_control_clock_mode = { /* * Audio Gain */ -static int vx_audio_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_audio_gain_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -581,9 +581,9 @@ static int vx_audio_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin return 0; } -static int vx_audio_gain_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_gain_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; int capture = (kcontrol->private_value >> 8) & 1; @@ -594,9 +594,9 @@ static int vx_audio_gain_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static int vx_audio_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_gain_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; int capture = (kcontrol->private_value >> 8) & 1; @@ -612,9 +612,9 @@ static int vx_audio_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static int vx_audio_monitor_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_monitor_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; down(&chip->mixer_mutex); @@ -624,9 +624,9 @@ static int vx_audio_monitor_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t * return 0; } -static int vx_audio_monitor_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_monitor_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; down(&chip->mixer_mutex); @@ -643,7 +643,7 @@ static int vx_audio_monitor_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t * return 0; } -static int vx_audio_sw_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_audio_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 2; @@ -652,9 +652,9 @@ static int vx_audio_sw_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo return 0; } -static int vx_audio_sw_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; down(&chip->mixer_mutex); @@ -664,9 +664,9 @@ static int vx_audio_sw_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont return 0; } -static int vx_audio_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; down(&chip->mixer_mutex); @@ -681,9 +681,9 @@ static int vx_audio_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont return 0; } -static int vx_monitor_sw_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; down(&chip->mixer_mutex); @@ -693,9 +693,9 @@ static int vx_monitor_sw_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static int vx_monitor_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); int audio = kcontrol->private_value & 0xff; down(&chip->mixer_mutex); @@ -712,28 +712,28 @@ static int vx_monitor_sw_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static snd_kcontrol_new_t vx_control_audio_gain = { +static struct snd_kcontrol_new vx_control_audio_gain = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* name will be filled later */ .info = vx_audio_gain_info, .get = vx_audio_gain_get, .put = vx_audio_gain_put }; -static snd_kcontrol_new_t vx_control_output_switch = { +static struct snd_kcontrol_new vx_control_output_switch = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "PCM Playback Switch", .info = vx_audio_sw_info, .get = vx_audio_sw_get, .put = vx_audio_sw_put }; -static snd_kcontrol_new_t vx_control_monitor_gain = { +static struct snd_kcontrol_new vx_control_monitor_gain = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Monitoring Volume", .info = vx_audio_gain_info, /* shared */ .get = vx_audio_monitor_get, .put = vx_audio_monitor_put }; -static snd_kcontrol_new_t vx_control_monitor_switch = { +static struct snd_kcontrol_new vx_control_monitor_switch = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Monitoring Switch", .info = vx_audio_sw_info, /* shared */ @@ -745,16 +745,16 @@ static snd_kcontrol_new_t vx_control_monitor_switch = { /* * IEC958 status bits */ -static int vx_iec958_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_iec958_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->count = 1; return 0; } -static int vx_iec958_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); down(&chip->mixer_mutex); ucontrol->value.iec958.status[0] = (chip->uer_bits >> 0) & 0xff; @@ -765,7 +765,7 @@ static int vx_iec958_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontro return 0; } -static int vx_iec958_mask_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_iec958_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { ucontrol->value.iec958.status[0] = 0xff; ucontrol->value.iec958.status[1] = 0xff; @@ -774,9 +774,9 @@ static int vx_iec958_mask_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *u return 0; } -static int vx_iec958_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_iec958_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); unsigned int val; val = (ucontrol->value.iec958.status[0] << 0) | @@ -794,7 +794,7 @@ static int vx_iec958_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontro return 0; } -static snd_kcontrol_new_t vx_control_iec958_mask = { +static struct snd_kcontrol_new vx_control_iec958_mask = { .access = SNDRV_CTL_ELEM_ACCESS_READ, .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), @@ -802,7 +802,7 @@ static snd_kcontrol_new_t vx_control_iec958_mask = { .get = vx_iec958_mask_get, }; -static snd_kcontrol_new_t vx_control_iec958 = { +static struct snd_kcontrol_new vx_control_iec958 = { .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), .info = vx_iec958_info, @@ -818,7 +818,7 @@ static snd_kcontrol_new_t vx_control_iec958 = { #define METER_MAX 0xff #define METER_SHIFT 16 -static int vx_vu_meter_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_vu_meter_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; @@ -827,9 +827,9 @@ static int vx_vu_meter_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo return 0; } -static int vx_vu_meter_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_vu_meter_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); struct vx_vu_meter meter[2]; int audio = kcontrol->private_value & 0xff; int capture = (kcontrol->private_value >> 8) & 1; @@ -840,9 +840,9 @@ static int vx_vu_meter_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucont return 0; } -static int vx_peak_meter_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_peak_meter_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); struct vx_vu_meter meter[2]; int audio = kcontrol->private_value & 0xff; int capture = (kcontrol->private_value >> 8) & 1; @@ -853,7 +853,7 @@ static int vx_peak_meter_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static int vx_saturation_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) +static int vx_saturation_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 2; @@ -862,9 +862,9 @@ static int vx_saturation_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uin return 0; } -static int vx_saturation_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +static int vx_saturation_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - vx_core_t *chip = snd_kcontrol_chip(kcontrol); + struct vx_core *chip = snd_kcontrol_chip(kcontrol); struct vx_vu_meter meter[2]; int audio = kcontrol->private_value & 0xff; @@ -874,7 +874,7 @@ static int vx_saturation_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uco return 0; } -static snd_kcontrol_new_t vx_control_vu_meter = { +static struct snd_kcontrol_new vx_control_vu_meter = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, /* name will be filled later */ @@ -882,7 +882,7 @@ static snd_kcontrol_new_t vx_control_vu_meter = { .get = vx_vu_meter_get, }; -static snd_kcontrol_new_t vx_control_peak_meter = { +static struct snd_kcontrol_new vx_control_peak_meter = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, /* name will be filled later */ @@ -890,7 +890,7 @@ static snd_kcontrol_new_t vx_control_peak_meter = { .get = vx_peak_meter_get, }; -static snd_kcontrol_new_t vx_control_saturation = { +static struct snd_kcontrol_new vx_control_saturation = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Input Saturation", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, @@ -904,12 +904,12 @@ static snd_kcontrol_new_t vx_control_saturation = { * */ -int snd_vx_mixer_new(vx_core_t *chip) +int snd_vx_mixer_new(struct vx_core *chip) { unsigned int i, c; int err; - snd_kcontrol_new_t temp; - snd_card_t *card = chip->card; + struct snd_kcontrol_new temp; + struct snd_card *card = chip->card; char name[32]; strcpy(card->mixername, card->driver); diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index 2b46758..464109e 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c @@ -61,7 +61,8 @@ */ /* get the physical page pointer on the given offset */ -static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, unsigned long offset) +static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, + unsigned long offset) { void *pageptr = subs->runtime->dma_area + offset; return vmalloc_to_page(pageptr); @@ -72,9 +73,9 @@ static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, unsigned * called from hw_params * NOTE: this may be called not only once per pcm open! */ -static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) +static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size) { - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (runtime->dma_area) { /* already allocated */ if (runtime->dma_bytes >= size) @@ -94,9 +95,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) * called from hw_free callback * NOTE: this may be called not only once per pcm open! */ -static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) +static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (runtime->dma_area) { vfree(runtime->dma_area); runtime->dma_area = NULL; @@ -108,7 +109,8 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) /* * read three pending pcm bytes via inb() */ -static void vx_pcm_read_per_bytes(vx_core_t *chip, snd_pcm_runtime_t *runtime, vx_pipe_t *pipe) +static void vx_pcm_read_per_bytes(struct vx_core *chip, struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe) { int offset = pipe->hw_ptr; unsigned char *buf = (unsigned char *)(runtime->dma_area + offset); @@ -135,7 +137,8 @@ static void vx_pcm_read_per_bytes(vx_core_t *chip, snd_pcm_runtime_t *runtime, v * @pc_time: the pointer for the PC-time to set * @dsp_time: the pointer for RMH status time array */ -static void vx_set_pcx_time(vx_core_t *chip, pcx_time_t *pc_time, unsigned int *dsp_time) +static void vx_set_pcx_time(struct vx_core *chip, pcx_time_t *pc_time, + unsigned int *dsp_time) { dsp_time[0] = (unsigned int)((*pc_time) >> 24) & PCX_TIME_HI_MASK; dsp_time[1] = (unsigned int)(*pc_time) & MASK_DSP_WORD; @@ -151,7 +154,8 @@ static void vx_set_pcx_time(vx_core_t *chip, pcx_time_t *pc_time, unsigned int * * * returns the increase of the command length. */ -static int vx_set_differed_time(vx_core_t *chip, struct vx_rmh *rmh, vx_pipe_t *pipe) +static int vx_set_differed_time(struct vx_core *chip, struct vx_rmh *rmh, + struct vx_pipe *pipe) { /* Update The length added to the RMH command by the timestamp */ if (! (pipe->differed_type & DC_DIFFERED_DELAY)) @@ -184,7 +188,8 @@ static int vx_set_differed_time(vx_core_t *chip, struct vx_rmh *rmh, vx_pipe_t * * @pipe: the affected pipe * @data: format bitmask */ -static int vx_set_stream_format(vx_core_t *chip, vx_pipe_t *pipe, unsigned int data) +static int vx_set_stream_format(struct vx_core *chip, struct vx_pipe *pipe, + unsigned int data) { struct vx_rmh rmh; @@ -210,8 +215,8 @@ static int vx_set_stream_format(vx_core_t *chip, vx_pipe_t *pipe, unsigned int d * * returns 0 if successful, or a negative error code. */ -static int vx_set_format(vx_core_t *chip, vx_pipe_t *pipe, - snd_pcm_runtime_t *runtime) +static int vx_set_format(struct vx_core *chip, struct vx_pipe *pipe, + struct snd_pcm_runtime *runtime) { unsigned int header = HEADER_FMT_BASE; @@ -239,7 +244,7 @@ static int vx_set_format(vx_core_t *chip, vx_pipe_t *pipe, /* * set / query the IBL size */ -static int vx_set_ibl(vx_core_t *chip, struct vx_ibl_info *info) +static int vx_set_ibl(struct vx_core *chip, struct vx_ibl_info *info) { int err; struct vx_rmh rmh; @@ -269,7 +274,7 @@ static int vx_set_ibl(vx_core_t *chip, struct vx_ibl_info *info) * * called from trigger callback only */ -static int vx_get_pipe_state(vx_core_t *chip, vx_pipe_t *pipe, int *state) +static int vx_get_pipe_state(struct vx_core *chip, struct vx_pipe *pipe, int *state) { int err; struct vx_rmh rmh; @@ -294,7 +299,7 @@ static int vx_get_pipe_state(vx_core_t *chip, vx_pipe_t *pipe, int *state) * you'll need to disconnect the host to get back to the * normal mode. */ -static int vx_query_hbuffer_size(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_query_hbuffer_size(struct vx_core *chip, struct vx_pipe *pipe) { int result; struct vx_rmh rmh; @@ -318,7 +323,7 @@ static int vx_query_hbuffer_size(vx_core_t *chip, vx_pipe_t *pipe) * * called from trigger callback only */ -static int vx_pipe_can_start(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_pipe_can_start(struct vx_core *chip, struct vx_pipe *pipe) { int err; struct vx_rmh rmh; @@ -339,7 +344,7 @@ static int vx_pipe_can_start(vx_core_t *chip, vx_pipe_t *pipe) * vx_conf_pipe - tell the pipe to stand by and wait for IRQA. * @pipe: the pipe to be configured */ -static int vx_conf_pipe(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_conf_pipe(struct vx_core *chip, struct vx_pipe *pipe) { struct vx_rmh rmh; @@ -353,7 +358,7 @@ static int vx_conf_pipe(vx_core_t *chip, vx_pipe_t *pipe) /* * vx_send_irqa - trigger IRQA */ -static int vx_send_irqa(vx_core_t *chip) +static int vx_send_irqa(struct vx_core *chip) { struct vx_rmh rmh; @@ -378,7 +383,7 @@ static int vx_send_irqa(vx_core_t *chip) * called from trigger callback only * */ -static int vx_toggle_pipe(vx_core_t *chip, vx_pipe_t *pipe, int state) +static int vx_toggle_pipe(struct vx_core *chip, struct vx_pipe *pipe, int state) { int err, i, cur_state; @@ -431,7 +436,7 @@ static int vx_toggle_pipe(vx_core_t *chip, vx_pipe_t *pipe, int state) * * called from trigger callback only */ -static int vx_stop_pipe(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_stop_pipe(struct vx_core *chip, struct vx_pipe *pipe) { struct vx_rmh rmh; vx_init_rmh(&rmh, CMD_STOP_PIPE); @@ -449,12 +454,12 @@ static int vx_stop_pipe(vx_core_t *chip, vx_pipe_t *pipe) * * return 0 on success, or a negative error code. */ -static int vx_alloc_pipe(vx_core_t *chip, int capture, +static int vx_alloc_pipe(struct vx_core *chip, int capture, int audioid, int num_audio, - vx_pipe_t **pipep) + struct vx_pipe **pipep) { int err; - vx_pipe_t *pipe; + struct vx_pipe *pipe; struct vx_rmh rmh; int data_mode; @@ -499,7 +504,7 @@ static int vx_alloc_pipe(vx_core_t *chip, int capture, * vx_free_pipe - release a pipe * @pipe: pipe to be released */ -static int vx_free_pipe(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_free_pipe(struct vx_core *chip, struct vx_pipe *pipe) { struct vx_rmh rmh; @@ -517,7 +522,7 @@ static int vx_free_pipe(vx_core_t *chip, vx_pipe_t *pipe) * * called from trigger callback only */ -static int vx_start_stream(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_start_stream(struct vx_core *chip, struct vx_pipe *pipe) { struct vx_rmh rmh; @@ -533,7 +538,7 @@ static int vx_start_stream(vx_core_t *chip, vx_pipe_t *pipe) * * called from trigger callback only */ -static int vx_stop_stream(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_stop_stream(struct vx_core *chip, struct vx_pipe *pipe) { struct vx_rmh rmh; @@ -547,11 +552,12 @@ static int vx_stop_stream(vx_core_t *chip, vx_pipe_t *pipe) * playback hw information */ -static snd_pcm_hardware_t vx_pcm_playback_hw = { +static struct snd_pcm_hardware vx_pcm_playback_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ /*SNDRV_PCM_INFO_RESUME*/), - .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, + .formats = (/*SNDRV_PCM_FMTBIT_U8 |*/ + SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE), .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, .rate_min = 5000, .rate_max = 48000, @@ -571,11 +577,11 @@ static void vx_pcm_delayed_start(unsigned long arg); /* * vx_pcm_playback_open - open callback for playback */ -static int vx_pcm_playback_open(snd_pcm_substream_t *subs) +static int vx_pcm_playback_open(struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; - vx_core_t *chip = snd_pcm_substream_chip(subs); - vx_pipe_t *pipe = NULL; + struct snd_pcm_runtime *runtime = subs->runtime; + struct vx_core *chip = snd_pcm_substream_chip(subs); + struct vx_pipe *pipe = NULL; unsigned int audio; int err; @@ -615,10 +621,10 @@ static int vx_pcm_playback_open(snd_pcm_substream_t *subs) /* * vx_pcm_playback_close - close callback for playback */ -static int vx_pcm_playback_close(snd_pcm_substream_t *subs) +static int vx_pcm_playback_close(struct snd_pcm_substream *subs) { - vx_core_t *chip = snd_pcm_substream_chip(subs); - vx_pipe_t *pipe; + struct vx_core *chip = snd_pcm_substream_chip(subs); + struct vx_pipe *pipe; if (! subs->runtime->private_data) return -EINVAL; @@ -641,7 +647,7 @@ static int vx_pcm_playback_close(snd_pcm_substream_t *subs) * * NB: call with a certain lock. */ -static int vx_notify_end_of_buffer(vx_core_t *chip, vx_pipe_t *pipe) +static int vx_notify_end_of_buffer(struct vx_core *chip, struct vx_pipe *pipe) { int err; struct vx_rmh rmh; /* use a temporary rmh here */ @@ -669,7 +675,9 @@ static int vx_notify_end_of_buffer(vx_core_t *chip, vx_pipe_t *pipe) * * return 0 if ok. */ -static int vx_pcm_playback_transfer_chunk(vx_core_t *chip, snd_pcm_runtime_t *runtime, vx_pipe_t *pipe, int size) +static int vx_pcm_playback_transfer_chunk(struct vx_core *chip, + struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe, int size) { int space, err = 0; @@ -705,7 +713,9 @@ static int vx_pcm_playback_transfer_chunk(vx_core_t *chip, snd_pcm_runtime_t *ru * so that the caller can check the total transferred size later * (to call snd_pcm_period_elapsed). */ -static int vx_update_pipe_position(vx_core_t *chip, snd_pcm_runtime_t *runtime, vx_pipe_t *pipe) +static int vx_update_pipe_position(struct vx_core *chip, + struct snd_pcm_runtime *runtime, + struct vx_pipe *pipe) { struct vx_rmh rmh; int err, update; @@ -731,10 +741,12 @@ static int vx_update_pipe_position(vx_core_t *chip, snd_pcm_runtime_t *runtime, * transfer the pending playback buffer data to DSP * called from interrupt handler */ -static void vx_pcm_playback_transfer(vx_core_t *chip, snd_pcm_substream_t *subs, vx_pipe_t *pipe, int nchunks) +static void vx_pcm_playback_transfer(struct vx_core *chip, + struct snd_pcm_substream *subs, + struct vx_pipe *pipe, int nchunks) { int i, err; - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) return; @@ -749,10 +761,12 @@ static void vx_pcm_playback_transfer(vx_core_t *chip, snd_pcm_substream_t *subs, * update the playback position and call snd_pcm_period_elapsed() if necessary * called from interrupt handler */ -static void vx_pcm_playback_update(vx_core_t *chip, snd_pcm_substream_t *subs, vx_pipe_t *pipe) +static void vx_pcm_playback_update(struct vx_core *chip, + struct snd_pcm_substream *subs, + struct vx_pipe *pipe) { int err; - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (pipe->running && ! (chip->chip_status & VX_STAT_IS_STALE)) { if ((err = vx_update_pipe_position(chip, runtime, pipe)) < 0) @@ -771,9 +785,9 @@ static void vx_pcm_playback_update(vx_core_t *chip, snd_pcm_substream_t *subs, v */ static void vx_pcm_delayed_start(unsigned long arg) { - snd_pcm_substream_t *subs = (snd_pcm_substream_t *)arg; - vx_core_t *chip = subs->pcm->private_data; - vx_pipe_t *pipe = subs->runtime->private_data; + struct snd_pcm_substream *subs = (struct snd_pcm_substream *)arg; + struct vx_core *chip = subs->pcm->private_data; + struct vx_pipe *pipe = subs->runtime->private_data; int err; /* printk( KERN_DEBUG "DDDD tasklet delayed start jiffies = %ld\n", jiffies);*/ @@ -792,10 +806,10 @@ static void vx_pcm_delayed_start(unsigned long arg) /* * vx_pcm_playback_trigger - trigger callback for playback */ -static int vx_pcm_trigger(snd_pcm_substream_t *subs, int cmd) +static int vx_pcm_trigger(struct snd_pcm_substream *subs, int cmd) { - vx_core_t *chip = snd_pcm_substream_chip(subs); - vx_pipe_t *pipe = subs->runtime->private_data; + struct vx_core *chip = snd_pcm_substream_chip(subs); + struct vx_pipe *pipe = subs->runtime->private_data; int err; if (chip->chip_status & VX_STAT_IS_STALE) @@ -839,18 +853,18 @@ static int vx_pcm_trigger(snd_pcm_substream_t *subs, int cmd) /* * vx_pcm_playback_pointer - pointer callback for playback */ -static snd_pcm_uframes_t vx_pcm_playback_pointer(snd_pcm_substream_t *subs) +static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; - vx_pipe_t *pipe = runtime->private_data; + struct snd_pcm_runtime *runtime = subs->runtime; + struct vx_pipe *pipe = runtime->private_data; return pipe->position; } /* * vx_pcm_hw_params - hw_params callback for playback and capture */ -static int vx_pcm_hw_params(snd_pcm_substream_t *subs, - snd_pcm_hw_params_t *hw_params) +static int vx_pcm_hw_params(struct snd_pcm_substream *subs, + struct snd_pcm_hw_params *hw_params) { return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params)); } @@ -858,7 +872,7 @@ static int vx_pcm_hw_params(snd_pcm_substream_t *subs, /* * vx_pcm_hw_free - hw_free callback for playback and capture */ -static int vx_pcm_hw_free(snd_pcm_substream_t *subs) +static int vx_pcm_hw_free(struct snd_pcm_substream *subs) { return snd_pcm_free_vmalloc_buffer(subs); } @@ -866,11 +880,11 @@ static int vx_pcm_hw_free(snd_pcm_substream_t *subs) /* * vx_pcm_prepare - prepare callback for playback and capture */ -static int vx_pcm_prepare(snd_pcm_substream_t *subs) +static int vx_pcm_prepare(struct snd_pcm_substream *subs) { - vx_core_t *chip = snd_pcm_substream_chip(subs); - snd_pcm_runtime_t *runtime = subs->runtime; - vx_pipe_t *pipe = runtime->private_data; + struct vx_core *chip = snd_pcm_substream_chip(subs); + struct snd_pcm_runtime *runtime = subs->runtime; + struct vx_pipe *pipe = runtime->private_data; int err, data_mode; // int max_size, nchunks; @@ -897,7 +911,8 @@ static int vx_pcm_prepare(snd_pcm_substream_t *subs) } if (chip->pcm_running && chip->freq != runtime->rate) { - snd_printk(KERN_ERR "vx: cannot set different clock %d from the current %d\n", runtime->rate, chip->freq); + snd_printk(KERN_ERR "vx: cannot set different clock %d " + "from the current %d\n", runtime->rate, chip->freq); return -EINVAL; } vx_set_clock(chip, runtime->rate); @@ -930,7 +945,7 @@ static int vx_pcm_prepare(snd_pcm_substream_t *subs) /* * operators for PCM playback */ -static snd_pcm_ops_t vx_pcm_playback_ops = { +static struct snd_pcm_ops vx_pcm_playback_ops = { .open = vx_pcm_playback_open, .close = vx_pcm_playback_close, .ioctl = snd_pcm_lib_ioctl, @@ -947,11 +962,12 @@ static snd_pcm_ops_t vx_pcm_playback_ops = { * playback hw information */ -static snd_pcm_hardware_t vx_pcm_capture_hw = { +static struct snd_pcm_hardware vx_pcm_capture_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ /*SNDRV_PCM_INFO_RESUME*/), - .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, + .formats = (/*SNDRV_PCM_FMTBIT_U8 |*/ + SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE), .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, .rate_min = 5000, .rate_max = 48000, @@ -969,12 +985,12 @@ static snd_pcm_hardware_t vx_pcm_capture_hw = { /* * vx_pcm_capture_open - open callback for capture */ -static int vx_pcm_capture_open(snd_pcm_substream_t *subs) +static int vx_pcm_capture_open(struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; - vx_core_t *chip = snd_pcm_substream_chip(subs); - vx_pipe_t *pipe; - vx_pipe_t *pipe_out_monitoring = NULL; + struct snd_pcm_runtime *runtime = subs->runtime; + struct vx_core *chip = snd_pcm_substream_chip(subs); + struct vx_pipe *pipe; + struct vx_pipe *pipe_out_monitoring = NULL; unsigned int audio; int err; @@ -1005,9 +1021,11 @@ static int vx_pcm_capture_open(snd_pcm_substream_t *subs) if an output pipe is available, it's audios still may need to be unmuted. hence we'll have to call a mixer entry point. */ - vx_set_monitor_level(chip, audio, chip->audio_monitor[audio], chip->audio_monitor_active[audio]); + vx_set_monitor_level(chip, audio, chip->audio_monitor[audio], + chip->audio_monitor_active[audio]); /* assuming stereo */ - vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1], chip->audio_monitor_active[audio+1]); + vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1], + chip->audio_monitor_active[audio+1]); } pipe->monitoring_pipe = pipe_out_monitoring; /* default value NULL */ @@ -1026,11 +1044,11 @@ static int vx_pcm_capture_open(snd_pcm_substream_t *subs) /* * vx_pcm_capture_close - close callback for capture */ -static int vx_pcm_capture_close(snd_pcm_substream_t *subs) +static int vx_pcm_capture_close(struct snd_pcm_substream *subs) { - vx_core_t *chip = snd_pcm_substream_chip(subs); - vx_pipe_t *pipe; - vx_pipe_t *pipe_out_monitoring; + struct vx_core *chip = snd_pcm_substream_chip(subs); + struct vx_pipe *pipe; + struct vx_pipe *pipe_out_monitoring; if (! subs->runtime->private_data) return -EINVAL; @@ -1062,10 +1080,11 @@ static int vx_pcm_capture_close(snd_pcm_substream_t *subs) /* * vx_pcm_capture_update - update the capture buffer */ -static void vx_pcm_capture_update(vx_core_t *chip, snd_pcm_substream_t *subs, vx_pipe_t *pipe) +static void vx_pcm_capture_update(struct vx_core *chip, struct snd_pcm_substream *subs, + struct vx_pipe *pipe) { int size, space, count; - snd_pcm_runtime_t *runtime = subs->runtime; + struct snd_pcm_runtime *runtime = subs->runtime; if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) return; @@ -1135,17 +1154,17 @@ static void vx_pcm_capture_update(vx_core_t *chip, snd_pcm_substream_t *subs, vx /* * vx_pcm_capture_pointer - pointer callback for capture */ -static snd_pcm_uframes_t vx_pcm_capture_pointer(snd_pcm_substream_t *subs) +static snd_pcm_uframes_t vx_pcm_capture_pointer(struct snd_pcm_substream *subs) { - snd_pcm_runtime_t *runtime = subs->runtime; - vx_pipe_t *pipe = runtime->private_data; + struct snd_pcm_runtime *runtime = subs->runtime; + struct vx_pipe *pipe = runtime->private_data; return bytes_to_frames(runtime, pipe->hw_ptr); } /* * operators for PCM capture */ -static snd_pcm_ops_t vx_pcm_capture_ops = { +static struct snd_pcm_ops vx_pcm_capture_ops = { .open = vx_pcm_capture_open, .close = vx_pcm_capture_close, .ioctl = snd_pcm_lib_ioctl, @@ -1161,10 +1180,10 @@ static snd_pcm_ops_t vx_pcm_capture_ops = { /* * interrupt handler for pcm streams */ -void vx_pcm_update_intr(vx_core_t *chip, unsigned int events) +void vx_pcm_update_intr(struct vx_core *chip, unsigned int events) { unsigned int i; - vx_pipe_t *pipe; + struct vx_pipe *pipe; #define EVENT_MASK (END_OF_BUFFER_EVENTS_PENDING|ASYNC_EVENTS_PENDING) @@ -1218,7 +1237,7 @@ void vx_pcm_update_intr(vx_core_t *chip, unsigned int events) /* * vx_init_audio_io - check the availabe audio i/o and allocate pipe arrays */ -static int vx_init_audio_io(vx_core_t *chip) +static int vx_init_audio_io(struct vx_core *chip) { struct vx_rmh rmh; int preferred; @@ -1234,19 +1253,20 @@ static int vx_init_audio_io(vx_core_t *chip) chip->audio_info = rmh.Stat[1]; /* allocate pipes */ - chip->playback_pipes = kmalloc(sizeof(vx_pipe_t *) * chip->audio_outs, GFP_KERNEL); - chip->capture_pipes = kmalloc(sizeof(vx_pipe_t *) * chip->audio_ins, GFP_KERNEL); + chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL); + chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL); if (! chip->playback_pipes || ! chip->capture_pipes) return -ENOMEM; - memset(chip->playback_pipes, 0, sizeof(vx_pipe_t *) * chip->audio_outs); - memset(chip->capture_pipes, 0, sizeof(vx_pipe_t *) * chip->audio_ins); + memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs); + memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins); preferred = chip->ibl.size; chip->ibl.size = 0; vx_set_ibl(chip, &chip->ibl); /* query the info */ if (preferred > 0) { - chip->ibl.size = ((preferred + chip->ibl.granularity - 1) / chip->ibl.granularity) * chip->ibl.granularity; + chip->ibl.size = ((preferred + chip->ibl.granularity - 1) / + chip->ibl.granularity) * chip->ibl.granularity; if (chip->ibl.size > chip->ibl.max_size) chip->ibl.size = chip->ibl.max_size; } else @@ -1260,9 +1280,9 @@ static int vx_init_audio_io(vx_core_t *chip) /* * free callback for pcm */ -static void snd_vx_pcm_free(snd_pcm_t *pcm) +static void snd_vx_pcm_free(struct snd_pcm *pcm) { - vx_core_t *chip = pcm->private_data; + struct vx_core *chip = pcm->private_data; chip->pcm[pcm->device] = NULL; kfree(chip->playback_pipes); chip->playback_pipes = NULL; @@ -1273,9 +1293,9 @@ static void snd_vx_pcm_free(snd_pcm_t *pcm) /* * snd_vx_pcm_new - create and initialize a pcm */ -int snd_vx_pcm_new(vx_core_t *chip) +int snd_vx_pcm_new(struct vx_core *chip) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; unsigned int i; int err; diff --git a/sound/drivers/vx/vx_uer.c b/sound/drivers/vx/vx_uer.c index 4fc38bd..7400306 100644 --- a/sound/drivers/vx/vx_uer.c +++ b/sound/drivers/vx/vx_uer.c @@ -31,7 +31,7 @@ * vx_modify_board_clock - tell the board that its clock has been modified * @sync: DSP needs to resynchronize its FIFO */ -static int vx_modify_board_clock(vx_core_t *chip, int sync) +static int vx_modify_board_clock(struct vx_core *chip, int sync) { struct vx_rmh rmh; @@ -45,7 +45,7 @@ static int vx_modify_board_clock(vx_core_t *chip, int sync) /* * vx_modify_board_inputs - resync audio inputs */ -static int vx_modify_board_inputs(vx_core_t *chip) +static int vx_modify_board_inputs(struct vx_core *chip) { struct vx_rmh rmh; @@ -59,7 +59,7 @@ static int vx_modify_board_inputs(vx_core_t *chip) * @index: the bit index * returns 0 or 1. */ -static int vx_read_one_cbit(vx_core_t *chip, int index) +static int vx_read_one_cbit(struct vx_core *chip, int index) { unsigned long flags; int val; @@ -82,7 +82,7 @@ static int vx_read_one_cbit(vx_core_t *chip, int index) * @index: the bit index * @val: bit value, 0 or 1 */ -static void vx_write_one_cbit(vx_core_t *chip, int index, int val) +static void vx_write_one_cbit(struct vx_core *chip, int index, int val) { unsigned long flags; val = !!val; /* 0 or 1 */ @@ -104,7 +104,7 @@ static void vx_write_one_cbit(vx_core_t *chip, int index, int val) * returns the frequency of UER, or 0 if not sync, * or a negative error code. */ -static int vx_read_uer_status(vx_core_t *chip, int *mode) +static int vx_read_uer_status(struct vx_core *chip, int *mode) { int val, freq; @@ -160,7 +160,7 @@ static int vx_read_uer_status(vx_core_t *chip, int *mode) * default : HexFreq = (dword) ((double) 28224000 / (double) (Frequency*4)) - 0x000001FF */ -static int vx_calc_clock_from_freq(vx_core_t *chip, int freq) +static int vx_calc_clock_from_freq(struct vx_core *chip, int freq) { int hexfreq; @@ -187,7 +187,7 @@ static int vx_calc_clock_from_freq(vx_core_t *chip, int freq) * vx_change_clock_source - change the clock source * @source: the new source */ -static void vx_change_clock_source(vx_core_t *chip, int source) +static void vx_change_clock_source(struct vx_core *chip, int source) { unsigned long flags; @@ -205,7 +205,7 @@ static void vx_change_clock_source(vx_core_t *chip, int source) /* * set the internal clock */ -void vx_set_internal_clock(vx_core_t *chip, unsigned int freq) +void vx_set_internal_clock(struct vx_core *chip, unsigned int freq) { int clock; unsigned long flags; @@ -228,7 +228,7 @@ void vx_set_internal_clock(vx_core_t *chip, unsigned int freq) * set the iec958 status bits * @bits: 32-bit status bits */ -void vx_set_iec958_status(vx_core_t *chip, unsigned int bits) +void vx_set_iec958_status(struct vx_core *chip, unsigned int bits) { int i; @@ -243,7 +243,7 @@ void vx_set_iec958_status(vx_core_t *chip, unsigned int bits) /* * vx_set_clock - change the clock and audio source if necessary */ -int vx_set_clock(vx_core_t *chip, unsigned int freq) +int vx_set_clock(struct vx_core *chip, unsigned int freq) { int src_changed = 0; @@ -285,7 +285,7 @@ int vx_set_clock(vx_core_t *chip, unsigned int freq) /* * vx_change_frequency - called from interrupt handler */ -int vx_change_frequency(vx_core_t *chip) +int vx_change_frequency(struct vx_core *chip) { int freq; |