mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
ALSA: opti-miro: remove snd_card pointer from snd_miro structure
Remove the snd_card pointer from the snd_miro structure and do some small code improvements. Also, move Opti chipset detection before detection of the ACI mixer, so the mci_base value is set in one place only. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
fbc543915f
commit
616ad593fe
1 changed files with 23 additions and 30 deletions
|
@ -110,7 +110,6 @@ struct snd_miro {
|
||||||
unsigned long pwd_reg;
|
unsigned long pwd_reg;
|
||||||
|
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
struct snd_card *card;
|
|
||||||
struct snd_pcm *pcm;
|
struct snd_pcm *pcm;
|
||||||
|
|
||||||
long wss_base;
|
long wss_base;
|
||||||
|
@ -132,8 +131,6 @@ struct snd_miro {
|
||||||
struct mutex aci_mutex;
|
struct mutex aci_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void snd_miro_proc_init(struct snd_miro * miro);
|
|
||||||
|
|
||||||
static char * snd_opti9xx_names[] = {
|
static char * snd_opti9xx_names[] = {
|
||||||
"unkown",
|
"unkown",
|
||||||
"82C928", "82C929",
|
"82C928", "82C929",
|
||||||
|
@ -457,11 +454,9 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
|
||||||
right = ucontrol->value.integer.value[1];
|
right = ucontrol->value.integer.value[1];
|
||||||
|
|
||||||
setreg_right = (kcontrol->private_value >> 8) & 0xff;
|
setreg_right = (kcontrol->private_value >> 8) & 0xff;
|
||||||
if (setreg_right == ACI_SET_MASTER) {
|
setreg_left = setreg_right + 8;
|
||||||
setreg_left = setreg_right + 1;
|
if (setreg_right == ACI_SET_MASTER)
|
||||||
} else {
|
setreg_left -= 7;
|
||||||
setreg_left = setreg_right + 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
getreg_right = kcontrol->private_value & 0xff;
|
getreg_right = kcontrol->private_value & 0xff;
|
||||||
getreg_left = getreg_right + 1;
|
getreg_left = getreg_right + 1;
|
||||||
|
@ -667,17 +662,15 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devinit snd_miro_mixer(struct snd_miro *miro)
|
static int __devinit snd_miro_mixer(struct snd_card *card,
|
||||||
|
struct snd_miro *miro)
|
||||||
{
|
{
|
||||||
struct snd_card *card;
|
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_BUG_ON(!miro || !miro->card))
|
if (snd_BUG_ON(!miro || !card))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
card = miro->card;
|
|
||||||
|
|
||||||
switch (miro->hardware) {
|
switch (miro->hardware) {
|
||||||
case OPTi9XX_HW_82C924:
|
case OPTi9XX_HW_82C924:
|
||||||
strcpy(card->mixername, "ACI & OPTi924");
|
strcpy(card->mixername, "ACI & OPTi924");
|
||||||
|
@ -950,11 +943,12 @@ static void snd_miro_proc_read(struct snd_info_entry * entry,
|
||||||
snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp);
|
snd_iprintf(buffer, " preamp : 0x%x\n", miro->aci_preamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __devinit snd_miro_proc_init(struct snd_miro * miro)
|
static void __devinit snd_miro_proc_init(struct snd_card *card,
|
||||||
|
struct snd_miro *miro)
|
||||||
{
|
{
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
|
|
||||||
if (! snd_card_proc_new(miro->card, "miro", &entry))
|
if (!snd_card_proc_new(card, "miro", &entry))
|
||||||
snd_info_set_text_ops(entry, miro, snd_miro_proc_read);
|
snd_info_set_text_ops(entry, miro, snd_miro_proc_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,20 +965,18 @@ static int __devinit snd_miro_configure(struct snd_miro *chip)
|
||||||
unsigned char mpu_irq_bits;
|
unsigned char mpu_irq_bits;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80);
|
||||||
|
snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */
|
||||||
|
snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02);
|
||||||
|
|
||||||
switch (chip->hardware) {
|
switch (chip->hardware) {
|
||||||
case OPTi9XX_HW_82C924:
|
case OPTi9XX_HW_82C924:
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02);
|
snd_miro_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02);
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80);
|
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */
|
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
|
snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02);
|
|
||||||
break;
|
break;
|
||||||
case OPTi9XX_HW_82C929:
|
case OPTi9XX_HW_82C929:
|
||||||
/* untested init commands for OPTi929 */
|
/* untested init commands for OPTi929 */
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(1), 0x80, 0x80);
|
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(2), 0x20, 0x20); /* OPL4 */
|
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(4), 0x00, 0x0c);
|
snd_miro_write_mask(chip, OPTi9XX_MC_REG(4), 0x00, 0x0c);
|
||||||
snd_miro_write_mask(chip, OPTi9XX_MC_REG(5), 0x02, 0x02);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware);
|
snd_printk(KERN_ERR "chip %d not supported\n", chip->hardware);
|
||||||
|
@ -1156,7 +1148,6 @@ static int __devinit snd_card_miro_aci_detect(struct snd_card *card,
|
||||||
|
|
||||||
/* get ACI port from OPTi9xx MC 4 */
|
/* get ACI port from OPTi9xx MC 4 */
|
||||||
|
|
||||||
miro->mc_base = 0xf8c;
|
|
||||||
regval=inb(miro->mc_base + 4);
|
regval=inb(miro->mc_base + 4);
|
||||||
miro->aci_port = (regval & 0x10) ? 0x344: 0x354;
|
miro->aci_port = (regval & 0x10) ? 0x344: 0x354;
|
||||||
|
|
||||||
|
@ -1232,7 +1223,13 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
|
||||||
|
|
||||||
card->private_free = snd_card_miro_free;
|
card->private_free = snd_card_miro_free;
|
||||||
miro = card->private_data;
|
miro = card->private_data;
|
||||||
miro->card = card;
|
|
||||||
|
error = snd_card_miro_detect(card, miro);
|
||||||
|
if (error < 0) {
|
||||||
|
snd_card_free(card);
|
||||||
|
snd_printk(KERN_ERR "unable to detect OPTi9xx chip\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
if ((error = snd_card_miro_aci_detect(card, miro)) < 0) {
|
if ((error = snd_card_miro_aci_detect(card, miro)) < 0) {
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
|
@ -1241,13 +1238,8 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init proc interface */
|
/* init proc interface */
|
||||||
snd_miro_proc_init(miro);
|
snd_miro_proc_init(card, miro);
|
||||||
|
|
||||||
if ((error = snd_card_miro_detect(card, miro)) < 0) {
|
|
||||||
snd_card_free(card);
|
|
||||||
snd_printk(KERN_ERR "unable to detect OPTi9xx chip\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! miro->res_mc_base &&
|
if (! miro->res_mc_base &&
|
||||||
(miro->res_mc_base = request_region(miro->mc_base, miro->mc_base_size,
|
(miro->res_mc_base = request_region(miro->mc_base, miro->mc_base_size,
|
||||||
|
@ -1341,7 +1333,8 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
|
||||||
|
|
||||||
miro->pcm = pcm;
|
miro->pcm = pcm;
|
||||||
|
|
||||||
if ((error = snd_miro_mixer(miro)) < 0) {
|
error = snd_miro_mixer(card, miro);
|
||||||
|
if (error < 0) {
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue