Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

native: force runtime-PM off from audio_init (after card is probed)

The init-script sysfs write fired too early — before the sound card
was probed, so the power/control node may not have existed. Move the
runtime-PM disable into audio_init after the mixer walk, using the
known card_idx to target the exact sysfs node. Also set
autosuspend_delay_ms=-1 as a belt-and-suspenders backstop.

G7 log showed partial improvement (amp stayed on 37s vs 23s before)
but still powered down at 50.96s — this should keep it permanently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+31
+31
fedac/native/src/audio.c
··· 2427 2427 audio->running = 1; 2428 2428 pthread_create(&audio->thread, NULL, audio_thread_fn, audio); 2429 2429 2430 + /* Force PCI runtime-PM to "on" for the sound card now that the 2431 + * driver is loaded and card_idx is known. The init-script attempt 2432 + * may fire before probe — doing it here guarantees the sysfs node 2433 + * exists. Without this the SOF DSP auto-suspends after ~20-40s 2434 + * of silence, which stops the SSP1 BE DAI and drops MAX98360A 2435 + * sdmode to 0 (speaker amp off), and the amp never comes back. 2436 + * Also try the generic PCI "power_save" disable for HDA paths. */ 2437 + { 2438 + char pm_path[128]; 2439 + snprintf(pm_path, sizeof(pm_path), 2440 + "/sys/class/sound/card%d/device/power/control", card_idx); 2441 + FILE *pm = fopen(pm_path, "w"); 2442 + if (pm) { 2443 + fputs("on", pm); 2444 + fclose(pm); 2445 + fprintf(stderr, "[audio] Disabled runtime-PM: %s\n", pm_path); 2446 + } else { 2447 + fprintf(stderr, "[audio] Could not set runtime-PM: %s\n", pm_path); 2448 + } 2449 + /* Also try the autosuspend delay — set to -1 (never) */ 2450 + snprintf(pm_path, sizeof(pm_path), 2451 + "/sys/class/sound/card%d/device/power/autosuspend_delay_ms", 2452 + card_idx); 2453 + pm = fopen(pm_path, "w"); 2454 + if (pm) { 2455 + fputs("-1", pm); 2456 + fclose(pm); 2457 + fprintf(stderr, "[audio] Set autosuspend_delay=-1: %s\n", pm_path); 2458 + } 2459 + } 2460 + 2430 2461 fprintf(stderr, "[audio] Ready\n"); 2431 2462 return audio; 2432 2463 }