Commit 8a1f8f8e authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA update

  - fixes in ALI5451 initalization
  - added snd_pci_alloc_page() workaround
  - FM801 - fixed PCI device identification
  - USB mixer - fixed min values for some types
parent 729bd50d
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.0rc6"
#define CONFIG_SND_DATE " (Wed Dec 11 21:24:39 2002 UTC)"
#define CONFIG_SND_DATE " (Mon Dec 16 14:23:15 2002 UTC)"
......@@ -92,6 +92,56 @@ int snd_pcm_sgbuf_delete(snd_pcm_substream_t *substream)
return 0;
}
/*
* snd_pci_alloc_page - allocate a page in the valid pci dma mask
*
* returns the virtual address and stores the physical address on
* addrp. this function cannot be called from interrupt handlers or
* within spinlocks.
*/
#ifdef __i386__
/*
* on ix86, we allocate a page with GFP_KERNEL to assure the
* allocation. the code is almost same with kernel/i386/pci-dma.c but
* it allocates only a single page and checkes the validity of the
* page address with the given pci dma mask.
*/
inline static void *snd_pci_alloc_page(struct pci_dev *pci, dma_addr_t *addrp)
{
void *ptr;
dma_addr_t addr;
unsigned long rmask;
if (pci)
rmask = ~(unsigned long)pci->dma_mask;
else
rmask = 0;
ptr = (void *)__get_free_page(GFP_KERNEL);
if (ptr) {
addr = virt_to_phys(ptr);
if (((unsigned long)addr + PAGE_SIZE - 1) & rmask) {
/* try to reallocate with the GFP_DMA */
free_page((unsigned long)ptr);
ptr = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
if (ptr) /* ok, the address must be within lower 16MB... */
addr = virt_to_phys(ptr);
else
addr = 0;
}
} else
addr = 0;
if (ptr)
memset(ptr, 0, PAGE_SIZE);
*addrp = addr;
return ptr;
}
#else
/* on other architectures, call snd_malloc_pci_pages() helper function
* which uses pci_alloc_consistent().
*/
#define snd_pci_alloc_page(pci, addrp) snd_malloc_pci_pages(pci, PAGE_SIZE, addrp)
#endif
/*
* allocate sg buffer table with the given byte size.
* if the buffer table already exists, try to resize it.
......@@ -128,7 +178,7 @@ int snd_pcm_sgbuf_alloc(snd_pcm_substream_t *substream, size_t size)
while (sgbuf->pages < pages) {
void *ptr;
dma_addr_t addr;
ptr = snd_malloc_pci_pages(sgbuf->pci, PAGE_SIZE, &addr);
ptr = snd_pci_alloc_page(sgbuf->pci, &addr);
if (! ptr)
return -ENOMEM;
sgbuf->table[sgbuf->pages].buf = ptr;
......
......@@ -205,19 +205,19 @@ static int translate_subdevice_to_hwport(mtpav_t *chip, int subdev)
static int translate_hwport_to_subdevice(mtpav_t *chip, int hwport)
{
int port;
int p;
if (hwport <= 0x00) /* all ports */
return chip->num_ports + MTPAV_PIDX_BROADCAST;
else if (hwport <= 0x08) { /* single port */
port = hwport - 1;
if (port >= chip->num_ports)
port = 0;
return port;
p = hwport - 1;
if (p >= chip->num_ports)
p = 0;
return p;
} else if (hwport <= 0x10) { /* remote port */
port = hwport - 0x09 + chip->num_ports;
if (port >= chip->num_ports * 2)
port = chip->num_ports;
return port;
p = hwport - 0x09 + chip->num_ports;
if (p >= chip->num_ports * 2)
p = chip->num_ports;
return p;
} else if (hwport == 0x11) /* computer port */
return chip->num_ports + MTPAV_PIDX_COMPUTER;
else /* ADAT */
......@@ -335,11 +335,11 @@ static void snd_mtpav_output_write(snd_rawmidi_substream_t * substream)
static void snd_mtpav_portscan(mtpav_t *chip) // put mtp into smart routing mode
{
u8 port;
u8 p;
for (port = 0; port < 8; port++) {
for (p = 0; p < 8; p++) {
snd_mtpav_send_byte(chip, 0xf5);
snd_mtpav_send_byte(chip, port);
snd_mtpav_send_byte(chip, p);
snd_mtpav_send_byte(chip, 0xfe);
}
}
......@@ -350,12 +350,12 @@ static void snd_mtpav_portscan(mtpav_t *chip) // put mtp into smart routing mode
static int snd_mtpav_input_open(snd_rawmidi_substream_t * substream)
{
unsigned long flags;
mtpav_port_t *port = &mtp_card->ports[substream->number];
mtpav_port_t *portp = &mtp_card->ports[substream->number];
//printk("mtpav port: %d opened\n", (int) substream->number);
spin_lock_irqsave(&mtp_card->spinlock, flags);
port->mode |= MTPAV_MODE_INPUT_OPENED;
port->input = substream;
portp->mode |= MTPAV_MODE_INPUT_OPENED;
portp->input = substream;
if (mtp_card->share_irq++ == 0)
snd_mtpav_mputreg(mtp_card, CREG, (SIGC_INTEN | SIGC_WRITE)); // enable pport interrupts
spin_unlock_irqrestore(&mtp_card->spinlock, flags);
......@@ -368,14 +368,14 @@ static int snd_mtpav_input_open(snd_rawmidi_substream_t * substream)
static int snd_mtpav_input_close(snd_rawmidi_substream_t *substream)
{
unsigned long flags;
mtpav_port_t *port = &mtp_card->ports[substream->number];
mtpav_port_t *portp = &mtp_card->ports[substream->number];
//printk("mtpav port: %d closed\n", (int) port);
//printk("mtpav port: %d closed\n", (int) portp);
spin_lock_irqsave(&mtp_card->spinlock, flags);
port->mode &= (~MTPAV_MODE_INPUT_OPENED);
port->input = NULL;
portp->mode &= (~MTPAV_MODE_INPUT_OPENED);
portp->input = NULL;
if (--mtp_card->share_irq == 0)
snd_mtpav_mputreg(mtp_card, CREG, 0); // disable pport interrupts
......@@ -389,13 +389,13 @@ static int snd_mtpav_input_close(snd_rawmidi_substream_t *substream)
static void snd_mtpav_input_trigger(snd_rawmidi_substream_t * substream, int up)
{
unsigned long flags;
mtpav_port_t *port = &mtp_card->ports[substream->number];
mtpav_port_t *portp = &mtp_card->ports[substream->number];
spin_lock_irqsave(&mtp_card->spinlock, flags);
if (up)
port->mode |= MTPAV_MODE_INPUT_TRIGGERED;
portp->mode |= MTPAV_MODE_INPUT_TRIGGERED;
else
port->mode &= ~MTPAV_MODE_INPUT_TRIGGERED;
portp->mode &= ~MTPAV_MODE_INPUT_TRIGGERED;
spin_unlock_irqrestore(&mtp_card->spinlock, flags);
}
......@@ -416,9 +416,9 @@ static void snd_mtpav_output_timer(unsigned long data)
add_timer(&chip->timer);
/* process each port */
for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) {
mtpav_port_t *port = &mtp_card->ports[p];
if ((port->mode & MTPAV_MODE_OUTPUT_TRIGGERED) && port->output)
snd_mtpav_output_port_write(port, port->output);
mtpav_port_t *portp = &mtp_card->ports[p];
if ((portp->mode & MTPAV_MODE_OUTPUT_TRIGGERED) && portp->output)
snd_mtpav_output_port_write(portp, portp->output);
}
spin_unlock(&chip->spinlock);
}
......@@ -445,11 +445,11 @@ static void snd_mtpav_remove_output_timer(mtpav_t *chip)
static int snd_mtpav_output_open(snd_rawmidi_substream_t * substream)
{
unsigned long flags;
mtpav_port_t *port = &mtp_card->ports[substream->number];
mtpav_port_t *portp = &mtp_card->ports[substream->number];
spin_lock_irqsave(&mtp_card->spinlock, flags);
port->mode |= MTPAV_MODE_OUTPUT_OPENED;
port->output = substream;
portp->mode |= MTPAV_MODE_OUTPUT_OPENED;
portp->output = substream;
spin_unlock_irqrestore(&mtp_card->spinlock, flags);
return 0;
};
......@@ -460,11 +460,11 @@ static int snd_mtpav_output_open(snd_rawmidi_substream_t * substream)
static int snd_mtpav_output_close(snd_rawmidi_substream_t * substream)
{
unsigned long flags;
mtpav_port_t *port = &mtp_card->ports[substream->number];
mtpav_port_t *portp = &mtp_card->ports[substream->number];
spin_lock_irqsave(&mtp_card->spinlock, flags);
port->mode &= (~MTPAV_MODE_OUTPUT_OPENED);
port->output = NULL;
portp->mode &= (~MTPAV_MODE_OUTPUT_OPENED);
portp->output = NULL;
spin_unlock_irqrestore(&mtp_card->spinlock, flags);
return 0;
};
......@@ -475,17 +475,17 @@ static int snd_mtpav_output_close(snd_rawmidi_substream_t * substream)
static void snd_mtpav_output_trigger(snd_rawmidi_substream_t * substream, int up)
{
unsigned long flags;
mtpav_port_t *port = &mtp_card->ports[substream->number];
mtpav_port_t *portp = &mtp_card->ports[substream->number];
spin_lock_irqsave(&mtp_card->spinlock, flags);
if (up) {
if (! (port->mode & MTPAV_MODE_OUTPUT_TRIGGERED)) {
if (! (portp->mode & MTPAV_MODE_OUTPUT_TRIGGERED)) {
if (mtp_card->istimer++ == 0)
snd_mtpav_add_output_timer(mtp_card);
port->mode |= MTPAV_MODE_OUTPUT_TRIGGERED;
portp->mode |= MTPAV_MODE_OUTPUT_TRIGGERED;
}
} else {
port->mode &= ~MTPAV_MODE_OUTPUT_TRIGGERED;
portp->mode &= ~MTPAV_MODE_OUTPUT_TRIGGERED;
if (--mtp_card->istimer == 0)
snd_mtpav_remove_output_timer(mtp_card);
}
......@@ -501,15 +501,15 @@ static void snd_mtpav_output_trigger(snd_rawmidi_substream_t * substream, int up
static void snd_mtpav_inmidi_process(mtpav_t *mcrd, u8 inbyte)
{
mtpav_port_t *port;
mtpav_port_t *portp;
if (mcrd->inmidiport > mcrd->num_ports * 2 + MTPAV_PIDX_BROADCAST)
return;
port = &mcrd->ports[mcrd->inmidiport];
if (port->mode & MTPAV_MODE_INPUT_TRIGGERED) {
portp = &mcrd->ports[mcrd->inmidiport];
if (portp->mode & MTPAV_MODE_INPUT_TRIGGERED) {
spin_unlock(&mcrd->spinlock);
snd_rawmidi_receive(port->input, &inbyte, 1);
snd_rawmidi_receive(portp->input, &inbyte, 1);
spin_lock(&mcrd->spinlock);
}
}
......
......@@ -1831,9 +1831,10 @@ static int snd_ali5451_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
return change;
}
static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinit = {
static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinitdata = {
/* spdif aplayback switch */
ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, 0),
/* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */
ALI5451_SPDIF("IEC958 Output switch", 0, 0),
/* spdif out to spdif channel */
ALI5451_SPDIF("IEC958 Channel Output Switch", 0, 1),
/* spdif in from spdif channel */
......@@ -1861,7 +1862,7 @@ static int __devinit snd_ali_mixer(ali_t * codec)
return err;
}
if (codec->revision == ALI_5451_V02) {
for(idx = 0; idx < 3; idx++) {
for(idx = 0; idx < ARRAY_SIZE(snd_ali5451_mixer_spdif); idx++) {
err=snd_ctl_add(codec->card, snd_ctl_new1(&snd_ali5451_mixer_spdif[idx], codec));
if (err < 0) return err;
}
......@@ -2010,10 +2011,12 @@ static int snd_ali_chip_init(ali_t *codec)
if (codec->revision == ALI_5451_V02) {
pci_dev = codec->pci_m1533;
pci_read_config_byte(pci_dev, 0x59, &temp);
temp |= 0x80;
pci_write_config_byte(pci_dev, 0x59, temp);
pci_dev = codec->pci_m7101;
pci_read_config_byte(pci_dev, 0xb8, &temp);
temp |= 1 << 6;
temp |= 0x20;
pci_write_config_byte(pci_dev, 0xB8, temp);
}
......
......@@ -164,7 +164,7 @@ struct _snd_fm801 {
};
static struct pci_device_id snd_fm801_ids[] __devinitdata = {
{ 0x1319, 0x0801, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* FM801 */
{ 0x1319, 0x0801, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0, }, /* FM801 */
{ 0, }
};
......
......@@ -24,9 +24,12 @@
*
*/
#define HOONTECH_DEVICE_DESC "{Hoontech SoundTrack DSP 24},"
#define HOONTECH_DEVICE_DESC \
"{Hoontech SoundTrack DSP 24}," \
"{Hoontech SoundTrack DSP 24 Value}," \
"{Hoontech SoundTrack DSP 24 Media 7.1}," \
#define ICE1712_SUBDEVICE_STDSP24 0x12141217 /* Hoontech SoundTrack Audio DSP 24 */
#define ICE1712_SUBDEVICE_STDSP24 0x12141217 /* Hoontech SoundTrack Audio DSP 24 */
#define ICE1712_SUBDEVICE_STDSP24_MEDIA7_1 0x16141217 /* Hoontech ST Audio DSP24 Media 7.1 */
extern struct snd_ice1712_card_info snd_ice1712_hoontech_cards[];
......
......@@ -296,7 +296,7 @@ static int get_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, i
return 0;
}
}
snd_printdd(KERN_ERR "cannot get ctl value: req = 0x%x, idx = 0x%x, val = 0x%x, type = %d\n", request, validx, cval->ctrlif | (cval->id << 8), cval->val_type);
snd_printdd(KERN_ERR "cannot get ctl value: req = 0x%x, wValue = 0x%x, wIndex = 0x%x, type = %d\n", request, validx, cval->ctrlif | (cval->id << 8), cval->val_type);
return -EINVAL;
}
......@@ -331,6 +331,7 @@ static int set_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, i
validx, cval->ctrlif | (cval->id << 8),
buf, val_len, HZ / 10) >= 0)
return 0;
snd_printdd(KERN_ERR "cannot set ctl value: req = 0x%x, wValue = 0x%x, wIndex = 0x%x, type = %d, data = 0x%x/0x%x\n", request, validx, cval->ctrlif | (cval->id << 8), cval->val_type, buf[0], buf[1]);
return -EINVAL;
}
......@@ -571,11 +572,11 @@ static void usb_mixer_elem_free(snd_kcontrol_t *kctl)
/*
* retrieve the minimum and maximum values for the specified control
*/
static int get_min_max(usb_mixer_elem_info_t *cval)
static int get_min_max(usb_mixer_elem_info_t *cval, int default_min)
{
/* for failsafe */
cval->min = 0;
cval->max = 1;
cval->min = default_min;
cval->max = cval->min + 1;
cval->res = 1;
if (cval->val_type == USB_MIXER_BOOLEAN ||
......@@ -634,7 +635,7 @@ static int mixer_ctl_feature_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
uinfo->value.integer.max = 1;
} else {
if (! cval->initialized)
get_min_max(cval);
get_min_max(cval, 0);
uinfo->value.integer.min = 0;
uinfo->value.integer.max = (cval->max - cval->min) / cval->res;
}
......@@ -784,7 +785,7 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc,
}
/* get min/max values */
get_min_max(cval);
get_min_max(cval, 0);
kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
if (! kctl) {
......@@ -952,7 +953,7 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc,
}
/* get min/max values */
get_min_max(cval);
get_min_max(cval, 0);
kctl = snd_ctl_new1(&usb_feature_unit_ctl, cval);
if (! kctl) {
......@@ -1060,6 +1061,7 @@ struct procunit_value_info {
int control;
char *suffix;
int val_type;
int min_value;
};
struct procunit_info {
......@@ -1070,12 +1072,12 @@ struct procunit_info {
static struct procunit_value_info updown_proc_info[] = {
{ USB_PROC_UPDOWN_SWITCH, "Switch", USB_MIXER_BOOLEAN },
{ USB_PROC_UPDOWN_MODE_SEL, "Mode Select", USB_MIXER_U8 },
{ USB_PROC_UPDOWN_MODE_SEL, "Mode Select", USB_MIXER_U8, 1 },
{ 0 }
};
static struct procunit_value_info prologic_proc_info[] = {
{ USB_PROC_PROLOGIC_SWITCH, "Switch", USB_MIXER_BOOLEAN },
{ USB_PROC_PROLOGIC_MODE_SEL, "Mode Select", USB_MIXER_U8 },
{ USB_PROC_PROLOGIC_MODE_SEL, "Mode Select", USB_MIXER_U8, 1 },
{ 0 }
};
static struct procunit_value_info threed_enh_proc_info[] = {
......@@ -1173,7 +1175,7 @@ static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char
cval->channels = 1;
/* get min/max values */
get_min_max(cval);
get_min_max(cval, valinfo->min_value);
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
if (! kctl) {
......
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