Commit 57648cd5 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/misc' into for-linus

parents 79598324 fb716c0b
...@@ -195,6 +195,24 @@ config RADIO_MAESTRO ...@@ -195,6 +195,24 @@ config RADIO_MAESTRO
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called radio-maestro. module will be called radio-maestro.
config RADIO_MIROPCM20
tristate "miroSOUND PCM20 radio"
depends on ISA && VIDEO_V4L2
select SND_MIRO
---help---
Choose Y here if you have this FM radio card. You also need to enable
the ALSA sound system. This choice automatically selects the ALSA
sound card driver "Miro miroSOUND PCM1pro/PCM12/PCM20radio" as this
is required for the radio-miropcm20.
In order to control your radio card, you will need to use programs
that are compatible with the Video For Linux API. Information on
this API and pointers to "v4l" programs may be found at
<file:Documentation/video4linux/API.html>.
To compile this driver as a module, choose M here: the
module will be called radio-miropcm20.
config RADIO_SF16FMI config RADIO_SF16FMI
tristate "SF16FMI Radio" tristate "SF16FMI Radio"
depends on ISA && VIDEO_V4L2 depends on ISA && VIDEO_V4L2
......
...@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o ...@@ -18,6 +18,7 @@ obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o obj-$(CONFIG_RADIO_MAESTRO) += radio-maestro.o
obj-$(CONFIG_RADIO_MIROPCM20) += radio-miropcm20.o
obj-$(CONFIG_USB_DSBR) += dsbr100.o obj-$(CONFIG_USB_DSBR) += dsbr100.o
obj-$(CONFIG_RADIO_SI470X) += si470x/ obj-$(CONFIG_RADIO_SI470X) += si470x/
obj-$(CONFIG_USB_MR800) += radio-mr800.o obj-$(CONFIG_USB_MR800) += radio-mr800.o
......
/* Miro PCM20 radio driver for Linux radio support
* (c) 1998 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
* Thanks to Norberto Pellici for the ACI device interface specification
* The API part is based on the radiotrack driver by M. Kirkwood
* This driver relies on the aci mixer provided by the snd-miro
* ALSA driver.
* Look there for further info...
*/
/* What ever you think about the ACI, version 0x07 is not very well!
* I can't get frequency, 'tuner status', 'tuner flags' or mute/mono
* conditions... Robert
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <sound/aci.h>
static int radio_nr = -1;
module_param(radio_nr, int, 0);
MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)");
static int mono;
module_param(mono, bool, 0);
MODULE_PARM_DESC(mono, "Force tuner into mono mode.");
struct pcm20 {
struct v4l2_device v4l2_dev;
struct video_device vdev;
unsigned long freq;
int muted;
struct snd_miro_aci *aci;
};
static struct pcm20 pcm20_card = {
.freq = 87*16000,
.muted = 1,
};
static int pcm20_mute(struct pcm20 *dev, unsigned char mute)
{
dev->muted = mute;
return snd_aci_cmd(dev->aci, ACI_SET_TUNERMUTE, mute, -1);
}
static int pcm20_stereo(struct pcm20 *dev, unsigned char stereo)
{
return snd_aci_cmd(dev->aci, ACI_SET_TUNERMONO, !stereo, -1);
}
static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq)
{
unsigned char freql;
unsigned char freqh;
struct snd_miro_aci *aci = dev->aci;
dev->freq = freq;
freq /= 160;
if (!(aci->aci_version == 0x07 || aci->aci_version >= 0xb0))
freq /= 10; /* I don't know exactly which version
* needs this hack */
freql = freq & 0xff;
freqh = freq >> 8;
pcm20_stereo(dev, !mono);
return snd_aci_cmd(aci, ACI_WRITE_TUNE, freql, freqh);
}
static const struct v4l2_file_operations pcm20_fops = {
.owner = THIS_MODULE,
.ioctl = video_ioctl2,
};
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *v)
{
strlcpy(v->driver, "Miro PCM20", sizeof(v->driver));
strlcpy(v->card, "Miro PCM20", sizeof(v->card));
strlcpy(v->bus_info, "ISA", sizeof(v->bus_info));
v->version = 0x1;
v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
return 0;
}
static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v)
{
if (v->index) /* Only 1 tuner */
return -EINVAL;
strlcpy(v->name, "FM", sizeof(v->name));
v->type = V4L2_TUNER_RADIO;
v->rangelow = 87*16000;
v->rangehigh = 108*16000;
v->signal = 0xffff;
v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
v->capability = V4L2_TUNER_CAP_LOW;
v->audmode = V4L2_TUNER_MODE_MONO;
return 0;
}
static int vidioc_s_tuner(struct file *file, void *priv,
struct v4l2_tuner *v)
{
return v->index ? -EINVAL : 0;
}
static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
struct pcm20 *dev = video_drvdata(file);
if (f->tuner != 0)
return -EINVAL;
f->type = V4L2_TUNER_RADIO;
f->frequency = dev->freq;
return 0;
}
static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
struct pcm20 *dev = video_drvdata(file);
if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
return -EINVAL;
dev->freq = f->frequency;
pcm20_setfreq(dev, f->frequency);
return 0;
}
static int vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
{
switch (qc->id) {
case V4L2_CID_AUDIO_MUTE:
return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
}
return -EINVAL;
}
static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct pcm20 *dev = video_drvdata(file);
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
ctrl->value = dev->muted;
break;
default:
return -EINVAL;
}
return 0;
}
static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct pcm20 *dev = video_drvdata(file);
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
pcm20_mute(dev, ctrl->value);
break;
default:
return -EINVAL;
}
return 0;
}
static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
{
*i = 0;
return 0;
}
static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
{
return i ? -EINVAL : 0;
}
static int vidioc_g_audio(struct file *file, void *priv,
struct v4l2_audio *a)
{
a->index = 0;
strlcpy(a->name, "Radio", sizeof(a->name));
a->capability = V4L2_AUDCAP_STEREO;
return 0;
}
static int vidioc_s_audio(struct file *file, void *priv,
struct v4l2_audio *a)
{
return a->index ? -EINVAL : 0;
}
static const struct v4l2_ioctl_ops pcm20_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_tuner = vidioc_g_tuner,
.vidioc_s_tuner = vidioc_s_tuner,
.vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency,
.vidioc_queryctrl = vidioc_queryctrl,
.vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_g_audio = vidioc_g_audio,
.vidioc_s_audio = vidioc_s_audio,
.vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input,
};
static int __init pcm20_init(void)
{
struct pcm20 *dev = &pcm20_card;
struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
int res;
dev->aci = snd_aci_get_aci();
if (dev->aci == NULL) {
v4l2_err(v4l2_dev,
"you must load the snd-miro driver first!\n");
return -ENODEV;
}
strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name));
res = v4l2_device_register(NULL, v4l2_dev);
if (res < 0) {
v4l2_err(v4l2_dev, "could not register v4l2_device\n");
return -EINVAL;
}
strlcpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name));
dev->vdev.v4l2_dev = v4l2_dev;
dev->vdev.fops = &pcm20_fops;
dev->vdev.ioctl_ops = &pcm20_ioctl_ops;
dev->vdev.release = video_device_release_empty;
video_set_drvdata(&dev->vdev, dev);
if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0)
goto fail;
v4l2_info(v4l2_dev, "Mirosound PCM20 Radio tuner\n");
return 0;
fail:
v4l2_device_unregister(v4l2_dev);
return -EINVAL;
}
MODULE_AUTHOR("Ruurd Reitsma, Krzysztof Helt");
MODULE_DESCRIPTION("A driver for the Miro PCM20 radio card.");
MODULE_LICENSE("GPL");
static void __exit pcm20_cleanup(void)
{
struct pcm20 *dev = &pcm20_card;
video_unregister_device(&dev->vdev);
v4l2_device_unregister(&dev->v4l2_dev);
}
module_init(pcm20_init);
module_exit(pcm20_cleanup);
#ifndef _MIRO_H_ #ifndef _ACI_H_
#define _MIRO_H_ #define _ACI_H_
#define ACI_REG_COMMAND 0 /* write register offset */ #define ACI_REG_COMMAND 0 /* write register offset */
#define ACI_REG_STATUS 1 /* read register offset */ #define ACI_REG_STATUS 1 /* read register offset */
...@@ -70,4 +70,21 @@ ...@@ -70,4 +70,21 @@
#define ACI_SET_EQ6 0x45 #define ACI_SET_EQ6 0x45
#define ACI_SET_EQ7 0x46 /* ... to Treble */ #define ACI_SET_EQ7 0x46 /* ... to Treble */
#endif /* _MIRO_H_ */ struct snd_miro_aci {
unsigned long aci_port;
int aci_vendor;
int aci_product;
int aci_version;
int aci_amp;
int aci_preamp;
int aci_solomode;
struct mutex aci_mutex;
};
int snd_aci_cmd(struct snd_miro_aci *aci, int write1, int write2, int write3);
struct snd_miro_aci *snd_aci_get_aci(void);
#endif /* _ACI_H_ */
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
#define AD1845_PWR_DOWN 0x1b /* power down control */ #define AD1845_PWR_DOWN 0x1b /* power down control */
#define CS4235_LEFT_MASTER 0x1b /* left master output control */ #define CS4235_LEFT_MASTER 0x1b /* left master output control */
#define CS4231_REC_FORMAT 0x1c /* clock and data format - record - bits 7-0 MCE */ #define CS4231_REC_FORMAT 0x1c /* clock and data format - record - bits 7-0 MCE */
#define CS4231_PLY_VAR_FREQ 0x1d /* playback variable frequency */
#define AD1845_CLOCK 0x1d /* crystal clock select and total power down */ #define AD1845_CLOCK 0x1d /* crystal clock select and total power down */
#define CS4235_RIGHT_MASTER 0x1d /* right master output control */ #define CS4235_RIGHT_MASTER 0x1d /* right master output control */
#define CS4231_REC_UPR_CNT 0x1e /* record upper count */ #define CS4231_REC_UPR_CNT 0x1e /* record upper count */
......
...@@ -154,7 +154,6 @@ int snd_wss_create(struct snd_card *card, ...@@ -154,7 +154,6 @@ int snd_wss_create(struct snd_card *card,
unsigned short hardware, unsigned short hardware,
unsigned short hwshare, unsigned short hwshare,
struct snd_wss **rchip); struct snd_wss **rchip);
int snd_wss_free(struct snd_wss *chip);
int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm); int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer); int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
int snd_wss_mixer(struct snd_wss *chip); int snd_wss_mixer(struct snd_wss *chip);
......
...@@ -58,7 +58,7 @@ config SOUND_OSS_CORE_PRECLAIM ...@@ -58,7 +58,7 @@ config SOUND_OSS_CORE_PRECLAIM
Please read Documentation/feature-removal-schedule.txt for Please read Documentation/feature-removal-schedule.txt for
details. details.
If unusre, say Y. If unsure, say Y.
source "sound/oss/dmasound/Kconfig" source "sound/oss/dmasound/Kconfig"
......
...@@ -18,10 +18,7 @@ ...@@ -18,10 +18,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/io.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/sizes.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/initval.h> #include <sound/initval.h>
...@@ -513,15 +510,9 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -513,15 +510,9 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
if (err < 0) if (err < 0)
goto out; goto out;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params),
err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), params_channels(params),
params_channels(params), aacirun->pcm->r[0].slots);
aacirun->pcm->r[0].slots);
else
err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params),
params_channels(params),
aacirun->pcm->r[0].slots);
if (err) if (err)
goto out; goto out;
...@@ -537,7 +528,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -537,7 +528,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream)
struct aaci_runtime *aacirun = runtime->private_data; struct aaci_runtime *aacirun = runtime->private_data;
aacirun->start = (void *)runtime->dma_area; aacirun->start = (void *)runtime->dma_area;
aacirun->end = aacirun->start + runtime->dma_bytes; aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream);
aacirun->ptr = aacirun->start; aacirun->ptr = aacirun->start;
aacirun->period = aacirun->period =
aacirun->bytes = frames_to_bytes(runtime, runtime->period_size); aacirun->bytes = frames_to_bytes(runtime, runtime->period_size);
......
...@@ -1119,7 +1119,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, ...@@ -1119,7 +1119,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
goto __kctl_end; goto __kctl_end;
} }
if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
if (file && vd->owner != NULL && vd->owner != file) { if (vd->owner != NULL && vd->owner != file) {
err = -EPERM; err = -EPERM;
goto __kctl_end; goto __kctl_end;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bitrev.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/control.h> #include <sound/control.h>
...@@ -55,18 +56,6 @@ struct cs8427 { ...@@ -55,18 +56,6 @@ struct cs8427 {
struct cs8427_stream capture; struct cs8427_stream capture;
}; };
static unsigned char swapbits(unsigned char val)
{
int bit;
unsigned char res = 0;
for (bit = 0; bit < 8; bit++) {
res <<= 1;
res |= val & 1;
val >>= 1;
}
return res;
}
int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
unsigned char val) unsigned char val)
{ {
...@@ -149,7 +138,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device, ...@@ -149,7 +138,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device,
} }
data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF; data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF;
for (idx = 0; idx < count; idx++) for (idx = 0; idx < count; idx++)
data[idx + 1] = swapbits(ndata[idx]); data[idx + 1] = bitrev8(ndata[idx]);
if (snd_i2c_sendbytes(device, data, count + 1) != count + 1) if (snd_i2c_sendbytes(device, data, count + 1) != count + 1)
return -EIO; return -EIO;
return 1; return 1;
......
...@@ -225,7 +225,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -225,7 +225,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
if (tea->ops->mute) { if (tea->ops->mute) {
tea->ops->mute(tea, ctrl->value); tea->ops->mute(tea, ctrl->value);
tea->mute = 1; tea->mute = ctrl->value;
return 0; return 0;
} }
} }
......
...@@ -394,21 +394,15 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) ...@@ -394,21 +394,15 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
return -EBUSY; return -EBUSY;
} }
err = snd_wss_create(card, port[dev], cport[dev], err = snd_cs4236_create(card, port[dev], cport[dev],
irq[dev], irq[dev],
dma1[dev], dma2[dev], dma1[dev], dma2[dev],
WSS_HW_DETECT3, 0, &chip); WSS_HW_DETECT3, 0, &chip);
if (err < 0) if (err < 0)
return err; return err;
acard->chip = chip;
if (chip->hardware & WSS_HW_CS4236B_MASK) { if (chip->hardware & WSS_HW_CS4236B_MASK) {
snd_wss_free(chip);
err = snd_cs4236_create(card,
port[dev], cport[dev],
irq[dev], dma1[dev], dma2[dev],
WSS_HW_DETECT, 0, &chip);
if (err < 0)
return err;
acard->chip = chip;
err = snd_cs4236_pcm(chip, 0, &pcm); err = snd_cs4236_pcm(chip, 0, &pcm);
if (err < 0) if (err < 0)
...@@ -418,7 +412,6 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) ...@@ -418,7 +412,6 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
if (err < 0) if (err < 0)
return err; return err;
} else { } else {
acard->chip = chip;
err = snd_wss_pcm(chip, 0, &pcm); err = snd_wss_pcm(chip, 0, &pcm);
if (err < 0) if (err < 0)
return err; return err;
......
This diff is collapsed.
...@@ -102,8 +102,6 @@ ...@@ -102,8 +102,6 @@
struct snd_es18xx { struct snd_es18xx {
unsigned long port; /* port of ESS chip */ unsigned long port; /* port of ESS chip */
unsigned long mpu_port; /* MPU-401 port of ESS chip */
unsigned long fm_port; /* FM port */
unsigned long ctrl_port; /* Control port of ESS chip */ unsigned long ctrl_port; /* Control port of ESS chip */
struct resource *res_port; struct resource *res_port;
struct resource *res_mpu_port; struct resource *res_mpu_port;
...@@ -116,8 +114,6 @@ struct snd_es18xx { ...@@ -116,8 +114,6 @@ struct snd_es18xx {
unsigned short audio2_vol; /* volume level of audio2 */ unsigned short audio2_vol; /* volume level of audio2 */
unsigned short active; /* active channel mask */ unsigned short active; /* active channel mask */
unsigned int dma1_size;
unsigned int dma2_size;
unsigned int dma1_shift; unsigned int dma1_shift;
unsigned int dma2_shift; unsigned int dma2_shift;
...@@ -135,7 +131,6 @@ struct snd_es18xx { ...@@ -135,7 +131,6 @@ struct snd_es18xx {
spinlock_t reg_lock; spinlock_t reg_lock;
spinlock_t mixer_lock; spinlock_t mixer_lock;
spinlock_t ctrl_lock;
#ifdef CONFIG_PM #ifdef CONFIG_PM
unsigned char pm_reg; unsigned char pm_reg;
#endif #endif
...@@ -354,7 +349,7 @@ static inline int snd_es18xx_mixer_writable(struct snd_es18xx *chip, unsigned ch ...@@ -354,7 +349,7 @@ static inline int snd_es18xx_mixer_writable(struct snd_es18xx *chip, unsigned ch
} }
static int snd_es18xx_reset(struct snd_es18xx *chip) static int __devinit snd_es18xx_reset(struct snd_es18xx *chip)
{ {
int i; int i;
outb(0x03, chip->port + 0x06); outb(0x03, chip->port + 0x06);
...@@ -490,8 +485,6 @@ static int snd_es18xx_playback1_prepare(struct snd_es18xx *chip, ...@@ -490,8 +485,6 @@ static int snd_es18xx_playback1_prepare(struct snd_es18xx *chip,
unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int size = snd_pcm_lib_buffer_bytes(substream);
unsigned int count = snd_pcm_lib_period_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream);
chip->dma2_size = size;
snd_es18xx_rate_set(chip, substream, DAC2); snd_es18xx_rate_set(chip, substream, DAC2);
/* Transfer Count Reload */ /* Transfer Count Reload */
...@@ -591,8 +584,6 @@ static int snd_es18xx_capture_prepare(struct snd_pcm_substream *substream) ...@@ -591,8 +584,6 @@ static int snd_es18xx_capture_prepare(struct snd_pcm_substream *substream)
unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int size = snd_pcm_lib_buffer_bytes(substream);
unsigned int count = snd_pcm_lib_period_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream);
chip->dma1_size = size;
snd_es18xx_reset_fifo(chip); snd_es18xx_reset_fifo(chip);
/* Set stereo/mono */ /* Set stereo/mono */
...@@ -659,8 +650,6 @@ static int snd_es18xx_playback2_prepare(struct snd_es18xx *chip, ...@@ -659,8 +650,6 @@ static int snd_es18xx_playback2_prepare(struct snd_es18xx *chip,
unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int size = snd_pcm_lib_buffer_bytes(substream);
unsigned int count = snd_pcm_lib_period_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream);
chip->dma1_size = size;
snd_es18xx_reset_fifo(chip); snd_es18xx_reset_fifo(chip);
/* Set stereo/mono */ /* Set stereo/mono */
...@@ -821,17 +810,18 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id) ...@@ -821,17 +810,18 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id)
static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_es18xx *chip = snd_pcm_substream_chip(substream); struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
unsigned int size = snd_pcm_lib_buffer_bytes(substream);
int pos; int pos;
if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) { if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
if (!(chip->active & DAC2)) if (!(chip->active & DAC2))
return 0; return 0;
pos = snd_dma_pointer(chip->dma2, chip->dma2_size); pos = snd_dma_pointer(chip->dma2, size);
return pos >> chip->dma2_shift; return pos >> chip->dma2_shift;
} else { } else {
if (!(chip->active & DAC1)) if (!(chip->active & DAC1))
return 0; return 0;
pos = snd_dma_pointer(chip->dma1, chip->dma1_size); pos = snd_dma_pointer(chip->dma1, size);
return pos >> chip->dma1_shift; return pos >> chip->dma1_shift;
} }
} }
...@@ -839,11 +829,12 @@ static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *s ...@@ -839,11 +829,12 @@ static snd_pcm_uframes_t snd_es18xx_playback_pointer(struct snd_pcm_substream *s
static snd_pcm_uframes_t snd_es18xx_capture_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t snd_es18xx_capture_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_es18xx *chip = snd_pcm_substream_chip(substream); struct snd_es18xx *chip = snd_pcm_substream_chip(substream);
unsigned int size = snd_pcm_lib_buffer_bytes(substream);
int pos; int pos;
if (!(chip->active & ADC1)) if (!(chip->active & ADC1))
return 0; return 0;
pos = snd_dma_pointer(chip->dma1, chip->dma1_size); pos = snd_dma_pointer(chip->dma1, size);
return pos >> chip->dma1_shift; return pos >> chip->dma1_shift;
} }
...@@ -974,9 +965,6 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream) ...@@ -974,9 +965,6 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream)
static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
static char *texts4Source[4] = {
"Mic", "CD", "Line", "Master"
};
static char *texts5Source[5] = { static char *texts5Source[5] = {
"Mic", "CD", "Line", "Master", "Mix" "Mic", "CD", "Line", "Master", "Mix"
}; };
...@@ -994,7 +982,8 @@ static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele ...@@ -994,7 +982,8 @@ static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
uinfo->value.enumerated.items = 4; uinfo->value.enumerated.items = 4;
if (uinfo->value.enumerated.item > 3) if (uinfo->value.enumerated.item > 3)
uinfo->value.enumerated.item = 3; uinfo->value.enumerated.item = 3;
strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]); strcpy(uinfo->value.enumerated.name,
texts5Source[uinfo->value.enumerated.item]);
break; break;
case 0x1887: case 0x1887:
case 0x1888: case 0x1888:
...@@ -1378,11 +1367,9 @@ ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), ...@@ -1378,11 +1367,9 @@ ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0),
static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg)
{ {
int data; int data;
unsigned long flags;
spin_lock_irqsave(&chip->ctrl_lock, flags);
outb(reg, chip->ctrl_port); outb(reg, chip->ctrl_port);
data = inb(chip->ctrl_port + 1); data = inb(chip->ctrl_port + 1);
spin_unlock_irqrestore(&chip->ctrl_lock, flags);
return data; return data;
} }
...@@ -1398,7 +1385,9 @@ static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, ...@@ -1398,7 +1385,9 @@ static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip,
#endif #endif
} }
static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip,
unsigned long mpu_port,
unsigned long fm_port)
{ {
int mask = 0; int mask = 0;
...@@ -1412,15 +1401,15 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) ...@@ -1412,15 +1401,15 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip)
if (chip->caps & ES18XX_CONTROL) { if (chip->caps & ES18XX_CONTROL) {
/* Hardware volume IRQ */ /* Hardware volume IRQ */
snd_es18xx_config_write(chip, 0x27, chip->irq); snd_es18xx_config_write(chip, 0x27, chip->irq);
if (chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) { if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) {
/* FM I/O */ /* FM I/O */
snd_es18xx_config_write(chip, 0x62, chip->fm_port >> 8); snd_es18xx_config_write(chip, 0x62, fm_port >> 8);
snd_es18xx_config_write(chip, 0x63, chip->fm_port & 0xff); snd_es18xx_config_write(chip, 0x63, fm_port & 0xff);
} }
if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { if (mpu_port > 0 && mpu_port != SNDRV_AUTO_PORT) {
/* MPU-401 I/O */ /* MPU-401 I/O */
snd_es18xx_config_write(chip, 0x64, chip->mpu_port >> 8); snd_es18xx_config_write(chip, 0x64, mpu_port >> 8);
snd_es18xx_config_write(chip, 0x65, chip->mpu_port & 0xff); snd_es18xx_config_write(chip, 0x65, mpu_port & 0xff);
/* MPU-401 IRQ */ /* MPU-401 IRQ */
snd_es18xx_config_write(chip, 0x28, chip->irq); snd_es18xx_config_write(chip, 0x28, chip->irq);
} }
...@@ -1507,11 +1496,12 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) ...@@ -1507,11 +1496,12 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip)
snd_es18xx_mixer_write(chip, 0x7A, 0x68); snd_es18xx_mixer_write(chip, 0x7A, 0x68);
/* Enable and set hardware volume interrupt */ /* Enable and set hardware volume interrupt */
snd_es18xx_mixer_write(chip, 0x64, 0x06); snd_es18xx_mixer_write(chip, 0x64, 0x06);
if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { if (mpu_port > 0 && mpu_port != SNDRV_AUTO_PORT) {
/* MPU401 share irq with audio /* MPU401 share irq with audio
Joystick enabled Joystick enabled
FM enabled */ FM enabled */
snd_es18xx_mixer_write(chip, 0x40, 0x43 | (chip->mpu_port & 0xf0) >> 1); snd_es18xx_mixer_write(chip, 0x40,
0x43 | (mpu_port & 0xf0) >> 1);
} }
snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01); snd_es18xx_mixer_write(chip, 0x7f, ((irqmask + 1) << 1) | 0x01);
} }
...@@ -1629,7 +1619,9 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip) ...@@ -1629,7 +1619,9 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip)
return 0; return 0;
} }
static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) static int __devinit snd_es18xx_probe(struct snd_es18xx *chip,
unsigned long mpu_port,
unsigned long fm_port)
{ {
if (snd_es18xx_identify(chip) < 0) { if (snd_es18xx_identify(chip) < 0) {
snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port); snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port);
...@@ -1650,8 +1642,6 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) ...@@ -1650,8 +1642,6 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip)
chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV;
break; break;
case 0x1887: case 0x1887:
chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME;
break;
case 0x1888: case 0x1888:
chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME;
break; break;
...@@ -1666,7 +1656,7 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) ...@@ -1666,7 +1656,7 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip)
if (chip->dma1 == chip->dma2) if (chip->dma1 == chip->dma2)
chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME); chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME);
return snd_es18xx_initialize(chip); return snd_es18xx_initialize(chip, mpu_port, fm_port);
} }
static struct snd_pcm_ops snd_es18xx_playback_ops = { static struct snd_pcm_ops snd_es18xx_playback_ops = {
...@@ -1802,10 +1792,7 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, ...@@ -1802,10 +1792,7 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card,
spin_lock_init(&chip->reg_lock); spin_lock_init(&chip->reg_lock);
spin_lock_init(&chip->mixer_lock); spin_lock_init(&chip->mixer_lock);
spin_lock_init(&chip->ctrl_lock);
chip->port = port; chip->port = port;
chip->mpu_port = mpu_port;
chip->fm_port = fm_port;
chip->irq = -1; chip->irq = -1;
chip->dma1 = -1; chip->dma1 = -1;
chip->dma2 = -1; chip->dma2 = -1;
...@@ -1841,11 +1828,11 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card, ...@@ -1841,11 +1828,11 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card,
} }
chip->dma2 = dma2; chip->dma2 = dma2;
if (snd_es18xx_probe(chip) < 0) { if (snd_es18xx_probe(chip, mpu_port, fm_port) < 0) {
snd_es18xx_free(card); snd_es18xx_free(card);
return -ENODEV; return -ENODEV;
} }
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, NULL, &ops); err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) { if (err < 0) {
snd_es18xx_free(card); snd_es18xx_free(card);
return err; return err;
...@@ -1980,7 +1967,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ ...@@ -1980,7 +1967,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
#endif #endif
static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */
#ifndef CONFIG_PNP #ifndef CONFIG_PNP
...@@ -2160,19 +2147,23 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) ...@@ -2160,19 +2147,23 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
return err; return err;
if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { if (snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2,
snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port); OPL3_HW_OPL3, 0, &opl3) < 0) {
snd_printk(KERN_WARNING PFX
"opl3 not detected at 0x%lx\n",
fm_port[dev]);
} else { } else {
if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (err < 0)
return err; return err;
} }
} }
if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
chip->mpu_port, 0, mpu_port[dev], 0,
irq[dev], 0, irq[dev], 0, &chip->rmidi);
&chip->rmidi)) < 0) if (err < 0)
return err; return err;
} }
......
This diff is collapsed.
...@@ -141,15 +141,7 @@ struct snd_opti9xx { ...@@ -141,15 +141,7 @@ struct snd_opti9xx {
spinlock_t lock; spinlock_t lock;
long wss_base;
int irq; int irq;
int dma1;
int dma2;
long fm_port;
long mpu_port;
int mpu_irq;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
struct pnp_dev *dev; struct pnp_dev *dev;
...@@ -216,13 +208,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, ...@@ -216,13 +208,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
chip->wss_base = -1;
chip->irq = -1; chip->irq = -1;
chip->dma1 = -1;
chip->dma2 = -1;
chip->fm_port = -1;
chip->mpu_port = -1;
chip->mpu_irq = -1;
switch (hardware) { switch (hardware) {
#ifndef OPTi93X #ifndef OPTi93X
...@@ -348,7 +334,10 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg, ...@@ -348,7 +334,10 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
(snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
long wss_base,
int irq, int dma1, int dma2,
long mpu_port, int mpu_irq)
{ {
unsigned char wss_base_bits; unsigned char wss_base_bits;
unsigned char irq_bits; unsigned char irq_bits;
...@@ -416,7 +405,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) ...@@ -416,7 +405,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
return -EINVAL; return -EINVAL;
} }
switch (chip->wss_base) { switch (wss_base) {
case 0x530: case 0x530:
wss_base_bits = 0x00; wss_base_bits = 0x00;
break; break;
...@@ -430,14 +419,13 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) ...@@ -430,14 +419,13 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
wss_base_bits = 0x02; wss_base_bits = 0x02;
break; break;
default: default:
snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base);
chip->wss_base);
goto __skip_base; goto __skip_base;
} }
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30); snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30);
__skip_base: __skip_base:
switch (chip->irq) { switch (irq) {
//#ifdef OPTi93X //#ifdef OPTi93X
case 5: case 5:
irq_bits = 0x05; irq_bits = 0x05;
...@@ -456,11 +444,11 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) ...@@ -456,11 +444,11 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
irq_bits = 0x04; irq_bits = 0x04;
break; break;
default: default:
snd_printk(KERN_WARNING "WSS irq # %d not valid\n", chip->irq); snd_printk(KERN_WARNING "WSS irq # %d not valid\n", irq);
goto __skip_resources; goto __skip_resources;
} }
switch (chip->dma1) { switch (dma1) {
case 0: case 0:
dma_bits = 0x01; dma_bits = 0x01;
break; break;
...@@ -471,38 +459,36 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) ...@@ -471,38 +459,36 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
dma_bits = 0x03; dma_bits = 0x03;
break; break;
default: default:
snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", dma1);
chip->dma1);
goto __skip_resources; goto __skip_resources;
} }
#if defined(CS4231) || defined(OPTi93X) #if defined(CS4231) || defined(OPTi93X)
if (chip->dma1 == chip->dma2) { if (dma1 == dma2) {
snd_printk(KERN_ERR "don't want to share dmas\n"); snd_printk(KERN_ERR "don't want to share dmas\n");
return -EBUSY; return -EBUSY;
} }
switch (chip->dma2) { switch (dma2) {
case 0: case 0:
case 1: case 1:
break; break;
default: default:
snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", dma2);
chip->dma2);
goto __skip_resources; goto __skip_resources;
} }
dma_bits |= 0x04; dma_bits |= 0x04;
#endif /* CS4231 || OPTi93X */ #endif /* CS4231 || OPTi93X */
#ifndef OPTi93X #ifndef OPTi93X
outb(irq_bits << 3 | dma_bits, chip->wss_base); outb(irq_bits << 3 | dma_bits, wss_base);
#else /* OPTi93X */ #else /* OPTi93X */
snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits)); snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
#endif /* OPTi93X */ #endif /* OPTi93X */
__skip_resources: __skip_resources:
if (chip->hardware > OPTi9XX_HW_82C928) { if (chip->hardware > OPTi9XX_HW_82C928) {
switch (chip->mpu_port) { switch (mpu_port) {
case 0: case 0:
case -1: case -1:
break; break;
...@@ -520,12 +506,11 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) ...@@ -520,12 +506,11 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
break; break;
default: default:
snd_printk(KERN_WARNING snd_printk(KERN_WARNING
"MPU-401 port 0x%lx not valid\n", "MPU-401 port 0x%lx not valid\n", mpu_port);
chip->mpu_port);
goto __skip_mpu; goto __skip_mpu;
} }
switch (chip->mpu_irq) { switch (mpu_irq) {
case 5: case 5:
mpu_irq_bits = 0x02; mpu_irq_bits = 0x02;
break; break;
...@@ -540,12 +525,12 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) ...@@ -540,12 +525,12 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
break; break;
default: default:
snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n", snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n",
chip->mpu_irq); mpu_irq);
goto __skip_mpu; goto __skip_mpu;
} }
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6),
(chip->mpu_port <= 0) ? 0x00 : (mpu_port <= 0) ? 0x00 :
0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3, 0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3,
0xf8); 0xf8);
} }
...@@ -701,6 +686,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -701,6 +686,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
{ {
static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
int error; int error;
int xdma2;
struct snd_opti9xx *chip = card->private_data; struct snd_opti9xx *chip = card->private_data;
struct snd_wss *codec; struct snd_wss *codec;
#ifdef CS4231 #ifdef CS4231
...@@ -715,31 +701,25 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -715,31 +701,25 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
"OPTi9xx MC")) == NULL) "OPTi9xx MC")) == NULL)
return -ENOMEM; return -ENOMEM;
chip->wss_base = port;
chip->fm_port = fm_port;
chip->mpu_port = mpu_port;
chip->irq = irq;
chip->mpu_irq = mpu_irq;
chip->dma1 = dma1;
#if defined(CS4231) || defined(OPTi93X) #if defined(CS4231) || defined(OPTi93X)
chip->dma2 = dma2; xdma2 = dma2;
#else #else
chip->dma2 = -1; xdma2 = -1;
#endif #endif
if (chip->wss_base == SNDRV_AUTO_PORT) { if (port == SNDRV_AUTO_PORT) {
chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4); port = snd_legacy_find_free_ioport(possible_ports, 4);
if (chip->wss_base < 0) { if (port < 0) {
snd_printk(KERN_ERR "unable to find a free WSS port\n"); snd_printk(KERN_ERR "unable to find a free WSS port\n");
return -EBUSY; return -EBUSY;
} }
} }
error = snd_opti9xx_configure(chip); error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
mpu_port, mpu_irq);
if (error) if (error)
return error; return error;
error = snd_wss_create(card, chip->wss_base + 4, -1, error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2,
chip->irq, chip->dma1, chip->dma2,
#ifdef OPTi93X #ifdef OPTi93X
WSS_HW_OPTI93X, WSS_HWSHARE_IRQ, WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
#else #else
...@@ -763,35 +743,35 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -763,35 +743,35 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
return error; return error;
#endif #endif
#ifdef OPTi93X #ifdef OPTi93X
error = request_irq(chip->irq, snd_opti93x_interrupt, error = request_irq(irq, snd_opti93x_interrupt,
IRQF_DISABLED, DEV_NAME" - WSS", codec); IRQF_DISABLED, DEV_NAME" - WSS", codec);
if (error < 0) { if (error < 0) {
snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq);
return error; return error;
} }
#endif #endif
chip->irq = irq;
strcpy(card->driver, chip->name); strcpy(card->driver, chip->name);
sprintf(card->shortname, "OPTi %s", card->driver); sprintf(card->shortname, "OPTi %s", card->driver);
#if defined(CS4231) || defined(OPTi93X) #if defined(CS4231) || defined(OPTi93X)
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d",
card->shortname, pcm->name, chip->wss_base + 4, card->shortname, pcm->name, port + 4, irq, dma1, xdma2);
chip->irq, chip->dma1, chip->dma2);
#else #else
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
card->shortname, pcm->name, chip->wss_base + 4, card->shortname, pcm->name, port + 4, irq, dma1);
chip->irq, chip->dma1);
#endif /* CS4231 || OPTi93X */ #endif /* CS4231 || OPTi93X */
if (chip->mpu_port <= 0 || chip->mpu_port == SNDRV_AUTO_PORT) if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
rmidi = NULL; rmidi = NULL;
else else {
if ((error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
chip->mpu_port, 0, chip->mpu_irq, IRQF_DISABLED, mpu_port, 0, mpu_irq, IRQF_DISABLED, &rmidi);
&rmidi))) if (error)
snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
chip->mpu_port); mpu_port);
}
if (chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) { if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) {
struct snd_opl3 *opl3 = NULL; struct snd_opl3 *opl3 = NULL;
#ifndef OPTi93X #ifndef OPTi93X
if (chip->hardware == OPTi9XX_HW_82C928 || if (chip->hardware == OPTi9XX_HW_82C928 ||
...@@ -801,9 +781,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -801,9 +781,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
/* assume we have an OPL4 */ /* assume we have an OPL4 */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2),
0x20, 0x20); 0x20, 0x20);
if (snd_opl4_create(card, if (snd_opl4_create(card, fm_port, fm_port - 8,
chip->fm_port,
chip->fm_port - 8,
2, &opl3, &opl4) < 0) { 2, &opl3, &opl4) < 0) {
/* no luck, use OPL3 instead */ /* no luck, use OPL3 instead */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2), snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2),
...@@ -811,12 +789,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) ...@@ -811,12 +789,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
} }
} }
#endif /* !OPTi93X */ #endif /* !OPTi93X */
if (!opl3 && snd_opl3_create(card, if (!opl3 && snd_opl3_create(card, fm_port, fm_port + 2,
chip->fm_port,
chip->fm_port + 2,
OPL3_HW_AUTO, 0, &opl3) < 0) { OPL3_HW_AUTO, 0, &opl3) < 0) {
snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n", snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n",
chip->fm_port, chip->fm_port + 4 - 1); fm_port, fm_port + 4 - 1);
} }
if (opl3) { if (opl3) {
error = snd_opl3_hwdep_new(opl3, 0, 1, &synth); error = snd_opl3_hwdep_new(opl3, 0, 1, &synth);
......
...@@ -1682,7 +1682,7 @@ static void snd_wss_resume(struct snd_wss *chip) ...@@ -1682,7 +1682,7 @@ static void snd_wss_resume(struct snd_wss *chip)
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
int snd_wss_free(struct snd_wss *chip) static int snd_wss_free(struct snd_wss *chip)
{ {
release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_port);
release_and_free_resource(chip->res_cport); release_and_free_resource(chip->res_cport);
...@@ -1705,7 +1705,6 @@ int snd_wss_free(struct snd_wss *chip) ...@@ -1705,7 +1705,6 @@ int snd_wss_free(struct snd_wss *chip)
kfree(chip); kfree(chip);
return 0; return 0;
} }
EXPORT_SYMBOL(snd_wss_free);
static int snd_wss_dev_free(struct snd_device *device) static int snd_wss_dev_free(struct snd_device *device)
{ {
...@@ -2225,7 +2224,7 @@ WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, ...@@ -2225,7 +2224,7 @@ WSS_DOUBLE_TLV("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT,
.get = snd_wss_get_mux, .get = snd_wss_get_mux,
.put = snd_wss_put_mux, .put = snd_wss_put_mux,
}, },
WSS_DOUBLE("Mic Boost", 0, WSS_DOUBLE("Mic Boost (+20dB)", 0,
CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0),
WSS_SINGLE("Loopback Capture Switch", 0, WSS_SINGLE("Loopback Capture Switch", 0,
CS4231_LOOPBACK, 0, 1, 0), CS4231_LOOPBACK, 0, 1, 0),
...@@ -2236,14 +2235,14 @@ WSS_DOUBLE("Line Playback Switch", 0, ...@@ -2236,14 +2235,14 @@ WSS_DOUBLE("Line Playback Switch", 0,
WSS_DOUBLE_TLV("Line Playback Volume", 0, WSS_DOUBLE_TLV("Line Playback Volume", 0,
CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1,
db_scale_5bit_12db_max), db_scale_5bit_12db_max),
WSS_SINGLE("Mono Playback Switch", 0, WSS_SINGLE("Beep Playback Switch", 0,
CS4231_MONO_CTRL, 7, 1, 1), CS4231_MONO_CTRL, 7, 1, 1),
WSS_SINGLE_TLV("Mono Playback Volume", 0, WSS_SINGLE_TLV("Beep Playback Volume", 0,
CS4231_MONO_CTRL, 0, 15, 1, CS4231_MONO_CTRL, 0, 15, 1,
db_scale_4bit), db_scale_4bit),
WSS_SINGLE("Mono Output Playback Switch", 0, WSS_SINGLE("Mono Output Playback Switch", 0,
CS4231_MONO_CTRL, 6, 1, 1), CS4231_MONO_CTRL, 6, 1, 1),
WSS_SINGLE("Mono Output Playback Bypass", 0, WSS_SINGLE("Beep Bypass Playback Switch", 0,
CS4231_MONO_CTRL, 5, 1, 0), CS4231_MONO_CTRL, 5, 1, 0),
}; };
......
...@@ -838,7 +838,7 @@ static int dma_ioctl(int dev, unsigned int cmd, void __user *arg) ...@@ -838,7 +838,7 @@ static int dma_ioctl(int dev, unsigned int cmd, void __user *arg)
if ((err = audio_devs[dev]->d->prepare_for_input(dev, if ((err = audio_devs[dev]->d->prepare_for_input(dev,
dmap_in->fragment_size, dmap_in->nbufs)) < 0) { dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
spin_unlock_irqrestore(&dmap_in->lock,flags); spin_unlock_irqrestore(&dmap_in->lock,flags);
return -err; return err;
} }
dmap_in->dma_mode = DMODE_INPUT; dmap_in->dma_mode = DMODE_INPUT;
audio_devs[dev]->enable_bits |= PCM_ENABLE_INPUT; audio_devs[dev]->enable_bits |= PCM_ENABLE_INPUT;
......
...@@ -426,7 +426,7 @@ midi_synth_open(int dev, int mode) ...@@ -426,7 +426,7 @@ midi_synth_open(int dev, int mode)
int err; int err;
struct midi_input_info *inc; struct midi_input_info *inc;
if (orig_dev < 0 || orig_dev > num_midis || midi_devs[orig_dev] == NULL) if (orig_dev < 0 || orig_dev >= num_midis || midi_devs[orig_dev] == NULL)
return -ENXIO; return -ENXIO;
midi2synth[orig_dev] = dev; midi2synth[orig_dev] = dev;
......
...@@ -770,7 +770,7 @@ static int mpu_synth_ioctl(int dev, unsigned int cmd, void __user *arg) ...@@ -770,7 +770,7 @@ static int mpu_synth_ioctl(int dev, unsigned int cmd, void __user *arg)
midi_dev = synth_devs[dev]->midi_dev; midi_dev = synth_devs[dev]->midi_dev;
if (midi_dev < 0 || midi_dev > num_midis || midi_devs[midi_dev] == NULL) if (midi_dev < 0 || midi_dev >= num_midis || midi_devs[midi_dev] == NULL)
return -ENXIO; return -ENXIO;
devc = &dev_conf[midi_dev]; devc = &dev_conf[midi_dev];
......
...@@ -570,6 +570,7 @@ config SND_ICE1712 ...@@ -570,6 +570,7 @@ config SND_ICE1712
tristate "ICEnsemble ICE1712 (Envy24)" tristate "ICEnsemble ICE1712 (Envy24)"
select SND_MPU401_UART select SND_MPU401_UART
select SND_AC97_CODEC select SND_AC97_CODEC
select BITREVERSE
help help
Say Y here to include support for soundcards based on the Say Y here to include support for soundcards based on the
ICE1712 (Envy24) chip. ICE1712 (Envy24) chip.
......
...@@ -55,7 +55,7 @@ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card * ...@@ -55,7 +55,7 @@ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card *
* 1 = MediaForte 256-PCS * 1 = MediaForte 256-PCS
* 2 = MediaForte 256-PCPR * 2 = MediaForte 256-PCPR
* 3 = MediaForte 64-PCR * 3 = MediaForte 64-PCR
* 16 = setup tuner only (this is additional bit), i.e. SF-64-PCR FM card * 16 = setup tuner only (this is additional bit), i.e. SF64-PCR FM card
* High 16-bits are video (radio) device number + 1 * High 16-bits are video (radio) device number + 1
*/ */
static int tea575x_tuner[SNDRV_CARDS]; static int tea575x_tuner[SNDRV_CARDS];
...@@ -67,7 +67,10 @@ MODULE_PARM_DESC(id, "ID string for the FM801 soundcard."); ...@@ -67,7 +67,10 @@ MODULE_PARM_DESC(id, "ID string for the FM801 soundcard.");
module_param_array(enable, bool, NULL, 0444); module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable FM801 soundcard."); MODULE_PARM_DESC(enable, "Enable FM801 soundcard.");
module_param_array(tea575x_tuner, int, NULL, 0444); module_param_array(tea575x_tuner, int, NULL, 0444);
MODULE_PARM_DESC(tea575x_tuner, "Enable TEA575x tuner."); MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (1 = SF256-PCS, 2=SF256-PCPR, 3=SF64-PCR, +16=tuner-only).");
#define TUNER_ONLY (1<<4)
#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF)
/* /*
* Direct registers * Direct registers
...@@ -160,7 +163,7 @@ struct fm801 { ...@@ -160,7 +163,7 @@ struct fm801 {
unsigned int multichannel: 1, /* multichannel support */ unsigned int multichannel: 1, /* multichannel support */
secondary: 1; /* secondary codec */ secondary: 1; /* secondary codec */
unsigned char secondary_addr; /* address of the secondary codec */ unsigned char secondary_addr; /* address of the secondary codec */
unsigned int tea575x_tuner; /* tuner flags */ unsigned int tea575x_tuner; /* tuner access method & flags */
unsigned short ply_ctrl; /* playback control */ unsigned short ply_ctrl; /* playback control */
unsigned short cap_ctrl; /* capture control */ unsigned short cap_ctrl; /* capture control */
...@@ -1287,7 +1290,7 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume) ...@@ -1287,7 +1290,7 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume)
{ {
unsigned short cmdw; unsigned short cmdw;
if (chip->tea575x_tuner & 0x0010) if (chip->tea575x_tuner & TUNER_ONLY)
goto __ac97_ok; goto __ac97_ok;
/* codec cold reset + AC'97 warm reset */ /* codec cold reset + AC'97 warm reset */
...@@ -1296,11 +1299,13 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume) ...@@ -1296,11 +1299,13 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume)
udelay(100); udelay(100);
outw(0, FM801_REG(chip, CODEC_CTRL)); outw(0, FM801_REG(chip, CODEC_CTRL));
if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0) { if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0)
snd_printk(KERN_ERR "Primary AC'97 codec not found\n"); if (!resume) {
if (! resume) snd_printk(KERN_INFO "Primary AC'97 codec not found, "
return -EIO; "assume SF64-PCR (tuner-only)\n");
} chip->tea575x_tuner = 3 | TUNER_ONLY;
goto __ac97_ok;
}
if (chip->multichannel) { if (chip->multichannel) {
if (chip->secondary_addr) { if (chip->secondary_addr) {
...@@ -1414,7 +1419,7 @@ static int __devinit snd_fm801_create(struct snd_card *card, ...@@ -1414,7 +1419,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
return err; return err;
} }
chip->port = pci_resource_start(pci, 0); chip->port = pci_resource_start(pci, 0);
if ((tea575x_tuner & 0x0010) == 0) { if ((tea575x_tuner & TUNER_ONLY) == 0) {
if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED, if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED,
"FM801", chip)) { "FM801", chip)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq);
...@@ -1429,6 +1434,14 @@ static int __devinit snd_fm801_create(struct snd_card *card, ...@@ -1429,6 +1434,14 @@ static int __devinit snd_fm801_create(struct snd_card *card,
chip->multichannel = 1; chip->multichannel = 1;
snd_fm801_chip_init(chip, 0); snd_fm801_chip_init(chip, 0);
/* init might set tuner access method */
tea575x_tuner = chip->tea575x_tuner;
if (chip->irq >= 0 && (tea575x_tuner & TUNER_ONLY)) {
pci_clear_master(pci);
free_irq(chip->irq, chip);
chip->irq = -1;
}
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_fm801_free(chip); snd_fm801_free(chip);
...@@ -1438,12 +1451,13 @@ static int __devinit snd_fm801_create(struct snd_card *card, ...@@ -1438,12 +1451,13 @@ static int __devinit snd_fm801_create(struct snd_card *card,
snd_card_set_dev(card, &pci->dev); snd_card_set_dev(card, &pci->dev);
#ifdef TEA575X_RADIO #ifdef TEA575X_RADIO
if (tea575x_tuner > 0 && (tea575x_tuner & 0x000f) < 4) { if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 &&
(tea575x_tuner & TUNER_TYPE_MASK) < 4) {
chip->tea.dev_nr = tea575x_tuner >> 16; chip->tea.dev_nr = tea575x_tuner >> 16;
chip->tea.card = card; chip->tea.card = card;
chip->tea.freq_fixup = 10700; chip->tea.freq_fixup = 10700;
chip->tea.private_data = chip; chip->tea.private_data = chip;
chip->tea.ops = &snd_fm801_tea_ops[(tea575x_tuner & 0x000f) - 1]; chip->tea.ops = &snd_fm801_tea_ops[(tea575x_tuner & TUNER_TYPE_MASK) - 1];
snd_tea575x_init(&chip->tea); snd_tea575x_init(&chip->tea);
} }
#endif #endif
...@@ -1483,7 +1497,7 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci, ...@@ -1483,7 +1497,7 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
sprintf(card->longname, "%s at 0x%lx, irq %i", sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, chip->port, chip->irq); card->shortname, chip->port, chip->irq);
if (tea575x_tuner[dev] & 0x0010) if (chip->tea575x_tuner & TUNER_ONLY)
goto __fm801_tuner_only; goto __fm801_tuner_only;
if ((err = snd_fm801_pcm(chip, 0, NULL)) < 0) { if ((err = snd_fm801_pcm(chip, 0, NULL)) < 0) {
......
...@@ -503,6 +503,31 @@ static int __devinit juli_add_controls(struct snd_ice1712 *ice) ...@@ -503,6 +503,31 @@ static int __devinit juli_add_controls(struct snd_ice1712 *ice)
return 0; return 0;
} }
/*
* suspend/resume
* */
#ifdef CONFIG_PM
static int juli_resume(struct snd_ice1712 *ice)
{
struct snd_akm4xxx *ak = ice->akm;
struct juli_spec *spec = ice->spec;
/* akm4358 un-reset, un-mute */
snd_akm4xxx_reset(ak, 0);
/* reinit ak4114 */
snd_ak4114_reinit(spec->ak4114);
return 0;
}
static int juli_suspend(struct snd_ice1712 *ice)
{
struct snd_akm4xxx *ak = ice->akm;
/* akm4358 reset and soft-mute */
snd_akm4xxx_reset(ak, 1);
return 0;
}
#endif
/* /*
* initialize the chip * initialize the chip
*/ */
...@@ -646,6 +671,13 @@ static int __devinit juli_init(struct snd_ice1712 *ice) ...@@ -646,6 +671,13 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
ice->set_spdif_clock = juli_set_spdif_clock; ice->set_spdif_clock = juli_set_spdif_clock;
ice->spdif.ops.open = juli_spdif_in_open; ice->spdif.ops.open = juli_spdif_in_open;
#ifdef CONFIG_PM
ice->pm_resume = juli_resume;
ice->pm_suspend = juli_suspend;
ice->pm_suspend_enabled = 1;
#endif
return 0; return 0;
} }
......
...@@ -2062,6 +2062,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { ...@@ -2062,6 +2062,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
.name = "MSI P4 ATX 645 Ultra", .name = "MSI P4 ATX 645 Ultra",
.type = AC97_TUNE_HP_ONLY .type = AC97_TUNE_HP_ONLY
}, },
{
.subvendor = 0x161f,
.subdevice = 0x203a,
.name = "Gateway 4525GZ", /* AD1981B */
.type = AC97_TUNE_INV_EAPD
},
{ {
.subvendor = 0x1734, .subvendor = 0x1734,
.subdevice = 0x0088, .subdevice = 0x0088,
......
...@@ -2893,7 +2893,9 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) ...@@ -2893,7 +2893,9 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || if ((altsd->bInterfaceClass == USB_CLASS_AUDIO ||
altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) &&
altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) { altsd->bInterfaceSubClass == USB_SUBCLASS_MIDI_STREAMING) {
if (snd_usb_create_midi_interface(chip, iface, NULL) < 0) { int err = snd_usbmidi_create(chip->card, iface,
&chip->midi_list, NULL);
if (err < 0) {
snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j); snd_printk(KERN_ERR "%d:%u:%d: cannot create sequencer device\n", dev->devnum, ctrlif, j);
continue; continue;
} }
...@@ -3038,12 +3040,11 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, ...@@ -3038,12 +3040,11 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
.type = QUIRK_MIDI_FIXED_ENDPOINT, .type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = &uaxx_ep .data = &uaxx_ep
}; };
if (chip->usb_id == USB_ID(0x0582, 0x002b)) const struct snd_usb_audio_quirk *quirk =
return snd_usb_create_midi_interface(chip, iface, chip->usb_id == USB_ID(0x0582, 0x002b)
&ua700_quirk); ? &ua700_quirk : &uaxx_quirk;
else return snd_usbmidi_create(chip->card, iface,
return snd_usb_create_midi_interface(chip, iface, &chip->midi_list, quirk);
&uaxx_quirk);
} }
if (altsd->bNumEndpoints != 1) if (altsd->bNumEndpoints != 1)
...@@ -3370,6 +3371,13 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, ...@@ -3370,6 +3371,13 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip,
return 0; /* keep this altsetting */ return 0; /* keep this altsetting */
} }
static int create_any_midi_quirk(struct snd_usb_audio *chip,
struct usb_interface *intf,
const struct snd_usb_audio_quirk *quirk)
{
return snd_usbmidi_create(chip->card, intf, &chip->midi_list, quirk);
}
/* /*
* audio-interface quirks * audio-interface quirks
* *
...@@ -3387,14 +3395,14 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, ...@@ -3387,14 +3395,14 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
static const quirk_func_t quirk_funcs[] = { static const quirk_func_t quirk_funcs[] = {
[QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
[QUIRK_COMPOSITE] = create_composite_quirk, [QUIRK_COMPOSITE] = create_composite_quirk,
[QUIRK_MIDI_STANDARD_INTERFACE] = snd_usb_create_midi_interface, [QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk,
[QUIRK_MIDI_FIXED_ENDPOINT] = snd_usb_create_midi_interface, [QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk,
[QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface, [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk,
[QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface, [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk,
[QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, [QUIRK_MIDI_NOVATION] = create_any_midi_quirk,
[QUIRK_MIDI_FASTLANE] = snd_usb_create_midi_interface, [QUIRK_MIDI_FASTLANE] = create_any_midi_quirk,
[QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk,
[QUIRK_MIDI_CME] = snd_usb_create_midi_interface, [QUIRK_MIDI_CME] = create_any_midi_quirk,
[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
[QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
......
...@@ -132,7 +132,6 @@ struct snd_usb_audio { ...@@ -132,7 +132,6 @@ struct snd_usb_audio {
int pcm_devs; int pcm_devs;
struct list_head midi_list; /* list of midi interfaces */ struct list_head midi_list; /* list of midi interfaces */
int next_midi_device;
struct list_head mixer_list; /* list of mixer interfaces */ struct list_head mixer_list; /* list of mixer interfaces */
}; };
...@@ -227,8 +226,10 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, ...@@ -227,8 +226,10 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
int ignore_error); int ignore_error);
void snd_usb_mixer_disconnect(struct list_head *p); void snd_usb_mixer_disconnect(struct list_head *p);
int snd_usb_create_midi_interface(struct snd_usb_audio *chip, struct usb_interface *iface, int snd_usbmidi_create(struct snd_card *card,
const struct snd_usb_audio_quirk *quirk); struct usb_interface *iface,
struct list_head *midi_list,
const struct snd_usb_audio_quirk *quirk);
void snd_usbmidi_input_stop(struct list_head* p); void snd_usbmidi_input_stop(struct list_head* p);
void snd_usbmidi_input_start(struct list_head* p); void snd_usbmidi_input_start(struct list_head* p);
void snd_usbmidi_disconnect(struct list_head *p); void snd_usbmidi_disconnect(struct list_head *p);
......
This diff is collapsed.
...@@ -277,6 +277,22 @@ static struct usbmix_name_map scratch_live_map[] = { ...@@ -277,6 +277,22 @@ static struct usbmix_name_map scratch_live_map[] = {
{ 0 } /* terminator */ { 0 } /* terminator */
}; };
/* "Gamesurround Muse Pocket LT" looks same like "Sound Blaster MP3+"
* most importand difference is SU[8], it should be set to "Capture Source"
* to make alsamixer and PA working properly.
* FIXME: or mp3plus_map should use "Capture Source" too,
* so this maps can be merget
*/
static struct usbmix_name_map hercules_usb51_map[] = {
{ 8, "Capture Source" }, /* SU, default "PCM Capture Source" */
{ 9, "Master Playback" }, /* FU, default "Speaker Playback" */
{ 10, "Mic Boost", 7 }, /* FU, default "Auto Gain Input" */
{ 11, "Line Capture" }, /* FU, default "PCM Capture" */
{ 13, "Mic Bypass Playback" }, /* FU, default "Mic Playback" */
{ 14, "Line Bypass Playback" }, /* FU, default "Line Playback" */
{ 0 } /* terminator */
};
/* /*
* Control map entries * Control map entries
*/ */
...@@ -315,6 +331,13 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { ...@@ -315,6 +331,13 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
.id = USB_ID(0x06f8, 0xd002), .id = USB_ID(0x06f8, 0xd002),
.ignore_ctl_error = 1, .ignore_ctl_error = 1,
}, },
{
/* Hercules Gamesurround Muse Pocket LT
* (USB 5.1 Channel Audio Adapter)
*/
.id = USB_ID(0x06f8, 0xc000),
.map = hercules_usb51_map,
},
{ {
.id = USB_ID(0x08bb, 0x2702), .id = USB_ID(0x08bb, 0x2702),
.map = linex_map, .map = linex_map,
......
...@@ -1563,6 +1563,29 @@ YAMAHA_DEVICE(0x7010, "UB99"), ...@@ -1563,6 +1563,29 @@ YAMAHA_DEVICE(0x7010, "UB99"),
} }
} }
}, },
{
/* has ID 0x00ea when not in Advanced Driver mode */
USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e9),
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
/* .vendor_name = "Roland", */
/* .product_name = "UA-1G", */
.ifnum = QUIRK_ANY_INTERFACE,
.type = QUIRK_COMPOSITE,
.data = (const struct snd_usb_audio_quirk[]) {
{
.ifnum = 0,
.type = QUIRK_AUDIO_STANDARD_INTERFACE
},
{
.ifnum = 1,
.type = QUIRK_AUDIO_STANDARD_INTERFACE
},
{
.ifnum = -1
}
}
}
},
/* Guillemot devices */ /* Guillemot devices */
{ {
......
...@@ -59,11 +59,11 @@ static int us122l_create_usbmidi(struct snd_card *card) ...@@ -59,11 +59,11 @@ static int us122l_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_US122L, .type = QUIRK_MIDI_US122L,
.data = &quirk_data .data = &quirk_data
}; };
struct usb_device *dev = US122L(card)->chip.dev; struct usb_device *dev = US122L(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 1); struct usb_interface *iface = usb_ifnum_to_if(dev, 1);
return snd_usb_create_midi_interface(&US122L(card)->chip, return snd_usbmidi_create(card, iface,
iface, &quirk); &US122L(card)->midi_list, &quirk);
} }
static int us144_create_usbmidi(struct snd_card *card) static int us144_create_usbmidi(struct snd_card *card)
...@@ -81,11 +81,11 @@ static int us144_create_usbmidi(struct snd_card *card) ...@@ -81,11 +81,11 @@ static int us144_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_US122L, .type = QUIRK_MIDI_US122L,
.data = &quirk_data .data = &quirk_data
}; };
struct usb_device *dev = US122L(card)->chip.dev; struct usb_device *dev = US122L(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 0); struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
return snd_usb_create_midi_interface(&US122L(card)->chip, return snd_usbmidi_create(card, iface,
iface, &quirk); &US122L(card)->midi_list, &quirk);
} }
/* /*
...@@ -194,11 +194,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file) ...@@ -194,11 +194,11 @@ static int usb_stream_hwdep_open(struct snd_hwdep *hw, struct file *file)
if (!us122l->first) if (!us122l->first)
us122l->first = file; us122l->first = file;
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
iface = usb_ifnum_to_if(us122l->chip.dev, 0); iface = usb_ifnum_to_if(us122l->dev, 0);
usb_autopm_get_interface(iface); usb_autopm_get_interface(iface);
} }
iface = usb_ifnum_to_if(us122l->chip.dev, 1); iface = usb_ifnum_to_if(us122l->dev, 1);
usb_autopm_get_interface(iface); usb_autopm_get_interface(iface);
return 0; return 0;
} }
...@@ -209,11 +209,11 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file) ...@@ -209,11 +209,11 @@ static int usb_stream_hwdep_release(struct snd_hwdep *hw, struct file *file)
struct usb_interface *iface; struct usb_interface *iface;
snd_printdd(KERN_DEBUG "%p %p\n", hw, file); snd_printdd(KERN_DEBUG "%p %p\n", hw, file);
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
iface = usb_ifnum_to_if(us122l->chip.dev, 0); iface = usb_ifnum_to_if(us122l->dev, 0);
usb_autopm_put_interface(iface); usb_autopm_put_interface(iface);
} }
iface = usb_ifnum_to_if(us122l->chip.dev, 1); iface = usb_ifnum_to_if(us122l->dev, 1);
usb_autopm_put_interface(iface); usb_autopm_put_interface(iface);
if (us122l->first == file) if (us122l->first == file)
us122l->first = NULL; us122l->first = NULL;
...@@ -297,7 +297,7 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw, ...@@ -297,7 +297,7 @@ static unsigned int usb_stream_hwdep_poll(struct snd_hwdep *hw,
static void us122l_stop(struct us122l *us122l) static void us122l_stop(struct us122l *us122l)
{ {
struct list_head *p; struct list_head *p;
list_for_each(p, &us122l->chip.midi_list) list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_stop(p); snd_usbmidi_input_stop(p);
usb_stream_stop(&us122l->sk); usb_stream_stop(&us122l->sk);
...@@ -330,7 +330,7 @@ static bool us122l_start(struct us122l *us122l, ...@@ -330,7 +330,7 @@ static bool us122l_start(struct us122l *us122l,
unsigned use_packsize = 0; unsigned use_packsize = 0;
bool success = false; bool success = false;
if (us122l->chip.dev->speed == USB_SPEED_HIGH) { if (us122l->dev->speed == USB_SPEED_HIGH) {
/* The us-122l's descriptor defaults to iso max_packsize 78, /* The us-122l's descriptor defaults to iso max_packsize 78,
which isn't needed for samplerates <= 48000. which isn't needed for samplerates <= 48000.
Lets save some memory: Lets save some memory:
...@@ -347,11 +347,11 @@ static bool us122l_start(struct us122l *us122l, ...@@ -347,11 +347,11 @@ static bool us122l_start(struct us122l *us122l,
break; break;
} }
} }
if (!usb_stream_new(&us122l->sk, us122l->chip.dev, 1, 2, if (!usb_stream_new(&us122l->sk, us122l->dev, 1, 2,
rate, use_packsize, period_frames, 6)) rate, use_packsize, period_frames, 6))
goto out; goto out;
err = us122l_set_sample_rate(us122l->chip.dev, rate); err = us122l_set_sample_rate(us122l->dev, rate);
if (err < 0) { if (err < 0) {
us122l_stop(us122l); us122l_stop(us122l);
snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); snd_printk(KERN_ERR "us122l_set_sample_rate error \n");
...@@ -363,7 +363,7 @@ static bool us122l_start(struct us122l *us122l, ...@@ -363,7 +363,7 @@ static bool us122l_start(struct us122l *us122l,
snd_printk(KERN_ERR "us122l_start error %i \n", err); snd_printk(KERN_ERR "us122l_start error %i \n", err);
goto out; goto out;
} }
list_for_each(p, &us122l->chip.midi_list) list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_start(p); snd_usbmidi_input_start(p);
success = true; success = true;
out: out:
...@@ -390,7 +390,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, ...@@ -390,7 +390,7 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
err = -ENXIO; err = -ENXIO;
goto free; goto free;
} }
high_speed = us122l->chip.dev->speed == USB_SPEED_HIGH; high_speed = us122l->dev->speed == USB_SPEED_HIGH;
if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 && if ((cfg->sample_rate != 44100 && cfg->sample_rate != 48000 &&
(!high_speed || (!high_speed ||
(cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) || (cfg->sample_rate != 88200 && cfg->sample_rate != 96000))) ||
...@@ -450,7 +450,7 @@ static int usb_stream_hwdep_new(struct snd_card *card) ...@@ -450,7 +450,7 @@ static int usb_stream_hwdep_new(struct snd_card *card)
{ {
int err; int err;
struct snd_hwdep *hw; struct snd_hwdep *hw;
struct usb_device *dev = US122L(card)->chip.dev; struct usb_device *dev = US122L(card)->dev;
err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw); err = snd_hwdep_new(card, SND_USB_STREAM_ID, 0, &hw);
if (err < 0) if (err < 0)
...@@ -476,26 +476,26 @@ static bool us122l_create_card(struct snd_card *card) ...@@ -476,26 +476,26 @@ static bool us122l_create_card(struct snd_card *card)
int err; int err;
struct us122l *us122l = US122L(card); struct us122l *us122l = US122L(card);
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
err = usb_set_interface(us122l->chip.dev, 0, 1); err = usb_set_interface(us122l->dev, 0, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
return false; return false;
} }
} }
err = usb_set_interface(us122l->chip.dev, 1, 1); err = usb_set_interface(us122l->dev, 1, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
return false; return false;
} }
pt_info_set(us122l->chip.dev, 0x11); pt_info_set(us122l->dev, 0x11);
pt_info_set(us122l->chip.dev, 0x10); pt_info_set(us122l->dev, 0x10);
if (!us122l_start(us122l, 44100, 256)) if (!us122l_start(us122l, 44100, 256))
return false; return false;
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) if (us122l->dev->descriptor.idProduct == USB_ID_US144)
err = us144_create_usbmidi(card); err = us144_create_usbmidi(card);
else else
err = us122l_create_usbmidi(card); err = us122l_create_usbmidi(card);
...@@ -508,7 +508,7 @@ static bool us122l_create_card(struct snd_card *card) ...@@ -508,7 +508,7 @@ static bool us122l_create_card(struct snd_card *card)
if (err < 0) { if (err < 0) {
/* release the midi resources */ /* release the midi resources */
struct list_head *p; struct list_head *p;
list_for_each(p, &us122l->chip.midi_list) list_for_each(p, &us122l->midi_list)
snd_usbmidi_disconnect(p); snd_usbmidi_disconnect(p);
us122l_stop(us122l); us122l_stop(us122l);
...@@ -520,7 +520,7 @@ static bool us122l_create_card(struct snd_card *card) ...@@ -520,7 +520,7 @@ static bool us122l_create_card(struct snd_card *card)
static void snd_us122l_free(struct snd_card *card) static void snd_us122l_free(struct snd_card *card)
{ {
struct us122l *us122l = US122L(card); struct us122l *us122l = US122L(card);
int index = us122l->chip.index; int index = us122l->card_index;
if (index >= 0 && index < SNDRV_CARDS) if (index >= 0 && index < SNDRV_CARDS)
snd_us122l_card_used[index] = 0; snd_us122l_card_used[index] = 0;
} }
...@@ -540,13 +540,12 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) ...@@ -540,13 +540,12 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
sizeof(struct us122l), &card); sizeof(struct us122l), &card);
if (err < 0) if (err < 0)
return err; return err;
snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; snd_us122l_card_used[US122L(card)->card_index = dev] = 1;
card->private_free = snd_us122l_free; card->private_free = snd_us122l_free;
US122L(card)->chip.dev = device; US122L(card)->dev = device;
US122L(card)->chip.card = card;
mutex_init(&US122L(card)->mutex); mutex_init(&US122L(card)->mutex);
init_waitqueue_head(&US122L(card)->sk.sleep); init_waitqueue_head(&US122L(card)->sk.sleep);
INIT_LIST_HEAD(&US122L(card)->chip.midi_list); INIT_LIST_HEAD(&US122L(card)->midi_list);
strcpy(card->driver, "USB "NAME_ALLCAPS""); strcpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
...@@ -554,8 +553,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) ...@@ -554,8 +553,8 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp)
le16_to_cpu(device->descriptor.idVendor), le16_to_cpu(device->descriptor.idVendor),
le16_to_cpu(device->descriptor.idProduct), le16_to_cpu(device->descriptor.idProduct),
0, 0,
US122L(card)->chip.dev->bus->busnum, US122L(card)->dev->bus->busnum,
US122L(card)->chip.dev->devnum US122L(card)->dev->devnum
); );
*cardp = card; *cardp = card;
return 0; return 0;
...@@ -635,16 +634,15 @@ static void snd_us122l_disconnect(struct usb_interface *intf) ...@@ -635,16 +634,15 @@ static void snd_us122l_disconnect(struct usb_interface *intf)
mutex_lock(&us122l->mutex); mutex_lock(&us122l->mutex);
us122l_stop(us122l); us122l_stop(us122l);
mutex_unlock(&us122l->mutex); mutex_unlock(&us122l->mutex);
us122l->chip.shutdown = 1;
/* release the midi resources */ /* release the midi resources */
list_for_each(p, &us122l->chip.midi_list) { list_for_each(p, &us122l->midi_list) {
snd_usbmidi_disconnect(p); snd_usbmidi_disconnect(p);
} }
usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 0)); usb_put_intf(usb_ifnum_to_if(us122l->dev, 0));
usb_put_intf(usb_ifnum_to_if(us122l->chip.dev, 1)); usb_put_intf(usb_ifnum_to_if(us122l->dev, 1));
usb_put_dev(us122l->chip.dev); usb_put_dev(us122l->dev);
while (atomic_read(&us122l->mmap_count)) while (atomic_read(&us122l->mmap_count))
msleep(500); msleep(500);
...@@ -667,7 +665,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -667,7 +665,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
if (!us122l) if (!us122l)
return 0; return 0;
list_for_each(p, &us122l->chip.midi_list) list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_stop(p); snd_usbmidi_input_stop(p);
mutex_lock(&us122l->mutex); mutex_lock(&us122l->mutex);
...@@ -694,23 +692,23 @@ static int snd_us122l_resume(struct usb_interface *intf) ...@@ -694,23 +692,23 @@ static int snd_us122l_resume(struct usb_interface *intf)
mutex_lock(&us122l->mutex); mutex_lock(&us122l->mutex);
/* needed, doesn't restart without: */ /* needed, doesn't restart without: */
if (us122l->chip.dev->descriptor.idProduct == USB_ID_US144) { if (us122l->dev->descriptor.idProduct == USB_ID_US144) {
err = usb_set_interface(us122l->chip.dev, 0, 1); err = usb_set_interface(us122l->dev, 0, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
goto unlock; goto unlock;
} }
} }
err = usb_set_interface(us122l->chip.dev, 1, 1); err = usb_set_interface(us122l->dev, 1, 1);
if (err) { if (err) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
goto unlock; goto unlock;
} }
pt_info_set(us122l->chip.dev, 0x11); pt_info_set(us122l->dev, 0x11);
pt_info_set(us122l->chip.dev, 0x10); pt_info_set(us122l->dev, 0x10);
err = us122l_set_sample_rate(us122l->chip.dev, err = us122l_set_sample_rate(us122l->dev,
us122l->sk.s->cfg.sample_rate); us122l->sk.s->cfg.sample_rate);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "us122l_set_sample_rate error \n"); snd_printk(KERN_ERR "us122l_set_sample_rate error \n");
...@@ -720,7 +718,7 @@ static int snd_us122l_resume(struct usb_interface *intf) ...@@ -720,7 +718,7 @@ static int snd_us122l_resume(struct usb_interface *intf)
if (err) if (err)
goto unlock; goto unlock;
list_for_each(p, &us122l->chip.midi_list) list_for_each(p, &us122l->midi_list)
snd_usbmidi_input_start(p); snd_usbmidi_input_start(p);
unlock: unlock:
mutex_unlock(&us122l->mutex); mutex_unlock(&us122l->mutex);
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
struct us122l { struct us122l {
struct snd_usb_audio chip; struct usb_device *dev;
int card_index;
int stride; int stride;
struct usb_stream_kernel sk; struct usb_stream_kernel sk;
...@@ -12,6 +13,7 @@ struct us122l { ...@@ -12,6 +13,7 @@ struct us122l {
unsigned second_periods_polled; unsigned second_periods_polled;
struct file *master; struct file *master;
struct file *slave; struct file *slave;
struct list_head midi_list;
atomic_t mmap_count; atomic_t mmap_count;
}; };
......
...@@ -114,7 +114,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, ...@@ -114,7 +114,7 @@ static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw,
struct usX2Ydev *us428 = hw->private_data; struct usX2Ydev *us428 = hw->private_data;
int id = -1; int id = -1;
switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { switch (le16_to_cpu(us428->dev->descriptor.idProduct)) {
case USB_ID_US122: case USB_ID_US122:
id = USX2Y_TYPE_122; id = USX2Y_TYPE_122;
break; break;
...@@ -164,14 +164,14 @@ static int usX2Y_create_usbmidi(struct snd_card *card) ...@@ -164,14 +164,14 @@ static int usX2Y_create_usbmidi(struct snd_card *card)
.type = QUIRK_MIDI_FIXED_ENDPOINT, .type = QUIRK_MIDI_FIXED_ENDPOINT,
.data = &quirk_data_2 .data = &quirk_data_2
}; };
struct usb_device *dev = usX2Y(card)->chip.dev; struct usb_device *dev = usX2Y(card)->dev;
struct usb_interface *iface = usb_ifnum_to_if(dev, 0); struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
struct snd_usb_audio_quirk *quirk = struct snd_usb_audio_quirk *quirk =
le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ?
&quirk_2 : &quirk_1; &quirk_2 : &quirk_1;
snd_printdd("usX2Y_create_usbmidi \n"); snd_printdd("usX2Y_create_usbmidi \n");
return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk); return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk);
} }
static int usX2Y_create_alsa_devices(struct snd_card *card) static int usX2Y_create_alsa_devices(struct snd_card *card)
...@@ -202,7 +202,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, ...@@ -202,7 +202,7 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw,
snd_printdd( "dsp_load %s\n", dsp->name); snd_printdd( "dsp_load %s\n", dsp->name);
if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { if (access_ok(VERIFY_READ, dsp->image, dsp->length)) {
struct usb_device* dev = priv->chip.dev; struct usb_device* dev = priv->dev;
char *buf; char *buf;
buf = memdup_user(dsp->image, dsp->length); buf = memdup_user(dsp->image, dsp->length);
......
...@@ -239,8 +239,8 @@ static void i_usX2Y_In04Int(struct urb *urb) ...@@ -239,8 +239,8 @@ static void i_usX2Y_In04Int(struct urb *urb)
for (j = 0; j < URBS_AsyncSeq && !err; ++j) for (j = 0; j < URBS_AsyncSeq && !err; ++j)
if (0 == usX2Y->AS04.urb[j]->status) { if (0 == usX2Y->AS04.urb[j]->status) {
struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost. struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more than 1 p4out is new, 1 gets lost.
usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->dev,
usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol,
p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5, p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5,
i_usX2Y_Out04Int, usX2Y); i_usX2Y_Out04Int, usX2Y);
err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC);
...@@ -253,7 +253,7 @@ static void i_usX2Y_In04Int(struct urb *urb) ...@@ -253,7 +253,7 @@ static void i_usX2Y_In04Int(struct urb *urb)
if (err) if (err)
snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err);
urb->dev = usX2Y->chip.dev; urb->dev = usX2Y->dev;
usb_submit_urb(urb, GFP_ATOMIC); usb_submit_urb(urb, GFP_ATOMIC);
} }
...@@ -273,8 +273,8 @@ int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y) ...@@ -273,8 +273,8 @@ int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y)
err = -ENOMEM; err = -ENOMEM;
break; break;
} }
usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->chip.dev, usb_fill_bulk_urb( usX2Y->AS04.urb[i], usX2Y->dev,
usb_sndbulkpipe(usX2Y->chip.dev, 0x04), usb_sndbulkpipe(usX2Y->dev, 0x04),
usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0, usX2Y->AS04.buffer + URB_DataLen_AsyncSeq*i, 0,
i_usX2Y_Out04Int, usX2Y i_usX2Y_Out04Int, usX2Y
); );
...@@ -293,7 +293,7 @@ int usX2Y_In04_init(struct usX2Ydev *usX2Y) ...@@ -293,7 +293,7 @@ int usX2Y_In04_init(struct usX2Ydev *usX2Y)
} }
init_waitqueue_head(&usX2Y->In04WaitQueue); init_waitqueue_head(&usX2Y->In04WaitQueue);
usb_fill_int_urb(usX2Y->In04urb, usX2Y->chip.dev, usb_rcvintpipe(usX2Y->chip.dev, 0x4), usb_fill_int_urb(usX2Y->In04urb, usX2Y->dev, usb_rcvintpipe(usX2Y->dev, 0x4),
usX2Y->In04Buf, 21, usX2Y->In04Buf, 21,
i_usX2Y_In04Int, usX2Y, i_usX2Y_In04Int, usX2Y,
10); 10);
...@@ -348,13 +348,12 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) ...@@ -348,13 +348,12 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp)
sizeof(struct usX2Ydev), &card); sizeof(struct usX2Ydev), &card);
if (err < 0) if (err < 0)
return err; return err;
snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; snd_usX2Y_card_used[usX2Y(card)->card_index = dev] = 1;
card->private_free = snd_usX2Y_card_private_free; card->private_free = snd_usX2Y_card_private_free;
usX2Y(card)->chip.dev = device; usX2Y(card)->dev = device;
usX2Y(card)->chip.card = card;
init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); init_waitqueue_head(&usX2Y(card)->prepare_wait_queue);
mutex_init(&usX2Y(card)->prepare_mutex); mutex_init(&usX2Y(card)->prepare_mutex);
INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); INIT_LIST_HEAD(&usX2Y(card)->midi_list);
strcpy(card->driver, "USB "NAME_ALLCAPS""); strcpy(card->driver, "USB "NAME_ALLCAPS"");
sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)", sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
...@@ -362,7 +361,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) ...@@ -362,7 +361,7 @@ static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp)
le16_to_cpu(device->descriptor.idVendor), le16_to_cpu(device->descriptor.idVendor),
le16_to_cpu(device->descriptor.idProduct), le16_to_cpu(device->descriptor.idProduct),
0,//us428(card)->usbmidi.ifnum, 0,//us428(card)->usbmidi.ifnum,
usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum usX2Y(card)->dev->bus->busnum, usX2Y(card)->dev->devnum
); );
*cardp = card; *cardp = card;
return 0; return 0;
...@@ -432,8 +431,8 @@ static void snd_usX2Y_card_private_free(struct snd_card *card) ...@@ -432,8 +431,8 @@ static void snd_usX2Y_card_private_free(struct snd_card *card)
usb_free_urb(usX2Y(card)->In04urb); usb_free_urb(usX2Y(card)->In04urb);
if (usX2Y(card)->us428ctls_sharedmem) if (usX2Y(card)->us428ctls_sharedmem)
snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem)); snd_free_pages(usX2Y(card)->us428ctls_sharedmem, sizeof(*usX2Y(card)->us428ctls_sharedmem));
if (usX2Y(card)->chip.index >= 0 && usX2Y(card)->chip.index < SNDRV_CARDS) if (usX2Y(card)->card_index >= 0 && usX2Y(card)->card_index < SNDRV_CARDS)
snd_usX2Y_card_used[usX2Y(card)->chip.index] = 0; snd_usX2Y_card_used[usX2Y(card)->card_index] = 0;
} }
/* /*
...@@ -445,13 +444,12 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) ...@@ -445,13 +444,12 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr)
struct snd_card *card = ptr; struct snd_card *card = ptr;
struct usX2Ydev *usX2Y = usX2Y(card); struct usX2Ydev *usX2Y = usX2Y(card);
struct list_head *p; struct list_head *p;
usX2Y->chip.shutdown = 1;
usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; usX2Y->chip_status = USX2Y_STAT_CHIP_HUP;
usX2Y_unlinkSeq(&usX2Y->AS04); usX2Y_unlinkSeq(&usX2Y->AS04);
usb_kill_urb(usX2Y->In04urb); usb_kill_urb(usX2Y->In04urb);
snd_card_disconnect(card); snd_card_disconnect(card);
/* release the midi resources */ /* release the midi resources */
list_for_each(p, &usX2Y->chip.midi_list) { list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_disconnect(p); snd_usbmidi_disconnect(p);
} }
if (usX2Y->us428ctls_sharedmem) if (usX2Y->us428ctls_sharedmem)
......
...@@ -22,7 +22,8 @@ struct snd_usX2Y_urbSeq { ...@@ -22,7 +22,8 @@ struct snd_usX2Y_urbSeq {
#include "usx2yhwdeppcm.h" #include "usx2yhwdeppcm.h"
struct usX2Ydev { struct usX2Ydev {
struct snd_usb_audio chip; struct usb_device *dev;
int card_index;
int stride; int stride;
struct urb *In04urb; struct urb *In04urb;
void *In04Buf; void *In04Buf;
...@@ -42,6 +43,9 @@ struct usX2Ydev { ...@@ -42,6 +43,9 @@ struct usX2Ydev {
struct snd_usX2Y_substream *subs[4]; struct snd_usX2Y_substream *subs[4];
struct snd_usX2Y_substream * volatile prepare_subs; struct snd_usX2Y_substream * volatile prepare_subs;
wait_queue_head_t prepare_wait_queue; wait_queue_head_t prepare_wait_queue;
struct list_head midi_list;
struct list_head pcm_list;
int pcm_devs;
}; };
......
...@@ -199,7 +199,7 @@ static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, i ...@@ -199,7 +199,7 @@ static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, i
return -ENODEV; return -ENODEV;
urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks
urb->hcpriv = NULL; urb->hcpriv = NULL;
urb->dev = subs->usX2Y->chip.dev; /* we need to set this at each time */ urb->dev = subs->usX2Y->dev; /* we need to set this at each time */
if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err);
return err; return err;
...@@ -300,7 +300,7 @@ static void usX2Y_error_sequence(struct usX2Ydev *usX2Y, ...@@ -300,7 +300,7 @@ static void usX2Y_error_sequence(struct usX2Ydev *usX2Y,
"Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n"
"Most propably some urb of usb-frame %i is still missing.\n" "Most propably some urb of usb-frame %i is still missing.\n"
"Cause could be too long delays in usb-hcd interrupt handling.\n", "Cause could be too long delays in usb-hcd interrupt handling.\n",
usb_get_current_frame_number(usX2Y->chip.dev), usb_get_current_frame_number(usX2Y->dev),
subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame);
usX2Y_clients_stop(usX2Y); usX2Y_clients_stop(usX2Y);
...@@ -313,7 +313,7 @@ static void i_usX2Y_urb_complete(struct urb *urb) ...@@ -313,7 +313,7 @@ static void i_usX2Y_urb_complete(struct urb *urb)
if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { if (unlikely(atomic_read(&subs->state) < state_PREPARED)) {
snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
usb_get_current_frame_number(usX2Y->chip.dev), usb_get_current_frame_number(usX2Y->dev),
subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
urb->status, urb->start_frame); urb->status, urb->start_frame);
return; return;
...@@ -424,7 +424,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) ...@@ -424,7 +424,7 @@ static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs)
int i; int i;
unsigned int pipe; unsigned int pipe;
int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
struct usb_device *dev = subs->usX2Y->chip.dev; struct usb_device *dev = subs->usX2Y->dev;
pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) :
usb_rcvisocpipe(dev, subs->endpoint); usb_rcvisocpipe(dev, subs->endpoint);
...@@ -500,7 +500,7 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) ...@@ -500,7 +500,7 @@ static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs)
unsigned long pack; unsigned long pack;
if (0 == i) if (0 == i)
atomic_set(&subs->state, state_STARTING3); atomic_set(&subs->state, state_STARTING3);
urb->dev = usX2Y->chip.dev; urb->dev = usX2Y->dev;
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
for (pack = 0; pack < nr_of_packs(); pack++) { for (pack = 0; pack < nr_of_packs(); pack++) {
urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack;
...@@ -692,7 +692,7 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) ...@@ -692,7 +692,7 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
} }
((char*)(usbdata + i))[0] = ra[i].c1; ((char*)(usbdata + i))[0] = ra[i].c1;
((char*)(usbdata + i))[1] = ra[i].c2; ((char*)(usbdata + i))[1] = ra[i].c2;
usb_fill_bulk_urb(us->urb[i], usX2Y->chip.dev, usb_sndbulkpipe(usX2Y->chip.dev, 4), usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4),
usbdata + i, 2, i_usX2Y_04Int, usX2Y); usbdata + i, 2, i_usX2Y_04Int, usX2Y);
#ifdef OLD_USB #ifdef OLD_USB
us->urb[i]->transfer_flags = USB_QUEUE_BULK; us->urb[i]->transfer_flags = USB_QUEUE_BULK;
...@@ -740,17 +740,17 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) ...@@ -740,17 +740,17 @@ static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format)
alternate = 1; alternate = 1;
usX2Y->stride = 4; usX2Y->stride = 4;
} }
list_for_each(p, &usX2Y->chip.midi_list) { list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_input_stop(p); snd_usbmidi_input_stop(p);
} }
usb_kill_urb(usX2Y->In04urb); usb_kill_urb(usX2Y->In04urb);
if ((err = usb_set_interface(usX2Y->chip.dev, 0, alternate))) { if ((err = usb_set_interface(usX2Y->dev, 0, alternate))) {
snd_printk(KERN_ERR "usb_set_interface error \n"); snd_printk(KERN_ERR "usb_set_interface error \n");
return err; return err;
} }
usX2Y->In04urb->dev = usX2Y->chip.dev; usX2Y->In04urb->dev = usX2Y->dev;
err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
list_for_each(p, &usX2Y->chip.midi_list) { list_for_each(p, &usX2Y->midi_list) {
snd_usbmidi_input_start(p); snd_usbmidi_input_start(p);
} }
usX2Y->format = format; usX2Y->format = format;
...@@ -955,7 +955,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, ...@@ -955,7 +955,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err, i; int err, i;
struct snd_usX2Y_substream **usX2Y_substream = struct snd_usX2Y_substream **usX2Y_substream =
usX2Y(card)->subs + 2 * usX2Y(card)->chip.pcm_devs; usX2Y(card)->subs + 2 * usX2Y(card)->pcm_devs;
for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { i <= SNDRV_PCM_STREAM_CAPTURE; ++i) {
...@@ -971,7 +971,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, ...@@ -971,7 +971,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint;
usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint;
err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->chip.pcm_devs, err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->pcm_devs,
playback_endpoint ? 1 : 0, 1, playback_endpoint ? 1 : 0, 1,
&pcm); &pcm);
if (err < 0) { if (err < 0) {
...@@ -987,7 +987,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, ...@@ -987,7 +987,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
pcm->private_free = snd_usX2Y_pcm_private_free; pcm->private_free = snd_usX2Y_pcm_private_free;
pcm->info_flags = 0; pcm->info_flags = 0;
sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->chip.pcm_devs); sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs);
if ((playback_endpoint && if ((playback_endpoint &&
0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream,
...@@ -1001,7 +1001,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, ...@@ -1001,7 +1001,7 @@ static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint,
snd_usX2Y_pcm_private_free(pcm); snd_usX2Y_pcm_private_free(pcm);
return err; return err;
} }
usX2Y(card)->chip.pcm_devs++; usX2Y(card)->pcm_devs++;
return 0; return 0;
} }
...@@ -1013,14 +1013,14 @@ int usX2Y_audio_create(struct snd_card *card) ...@@ -1013,14 +1013,14 @@ int usX2Y_audio_create(struct snd_card *card)
{ {
int err = 0; int err = 0;
INIT_LIST_HEAD(&usX2Y(card)->chip.pcm_list); INIT_LIST_HEAD(&usX2Y(card)->pcm_list);
if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8)))
return err; return err;
if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) == USB_ID_US428) if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428)
if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA)))
return err; return err;
if (le16_to_cpu(usX2Y(card)->chip.dev->descriptor.idProduct) != USB_ID_US122) if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122)
err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122.
return err; return err;
} }
...@@ -234,7 +234,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb) ...@@ -234,7 +234,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { if (unlikely(atomic_read(&subs->state) < state_PREPARED)) {
snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n",
usb_get_current_frame_number(usX2Y->chip.dev), usb_get_current_frame_number(usX2Y->dev),
subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out",
urb->status, urb->start_frame); urb->status, urb->start_frame);
return; return;
...@@ -318,7 +318,7 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs) ...@@ -318,7 +318,7 @@ static int usX2Y_usbpcm_urbs_allocate(struct snd_usX2Y_substream *subs)
int i; int i;
unsigned int pipe; unsigned int pipe;
int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK];
struct usb_device *dev = subs->usX2Y->chip.dev; struct usb_device *dev = subs->usX2Y->dev;
pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) :
usb_rcvisocpipe(dev, subs->endpoint); usb_rcvisocpipe(dev, subs->endpoint);
...@@ -441,7 +441,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs) ...@@ -441,7 +441,7 @@ static int usX2Y_usbpcm_urbs_start(struct snd_usX2Y_substream *subs)
unsigned long pack; unsigned long pack;
if (0 == u) if (0 == u)
atomic_set(&subs->state, state_STARTING3); atomic_set(&subs->state, state_STARTING3);
urb->dev = usX2Y->chip.dev; urb->dev = usX2Y->dev;
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
for (pack = 0; pack < nr_of_packs(); pack++) { for (pack = 0; pack < nr_of_packs(); pack++) {
urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs()); urb->iso_frame_desc[pack].offset = subs->maxpacksize * (pack + u * nr_of_packs());
...@@ -741,7 +741,7 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card) ...@@ -741,7 +741,7 @@ int usX2Y_hwdep_pcm_new(struct snd_card *card)
int err; int err;
struct snd_hwdep *hw; struct snd_hwdep *hw;
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct usb_device *dev = usX2Y(card)->chip.dev; struct usb_device *dev = usX2Y(card)->dev;
if (1 != nr_of_packs()) if (1 != nr_of_packs())
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment