hda: Added new IDT codec family
PATCH 1/1 hda: Added new IDT codec family
Added initial support for the STAC92HD71BXX family of codecs.
---
pci/hda/hda_codec.h +2 -0
@@ -92,6 +92,8 @@ enum {*/ #define AC_VERB_SET_STREAM_FORMAT 0x200#define AC_VERB_SET_AMP_GAIN_MUTE 0x300 +#define AC_VERB_SET_RIGHT_AMP_IN_MUTE 0x350 +#define AC_VERB_SET_LEFT_AMP_IN_MUTE 0x360#define AC_VERB_SET_PROC_COEF 0x400#define AC_VERB_SET_COEF_INDEX 0x500#define AC_VERB_SET_CONNECT_SEL 0x701
pci/hda/patch_sigmatel.c +155 -0
202 lines not on this page · raw message
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Mon, 05 Nov 2007 10:06:57 -0500,
pci/hda/hda_codec.h enum { · line 96
Quoted 10 lines · Matthew Ranostay
diff -r
3e1a17f8bacapci/hda/hda_codec.hpci/hda/hda_codec.h +2
-0@@ -92,6 +92,8 @@ enum {*/ #define AC_VERB_SET_STREAM_FORMAT 0x200#define AC_VERB_SET_AMP_GAIN_MUTE 0x300 +#define AC_VERB_SET_RIGHT_AMP_IN_MUTE 0x350 +#define AC_VERB_SET_LEFT_AMP_IN_MUTE 0x360
Usually we pass the values for left or right bits in the parameter value (AC_AMP_SET_LEFT and AC_AMP_SET_RIGHT) instead of the verb value. So, no need to redefine them.
Quoted 29 lines
pci/hda/hda_codec.h +0
-0#define AC_VERB_SET_PROC_COEF 0x400#define AC_VERB_SET_COEF_INDEX 0x500#define AC_VERB_SET_CONNECT_SEL 0x701diff -r
3e1a17f8bacapci/hda/patch_sigmatel.cpci/hda/patch_sigmatel.c +11
-0@@ -62,6 +62,11 @@ enum { };enum { +STAC_92HD71BXX_REF , +STAC_92HD71BXX_MODELS +}; + +enum { STAC_925x_REF,STAC_M2_2 ,STAC_MA6 ,@@ -172,6 +177,23 @@ static hda_nid_t stac9200_dac_nids[1] = 0x02, }; +static hda_nid_t stac92hd71bxx_adc_nids[2 ] = { +0x12 ,0x13 , +}; + +static hda_nid_t stac92hd71bxx_mux_nids[2 ] = { +0x1a ,0x1b
pci/hda/patch_sigmatel.c static hda_nid_t stac9200_dac_nids[1] = · line 195
Quoted 10 lines
pci/hda/patch_sigmatel.c +10
-0+}; + +static hda_nid_t stac92hd71bxx_dac_nids[2 ] = { +0x10 ,/*0x11, */ +}; + +#define STAC92HD71BXX_NUM_DMICS 2 +static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS +1 ] = { +0x18 ,0x19 ,0 +};
Wrong indentations.
Try to run $linux_kernel/scripts/checkpatch.pl. You'll find other minor coding-style issues.
Quoted 19 lines
pci/hda/patch_sigmatel.c +6
-0+static hda_nid_t stac925x_adc_nids[1 ] = {0x03 , };@@ -236,6 +258,11 @@ static hda_nid_t stac922x_pin_nids[10] =static hda_nid_t stac922x_pin_nids[10 ] = {0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f ,0x10 ,0x11 ,0x15 ,0x1b , +}; + +static hda_nid_t stac92hd71bxx_pin_nids[10 ] = { +0x0a ,0x0b ,0x0c ,0x0d ,0x0e , +0x0f ,0x14 ,0x18 ,0x19 ,0x1e , };static hda_nid_t stac927x_pin_nids[14 ] = {@@ -393,6 +420,25 @@ static struct hda_verb stac9200_eapd_ini/* set dac0mux for dac converter */ {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
pci/hda/patch_sigmatel.c static struct hda_verb stac9200_eapd_ini · line 431
Quoted 10 lines
pci/hda/patch_sigmatel.c +9
-0{0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, + {} +}; + +static struct hda_verb stac92hd71bxx_core_init[] = { +/* set master volume and direct control */ + {0x28 ,AC_VERB_SET_VOLUME_KNOB_CONTROL ,0xff }, +/* unmute right and left channels for node 0x0a */ + {0x0a ,AC_VERB_SET_LEFT_AMP_IN_MUTE ,0x0 }, + { 0x0a, AC_VERB_SET_RIGHT_AMP_IN_MUTE, 0x0},
The below would do the same job with a single line:
{ 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }pci/hda/patch_sigmatel.c static struct hda_verb stac9200_eapd_ini · line 443
Quoted 12 lines
pci/hda/patch_sigmatel.c +10
-0+/* connect headphone jack to dac1 */ + { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, +/* unmute right and left channels for node 0x0d */ + { 0x0d, AC_VERB_SET_LEFT_AMP_IN_MUTE, 0x0}, + { 0x0d, AC_VERB_SET_RIGHT_AMP_IN_MUTE, 0x0}, +/* unmute right and left channels for node 0x0f */ + { 0x0f, AC_VERB_SET_LEFT_AMP_IN_MUTE, 0x0}, + { 0x0f, AC_VERB_SET_RIGHT_AMP_IN_MUTE, 0x0}, +/* unmute mono out node */ + { 0x14, AC_VERB_SET_LEFT_AMP_IN_MUTE, 0x0}, {} };
Ditto.
Thanks,
Takashi
Quoted 18 lines · On Monday 05 November 2007 14:30:07 Takashi Iwai wrote:
At Mon, 05 Nov 2007 10:06:57 -0500,
pci/hda/hda_codec.h enum { · line 96
Quoted 10 lines · Matthew Ranostay
diff -r
3e1a17f8bacapci/hda/hda_codec.hpci/hda/hda_codec.h +2
-0@@ -92,6 +92,8 @@ enum {*/ #define AC_VERB_SET_STREAM_FORMAT 0x200#define AC_VERB_SET_AMP_GAIN_MUTE 0x300 +#define AC_VERB_SET_RIGHT_AMP_IN_MUTE 0x350 +#define AC_VERB_SET_LEFT_AMP_IN_MUTE 0x360Usually we pass the values for left or right bits in the parameter value (
AC_AMP_SET_LEFTandAC_AMP_SET_RIGHT) instead of the verb value. So, no need to redefine them.Quoted 1 line
pci/hda/hda_codec.h +0
-0#define AC_VERB_SET_PROC_COEF 0x400
Any chance to see data-sheets of newer IDT chips?
There seems to be nothing on the web.
Are they available to general public?
For example STAC9872 has very limited support due to no datasheets.
Quoted 12 lines
pci/hda/patch_sigmatel.c +12
-0+static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { + STAC_DIGITAL_INPUT_SOURCE(1), + STAC_INPUT_SOURCE(2), + STAC_VOLKNOB(0x28), + + /* hardware gain controls */ + HDA_CODEC_VOLUME("Digital Mic 1 Volume", 0x18, 0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Digital Mic 2 Volume", 0x19, 0, HDA_OUTPUT), + + HDA_CODEC_VOLUME("Capture Volume", 0x1c, 0, HDA_OUTPUT), + HDA_CODEC_MUTE("Capture Switch", 0x1c, 0, HDA_OUTPUT), + HDA_CODEC_VOLUME("Capture Mux Volume", 0x1a, 0, HDA_OUTPUT),
Quoted 1 line
{ } /* end */
The chip has two ADCs, but why just one "Capture Volume" ? No analog loopback?
Best regards,
Maxim Levitsky
Quoted 118 lines · Takashi Iwai
At Mon, 05 Nov 2007 10:06:57 -0500,
pci/hda/hda_codec.h enum { · line 97
Quoted 10 lines · Matthew Ranostay
diff -r
3e1a17f8bacapci/hda/hda_codec.hpci/hda/hda_codec.h +2
-0@@ -92,6 +92,8 @@ enum {*/ #define AC_VERB_SET_STREAM_FORMAT 0x200#define AC_VERB_SET_AMP_GAIN_MUTE 0x300 +#define AC_VERB_SET_RIGHT_AMP_IN_MUTE 0x350 +#define AC_VERB_SET_LEFT_AMP_IN_MUTE 0x360Usually we pass the values for left or right bits in the parameter value (
AC_AMP_SET_LEFTandAC_AMP_SET_RIGHT) instead of the verb value. So, no need to redefine them.Quoted 30 lines
pci/hda/hda_codec.h +0
-0#define AC_VERB_SET_PROC_COEF 0x400#define AC_VERB_SET_COEF_INDEX 0x500#define
AC_VERB_SET_CONNECT_SEL0x701diff -r
3e1a17f8bacapci/hda/patch_sigmatel.cpci/hda/patch_sigmatel.c +12
-0@@ -62,6 +62,11 @@ enum { };enum { +STAC_92HD71BXX_REF , +STAC_92HD71BXX_MODELS +}; + +enum { STAC_925x_REF,STAC_M2_2 ,STAC_MA6 ,@@ -172,6 +177,23 @@ static hda_nid_t stac9200_dac_nids[1] = 0x02, }; +static hda_nid_t stac92hd71bxx_adc_nids[2 ] = { +0x12 ,0x13 , +}; + +static hda_nid_t stac92hd71bxx_mux_nids[2 ] = { +0x1a ,0x1b +};pci/hda/patch_sigmatel.c static hda_nid_t stac9200_dac_nids[1] = · line 196
Quoted 10 lines
pci/hda/patch_sigmatel.c +9
-0+ +static hda_nid_t stac92hd71bxx_dac_nids[2 ] = { +0x10 ,/*0x11, */ +}; + +#define STAC92HD71BXX_NUM_DMICS 2 +static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS +1 ] = { +0x18 ,0x19 ,0 +};Wrong indentations.
Try to run$linux_kernel/scripts/checkpatch.pl. You'll find other minor coding-style issues.Quoted 20 lines
pci/hda/patch_sigmatel.c +1
-0+static hda_nid_t stac925x_adc_nids[1 ] = {0x03 ,};
pci/hda/patch_sigmatel.c +5
-0@@ -236,6 +258,11 @@ static hda_nid_t stac922x_pin_nids[10] =static hda_nid_t stac922x_pin_nids[10 ] = {0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f ,0x10 ,0x11 ,0x15 ,0x1b , +}; + +static hda_nid_t stac92hd71bxx_pin_nids[10 ] = { +0x0a ,0x0b ,0x0c ,0x0d ,0x0e , +0x0f ,0x14 ,0x18 ,0x19 ,0x1e , };static hda_nid_t stac927x_pin_nids[14 ] = {@@ -393,6 +420,25 @@ static struct hda_verb stac9200_eapd_ini/* set dac0mux for dac converter */ {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},pci/hda/patch_sigmatel.c static struct hda_verb stac9200_eapd_ini · line 432
Quoted 10 lines
pci/hda/patch_sigmatel.c +9
-0+ {} +}; + +static struct hda_verb stac92hd71bxx_core_init[] = { +/* set master volume and direct control */ + {0x28 ,AC_VERB_SET_VOLUME_KNOB_CONTROL ,0xff }, +/* unmute right and left channels for node 0x0a */ + {0x0a ,AC_VERB_SET_LEFT_AMP_IN_MUTE ,0x0 }, + {0x0a ,AC_VERB_SET_RIGHT_AMP_IN_MUTE ,0x0 },The below would do the same job with a single line:
{ 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }pci/hda/patch_sigmatel.c static struct hda_verb stac9200_eapd_ini · line 444
Quoted 13 lines
pci/hda/patch_sigmatel.c +10
-0+/* connect headphone jack to dac1 */ + { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, +/* unmute right and left channels for node 0x0d */ + { 0x0d, AC_VERB_SET_LEFT_AMP_IN_MUTE, 0x0}, + { 0x0d, AC_VERB_SET_RIGHT_AMP_IN_MUTE, 0x0}, +/* unmute right and left channels for node 0x0f */ + { 0x0f, AC_VERB_SET_LEFT_AMP_IN_MUTE, 0x0}, + { 0x0f, AC_VERB_SET_RIGHT_AMP_IN_MUTE, 0x0}, +/* unmute mono out node */ + { 0x14, AC_VERB_SET_LEFT_AMP_IN_MUTE, 0x0}, {} };Ditto.
Quoted 4 lines
Thanks,
Takashi
Hello Takashi,
Here is an updated and cleanup version of the last patch. Thanks for pointing out the cruft in the previous patch.
Matt Ranstasy
pci/hda/patch_sigmatel.c +149 -0
@@ -62,6 +62,11 @@ enum { };enum { +STAC_92HD71BXX_REF , +STAC_92HD71BXX_MODELS +}; + +enum { STAC_925x_REF,STAC_M2_2 ,STAC_MA6 ,
@@ -172,6 +177,23 @@ static hda_nid_t stac9200_dac_nids[1] = 0x02, }; +static hda_nid_t stac92hd71bxx_adc_nids[2 ] = { +0x12 ,0x13 , +}; + +static hda_nid_t stac92hd71bxx_mux_nids[2 ] = { +0x1a ,0x1b +}; + +static hda_nid_t stac92hd71bxx_dac_nids[2 ] = { +0x10 ,/*0x11, */ +}; + +#define STAC92HD71BXX_NUM_DMICS 2 +static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS +1 ] = { +0x18 ,0x19 ,0 +}; +static hda_nid_t stac925x_adc_nids[1 ] = {0x03 , };
@@ -236,6 +258,11 @@ static hda_nid_t stac922x_pin_nids[10] =static hda_nid_t stac922x_pin_nids[10 ] = {0x0a ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f ,0x10 ,0x11 ,0x15 ,0x1b , +}; + +static hda_nid_t stac92hd71bxx_pin_nids[10 ] = { +0x0a ,0x0b ,0x0c ,0x0d ,0x0e , +0x0f ,0x14 ,0x18 ,0x19 ,0x1e , };static hda_nid_t stac927x_pin_nids[14 ] = {
@@ -393,6 +420,20 @@ static struct hda_verb stac9200_eapd_ini/* set dac0mux for dac converter */ {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, + {} +}; + +static struct hda_verb stac92hd71bxx_core_init[] = { +/* set master volume and direct control */ + {0x28 ,AC_VERB_SET_VOLUME_KNOB_CONTROL ,0xff }, +/* connect headphone jack to dac1 */ + {0x0a ,AC_VERB_SET_CONNECT_SEL ,0x01 }, +/* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ + {0x0a ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (0 )}, + {0x0d ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (0 )}, + {0x0f ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (0 )}, +/* unmute mono out node */ + {0x14 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_IN_UNMUTE (0 )}, {} };
@@ -480,6 +521,21 @@ static struct snd_kcontrol_new stac9200_HDA_CODEC_VOLUME ("Capture Volume" ,0x0a ,0 ,HDA_OUTPUT ),HDA_CODEC_MUTE ("Capture Switch" ,0x0a ,0 ,HDA_OUTPUT ), HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), + { } /* end */ +}; + +static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { +STAC_DIGITAL_INPUT_SOURCE (1 ), +STAC_INPUT_SOURCE (2 ), +STAC_VOLKNOB (0x28 ), + +/* hardware gain controls */ +HDA_CODEC_VOLUME ("Digital Mic 1 Volume" ,0x18 ,0 ,HDA_OUTPUT ), +HDA_CODEC_VOLUME ("Digital Mic 2 Volume" ,0x19 ,0 ,HDA_OUTPUT ), + +HDA_CODEC_VOLUME ("Capture Volume" ,0x1c ,0 ,HDA_OUTPUT ), +HDA_CODEC_MUTE ("Capture Switch" ,0x1c ,0 ,HDA_OUTPUT ), +HDA_CODEC_VOLUME ("Capture Mux Volume" ,0x1a ,0 ,HDA_OUTPUT ), { }/* end */ };
@@ -835,6 +891,27 @@ static struct snd_pci_quirk stac925x_cfgSND_PCI_QUIRK (0x107b ,0x0461 ,"Gateway NX560XL" ,STAC_MA6 ),SND_PCI_QUIRK (0x107b ,0x0681 ,"Gateway NX860" ,STAC_PA6 ), SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), + {} /* terminator */ +}; + +static unsigned int ref92hd71bxx_pin_configs[10 ] = { +0x02214030 ,0x02a19040 ,0x01a19020 ,0x01014010 , +0x0181302e ,0x01114010 ,0x01a19020 ,0x90a000f0 , +0x90a000f0 ,0x01452050 , +}; + +static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS ] = { + [STAC_92HD71BXX_REF ] = ref92hd71bxx_pin_configs, +}; + +static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS ] = { + [STAC_92HD71BXX_REF ] ="ref" , +}; + +static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { +/* SigmaTel reference board */ +SND_PCI_QUIRK (PCI_VENDOR_ID_INTEL ,0x2668 , +"DFI LanParty" ,STAC_92HD71BXX_REF ), {}/* terminator */ };
@@ -2615,6 +2692,77 @@ static int patch_stac925x(struct hda_codreturn 0 ; } +static int patch_stac92hd71bxx (struct hda_codec *codec) +{ +struct sigmatel_spec *spec; +int err =0 ; + + spec =kzalloc (sizeof (*spec),GFP_KERNEL ); +if (spec ==NULL ) +return -ENOMEM ; + + codec->spec = spec; + spec->num_pins =ARRAY_SIZE (stac92hd71bxx_pin_nids); + spec->pin_nids = stac92hd71bxx_pin_nids; + spec->board_config =snd_hda_check_board_config (codec, +STAC_92HD71BXX_MODELS , + stac92hd71bxx_models, + stac92hd71bxx_cfg_tbl); +again: +if (spec->board_config <0 ) { +snd_printdd (KERN_INFO "hda_codec: Unknown model for" +" STAC92HD71BXX, using BIOS defaults\n" ); + err =stac92xx_save_bios_config_regs (codec); +if (err <0 ) { +stac92xx_free (codec); +return err; + } + spec->pin_configs = spec->bios_pin_configs; + }else { + spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config]; +stac92xx_set_config_regs (codec); + } + + spec->gpio_mask = spec->gpio_data =0x00000001 ;/* GPIO0 High = EAPD */ +stac92xx_enable_gpio_mask (codec); + + spec->init = stac92hd71bxx_core_init; + spec->mixer = stac92hd71bxx_mixer; + + spec->mux_nids = stac92hd71bxx_mux_nids; + spec->adc_nids = stac92hd71bxx_adc_nids; + spec->dmic_nids = stac92hd71bxx_dmic_nids; + spec->dmux_nid =0x1c ; + + spec->num_muxes =ARRAY_SIZE (stac92hd71bxx_mux_nids); + spec->num_adcs =ARRAY_SIZE (stac92hd71bxx_adc_nids); + spec->num_dmics =STAC92HD71BXX_NUM_DMICS ; + + spec->multiout.num_dacs =2 ; + spec->multiout.hp_nid =0x11 ; + spec->multiout.dac_nids = stac92hd71bxx_dac_nids; + + err =stac92xx_parse_auto_config (codec,0x21 ,0x23 ); +if (!err) { +if (spec->board_config <0 ) { +printk (KERN_WARNING "hda_codec: No auto-config is " +"available, default to model=ref\n" ); + spec->board_config =STAC_92HD71BXX_REF ; + goto again; + } + err = -EINVAL ; + } + +if (err <0 ) { +stac92xx_free (codec); +return err; + } + + codec->patch_ops = stac92xx_patch_ops; + +return 0 ; +}; +static int patch_stac922x (struct hda_codec *codec) {struct sigmatel_spec *spec;
@@ -3183,5 +3331,6 @@ struct hda_codec_preset snd_hda_preset_s { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, + { .id = 0x111d76b0, .name = "92HD71BXX", .patch = patch_stac92hd71bxx }, {}/* terminator */ };
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Mon, 05 Nov 2007 12:10:44 -0500,
Quoted 5 lines · Matthew Ranostay
Hello Takashi,
Here is an updated and cleanup version of the last patch. Thanks for pointing out the cruft in the previous patch.
Thanks for the quick fix!
Now I applied your updated patch to HG tree.
Takashi