EMLommers / Apollolake_Audio

Linux Audio fix + sleep/resume Apollolake Chromebook
9 stars 5 forks source link

New approach still draft, use on your own responsibility
New appoach1, to get audio working without / with SOF / get DA7219 working:

  1. Extract Device-tree from kernel firmware / kernel ChromeOS, and or overlays. (dts,Dtb,dtbo)
  2. Extract ACPI from chromeOS
  3. check and verify (flat) Device-tree
  4. make sure regulator reg_audio: is included.
  5. build kernel with dtb, and if needed dtbo overlay, and ACPI

New appoach2, to get audio working without / with SOF / get DA7219 working:

See files in directory: kernel
Modified based on kernel 5.15.0

Obsolete:

  1. Add to include/sound/da7219.h :
    u32 vddio;
    u32 vdd;
    u32 vddmic;

  2. add to acpi dlg,vddio and value 1800 , dlg,vdd value 1800 and dlg,vddmic 3300

  3. sound/soc/codecs/da719.c read ACPI and write to according u32.

+ if (device_property_read_u32(dev, "dlg,vdd", &of_val32) >= 0) + pdata->vdd = of_val32; +

  • if (device_property_read_u32(dev, "dlg,vddio", &of_val32) >= 0)

  • pdata->vddio = of_val32;

  • if (device_property_read_u32(dev, "dlg,vddmic", &of_val32) >= 0)

  • pdata->vddmic = of_val32;

  • ret = regulator_get_voltage(vddio);

  • / If regulator_get_voltage() fails, try to use vddio from pdata. /

  • if (ret < 0 && da7219->pdata)

  • ret = da7219->pdata->vddio;

    ret = regulator_get_voltage(vdd);

  • / If regulator_get_voltage() fails, try to use vdd from pdata. /

  • if (ret < 0 && da7219->pdata)

  • ret = da7219->pdata->vdd;

    ret = regulator_get_voltage(vddmic); / If regulator_get_voltage() fails, try to use vddio from pdata. /

  • if (ret < 0 && da7219->pdata)

  • ret = da7219->pdata->vddmic;

  • dev_warn(component->dev, "Invalid VDDIO voltage: %d mV\n",

  • ret);

  • / Handle DT/ACPI/Platform data /

  • da7219->pdata = dev_get_platdata(component->dev);

    • if (!da7219->pdata)
    • da7219->pdata = da7219_fw_to_pdata(component);

Or use Device tree and ACPI together.. Works guaranteed!! Thanks See kernel directory and copy to your distro and build, acpi for da7219 included. Still draft (not completely tested yet)
Maybe I gave you some ideas

Chromebook Coral rev5 (Apollolake / Broxton) Audio fix v4
There is now an offical SOF topology file for the APL platform with da7219, made by the SOF Team
delete original sof-apl-da7219.tplg extract the file: sof-apl-da7219.tplg.gz
make apollolake_audio2.sh executable Run the apollolake_audio2.sh
If audio problems still persist, manually copy the options from the sh file into /etc/modprobe.d/inteldsp.conf

Chromebook Coral rev5 (Apollolake / Broxton) Audio fix v3
sudo cp /lib/firmware/intel/sof-tplg/sof-glk-da7219.tplg /lib/firmware/intel/sof-tplg/sof-apl-da7219.tplg
sudo sed -i 's/ssp1/ssp5/g' /lib/firmware/intel/sof-tplg/sof-apl-da7219.tplg
sudo sed -i 's/SSP1/SSP5/g' /lib/firmware/intel/sof-tplg/sof-apl-da7219.tplg
sudo sed -i 's/ssp2/ssp1/g' /lib/firmware/intel/sof-tplg/sof-apl-da7219.tplg
sudo sed -i 's/SSP2/SSP1/g' /lib/firmware/intel/sof-tplg/sof-apl-da7219.tplg
reboot

Chromebook Coral rev5 (Apollolake / Broxton) Audio fix v2
Copy only the new tplg file to /lib/firmware/intel/sof-tplg
Kernel parameter: snd_intel_dspcfg.dsp_driver=3

Or... just run: apollolake_audio2.sh


That's it

Rest is obsolete

Chromebook Coral rev5 (Apollolake / Broxton) Audio fix / TPM / Sleep & Resume

AUDIO APOLLOLAKE / BROXTON /SKYLAKE FIX + SLEEP/RESUME (TPM)


Install MrChromeBox RW/Legacy firmware
Developer mode + ctrl -d
sudo crossystem "dev_boot_usb"=1 "dev_boot_altfw"=1 "dev_boot_signed"=0

Can be installed on internal with GBB FLAGS , FORCE_DEV_MODE, FORCE_DEV_ALTFW, SHORT_WAIT
sudo sh /usr/share/vboot/bin/set_gbb_flags.sh 0xd
reduce google screen start: sudo crossystem "loc_idx"=100

Linux kernel 5.13 Audio fix Apollo Lake Chromebooks
Kernel 5.13.0-19-generic (Fresh install Ubuntu 21.10 impish)
Double checked , altered some typos

Sources + Partner + Partner sources repositories should be enabled.
After install it should mention Headphones - Celeron N3350 / Pentium N4..
Sound is via speakers


Suspend Resume also working
TODO:
-Alsa UCM -> profile jack / speaker



output $ aplay -l

  **** List of PLAYBACK Hardware Devices ****
card 0: sofbxtda7219max [sof-bxtda7219max], device 0: Speakers (*) []
   Subdevices: 0/1
   Subdevice #0: subdevice #0
card 0: sofbxtda7219max [sof-bxtda7219max], device 1: Headset (*) []
   Subdevices: 1/1
   Subdevice #0: subdevice #0
card 0: sofbxtda7219max [sof-bxtda7219max], device 5: HDMI1 (*) []
   Subdevices: 1/1
   Subdevice #0: subdevice #0
card 0: sofbxtda7219max [sof-bxtda7219max], device 6: HDMI2 (*) []
   Subdevices: 1/1
   Subdevice #0: subdevice #0
card 0: sofbxtda7219max [sof-bxtda7219max], device 7: HDMI3 (*) []
   Subdevices: 1/1
   Subdevice #0: subdevice #0