AsahiLinux / linux

Linux kernel source tree
Other
2.36k stars 90 forks source link

No sound on J274! Bug + fix #331

Closed hnaz closed 1 month ago

hnaz commented 1 month ago

I'm not getting sound on my Mac Mini 2020 and the following splat in dmesg:

Sep 21 20:01:36 localhost kernel: sysfs: cannot create duplicate filename '/devices/platform/soc/235014000.i2c/i2c-1/1-0031/die_temp'
Sep 21 20:01:36 localhost kernel: CPU: 4 UID: 0 PID: 57 Comm: kworker/u34:0 Tainted: G S                 6.11.0-asahi-01021-g4c2c5cc1f0ae #3
Sep 21 20:01:36 localhost kernel: Tainted: [S]=CPU_OUT_OF_SPEC
Sep 21 20:01:36 localhost kernel: Hardware name: Apple Mac mini (M1, 2020) (DT)
Sep 21 20:01:36 localhost kernel: Workqueue: events_unbound deferred_probe_work_func
Sep 21 20:01:36 localhost kernel: Call trace:
Sep 21 20:01:36 localhost kernel:  dump_backtrace.part.0+0xd4/0xe0
Sep 21 20:01:36 localhost kernel:  show_stack+0x18/0x30
Sep 21 20:01:36 localhost kernel:  dump_stack_lvl+0x5c/0x7c
Sep 21 20:01:36 localhost kernel:  dump_stack+0x18/0x24
Sep 21 20:01:36 localhost kernel:  sysfs_warn_dup+0x7c/0x9c
Sep 21 20:01:36 localhost kernel:  sysfs_add_file_mode_ns+0x124/0x128
Sep 21 20:01:36 localhost kernel:  internal_create_group+0x260/0x420
Sep 21 20:01:36 localhost kernel:  internal_create_groups+0x50/0xd8
Sep 21 20:01:36 localhost kernel:  sysfs_create_groups+0x18/0x24
Sep 21 20:01:36 localhost kernel:  tas2770_codec_probe+0x130/0x1f8
Sep 21 20:01:36 localhost kernel:  snd_soc_component_probe+0x24/0x94
Sep 21 20:01:36 localhost kernel:  soc_probe_component+0x1a0/0x350
Sep 21 20:01:36 localhost kernel:  snd_soc_bind_card+0x3f4/0xbb8
Sep 21 20:01:36 localhost kernel:  snd_soc_register_card+0xf0/0x108
Sep 21 20:01:36 localhost kernel:  devm_snd_soc_register_card+0x4c/0xa4
Sep 21 20:01:36 localhost kernel:  macaudio_snd_platform_probe+0x338/0xc38
Sep 21 20:01:36 localhost kernel:  platform_probe+0x68/0xd8
Sep 21 20:01:36 localhost kernel:  really_probe+0xbc/0x2c0
Sep 21 20:01:36 localhost kernel:  __driver_probe_device+0x78/0x120
Sep 21 20:01:36 localhost kernel:  driver_probe_device+0x3c/0x160
Sep 21 20:01:36 localhost kernel:  __device_attach_driver+0xb8/0x140
Sep 21 20:01:36 localhost kernel:  bus_for_each_drv+0x70/0xbc
Sep 21 20:01:36 localhost kernel:  __device_attach+0xa0/0x184
Sep 21 20:01:36 localhost kernel:  device_initial_probe+0x14/0x20
Sep 21 20:01:36 localhost kernel:  bus_probe_device+0xac/0xb8
Sep 21 20:01:36 localhost kernel:  deferred_probe_work_func+0x90/0xc8
Sep 21 20:01:36 localhost kernel:  process_one_work+0x148/0x2a0
Sep 21 20:01:36 localhost kernel:  worker_thread+0x2bc/0x3d8
Sep 21 20:01:36 localhost kernel:  kthread+0x10c/0x110
Sep 21 20:01:36 localhost kernel:  ret_from_fork+0x10/0x20
Sep 21 20:01:36 localhost kernel: tas2770 1-0031: ASoC: error at snd_soc_component_probe on tas2770.1-0031: -17
Sep 21 20:01:36 localhost kernel: snd-soc-macaudio sound: ASoC: failed to instantiate card -17
Sep 21 20:01:36 localhost kernel: snd-soc-macaudio sound: probe with driver snd-soc-macaudio failed with error -17

There appear to be two probes of the macaudio driver, where the first one fails and defers. A few lines up:

Sep 21 20:01:36 localhost kernel: snd-soc-macaudio sound: ASoC: can't create pcm Primary :-517

-517 is -EPROBE_DEFER (I think it's from mca_pcm_new()).

This doesn't seem to be a problem in itself. Unfortunately, tas2770_codec_remove() doesn't clean up the sysfs files it creates in its probe(). The secondary probe then fails when it tries to create them again.

With the below patch applied, the driver works and I get sound:

diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c
index eb4be94c6ffc..acc86b8dd907 100644
--- a/sound/soc/codecs/tas2770.c
+++ b/sound/soc/codecs/tas2770.c
@@ -657,6 +657,7 @@ static void tas2770_codec_remove(struct snd_soc_component *component)
        struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);

        regulator_disable(tas2770->sdz_reg);
+       sysfs_remove_groups(&component->dev->kobj, tas2770_sysfs_groups);
 }

 static DECLARE_TLV_DB_SCALE(tas2770_digital_tlv, 1100, 50, 0);
jannau commented 1 month ago

thanks, I pulled this manually in and is now in bits/070-audio and in the latest tag asahi-6.11.2-1