* [PATCH] [ALSA] ice1724 - support for more that one codec.
[not found] <s5h8xamsuxd.wl%tiwai@suse.de>
@ 2008-04-30 9:27 ` Rodolfo Giometti
2008-04-30 12:33 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Rodolfo Giometti @ 2008-04-30 9:27 UTC (permalink / raw)
To: linux-kernel
Cc: Takashi Iwai, Jaroslav Kysela, James Stafford, Doug McLain,
Rodolfo Giometti
Now it's possible to specify how many codes are present on the board by
using a new filed as follow:
ice->ac97_codecs = 4;
For backward compatibility if "ice->ac97_codecs" is set to zero, the patch
redefines it as "1".
Signed-off-by: Rodolfo Giometti <giometti@linux.it>
---
sound/pci/ice1712/ice1712.c | 37 +++++++++++++++++++++++++------------
sound/pci/ice1712/ice1712.h | 1 +
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 6630a0a..f78c724 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -221,7 +221,7 @@ static void snd_ice1712_pro_ac97_write(struct snd_ac97 *ac97,
outb(reg, ICEMT(ice, AC97_INDEX));
outw(val, ICEMT(ice, AC97_DATA));
old_cmd &= ~(ICE1712_AC97_PBK_VSR | ICE1712_AC97_CAP_VSR);
- outb(old_cmd | ICE1712_AC97_WRITE, ICEMT(ice, AC97_CMD));
+ outb(old_cmd | ac97->num | ICE1712_AC97_WRITE, ICEMT(ice, AC97_CMD));
for (tm = 0; tm < 0x10000; tm++)
if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_WRITE) == 0)
break;
@@ -244,7 +244,7 @@ static unsigned short snd_ice1712_pro_ac97_read(struct snd_ac97 *ac97,
break;
}
outb(reg, ICEMT(ice, AC97_INDEX));
- outb(old_cmd | ICE1712_AC97_READ, ICEMT(ice, AC97_CMD));
+ outb(old_cmd | ac97->num | ICE1712_AC97_READ, ICEMT(ice, AC97_CMD));
for (tm = 0; tm < 0x10000; tm++)
if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_READ) == 0)
break;
@@ -1504,7 +1504,7 @@ static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97)
static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice)
{
- int err, bus_num = 0;
+ int err, codec, bus_num = 0;
struct snd_ac97_template ac97;
struct snd_ac97_bus *pbus;
static struct snd_ac97_bus_ops con_ops = {
@@ -1532,15 +1532,28 @@ static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice)
}
if (! (ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) {
- if ((err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus)) < 0)
- return err;
- memset(&ac97, 0, sizeof(ac97));
- ac97.private_data = ice;
- ac97.private_free = snd_ice1712_mixer_free_ac97;
- if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0)
- printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n");
- else
- return 0;
+ /* Backward compatibility */
+ if (!ice->ac97_codecs)
+ ice->ac97_codecs = 1;
+
+ for (codec = 0; codec < ice->ac97_codecs; codec++) {
+ /* Sanity check */
+ if (codec >= 4) {
+ printk(KERN_WARNING "ice1712: too much pro ac97 codes (max = %d), skipped\n", codec);
+ break;
+ }
+
+ if ((err = snd_ac97_bus(ice->card, bus_num++, &pro_ops, NULL, &pbus)) < 0)
+ return err;
+ memset(&ac97, 0, sizeof(ac97));
+ ac97.num = codec;
+ ac97.private_data = ice;
+ ac97.private_free = snd_ice1712_mixer_free_ac97;
+ if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0)
+ printk(KERN_WARNING "ice1712: cannot initialize pro ac97 #%d, skipped\n", codec);
+ }
+
+ return 0;
}
/* I2S mixer only */
strcat(ice->card->mixername, "ICE1712 - multitrack");
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index 6ac486d..59047ad 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -335,6 +335,7 @@ struct snd_ice1712 {
unsigned int force_rdma1: 1; /* VT1720/4 - RDMA1 as non-spdif */
unsigned int num_total_dacs; /* total DACs */
unsigned int num_total_adcs; /* total ADCs */
+ unsigned int ac97_codecs; /* total pro AC97 codecs */
unsigned int cur_rate; /* current rate */
struct mutex open_mutex;
--
1.5.3.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [ALSA] ice1724 - support for more that one codec.
2008-04-30 9:27 ` [PATCH] [ALSA] ice1724 - support for more that one codec Rodolfo Giometti
@ 2008-04-30 12:33 ` Takashi Iwai
2008-05-02 19:52 ` Rodolfo Giometti
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2008-04-30 12:33 UTC (permalink / raw)
To: Rodolfo Giometti
Cc: linux-kernel, Jaroslav Kysela, James Stafford, Doug McLain
At Wed, 30 Apr 2008 11:27:18 +0200,
Rodolfo Giometti wrote:
>
> Now it's possible to specify how many codes are present on the board by
> using a new filed as follow:
>
> ice->ac97_codecs = 4;
>
> For backward compatibility if "ice->ac97_codecs" is set to zero, the patch
> redefines it as "1".
>
> Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Thanks for the patch. The change looks OK to me, but please fix the
issues reported by checkpatch.pl.
And, which hardware has multiple AC97 codecs? I'd like rather apply
it together.
Takashi
> ---
> sound/pci/ice1712/ice1712.c | 37 +++++++++++++++++++++++++------------
> sound/pci/ice1712/ice1712.h | 1 +
> 2 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
> index 6630a0a..f78c724 100644
> --- a/sound/pci/ice1712/ice1712.c
> +++ b/sound/pci/ice1712/ice1712.c
> @@ -221,7 +221,7 @@ static void snd_ice1712_pro_ac97_write(struct snd_ac97 *ac97,
> outb(reg, ICEMT(ice, AC97_INDEX));
> outw(val, ICEMT(ice, AC97_DATA));
> old_cmd &= ~(ICE1712_AC97_PBK_VSR | ICE1712_AC97_CAP_VSR);
> - outb(old_cmd | ICE1712_AC97_WRITE, ICEMT(ice, AC97_CMD));
> + outb(old_cmd | ac97->num | ICE1712_AC97_WRITE, ICEMT(ice, AC97_CMD));
> for (tm = 0; tm < 0x10000; tm++)
> if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_WRITE) == 0)
> break;
> @@ -244,7 +244,7 @@ static unsigned short snd_ice1712_pro_ac97_read(struct snd_ac97 *ac97,
> break;
> }
> outb(reg, ICEMT(ice, AC97_INDEX));
> - outb(old_cmd | ICE1712_AC97_READ, ICEMT(ice, AC97_CMD));
> + outb(old_cmd | ac97->num | ICE1712_AC97_READ, ICEMT(ice, AC97_CMD));
> for (tm = 0; tm < 0x10000; tm++)
> if ((inb(ICEMT(ice, AC97_CMD)) & ICE1712_AC97_READ) == 0)
> break;
> @@ -1504,7 +1504,7 @@ static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97)
>
> static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice)
> {
> - int err, bus_num = 0;
> + int err, codec, bus_num = 0;
> struct snd_ac97_template ac97;
> struct snd_ac97_bus *pbus;
> static struct snd_ac97_bus_ops con_ops = {
> @@ -1532,15 +1532,28 @@ static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 * ice)
> }
>
> if (! (ice->eeprom.data[ICE_EEP1_ACLINK] & ICE1712_CFG_PRO_I2S)) {
> - if ((err = snd_ac97_bus(ice->card, bus_num, &pro_ops, NULL, &pbus)) < 0)
> - return err;
> - memset(&ac97, 0, sizeof(ac97));
> - ac97.private_data = ice;
> - ac97.private_free = snd_ice1712_mixer_free_ac97;
> - if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0)
> - printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n");
> - else
> - return 0;
> + /* Backward compatibility */
> + if (!ice->ac97_codecs)
> + ice->ac97_codecs = 1;
> +
> + for (codec = 0; codec < ice->ac97_codecs; codec++) {
> + /* Sanity check */
> + if (codec >= 4) {
> + printk(KERN_WARNING "ice1712: too much pro ac97 codes (max = %d), skipped\n", codec);
> + break;
> + }
> +
> + if ((err = snd_ac97_bus(ice->card, bus_num++, &pro_ops, NULL, &pbus)) < 0)
> + return err;
> + memset(&ac97, 0, sizeof(ac97));
> + ac97.num = codec;
> + ac97.private_data = ice;
> + ac97.private_free = snd_ice1712_mixer_free_ac97;
> + if ((err = snd_ac97_mixer(pbus, &ac97, &ice->ac97)) < 0)
> + printk(KERN_WARNING "ice1712: cannot initialize pro ac97 #%d, skipped\n", codec);
> + }
> +
> + return 0;
> }
> /* I2S mixer only */
> strcat(ice->card->mixername, "ICE1712 - multitrack");
> diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
> index 6ac486d..59047ad 100644
> --- a/sound/pci/ice1712/ice1712.h
> +++ b/sound/pci/ice1712/ice1712.h
> @@ -335,6 +335,7 @@ struct snd_ice1712 {
> unsigned int force_rdma1: 1; /* VT1720/4 - RDMA1 as non-spdif */
> unsigned int num_total_dacs; /* total DACs */
> unsigned int num_total_adcs; /* total ADCs */
> + unsigned int ac97_codecs; /* total pro AC97 codecs */
> unsigned int cur_rate; /* current rate */
>
> struct mutex open_mutex;
> --
> 1.5.3.6
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [ALSA] ice1724 - support for more that one codec.
2008-04-30 12:33 ` Takashi Iwai
@ 2008-05-02 19:52 ` Rodolfo Giometti
0 siblings, 0 replies; 3+ messages in thread
From: Rodolfo Giometti @ 2008-05-02 19:52 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-kernel, Jaroslav Kysela, James Stafford, Doug McLain
On Wed, Apr 30, 2008 at 02:33:36PM +0200, Takashi Iwai wrote:
> At Wed, 30 Apr 2008 11:27:18 +0200,
> Rodolfo Giometti wrote:
> >
> > Now it's possible to specify how many codes are present on the board by
> > using a new filed as follow:
> >
> > ice->ac97_codecs = 4;
> >
> > For backward compatibility if "ice->ac97_codecs" is set to zero, the patch
> > redefines it as "1".
> >
> > Signed-off-by: Rodolfo Giometti <giometti@linux.it>
>
> Thanks for the patch. The change looks OK to me, but please fix the
> issues reported by checkpatch.pl.
Ok, I'll do it ASAP.
> And, which hardware has multiple AC97 codecs? I'd like rather apply
> it together.
I'm still working on it since I'd like to record from 4 channels at
time but I can't... here my custom settings:
static unsigned char int1410_eeprom[] __devinitdata = {
[ICE_EEP1_CODEC] = 0x1f,
[ICE_EEP1_ACLINK] = 0x00,
[ICE_EEP1_I2SID] = 0x01,
[ICE_EEP1_SPDIF] = 0x03,
[ICE_EEP1_GPIO_MASK] = 0xff,
[ICE_EEP1_GPIO_STATE] = 0xff,
[ICE_EEP1_GPIO_DIR] = 0xff,
};
static int __devinit snd_ice1712_int1410_init(struct snd_ice1712 *ice)
{
printk("%s\n", __FUNCTION__);
/* Set the pro AC97 codecs */
ice->ac97_codecs = 4;
/* Set the analog DACs/ADCs */
ice->num_total_dacs = 8;
ice->num_total_adcs = 8;
return 0;
}
/* entry point */
struct snd_ice1712_card_info snd_ice1712_eurotech_cards[] __devinitdata =
{
{
.subvendor = ICE1712_SUBDEVICE_INT1410, /* a dummy id */
.name = "Eurotech INT 1410",
.model = "int1410",
.chip_init = snd_ice1712_int1410_init,
.build_controls = snd_ice1712_int1410_add_controls,
.no_mpu401 = 1,
.eeprom_size = sizeof(int1410_eeprom),
.eeprom_data = int1410_eeprom,
.driver = "int1410",
},
{ } /* terminator */
};
But I'm a bit confused regarding how to enable such feature. Again,
should I use a multitrack audio recorder as ecasound or I can just use
arecord with some magic options? :)
Thanks,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-02 19:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <s5h8xamsuxd.wl%tiwai@suse.de>
2008-04-30 9:27 ` [PATCH] [ALSA] ice1724 - support for more that one codec Rodolfo Giometti
2008-04-30 12:33 ` Takashi Iwai
2008-05-02 19:52 ` Rodolfo Giometti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox