Simple Temporary Fix for No Sound on HP All-In-One PCs

Audio Related In-House Builds and Pojects
Post Reply
admin
Site Admin
Posts: 205
Joined: 26 Dec 2023 13:05

Simple Temporary Fix for No Sound on HP All-In-One PCs

Post by admin »

Here is a Simple userland Temporary Fix for No Sound on HP All-In-One (AIO) PCs.

#Pavilion #Hewlett Packard #27-inch #24-inch #Intel #Core i7 #Core i5 #23.8-inch #Bang & Olufsen #B&O


BandO.png
BandO.png (8.7 KiB) Viewed 458 times

This is a *Temporary* fix.

NOTES:
  • No kernel update or mods to system files needed. This is the "For Dummies" fix.
  • This is only needed for the internal Bang and Olufsen Speakers. Headphones, Gaming Headsets, USB Sound Cards, etc. work fine without this fix.
  • This is needed because these HP All-In-Ones really do contain Custom Designed Signal Processing Hardware and Amplifier. Because this hardware is unique, Linux does not know to turn it on. I don't consider this to be a fair example of Linux not supporting Standard PC Hardware.
  • The B&O Sound System really does sound better than any other Internal PC Speakers I have ever heard.
  • Even with the above said, work is being done to support this unique hardware. Reference:
    https://bugzilla.kernel.org/show_bug.cgi?id=216139,
    Which is the source of this "How-To".
  • This fix does not currently survive a Reboot or a Suspend/Wake cycle. The script must be run every time you want to hear something from the internal speakers.
  • Root access needed -- Every time.
  • This assumes a standard, recent Ubuntu.
  • Tested on an HP Pavilion All-in-One Desktop 27-ca1xxx 27 inch Core i7 12th Gen PC running Ubuntu 22.04.
EASY STEPS:

DO ONCE:

Open a terminal from the 9-Dots menu, or by press Alt-F2 (You may have to press Alt-Fn-F2 on a compact keyboard) and typing: Terminal).

Install Alsa-Tools. This is a normal utility from the Ubuntu Repositories. Installing it requires root, but it's about as safe as it gets:

Code: Select all

sudo apt update
sudo apt install alsa-tools
Create a Batch file using the following steps:

Code: Select all

touch snd_fix.bat
gedit snd_fix.bat
Paste the following into the Gedit window that appears:

Code: Select all

#!/usr/bin/bash

# Check if the script is being run as root
  if [ "$EUID" -ne 0 ]; then
    echo "Elevating privileges..."
    exec sudo "$0" "$@"
  fi
  
  hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIRECTION 0x0f
  hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x0f
  hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 4.

  hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x26
  hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x5757
  hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x10
  hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0xc580
  hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x0b
  hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x7778
  hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x6b
  hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x0060

Save the file in your home directory by hitting "Save" at the top of the window.

Back in the Terminal Window, do the following to allow the file to be executed as a script:

Code: Select all

chmod +x snd_fix.bat
(Of course you can name the file anything you want)



DO EVERY TIME:

Do the following after Sleep (Suspend), or Powering off/on the Computer. You do not need to repeat this for every song, or every app that plays sound:

Code: Select all

snd_fix.bat
(Since we are asking this to be run as root, you will be prompted for your password.)

UPDATE: Code has been updated so that it will prompt for an administrator password if run as a regular user.

Only this simple one-line command needs to be run each time.

You should be able to hear sound from the internal speakers if you play a sound file, YouTube, etc.
Post Reply