Commit 2c26759c authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA update

  - fixed compilation problems for rawmidi, sb16, ac97_codec, ens1370
  - ES1968 - added use_pm parameter
  - USB audio
    - complete callback follows 2.5
    - fixed support for FU and PU controls (mixer)
    - updated SB Extigy comments
parent 4bc22c0a
/* include/version.h. Generated automatically by configure. */
#define CONFIG_SND_VERSION "0.9.0rc6"
#define CONFIG_SND_DATE " (Wed Dec 11 11:08:10 2002 UTC)"
#define CONFIG_SND_DATE " (Wed Dec 11 21:24:39 2002 UTC)"
......@@ -1545,10 +1545,10 @@ void snd_rawmidi_set_ops(snd_rawmidi_t *rmidi, int stream, snd_rawmidi_ops_t *op
static int __init alsa_rawmidi_init(void)
{
int i;
snd_ctl_register_ioctl(snd_rawmidi_control_ioctl);
#ifdef CONFIG_SND_OSSEMUL
{ int i;
/* check device map table */
for (i = 0; i < SNDRV_CARDS; i++) {
if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
......@@ -1560,6 +1560,7 @@ static int __init alsa_rawmidi_init(void)
amidi_map[i] = 1;
}
}
}
#endif /* CONFIG_SND_OSSEMUL */
return 0;
}
......
......@@ -696,7 +696,7 @@ static int __init alsa_card_sb16_setup(char *str)
isapnp[nr_dev] = pnp;
#endif
#ifdef CONFIG_SND_SB16_CSP
if (csp != INT_MAX)
if (xcsp != INT_MAX)
csp[nr_dev] = xcsp;
#endif
nr_dev++;
......
......@@ -1317,7 +1317,7 @@ static int snd_ac97_mixer_build(snd_card_t * card, ac97_t * ac97)
/* build master tone controls */
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
for (idx = 0; idx < 2; idx++) {
if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
return err;
if (ac97->id == AC97_ID_YMF753) {
kctl->private_value &= ~(0xff << 16);
......
......@@ -1514,6 +1514,8 @@ static int snd_ensoniq_control_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
return 0;
}
#ifdef CHIP1370
static int snd_ensoniq_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
{
ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol);
......@@ -1532,8 +1534,6 @@ static int snd_ensoniq_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
return change;
}
#ifdef CHIP1370
#define ES1370_CONTROLS 2
static snd_kcontrol_new_t snd_es1370_controls[2] __devinitdata = {
......
......@@ -129,6 +129,7 @@ static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 };
static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 };
static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 };
static int clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
......@@ -151,6 +152,9 @@ MODULE_PARM_SYNTAX(pcm_substreams_c, SNDRV_ENABLED ",allows:{{0,8}}");
MODULE_PARM(clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(clock, "Clock on " CARD_NAME " soundcard. (0 = auto-detect)");
MODULE_PARM_SYNTAX(clock, SNDRV_ENABLED);
MODULE_PARM(use_pm, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
MODULE_PARM_DESC(use_pm, "Toggle power-management. (0 = off, 1 = on, 2 = auto)");
MODULE_PARM_SYNTAX(use_pm, SNDRV_ENABLED ",allows:{{0,1,2}},skill:advanced");
/* PCI Dev ID's */
......@@ -493,6 +497,11 @@ enum snd_enum_apu_type {
ESM_APU_FREE
};
/* chip type */
enum {
TYPE_MAESTRO, TYPE_MAESTRO2, TYPE_MAESTRO2E
};
/* DMA Hack! */
struct snd_esm_memory {
char *buf;
......@@ -558,6 +567,7 @@ struct snd_es1968 {
struct pci_dev *pci;
snd_card_t *card;
snd_pcm_t *pcm;
int do_pm; /* power-management enabled */
/* DMA memory block */
struct list_head buf_list;
......@@ -593,17 +603,13 @@ struct snd_es1968 {
static void snd_es1968_interrupt(int irq, void *dev_id, struct pt_regs *regs);
#define CARD_TYPE_ESS_ESOLDM1 0x12850100
#define CARD_TYPE_ESS_ES1968 0x125d1968
#define CARD_TYPE_ESS_ES1978 0x125d1978
static struct pci_device_id snd_es1968_ids[] __devinitdata = {
/* Maestro 1 */
{ 0x1285, 0x0100, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0, },
{ 0x1285, 0x0100, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, TYPE_MAESTRO },
/* Maestro 2 */
{ 0x125d, 0x1968, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0, },
{ 0x125d, 0x1968, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, TYPE_MAESTRO2 },
/* Maestro 2E */
{ 0x125d, 0x1978, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0, },
{ 0x125d, 0x1978, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, TYPE_MAESTRO2E },
{ 0, }
};
......@@ -2411,6 +2417,9 @@ static void es1968_suspend(es1968_t *chip)
{
snd_card_t *card = chip->card;
if (! chip->do_pm)
return;
snd_power_lock(card);
if (card->power_state == SNDRV_CTL_POWER_D3hot)
goto __skip;
......@@ -2426,6 +2435,9 @@ static void es1968_resume(es1968_t *chip)
{
snd_card_t *card = chip->card;
if (! chip->do_pm)
return;
snd_power_lock(card);
if (card->power_state == SNDRV_CTL_POWER_D0)
goto __skip;
......@@ -2528,6 +2540,8 @@ static int __devinit snd_es1968_create(snd_card_t * card,
int total_bufsize,
int play_streams,
int capt_streams,
int chip_type,
int do_pm,
es1968_t **chip_ret)
{
static snd_device_ops_t ops = {
......@@ -2553,7 +2567,7 @@ static int __devinit snd_es1968_create(snd_card_t * card,
return -ENOMEM;
/* Set Vars */
chip->type = (pci->vendor << 16) | pci->device;
chip->type = chip_type;
spin_lock_init(&chip->reg_lock);
spin_lock_init(&chip->substream_lock);
spin_lock_init(&chip->bob_lock);
......@@ -2595,11 +2609,26 @@ static int __devinit snd_es1968_create(snd_card_t * card,
/* just to be sure */
pci_set_master(pci);
if (do_pm) {
/* disable power-management if not maestro2e or
* if not on the whitelist
*/
unsigned int vend;
pci_read_config_dword(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);
if (chip->type != TYPE_MAESTRO2E || (vend & 0xffff) != 0x1028) {
printk(KERN_INFO "es1968: not attempting power management.\n");
do_pm = 0;
}
}
chip->do_pm = do_pm;
snd_es1968_chip_init(chip);
#ifdef CONFIG_PM
if (chip->do_pm) {
card->set_power_state = snd_es1968_set_power_state;
card->power_state_private_data = chip;
}
#endif
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
......@@ -2693,21 +2722,23 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
total_bufsize[dev] * 1024, /* in bytes */
pcm_substreams_p[dev],
pcm_substreams_c[dev],
pci_id->driver_data,
use_pm[dev],
&chip)) < 0) {
snd_card_free(card);
return err;
}
switch (chip->type) {
case CARD_TYPE_ESS_ES1978:
case TYPE_MAESTRO2E:
strcpy(card->driver, "ES1978");
strcpy(card->shortname, "ESS ES1978 (Maestro 2E)");
break;
case CARD_TYPE_ESS_ES1968:
case TYPE_MAESTRO2:
strcpy(card->driver, "ES1968");
strcpy(card->shortname, "ESS ES1968 (Maestro 2)");
break;
case CARD_TYPE_ESS_ESOLDM1:
case TYPE_MAESTRO:
strcpy(card->driver, "ESM1");
strcpy(card->shortname, "ESS Maestro 1");
break;
......
......@@ -12,8 +12,7 @@ obj-$(CONFIG_SND_EMU10K1) += snd-util-mem.o
obj-$(CONFIG_SND_TRIDENT) += snd-util-mem.o
ifeq ($(subst m,y,$(CONFIG_SND_SEQUENCER)),y)
obj-$(CONFIG_SND_SBAWE) += snd-util-mem.o
obj-$(CONFIG_SND) += emux/
endif
obj-$(CONFIG_SND) += emux/
include $(TOPDIR)/Rules.make
......@@ -526,7 +526,7 @@ static struct snd_urb_ops audio_urb_ops[2] = {
/*
* complete callback from data urb
*/
static void snd_complete_urb(struct urb *urb)
static void snd_complete_urb(struct urb *urb, struct pt_regs *regs)
{
snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context;
snd_usb_substream_t *subs = ctx->subs;
......@@ -551,7 +551,7 @@ static void snd_complete_urb(struct urb *urb)
/*
* complete callback from sync urb
*/
static void snd_complete_sync_urb(struct urb *urb)
static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs)
{
snd_urb_ctx_t *ctx = (snd_urb_ctx_t *)urb->context;
snd_usb_substream_t *subs = ctx->subs;
......
......@@ -172,7 +172,7 @@ static void snd_usbmidi_input_packet(snd_usb_midi_in_endpoint_t* ep,
/*
* Processes the data read from the device.
*/
static void snd_usbmidi_in_urb_complete(struct urb* urb)
static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs)
{
snd_usb_midi_in_endpoint_t* ep = snd_magic_cast(snd_usb_midi_in_endpoint_t, urb->context, return);
......@@ -197,7 +197,7 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb)
/*
* Converts the data read from a Midiman device to standard USB MIDI packets.
*/
static void snd_usbmidi_in_midiman_complete(struct urb* urb)
static void snd_usbmidi_in_midiman_complete(struct urb* urb, struct pt_regs *regs)
{
if (urb->status == 0) {
uint8_t* buffer = (uint8_t*)urb->transfer_buffer;
......@@ -223,10 +223,10 @@ static void snd_usbmidi_in_midiman_complete(struct urb* urb)
}
}
}
snd_usbmidi_in_urb_complete(urb);
snd_usbmidi_in_urb_complete(urb, regs);
}
static void snd_usbmidi_out_urb_complete(struct urb* urb)
static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs)
{
snd_usb_midi_out_endpoint_t* ep = snd_magic_cast(snd_usb_midi_out_endpoint_t, urb->context, return);
......
......@@ -76,7 +76,7 @@ struct usb_mixer_elem_info {
snd_usb_audio_t *chip;
unsigned int ctrlif;
unsigned int id;
unsigned int control;
unsigned int control; /* CS or ICN (high byte) */
unsigned int cmask; /* channel mask bitmap: 0 = master */
int channels;
int val_type;
......@@ -252,6 +252,8 @@ static int convert_bytes_value(usb_mixer_elem_info_t *cval, int val)
static int get_relative_value(usb_mixer_elem_info_t *cval, int val)
{
if (! cval->res)
cval->res = 1;
if (val < cval->min)
return 0;
else if (val > cval->max)
......@@ -264,6 +266,8 @@ static int get_abs_value(usb_mixer_elem_info_t *cval, int val)
{
if (val < 0)
return cval->min;
if (! cval->res)
cval->res = 1;
val *= cval->res;
val += cval->min;
if (val > cval->max)
......@@ -1003,7 +1007,7 @@ static int mixer_ctl_procunit_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
usb_mixer_elem_info_t *cval = snd_magic_cast(usb_mixer_elem_info_t, kcontrol->private_data, return -EINVAL);
int err, val;
err = get_cur_ctl_value(cval, cval->control, &val);
err = get_cur_ctl_value(cval, cval->control << 8, &val);
#ifdef IGNORE_CTL_ERROR
if (err < 0) {
ucontrol->value.integer.value[0] = cval->min;
......@@ -1023,7 +1027,7 @@ static int mixer_ctl_procunit_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
usb_mixer_elem_info_t *cval = snd_magic_cast(usb_mixer_elem_info_t, kcontrol->private_data, return -EINVAL);
int val, oval, err;
err = get_cur_ctl_value(cval, cval->control, &oval);
err = get_cur_ctl_value(cval, cval->control << 8, &oval);
#ifdef IGNORE_CTL_ERROR
if (err < 0)
return 0;
......@@ -1033,7 +1037,7 @@ static int mixer_ctl_procunit_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
val = ucontrol->value.integer.value[0];
val = get_abs_value(cval, val);
if (val != oval) {
set_cur_ctl_value(cval, cval->control, val);
set_cur_ctl_value(cval, cval->control << 8, val);
return 1;
}
return 0;
......@@ -1347,6 +1351,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
cval->channels = 1;
cval->min = 1;
cval->max = num_ins;
cval->res = 1;
cval->initialized = 1;
namelist = kmalloc(sizeof(char *) * num_ins, GFP_KERNEL);
......
......@@ -39,9 +39,9 @@ struct usbmix_ctl_map {
/*
* Topology of SB Extigy (see on the wide screen :)
USB_IN[1] --->FU[2]------------------------------+->MU[16]-->PE[17]-+->FU[18]--+->EU[27]--+->EU[21]-->FU[22]--+->FU[23] > Dig_OUT[24]
USB_IN[1] --->FU[2]------------------------------+->MU[16]-->PU[17]-+->FU[18]--+->EU[27]--+->EU[21]-->FU[22]--+->FU[23] > Dig_OUT[24]
^ | | | |
USB_IN[3] -+->SU[5]-->FU[6]--+->MU[14] ->PE[15]->+ | | | +->FU[25] > Dig_OUT[26]
USB_IN[3] -+->SU[5]-->FU[6]--+->MU[14] ->PU[15]->+ | | | +->FU[25] > Dig_OUT[26]
^ ^ | | | |
Dig_IN[4] -+ | | | | +->FU[28]---------------------> Spk_OUT[19]
| | | |
......@@ -69,9 +69,9 @@ static struct usbmix_name_map extigy_map[] = {
{ 12, "Capture" }, /* FU */
/* 13: OT pcm capture */
/* 14: MU (w/o controls) */
/* 15: PE (3D enh) */
/* 15: PU (3D enh) */
/* 16: MU (w/o controls) */
/* 17: PE (updown) */ /* FIXME: what control? */
/* 17: PU (updown) */ /* FIXME: what control? */
{ 18, "Tone Control - Bass", USB_FEATURE_BASS }, /* FU */
{ 18, "Tone Control - Treble", USB_FEATURE_TREBLE }, /* FU */
{ 18, "Master Playback" }, /* FU; others */
......
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