Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH V4] Initialize the gain and boost values of the ADC in the SN6180 chip to achieve a better recording experience.
@ 2025-03-25  6:09 bo liu
  2025-03-25 10:54 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: bo liu @ 2025-03-25  6:09 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-sound, bo liu

Signed-off-by: bo liu <bo.liu@senarytech.com>
---
 sound/pci/hda/patch_conexant.c | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 34874039ad45..7017db4a0fee 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -185,6 +185,40 @@ static void cx_fixup_headset_recog(struct hda_codec *codec)
 		snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20);
 }
 
+static void cxt_setup_capture_default_boost_gain(struct hda_codec *codec)
+{
+	struct conexant_spec *spec = codec->spec;
+	struct hda_gen_spec *gen = &(spec->gen);
+	hda_nid_t adc_id = 0, nid = 0;
+	int nids;
+	size_t i = 0;
+
+	for (i = 0; i < gen->num_all_adcs; i++) {
+		int index;
+
+		adc_id = gen->all_adcs[i];
+
+		index = snd_hda_codec_read(codec, adc_id, 0, AC_VERB_GET_CONNECT_SEL, 0);
+		nids = snd_hda_codec_read(codec, adc_id, 0, AC_VERB_GET_CONNECT_LIST, 0);
+		nid = ((nids & (0xFF << (8*index))) >> (8*index));
+
+		if (nid < codec->core.start_nid || nid > codec->core.end_nid) {
+			codec_err(codec, "Error, invalid nid 0x%02x.\n", nid);
+			continue;
+		}
+
+		snd_hda_codec_write(codec, adc_id, 0, (0x370|(index&0xF)), 0x4A);
+		snd_hda_codec_write(codec, nid, 0, 0x370, 0x2);
+		codec_dbg(codec, "ADC 0x%02x, nid=0x%02x are set. Boost=2, gain=0x4A.\n",
+			adc_id, nid);
+	}
+}
+
+static void cxt_init_capture_boost_gain(struct hda_codec *codec)
+{
+	cxt_setup_capture_default_boost_gain(codec);
+}
+
 static int cx_auto_init(struct hda_codec *codec)
 {
 	struct conexant_spec *spec = codec->spec;
@@ -198,6 +232,9 @@ static int cx_auto_init(struct hda_codec *codec)
 	if (spec->is_cx8070_sn6140)
 		cx_fixup_headset_recog(codec);
 
+	if (codec->core.vendor_id == 0x14f120d1) //SN6180
+		cxt_init_capture_boost_gain(codec);
+
 	return 0;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-25 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25  6:09 [PATCH V4] Initialize the gain and boost values of the ADC in the SN6180 chip to achieve a better recording experience bo liu
2025-03-25 10:54 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox