Skip to contentSkip to conversation

ALSA: hda/senarytech: add senarytech codec support

PATCH Superseded bo liu 2 participants 2 messages Jun 3, 2024 – Jun 5, 2024 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

bo liu

author
#0 lore raw

PATCH 1/1 ALSA: hda/senarytech: add senarytech codec support

Add initial Senarytech codec support for SN6180. Note that this hda patch relies on the configuration default registers to be set correctly (normally by BIOS/firmware) in order for it to set up pin widgets properly.

---
 MAINTAINERS                      |   6 +
 sound/hda/hdac_device.c          |   1 +
 sound/pci/hda/Kconfig            |  11 ++
 sound/pci/hda/Makefile           |   2 +
 sound/pci/hda/patch_senarytech.c | 263 +++++++++++++++++++++++++++++++
 5 files changed, 283 insertions(+)
 create mode 100644 sound/pci/hda/patch_senarytech.c
MAINTAINERS +6 -0
index a6a011792167..82ea8c8f74c1 100644
@@ -24949,6 +24949,12 @@ F:	mm/zpool.c
 F:	mm/zswap.c
 F:	tools/testing/selftests/cgroup/test_zswap.c
 
+SENARYTECH AUDIO CODEC DRIVER
+M:	bo liu <[email protected]>
+S:	Maintained
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
+F:	sound/pci/hda/patch_senarytech.c
+
 THE REST
 M:	Linus Torvalds <[email protected]>
 L:	[email protected]
sound/hda/hdac_device.c +1 -0
index 068c16e52dff..3fbb9793dcfc 100644
@@ -665,6 +665,7 @@ static const struct hda_vendor_id hda_vendor_ids[] = {
 	{ 0x19e5, "Huawei" },
 	{ 0x1aec, "Wolfson Microelectronics" },
 	{ 0x1af4, "QEMU" },
+	{ 0x1fa8, "Senarytech" },
 	{ 0x434d, "C-Media" },
 	{ 0x8086, "Intel" },
 	{ 0x8384, "SigmaTel" },
sound/pci/hda/Kconfig +11 -0
index 0da625533afc..1252632f0ffa 100644
@@ -292,6 +292,17 @@ config SND_HDA_CODEC_CONEXANT
 comment "Set to Y if you want auto-loading the codec driver"
 	depends on SND_HDA=y && SND_HDA_CODEC_CONEXANT=m
 
+config SND_HDA_CODEC_SENARYTECH
+	tristate "Build Senarytech HD-audio codec support"
+	select SND_HDA_GENERIC
+	select SND_HDA_GENERIC_LEDS
+	help
+	  Say Y or M here to include Senarytech HD-audio codec support in
+	  snd-hda-intel driver, such as SN6186.
+
+comment "Set to Y if you want auto-loading the codec driver"
+	depends on SND_HDA=y && SND_HDA_CODEC_SENARYTECH=m
+
 config SND_HDA_CODEC_CA0110
 	tristate "Build Creative CA0110-IBG codec support"
 	select SND_HDA_GENERIC
sound/pci/hda/Makefile +2 -0
index 058ca0a289e4..7ac2105c2e00 100644
@@ -24,6 +24,7 @@ snd-hda-codec-cs8409-y :=	patch_cs8409.o patch_cs8409-tables.o
 snd-hda-codec-ca0110-y :=	patch_ca0110.o
 snd-hda-codec-ca0132-y :=	patch_ca0132.o
 snd-hda-codec-conexant-y :=	patch_conexant.o
+snd-hda-codec-senarytech-objs :=patch_senarytech.o
 snd-hda-codec-via-y :=		patch_via.o
 snd-hda-codec-hdmi-y :=		patch_hdmi.o hda_eld.o
 
@@ -55,6 +56,7 @@ obj-$(CONFIG_SND_HDA_CODEC_CS8409) += snd-hda-codec-cs8409.o
 obj-$(CONFIG_SND_HDA_CODEC_CA0110) += snd-hda-codec-ca0110.o
 obj-$(CONFIG_SND_HDA_CODEC_CA0132) += snd-hda-codec-ca0132.o
 obj-$(CONFIG_SND_HDA_CODEC_CONEXANT) += snd-hda-codec-conexant.o
+obj-$(CONFIG_SND_HDA_CODEC_SENARYTECH) += snd-hda-codec-senarytech.o
 obj-$(CONFIG_SND_HDA_CODEC_VIA) += snd-hda-codec-via.o
 obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
 
sound/pci/hda/patch_senarytech.c new file +263 -0

263 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
kernel test robot noticed the following build errors:

Hi bo,

kernel test robot noticed the following build errors:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus linus/master v6.10-rc2 next-20240605] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/bo-liu/ALSA-hda-senarytech-add-senarytech-codec-support/20240603-181658
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20240603093429.25511-1-bo.liu%40senarytech.com
patch subject: [PATCH] ALSA: hda/senarytech: add senarytech codec support
config: sparc64-randconfig-r081-20240605 (https://download.01.org/0day-ci/archive/20240605/[email protected]/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240605/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

sound/pci/hda/patch_senarytech.c: In function 'patch_senary_auto':

>> sound/pci/hda/patch_senarytech.c:219:43: error: macro "senary_auto_parse_beep" passed 1 arguments, but takes just 0
     219 |         err = senary_auto_parse_beep(codec);
         |                                           ^
   sound/pci/hda/patch_senarytech.c:76: note: macro "senary_auto_parse_beep" defined here
      76 | #define senary_auto_parse_beep()        0
         | 
>> sound/pci/hda/patch_senarytech.c:219:15: error: 'senary_auto_parse_beep' undeclared (first use in this function); did you mean 'senary_auto_parse_eapd'?
     219 |         err = senary_auto_parse_beep(codec);
         |               ^~~~~~~~~~~~~~~~~~~~~~
         |               senary_auto_parse_eapd

sound/pci/hda/patch_senarytech.c:219:15: note: each undeclared identifier is reported only once for each function it appears in

vim +/senary_auto_parse_beep +219 sound/pci/hda/patch_senarytech.c

191
192 static int patch_senary_auto(struct hda_codec *codec)
193 {
194 struct senary_spec *spec;
195 int err;
196
197 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
198
199 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
200 if (!spec)
201 return -ENOMEM;
202 snd_hda_gen_spec_init(&spec->gen);
203 codec->spec = spec;
204 codec->patch_ops = senary_auto_patch_ops;
205
206 senary_auto_parse_eapd(codec);
207 spec->gen.own_eapd_ctl = 1;
208
209 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
210 spec->gen.vmaster_mute.hook = senary_auto_vmaster_hook;
211
212 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
213
214 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
215 spec->parse_flags);
216 if (err < 0)
217 goto error;
218

 > 219		err = senary_auto_parse_beep(codec);

220 if (err < 0)
221 goto error;
222
223 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
224 if (err < 0)
225 goto error;
226
227 /* Some laptops with Senary chips show stalls in S3 resume,
228 * which falls into the single-cmd mode.
229 * Better to make reset, then.
230 */
231 if (!codec->bus->core.sync_write) {
232 codec_info(codec,
233 "Enable sync_write for stable communication\n");
234 codec->bus->core.sync_write = 1;
235 codec->bus->allow_bus_reset = 1;
236 }
237
238 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
239
240 return 0;
241
242 error:
243 senary_auto_free(codec);
244 return err;
245 }
246

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki