Skip to content

Instantly share code, notes, and snippets.

@finnbainbridge
Created January 3, 2026 18:41
Show Gist options
  • Select an option

  • Save finnbainbridge/7e8c260a53f30fa669bc7bef0518a68c to your computer and use it in GitHub Desktop.

Select an option

Save finnbainbridge/7e8c260a53f30fa669bc7bef0518a68c to your computer and use it in GitHub Desktop.
How to fix ASUS Vivobook 16 Flip (TP3607) speakers not working on Linux (TAS2781 not working)

How to fix speakers on ASUS Vivobook 16 Flip (TP3607) on Linux (TAS2781 chip not working)

Note: This guide is based on this gist by rraks. I did not discover how to do this, all credit goes to them!

The speakers on some ASUS laptops, like the ASUS Vivobook 16 Flip, do not work out of the box on current versions of Linux. But, it is possible to fix them using some magic scripts.

This guide will show you the scripts needed to make the speakers work, and how to control their volume and integrate volume control with GNOME.

This guide has only been tested on Fedora 43 (as it's what I use). Your mileage may vary.

Also checkout my guide on how to get tablet mode working properly on the ASUS Vivobook 16 Flip here!

Background

The ASUS Vivobook 16 Flip TP3607SA uses Texas Instruments TAS2781 amplifiers for its speakers. The kernel driver fails to initialize these amplifiers properly, so we need to manually configure them via I2C and create a volume control service.

Prerequisites

Install required packages:

sudo dnf install i2c-tools alsa-utils

Load the i2c-dev module:

sudo modprobe i2c-dev

Step 1: Create the Speaker Initialization Script

This script initializes the TAS2781 amplifiers and must run at boot.

sudo nano /usr/local/bin/tas2781-init.sh

Paste the following:

#!/bin/bash

export TERM=linux
# Some distros don't have i2c-dev module loaded by default, so we load it manually

modprobe i2c-dev
i2c_bus=0
echo "Using I2C bus:  $i2c_bus"
i2c_addr=(0x38 0x3d)

count=0
for value in "${i2c_addr[@]}"; do
    val=$((count % 2))
    i2cset -f -y "$i2c_bus" "$value" 0x00 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x7f 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x01 0x01
    i2cset -f -y "$i2c_bus" "$value" 0x0e 0xc4
    i2cset -f -y "$i2c_bus" "$value" 0x0f 0x40
    i2cset -f -y "$i2c_bus" "$value" 0x5c 0xd9
    i2cset -f -y "$i2c_bus" "$value" 0x60 0x10
    if [ $val -eq 0 ]; then
        i2cset -f -y "$i2c_bus" "$value" 0x0a 0x1e
    else
        i2cset -f -y "$i2c_bus" "$value" 0x0a 0x2e
    fi
    i2cset -f -y "$i2c_bus" "$value" 0x0d 0x01
    i2cset -f -y "$i2c_bus" "$value" 0x16 0x40
    i2cset -f -y "$i2c_bus" "$value" 0x00 0x01
    i2cset -f -y "$i2c_bus" "$value" 0x17 0xc8
    i2cset -f -y "$i2c_bus" "$value" 0x00 0x04
    i2cset -f -y "$i2c_bus" "$value" 0x30 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x31 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x32 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x33 0x01

    i2cset -f -y "$i2c_bus" "$value" 0x00 0x08
    i2cset -f -y "$i2c_bus" "$value" 0x18 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x19 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x1a 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x1b 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x28 0x40
    i2cset -f -y "$i2c_bus" "$value" 0x29 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x2a 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x2b 0x00

    i2cset -f -y "$i2c_bus" "$value" 0x00 0x0a
    i2cset -f -y "$i2c_bus" "$value" 0x48 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x49 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x4a 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x4b 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x58 0x40
    i2cset -f -y "$i2c_bus" "$value" 0x59 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x5a 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x5b 0x00

    i2cset -f -y "$i2c_bus" "$value" 0x00 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x02 0x00
    count=$((count + 1))
done

**NOTE: your i2c_bus and i2c_addr may be different. ** This script is not mine and comes from here. There are more details there on how it works and how to find your i2c_bus.

Make it executable:

sudo chmod +x /usr/local/bin/tas2781-init.sh

Test it:

sudo /usr/local/bin/tas2781-init.sh
speaker-test -c2 -t wav

You should hear sound now (though be careful - it will be ahttps://gist.github.com/rraks/4edddb99b50b94fe6298adbf3c9f43ebt maximum volume).

Step 2: Create the Volume Control Script

This script controls the speaker volume by writing to the TAS2781's digital volume control registers.

sudo nano /usr/local/bin/tas2781-volume. sh

Paste the following:

#!/bin/bash

i2c_bus=0
i2c_addr=(0x38 0x3d)

# Volume 0-100
VOLUME=${1:-50}

# Convert to 4-byte value (signed 8.24 format)
# 0x00000000 = silent
# 0x40000000 = unity gain (default)
# 0x7F000000 = max gain (about +6dB louder)
# Adjust the max value (0x7F) to change maximum volume

SCALE=$((VOLUME * 0x7F / 100))

for value in "${i2c_addr[@]}"; do
    # Switch to page 0x08
    i2cset -f -y "$i2c_bus" "$value" 0x00 0x08
    
    # Set registers 0x28-0x2b (4-byte volume control)
    i2cset -f -y "$i2c_bus" "$value" 0x28 $(printf "0x%02x" $SCALE)
    i2cset -f -y "$i2c_bus" "$value" 0x29 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x2a 0x00
    i2cset -f -y "$i2c_bus" "$value" 0x2b 0x00
done

echo "Volume set to $VOLUME% (byte value: $(printf "0x%02x" $SCALE))"

Make it executable:

sudo chmod +x /usr/local/bin/tas2781-volume.sh

Test volume control:

sudo /usr/local/bin/tas2781-volume.sh 0   # No sound
sudo /usr/local/bin/tas2781-volume.sh 1   # Very quiet
sudo /usr/local/bin/tas2781-volume.sh 10   # Fairly quiet
sudo /usr/local/bin/tas2781-volume. sh 50   # Medium
sudo /usr/local/bin/tas2781-volume.sh 100  # Max

Adjusting Maximum Volume

The volume curve in this script is completely arbritary and simply reflects my preferences. It is definitely not perfect. A non linear curve probably makes more sense. I might update it in the future.

To change the maximum volume, edit the line in the volume script:

SCALE=$((VOLUME * 0x7F / 100))
  • For louder maximum volume: Change 0x7F to 0xFF

    SCALE=$((VOLUME * 0xFF / 100))
  • For quieter maximum volume: Change 0x7F to a lower value like 0x60

    SCALE=$((VOLUME * 0x60 / 100))

The value 0x40 represents unity gain (0dB), 0x7F is about +6dB, and 0xFF is maximum.

Step 3: Create the PipeWire Volume Sync Script

This script monitors GNOME/PipeWire volume changes and syncs them to the hardware.

sudo nano /usr/local/bin/tas2781-pipewire-sync.sh

Paste the following:

#!/bin/bash

i2c_bus=0
i2c_addr=(0x38 0x3d)

# Detect the actual user (not root)
REAL_USER=$(who | awk '{print $1}' | head -1)
REAL_UID=$(id -u $REAL_USER)
export XDG_RUNTIME_DIR="/run/user/$REAL_UID"

# Function to set hardware volume
set_hw_volume() {
    local VOLUME=$1
    local SCALE=$((VOLUME * 0x7F / 100))
    
    for value in "${i2c_addr[@]}"; do
        i2cset -f -y "$i2c_bus" "$value" 0x00 0x08
        i2cset -f -y "$i2c_bus" "$value" 0x28 $(printf "0x%02x" $SCALE)
        i2cset -f -y "$i2c_bus" "$value" 0x29 0x00
        i2cset -f -y "$i2c_bus" "$value" 0x2a 0x00
        i2cset -f -y "$i2c_bus" "$value" 0x2b 0x00
    done
}

# Monitor PipeWire volume changes as the real user
su - $REAL_USER -c "export XDG_RUNTIME_DIR=/run/user/$REAL_UID; pactl subscribe" | \
grep --line-buffered "sink" | while read -r line; do
    # Get current volume percentage from default sink (as the real user)
    VOLUME=$(su - $REAL_USER -c "export XDG_RUNTIME_DIR=/run/user/$REAL_UID; pactl get-sink-volume @DEFAULT_SINK@" | grep -oP '\d+%' | head -1 | tr -d '%')
    
    if [ -n "$VOLUME" ]; then
        set_hw_volume "$VOLUME"
    fi
done

Make it executable:

sudo chmod +x /usr/local/bin/tas2781-pipewire-sync.sh

Note: If you changed the max volume in Step 2, make sure to change the same line in this script:

local SCALE=$((VOLUME * 0x7F / 100))

Step 4: Create Systemd Services

Service 1: Speaker Initialization (runs at boot)

sudo nano /etc/systemd/system/tas2781-init.service

Paste:

[Unit]
Description=Initialize TAS2781 Amplifiers
After=sound.target
Before=pipewire.service tas2781-volume-sync.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/tas2781-init.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Service 2: Volume Sync (monitors GNOME volume)

sudo nano /etc/systemd/system/tas2781-volume-sync.service

Paste:

[Unit]
Description=TAS2781 Volume Sync with PipeWire
After=sound. target pipewire.service tas2781-init.service

[Service]
Type=simple
ExecStart=/usr/local/bin/tas2781-pipewire-sync.sh
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Step 5: Enable and Start Services

sudo systemctl daemon-reload
sudo systemctl enable tas2781-init.service
sudo systemctl enable tas2781-volume-sync.service
sudo systemctl start tas2781-init.service
sudo systemctl start tas2781-volume-sync.service

Check that both services are running:

sudo systemctl status tas2781-init.service
sudo systemctl status tas2781-volume-sync. service

Step 6: Test Everything

  1. Reboot your laptop:

    sudo reboot
  2. After reboot, test the speakers:

    speaker-test -c2 -t wav
  3. Try changing volume using:

    • GNOME volume slider (top-right menu)
    • Keyboard volume keys
    • Any application's volume control

The hardware volume should automatically follow!

Troubleshooting

Speakers don't work after boot

Check the init service:

sudo systemctl status tas2781-init.service
sudo journalctl -u tas2781-init.service

Volume control doesn't work

Check the volume sync service:

sudo systemctl status tas2781-volume-sync.service
sudo journalctl -u tas2781-volume-sync.service -f

Volume is too loud/quiet at max

Edit the SCALE calculation in both /usr/local/bin/tas2781-volume.sh and /usr/local/bin/tas2781-pipewire-sync.sh. Change 0x7F to a higher value (up to 0xFF) for louder, or lower value for quieter maximum volume.

@pierref2012

Copy link
Copy Markdown

All work good except on resume from standby mode. I edited this script to restart init service on resume. (for Ubuntu)
/lib/systemd/system-sleep/tas2781-init :

#!/bin/sh
if [ "$1" = "post" ]; then
systemctl restart tas2781-init.service
fi

@daniel-crane-64

Copy link
Copy Markdown

I have the exact same computer so this was super easy. You’re my goat 🙏

@AayushAmit

AayushAmit commented Jul 22, 2026 •

Copy link
Copy Markdown

i am having the same problem but i am on cachyos is there any fix

@daniel-crane-64

Copy link
Copy Markdown

the original fix referenced by OP at the top was made by a guy on cachy os so this should fix it https://gist.github.com/rraks/4edddb99b50b94fe6298adbf3c9f43eb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment