* [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson. [not found] <1340088624-25550-1-git-send-email-chenhc@lemote.com> @ 2012-06-19 6:50 ` Huacai Chen 2012-06-19 9:09 ` Clemens Ladisch 2012-06-19 9:26 ` [alsa-devel] " Takashi Iwai 0 siblings, 2 replies; 4+ messages in thread From: Huacai Chen @ 2012-06-19 6:50 UTC (permalink / raw) To: Ralf Baechle Cc: linux-mips, alsa-devel, Zhangjin Wu, Hua Yan, Fuxin Zhang, Hongliang Tao, Huacai Chen Lemote A1004(Laptop) and A1205(All-In-One) use Conexant's hda codec, this patch make it usable: 1, Use 32-bit DMA as a workaround (Loongson has a hardware bug that it doesn't support DMA address above 4GB). 2, Modify patch_conexant.c to add Lemote specific code. Signed-off-by: Huacai Chen <chenhc@lemote.com> Signed-off-by: Hongliang Tao <taohl@lemote.com> Signed-off-by: Hua Yan <yanh@lemote.com> Cc: alsa-devel@alsa-project.org --- include/linux/pci_ids.h | 2 + sound/pci/hda/hda_intel.c | 5 ++++ sound/pci/hda/patch_conexant.c | 52 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index ab741b0..d8b0a52 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2906,3 +2906,5 @@ #define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 #define PCI_VENDOR_ID_OCZ 0x1b85 + +#define PCI_VENDOR_ID_LEMOTE 0x1c06 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 2b6392b..2b73ed4 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -3013,6 +3013,11 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip) gcap &= ~ICH6_GCAP_64OK; } +#ifdef CONFIG_CPU_LOONGSON3 + /* Workaround: Loongson 3 doesn't support 64-bit DMA */ + gcap &= ~ICH6_GCAP_64OK; +#endif + /* disable buffer size rounding to 128-byte multiples if supported */ if (align_buffer_size >= 0) chip->align_buffer_size = !!align_buffer_size; diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 3acb582..1c8dfb9 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -142,6 +142,7 @@ struct conexant_spec { unsigned int thinkpad:1; unsigned int hp_laptop:1; unsigned int asus:1; + unsigned int lemote:1; unsigned int pin_eapd_ctrls:1; unsigned int fixup_stereo_dmic:1; @@ -2278,7 +2279,7 @@ static void cxt5066_automic(struct hda_codec *codec) cxt5066_thinkpad_automic(codec); else if (spec->hp_laptop) cxt5066_hp_laptop_automic(codec); - else if (spec->asus) + else if (spec->asus || spec->lemote) cxt5066_asus_automic(codec); } @@ -2911,6 +2912,32 @@ static const struct hda_verb cxt5066_init_verbs_hp_laptop[] = { { } /* end */ }; +static struct hda_verb cxt5066_init_verbs_lemote[] = { + {0x14, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1: Connection index: 0 */ + {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, + {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, + + /* DAC2: unused */ + {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + + /* ADC2, ADC3: unused */ + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, + {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, + + /* Disable digital microphone port */ + {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + + /* Disable SPDIF */ + {0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, + { } /* end */ +}; + /* initialize jack-sensing, too */ static int cxt5066_init(struct hda_codec *codec) { @@ -2948,6 +2975,8 @@ enum { CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */ CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */ CXT5066_HP_LAPTOP, /* HP Laptop */ + CXT5066_LEMOTE_A1004, /* Lemote Laptop A1004 */ + CXT5066_LEMOTE_A1205, /* Lemote All-In-One A1205 */ CXT5066_AUTO, /* BIOS auto-parser */ CXT5066_MODELS }; @@ -2961,6 +2990,8 @@ static const char * const cxt5066_models[CXT5066_MODELS] = { [CXT5066_THINKPAD] = "thinkpad", [CXT5066_ASUS] = "asus", [CXT5066_HP_LAPTOP] = "hp-laptop", + [CXT5066_LEMOTE_A1004] = "lemote-laptop-a1004", + [CXT5066_LEMOTE_A1205] = "lemote-aio-a1205", [CXT5066_AUTO] = "auto", }; @@ -2993,6 +3024,8 @@ static const struct snd_pci_quirk cxt5066_cfg_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo U350", CXT5066_ASUS), SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), SND_PCI_QUIRK(0x17aa, 0x3938, "Lenovo G565", CXT5066_AUTO), + SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT5066_LEMOTE_A1004), + SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT5066_LEMOTE_A1205), SND_PCI_QUIRK(0x1b0a, 0x2092, "CyberpowerPC Gamer Xplorer N57001", CXT5066_AUTO), {} }; @@ -3073,7 +3106,22 @@ static int patch_cxt5066(struct hda_codec *codec) spec->port_d_mode = 0; spec->mic_boost = 3; /* default 30dB gain */ break; - + case CXT5066_LEMOTE_A1004: + case CXT5066_LEMOTE_A1205: + codec->patch_ops.init = cxt5066_init; + codec->patch_ops.unsol_event = cxt5066_unsol_event; + spec->init_verbs[spec->num_init_verbs] = + cxt5066_init_verbs_lemote; + spec->num_init_verbs++; + spec->lemote = 1; + spec->mixers[spec->num_mixers++] = cxt5066_mixer_master; + spec->mixers[spec->num_mixers++] = cxt5066_mixers; + /* no S/PDIF out */ + /* input source automatically selected */ + spec->input_mux = NULL; + spec->port_d_mode = 0; + spec->mic_boost = 3; /* default 30dB gain */ + break; case CXT5066_OLPC_XO_1_5: codec->patch_ops.init = cxt5066_olpc_init; codec->patch_ops.unsol_event = cxt5066_olpc_unsol_event; -- 1.7.7.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson. 2012-06-19 6:50 ` [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson Huacai Chen @ 2012-06-19 9:09 ` Clemens Ladisch 2012-06-19 9:26 ` [alsa-devel] " Takashi Iwai 1 sibling, 0 replies; 4+ messages in thread From: Clemens Ladisch @ 2012-06-19 9:09 UTC (permalink / raw) To: Huacai Chen Cc: linux-mips, alsa-devel, Zhangjin Wu, Hua Yan, Ralf Baechle, Fuxin Zhang, Huacai Chen, Hongliang Tao Huacai Chen wrote: > 1, Use 32-bit DMA as a workaround (Loongson has a hardware bug that it > doesn't support DMA address above 4GB). > 2, Modify patch_conexant.c to add Lemote specific code. Please create separate patches for these two changes. > +++ b/include/linux/pci_ids.h > @@ -2906,3 +2906,5 @@ > #define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 > > #define PCI_VENDOR_ID_OCZ 0x1b85 > + > +#define PCI_VENDOR_ID_LEMOTE 0x1c06 AFAICS this symbol is not used in this patch. > +#ifdef CONFIG_CPU_LOONGSON3 > + /* Workaround: Loongson 3 doesn't support 64-bit DMA */ > + gcap &= ~ICH6_GCAP_64OK; > +#endif /* Workaround: Loongson 3 doesn't actually support 64-bit DMA */ Regards, Clemens ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [alsa-devel] [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson. 2012-06-19 6:50 ` [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson Huacai Chen 2012-06-19 9:09 ` Clemens Ladisch @ 2012-06-19 9:26 ` Takashi Iwai 2012-06-19 10:47 ` Huacai Chen 1 sibling, 1 reply; 4+ messages in thread From: Takashi Iwai @ 2012-06-19 9:26 UTC (permalink / raw) To: Huacai Chen Cc: Ralf Baechle, linux-mips, alsa-devel, Zhangjin Wu, Hua Yan, Fuxin Zhang, Hongliang Tao, Huacai Chen At Tue, 19 Jun 2012 14:50:21 +0800, Huacai Chen wrote: > > Lemote A1004(Laptop) and A1205(All-In-One) use Conexant's hda codec, > this patch make it usable: > 1, Use 32-bit DMA as a workaround (Loongson has a hardware bug that it > doesn't support DMA address above 4GB). > 2, Modify patch_conexant.c to add Lemote specific code. > > Signed-off-by: Huacai Chen <chenhc@lemote.com> > Signed-off-by: Hongliang Tao <taohl@lemote.com> > Signed-off-by: Hua Yan <yanh@lemote.com> > Cc: alsa-devel@alsa-project.org > --- > include/linux/pci_ids.h | 2 + > sound/pci/hda/hda_intel.c | 5 ++++ > sound/pci/hda/patch_conexant.c | 52 ++++++++++++++++++++++++++++++++++++++- > 3 files changed, 57 insertions(+), 2 deletions(-) > > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h > index ab741b0..d8b0a52 100644 > --- a/include/linux/pci_ids.h > +++ b/include/linux/pci_ids.h > @@ -2906,3 +2906,5 @@ > #define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 > > #define PCI_VENDOR_ID_OCZ 0x1b85 > + > +#define PCI_VENDOR_ID_LEMOTE 0x1c06 As Clemens already suggested, please split your patch. The addition of PCI ID, addition of the workaround in HD-audio controller code, and the modification to Conexant codec code are all different things. > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index 2b6392b..2b73ed4 100644 > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -3013,6 +3013,11 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip) > gcap &= ~ICH6_GCAP_64OK; > } > > +#ifdef CONFIG_CPU_LOONGSON3 > + /* Workaround: Loongson 3 doesn't support 64-bit DMA */ > + gcap &= ~ICH6_GCAP_64OK; > +#endif Where is CONFIG_CPU_LOONGSON3 defined at all? This isn't found in the upstream Linus or linux-next tree. > diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c > index 3acb582..1c8dfb9 100644 > --- a/sound/pci/hda/patch_conexant.c > +++ b/sound/pci/hda/patch_conexant.c > @@ -142,6 +142,7 @@ struct conexant_spec { > unsigned int thinkpad:1; > unsigned int hp_laptop:1; > unsigned int asus:1; > + unsigned int lemote:1; In general, we don't accept such a static quirk any longer unless a special reason is given. Doesn't the auto-parser work for you? thanks, Takashi ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson. 2012-06-19 9:26 ` [alsa-devel] " Takashi Iwai @ 2012-06-19 10:47 ` Huacai Chen 0 siblings, 0 replies; 4+ messages in thread From: Huacai Chen @ 2012-06-19 10:47 UTC (permalink / raw) To: Takashi Iwai Cc: linux-mips, alsa-devel, Zhangjin Wu, Hua Yan, Ralf Baechle, Fuxin Zhang, Huacai Chen, Hongliang Tao Thanks, I'll improve the patch. On Tue, Jun 19, 2012 at 5:26 PM, Takashi Iwai <tiwai@suse.de> wrote: > At Tue, 19 Jun 2012 14:50:21 +0800, > Huacai Chen wrote: >> >> Lemote A1004(Laptop) and A1205(All-In-One) use Conexant's hda codec, >> this patch make it usable: >> 1, Use 32-bit DMA as a workaround (Loongson has a hardware bug that it >> doesn't support DMA address above 4GB). >> 2, Modify patch_conexant.c to add Lemote specific code. >> >> Signed-off-by: Huacai Chen <chenhc@lemote.com> >> Signed-off-by: Hongliang Tao <taohl@lemote.com> >> Signed-off-by: Hua Yan <yanh@lemote.com> >> Cc: alsa-devel@alsa-project.org >> --- >> include/linux/pci_ids.h | 2 + >> sound/pci/hda/hda_intel.c | 5 ++++ >> sound/pci/hda/patch_conexant.c | 52 ++++++++++++++++++++++++++++++++++++++- >> 3 files changed, 57 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h >> index ab741b0..d8b0a52 100644 >> --- a/include/linux/pci_ids.h >> +++ b/include/linux/pci_ids.h >> @@ -2906,3 +2906,5 @@ >> #define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 >> >> #define PCI_VENDOR_ID_OCZ 0x1b85 >> + >> +#define PCI_VENDOR_ID_LEMOTE 0x1c06 > > As Clemens already suggested, please split your patch. The addition > of PCI ID, addition of the workaround in HD-audio controller code, and > the modification to Conexant codec code are all different things. > > >> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c >> index 2b6392b..2b73ed4 100644 >> --- a/sound/pci/hda/hda_intel.c >> +++ b/sound/pci/hda/hda_intel.c >> @@ -3013,6 +3013,11 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip) >> gcap &= ~ICH6_GCAP_64OK; >> } >> >> +#ifdef CONFIG_CPU_LOONGSON3 >> + /* Workaround: Loongson 3 doesn't support 64-bit DMA */ >> + gcap &= ~ICH6_GCAP_64OK; >> +#endif > > Where is CONFIG_CPU_LOONGSON3 defined at all? > This isn't found in the upstream Linus or linux-next tree. > > >> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c >> index 3acb582..1c8dfb9 100644 >> --- a/sound/pci/hda/patch_conexant.c >> +++ b/sound/pci/hda/patch_conexant.c >> @@ -142,6 +142,7 @@ struct conexant_spec { >> unsigned int thinkpad:1; >> unsigned int hp_laptop:1; >> unsigned int asus:1; >> + unsigned int lemote:1; > > In general, we don't accept such a static quirk any longer unless a > special reason is given. Doesn't the auto-parser work for you? > > > thanks, > > Takashi ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-19 10:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1340088624-25550-1-git-send-email-chenhc@lemote.com>
2012-06-19 6:50 ` [PATCH V2 13/16] ALSA: HDA: Make hda sound card usable for Loongson Huacai Chen
2012-06-19 9:09 ` Clemens Ladisch
2012-06-19 9:26 ` [alsa-devel] " Takashi Iwai
2012-06-19 10:47 ` Huacai Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox