Commit 4410b384 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Takashi Iwai <tiwai@suse.de>

AC97 Codec Core
Clemens Ladisch <clemens@ladisch.de>:
added AD1888 support.
parent f21ae4ea
...@@ -100,6 +100,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = { ...@@ -100,6 +100,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
{ 0x41445361, 0xffffffff, "AD1886", patch_ad1886, NULL }, { 0x41445361, 0xffffffff, "AD1886", patch_ad1886, NULL },
{ 0x41445362, 0xffffffff, "AD1887", patch_ad1881, NULL }, { 0x41445362, 0xffffffff, "AD1887", patch_ad1881, NULL },
{ 0x41445363, 0xffffffff, "AD1886A", patch_ad1881, NULL }, { 0x41445363, 0xffffffff, "AD1886A", patch_ad1881, NULL },
{ 0x41445368, 0xffffffff, "AD1888", patch_ad1888, NULL },
{ 0x41445370, 0xffffffff, "AD1980", patch_ad1980, NULL }, { 0x41445370, 0xffffffff, "AD1980", patch_ad1980, NULL },
{ 0x41445372, 0xffffffff, "AD1981A", patch_ad1981a, NULL }, { 0x41445372, 0xffffffff, "AD1981A", patch_ad1981a, NULL },
{ 0x41445374, 0xffffffff, "AD1981B", patch_ad1981b, NULL }, { 0x41445374, 0xffffffff, "AD1981B", patch_ad1981b, NULL },
......
...@@ -802,7 +802,7 @@ int patch_ad1981b(ac97_t *ac97) ...@@ -802,7 +802,7 @@ int patch_ad1981b(ac97_t *ac97)
return 0; return 0;
} }
static int snd_ac97_ad1980_lohpsel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) static int snd_ac97_ad1888_lohpsel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1; uinfo->count = 1;
...@@ -811,7 +811,7 @@ static int snd_ac97_ad1980_lohpsel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_i ...@@ -811,7 +811,7 @@ static int snd_ac97_ad1980_lohpsel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_i
return 0; return 0;
} }
static int snd_ac97_ad1980_lohpsel_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol) static int snd_ac97_ad1888_lohpsel_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol)
{ {
ac97_t *ac97 = snd_kcontrol_chip(kcontrol); ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
unsigned short val; unsigned short val;
...@@ -821,7 +821,7 @@ static int snd_ac97_ad1980_lohpsel_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_va ...@@ -821,7 +821,7 @@ static int snd_ac97_ad1980_lohpsel_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_va
return 0; return 0;
} }
static int snd_ac97_ad1980_lohpsel_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_ac97_ad1888_lohpsel_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
{ {
ac97_t *ac97 = snd_kcontrol_chip(kcontrol); ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
unsigned short val; unsigned short val;
...@@ -832,7 +832,7 @@ static int snd_ac97_ad1980_lohpsel_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_va ...@@ -832,7 +832,7 @@ static int snd_ac97_ad1980_lohpsel_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_va
AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val); AC97_AD198X_LOSEL | AC97_AD198X_HPSEL, val);
} }
static int snd_ac97_ad1980_downmix_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) static int snd_ac97_ad1888_downmix_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
{ {
static char *texts[3] = {"Off", "6 -> 4", "6 -> 2"}; static char *texts[3] = {"Off", "6 -> 4", "6 -> 2"};
...@@ -845,7 +845,7 @@ static int snd_ac97_ad1980_downmix_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_i ...@@ -845,7 +845,7 @@ static int snd_ac97_ad1980_downmix_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_i
return 0; return 0;
} }
static int snd_ac97_ad1980_downmix_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol) static int snd_ac97_ad1888_downmix_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol)
{ {
ac97_t *ac97 = snd_kcontrol_chip(kcontrol); ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
unsigned short val; unsigned short val;
...@@ -858,7 +858,7 @@ static int snd_ac97_ad1980_downmix_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_va ...@@ -858,7 +858,7 @@ static int snd_ac97_ad1980_downmix_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_va
return 0; return 0;
} }
static int snd_ac97_ad1980_downmix_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_ac97_ad1888_downmix_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
{ {
ac97_t *ac97 = snd_kcontrol_chip(kcontrol); ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
unsigned short val; unsigned short val;
...@@ -874,51 +874,47 @@ static int snd_ac97_ad1980_downmix_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_va ...@@ -874,51 +874,47 @@ static int snd_ac97_ad1980_downmix_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_va
AC97_AD198X_DMIX0 | AC97_AD198X_DMIX1, val); AC97_AD198X_DMIX0 | AC97_AD198X_DMIX1, val);
} }
static const snd_kcontrol_new_t snd_ac97_ad1980_controls[] = { static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Exchange Front/Surround", .name = "Exchange Front/Surround",
.info = snd_ac97_ad1980_lohpsel_info, .info = snd_ac97_ad1888_lohpsel_info,
.get = snd_ac97_ad1980_lohpsel_get, .get = snd_ac97_ad1888_lohpsel_get,
.put = snd_ac97_ad1980_lohpsel_put .put = snd_ac97_ad1888_lohpsel_put
}, },
AC97_SINGLE("Spread Front to Surround and Center/LFE", AC97_AD_MISC, 7, 1, 0), AC97_SINGLE("Spread Front to Surround and Center/LFE", AC97_AD_MISC, 7, 1, 0),
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Downmix", .name = "Downmix",
.info = snd_ac97_ad1980_downmix_info, .info = snd_ac97_ad1888_downmix_info,
.get = snd_ac97_ad1980_downmix_get, .get = snd_ac97_ad1888_downmix_get,
.put = snd_ac97_ad1980_downmix_put .put = snd_ac97_ad1888_downmix_put
}, },
AC97_SINGLE("Surround Jack as Input", AC97_AD_MISC, 12, 1, 0), AC97_SINGLE("Surround Jack as Input", AC97_AD_MISC, 12, 1, 0),
AC97_SINGLE("Center/LFE Jack as Input", AC97_AD_MISC, 11, 1, 0), AC97_SINGLE("Center/LFE Jack as Input", AC97_AD_MISC, 11, 1, 0),
}; };
static int patch_ad1980_specific(ac97_t *ac97) static int patch_ad1888_specific(ac97_t *ac97)
{ {
int err;
/* rename 0x04 as "Master" and 0x02 as "Master Surround" */ /* rename 0x04 as "Master" and 0x02 as "Master Surround" */
snd_ac97_rename_ctl(ac97, "Master Playback Switch", "Master Surround Playback Switch"); snd_ac97_rename_ctl(ac97, "Master Playback Switch", "Master Surround Playback Switch");
snd_ac97_rename_ctl(ac97, "Master Playback Volume", "Master Surround Playback Volume"); snd_ac97_rename_ctl(ac97, "Master Playback Volume", "Master Surround Playback Volume");
snd_ac97_rename_ctl(ac97, "Headphone Playback Switch", "Master Playback Switch"); snd_ac97_rename_ctl(ac97, "Headphone Playback Switch", "Master Playback Switch");
snd_ac97_rename_ctl(ac97, "Headphone Playback Volume", "Master Playback Volume"); snd_ac97_rename_ctl(ac97, "Headphone Playback Volume", "Master Playback Volume");
if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls));
return err;
return patch_build_controls(ac97, snd_ac97_ad1980_controls, ARRAY_SIZE(snd_ac97_ad1980_controls));
} }
static struct snd_ac97_build_ops patch_ad1980_build_ops = { static struct snd_ac97_build_ops patch_ad1888_build_ops = {
.build_post_spdif = patch_ad198x_post_spdif, .build_post_spdif = patch_ad198x_post_spdif,
.build_specific = patch_ad1980_specific .build_specific = patch_ad1888_specific
}; };
int patch_ad1980(ac97_t * ac97) int patch_ad1888(ac97_t * ac97)
{ {
unsigned short misc; unsigned short misc;
patch_ad1881(ac97); patch_ad1881(ac97);
ac97->build_ops = &patch_ad1980_build_ops; ac97->build_ops = &patch_ad1888_build_ops;
/* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */ /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */
/* it seems that most vendors connect line-out connector to headphone out of AC'97 */ /* it seems that most vendors connect line-out connector to headphone out of AC'97 */
/* AD-compatible mode */ /* AD-compatible mode */
...@@ -933,6 +929,27 @@ int patch_ad1980(ac97_t * ac97) ...@@ -933,6 +929,27 @@ int patch_ad1980(ac97_t * ac97)
return 0; return 0;
} }
static int patch_ad1980_specific(ac97_t *ac97)
{
int err;
if ((err = patch_ad1888_specific(ac97)) < 0)
return err;
return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
}
static struct snd_ac97_build_ops patch_ad1980_build_ops = {
.build_post_spdif = patch_ad198x_post_spdif,
.build_specific = patch_ad1980_specific
};
int patch_ad1980(ac97_t * ac97)
{
patch_ad1888(ac97);
ac97->build_ops = &patch_ad1980_build_ops;
return 0;
}
static const snd_kcontrol_new_t snd_ac97_ad1985_controls[] = { static const snd_kcontrol_new_t snd_ac97_ad1985_controls[] = {
AC97_SINGLE("Center/LFE Jack as Mic", AC97_AD_SERIAL_CFG, 9, 1, 0), AC97_SINGLE("Center/LFE Jack as Mic", AC97_AD_SERIAL_CFG, 9, 1, 0),
AC97_SINGLE("Exchange Center/LFE", AC97_AD_SERIAL_CFG, 3, 1, 0) AC97_SINGLE("Exchange Center/LFE", AC97_AD_SERIAL_CFG, 3, 1, 0)
......
...@@ -41,6 +41,7 @@ int patch_ad1819(ac97_t * ac97); ...@@ -41,6 +41,7 @@ int patch_ad1819(ac97_t * ac97);
int patch_ad1881(ac97_t * ac97); int patch_ad1881(ac97_t * ac97);
int patch_ad1885(ac97_t * ac97); int patch_ad1885(ac97_t * ac97);
int patch_ad1886(ac97_t * ac97); int patch_ad1886(ac97_t * ac97);
int patch_ad1888(ac97_t * ac97);
int patch_ad1980(ac97_t * ac97); int patch_ad1980(ac97_t * ac97);
int patch_ad1981a(ac97_t * ac97); int patch_ad1981a(ac97_t * ac97);
int patch_ad1981b(ac97_t * ac97); int patch_ad1981b(ac97_t * ac97);
......
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