Dell XPS 17 9700

Enable Javascript to display Table of Contents.

Audio on Ubuntu 2020.10

I recently upgraded from 2020.04, where I got the audio running with the links below. With 2020.10 I needed the following steps:

For Ubuntu 2020.10 which comes with a Linux Kernel v5.8, I needed soundwire 1.4:
git clone https://github.com/maaarghk/soundwire-dkms
cd soundwire-dkms
git checkout latest-sofproject
cd ..
sudo mv soundwire-dkms /usr/src/soundwire-1.4.0
sudo dkms add soundwire/1.4.0
sudo dkms build soundwire/1.4.0
sudo dkms install soundwire/1.4.0
I guess I will have to repeat the steps above, whenever a new Kernel is installed.

The files coming with the packet linux-firmware must be replaced by the content of sof-firmware-1.6-2-any.pkg.tar.zst (mainly files of the lib folder).

#wget https://www.archlinux.de/download/extra/os/x86_64/sof-firmware-1.6-2-any.pkg.tar.zst
wget http://tardis.tiny-vps.com/aarm/packages/s/sof-firmware/sof-firmware-1.6-2-any.pkg.tar.xz
tar xf sof-firmware-1.6-2-any.pkg.tar.*
sudo mv /usr/lib/firmware/intel/sof /usr/lib/firmware/intel/sof.bak
sudo mv /usr/lib/firmware/intel/sof-tplg /usr/lib/firmware/intel/sof-tplg.bak
sudo cp -r usr/lib/firmware/intel/sof/v1.6 /usr/lib/firmware/intel/sof
sudo cp -r usr/lib/firmware/intel/sof-tplg-v1.6/ /usr/lib/firmware/intel/sof-tplg

It seems that the replacement of /usr/share/alsa/ucm2/sof-soundwire is not needed - on my Xubuntu 2020.10 it is working even without. To be sure to have the original distro files, I run sudo apt reinstall alsa-ucm-conf.

Source: isopr0p Redit Post, Mark's Blog, Howto Ubuntu on Redit
answer here when solved: https://askubuntu.com/questions/1308884/how-to-install-ubuntu-20-10-on-the-new-xps-17-9700


check here to get it solved:
 - https://wiki.archlinux.org/title/Dell_XPS_17_(9700)#Audio
 - https://askubuntu.com/questions/1270442/no-sound-on-xps-17-9700
 - https://askubuntu.com/questions/1256825/no-sound-on-ubuntu-20-04-dell-xps-7390-realtek-alc3271-intel-corporation-de
 - https://itectec.com/ubuntu/ubuntu-no-sound-on-xps-17-9700/
 - https://www.reddit.com/r/Dell/comments/hteg2c/ubuntudebian_audio_with_the_dell_xps_9700_progress/
 - https://forums.linuxmint.com/viewtopic.php?t=339927

- https://blog.fts.scot/2020/07/04/dell-xps-2020-how-to-get-audio-working-on-linux/

Change Minimum Brightness in XFCE

If you set the brightness slider to the minimum, the brightness is still quite high:
$ cat /sys/class/backlight/intel_backlight/actual_brightness 
40
$ 
Manually it can be reduced even till 1:
$ echo 1 | sudo tee /sys/class/backlight/intel_backlight/brightness 
$ 
To be able to do the same with the GUI (and keyboard shortcuts), you have to open the xfce4-settings-editor, then choose the channel xfce4-power-manager on the left, and click on the button + Add on the right. Here add /xfce4-power-manager/brightness-slider-min-level as Property name, Int as type and 1 as value.

Make Touchpad working after Suspend

After returning from suspend scripts in the folder /lib/systemd/system-sleep are executed. So create a new script there (e.g. name it fix_touchpad) and fill it with the following content:
#!/bin/sh

case $1 in
	pre)
		;;
	post)
		synclient Touchpadoff=0
		echo "Set 'Touchpadoff' to zero." | systemd-cat -t fix_touchpad -p info
		;;
esac
Finally make it executable (e.g. by running chmod 755 /lib/systemd/system-sleep/fix_touchpad. Then perform suspend and wakeup, and check if your script was executed:
$ journalctl -e | grep fix_touchpad
Dec 16 06:14:04 XPS-17-9700 fix_touchpad[4900]: Set 'Touchpadoff' to zero.

Enable Hibernate

First check if /lib/systemd/system/nvidia-resume.service exists. Otherwise reinstall your nvidia-kernel-common package:
sudo apt-get install --reinstall nvidia-kernel-common-XXX
After that hibernate your system via command line:
sudo systemctl hibernate
If this works, check if hibernate is disabled on Ubuntu:
sudo vi /usr/share/polkit-1/rules.d/com.ubuntu.desktop.rules
sudo systemctl restart polkit
At the end hibernate should be enabled like this:
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.upower.hibernate" ||
         action.id == "org.freedesktop.login1.hibernate" ||
         action.id == "org.freedesktop.login1.handle-hibernate-key" ||
         action.id == "org.freedesktop.login1.hibernate-multiple-sessions") {
            return polkit.Result.YES;
    }
});
Source: stackoverflow.com

Hibernate on Lid-Close

First call script on LID close and LID open ACPI events:
$ cat /etc/acpi/events/notebook-lid-close 
event=button/lid LID close
action=/etc/acpi/handle-lid-event.sh close
$
$ cat /etc/acpi/events/notebook-lid-open 
event=button/lid LID open
action=/etc/acpi/handle-lid-event.sh open
$ 
The script itself performs some actions on close/open:
#!/bin/sh
#
# Hibernate
#

NAME=handle-lid-event
#echo "lid $@" | systemd-cat -t $NAME -p info

if [ "$1" = "close" ] ; then
	# Rotate fans so that successful hibernate is audible
	smbios-thermal-ctl --set-thermal-mode=cool-bottom
	# Log hibernate
	/usr/lib/systemd/system-sleep/monitor_sleep pre hibernate

	# Perform hibernate
	echo disk > /sys/power/state
fi

if [ "$1" = "open" ] ; then
	# Log return from hibernate
	/usr/lib/systemd/system-sleep/monitor_sleep post hibernate
	# Reset fan speed
	smbios-thermal-ctl --set-thermal-mode=balanced

	# Activate touchpad
	synclient Touchpadoff=0
fi

Monitor Battery Level via Journal

To monitor the battery level and the power consumption of the notebook, I ve written a script which writes the key values to the journal. The output looks like this:
$ /usr/lib/systemd/system-sleep/monitor_sleep status
Battery:  51% (Charging 52.945 of 95.1Wh,  53.08W/16826J (now 50.41W),  55.82%/h, 1.79h, since 317 seconds)
$ /usr/lib/systemd/system-sleep/monitor_sleep print
2025-08-22T19:54:17+02:00 monitor_sleep[5488]: Battery:  47% (Charging 48.271 of 95.1Wh,  52.63W, 13421J,  55.34%/h, 1.81h)
2025-08-22T20:00:01+02:00 monitor_sleep[6408]: Battery:  52% (Charging 53.369 of 95.1Wh,  53.20W, 18353J,  55.94%/h, 1.79h)
The script is located at /usr/lib/systemd/system-sleep/monitor_sleep and is called every 10 minutes via cron job.
#!/bin/bash -ue
#
# Monitor system sleep/suspend/hibernate
#
NAME=$(basename $0)

LAST_CHARGE_FILE=/tmp/monitor-sleep-last-charge

TIME_NOW=$(date +%s)

ACTION=$(cat /sys/class/power_supply/BAT0/status)
CURRENT_NOW=$(cat /sys/class/power_supply/BAT0/current_now)
VOLTAGE_NOW=$(cat /sys/class/power_supply/BAT0/voltage_now)
VOLTAGE_DESIGN=$(cat /sys/class/power_supply/BAT0/voltage_min_design)
CHARGE_NOW_uAH=$(cat /sys/class/power_supply/BAT0/charge_now)
FULL_uAH=$(cat /sys/class/power_supply/BAT0/charge_full)

CHARGE_NOW_WH=$(echo "$CHARGE_NOW_uAH / 1000000 * $VOLTAGE_NOW / 1000000" | bc -l | awk '{printf "%6.3f\n", $0}')
FULL_WH=$(echo "$FULL_uAH / 1000000 * $VOLTAGE_DESIGN / 1000000" | bc -l | awk '{printf "%4.1f\n", $0}')
PERCENT=$(echo "$CHARGE_NOW_uAH * 100 / $FULL_uAH" | bc -l | awk '{printf "%3.0f\n", $0}')
POWER_NOW=$(echo "$CURRENT_NOW * $VOLTAGE_NOW / 1000000 / 1000000" | bc -l | awk '{printf "%5.2f\n", $0}')

POWER_AVG=""
PERCENT_CHANGE=""
CAPACITY_HOURS=""
WORK_J=""
TIME_DIFF=""
if [ -e $LAST_CHARGE_FILE ] ; then
	LAST_CHARGE_STRING=$(cat $LAST_CHARGE_FILE)
	LAST_CHARGE_ARRAY=( $LAST_CHARGE_STRING )
	LAST_TIME=${LAST_CHARGE_ARRAY[0]}
	LAST_CHARGE_WH=${LAST_CHARGE_ARRAY[2]}

	TIME_DIFF=$(($TIME_NOW - $LAST_TIME))
	WORK_WH=$(echo "$CHARGE_NOW_WH - $LAST_CHARGE_WH" | bc -l | awk '{printf "%.5f\n", $0}')
	WORK_J=$(echo "$WORK_WH * 3600" | bc -l | awk '{printf "%4.0f\n", $0}')
	POWER_AVG=$( echo "3600 * $WORK_WH / $TIME_DIFF" | bc -l | awk '{printf "%6.2f\n", $0}')
	PERCENT_CHANGE=$( echo "3600 * 100 * $WORK_WH / $FULL_WH / $TIME_DIFF" | bc -l | awk '{printf "%6.2f\n", $0}')
	CAPACITY_HOURS=$( echo "100 / $PERCENT_CHANGE" | bc -l | awk '{printf "%4.2f\n", $0}')
else
	echo "$TIME_NOW $PERCENT $CHARGE_NOW_WH $FULL_WH" > $LAST_CHARGE_FILE
fi

case $1 in
	status)
		echo "Battery: $PERCENT% ($ACTION $CHARGE_NOW_WH of ${FULL_WH}Wh, ${POWER_AVG}W/${WORK_J}J (now ${POWER_NOW}W), $PERCENT_CHANGE%/h, ${CAPACITY_HOURS}h, since $TIME_DIFF seconds)"
		;;
	startup)
		# triggered by crontab line '@reboot /usr/lib/systemd/system-sleep/monitor_sleep startup'
		echo "Startup: $PERCENT% ($ACTION $CHARGE_NOW_WH of ${FULL_WH}Wh)" | systemd-cat -t $NAME -p info
		echo "$TIME_NOW $PERCENT $CHARGE_NOW_WH $FULL_WH" > $LAST_CHARGE_FILE
		;;
	pre)
		echo "Going to $2: $PERCENT% ($ACTION $CHARGE_NOW_WH of ${FULL_WH}Wh)" | systemd-cat -t $NAME -p info
		echo "$TIME_NOW $PERCENT $CHARGE_NOW_WH $FULL_WH" > $LAST_CHARGE_FILE
		;;
	post)
		echo "Resuming from $2: $PERCENT% ($ACTION $CHARGE_NOW_WH of ${FULL_WH}Wh, ${POWER_AVG}W, ${WORK_J}J, $PERCENT_CHANGE%/h, ${CAPACITY_HOURS}h)" | systemd-cat -t $NAME -p info
		echo "$TIME_NOW $PERCENT $CHARGE_NOW_WH $FULL_WH" > $LAST_CHARGE_FILE
		;;
	log)
		# triggered by crontab line '*/10 * * * * /usr/lib/systemd/system-sleep/monitor_sleep log'
		if [ "$ACTION" = "Full" ] ; then
			echo "Battery: $PERCENT% ($ACTION $CHARGE_NOW_WH of ${FULL_WH}Wh)"  | systemd-cat -t $NAME -p info
		else
			echo "Battery: $PERCENT% ($ACTION $CHARGE_NOW_WH of ${FULL_WH}Wh, ${POWER_AVG}W, ${WORK_J}J, $PERCENT_CHANGE%/h, ${CAPACITY_HOURS}h)"  | systemd-cat -t $NAME -p info
		fi
		echo "$TIME_NOW $PERCENT $CHARGE_NOW_WH $FULL_WH" > $LAST_CHARGE_FILE
		;;
	print)
		journalctl -o short-iso --no-hostname --identifier $NAME --boot --follow
		;;
	printall|print-all|print_all)
		journalctl -o short-iso --no-hostname --identifier $NAME
		;;
	*)
		echo "Usage: $0 status|startup|pre|post|log|print|print-all"
		echo
		echo "  status     prints current battery status"
		echo "  startup    log startup"
		echo "  pre        log action at \$2"
		echo "  post       log resuming from \$2"
		echo "  log        log running computer"
		echo "  print      print logs since last boot"
		echo "  print-all  print all logs"
		;;
esac

Enable Shutdown/Hibernate/Suspend/.. Buttons

Check if the file 10-ctxhdx-disable-power-management.rules exists and add a group, you re added:
21:39:04[~]$ cat /usr/share/polkit-1/rules.d/10-ctxhdx-disable-power-management.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.login1.suspend" ||
        action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
        action.id == "org.freedesktop.login1.hibernate" ||
        action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
        action.id == "org.freedesktop.login1.reboot" ||
        action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
        action.id == "org.freedesktop.login1.power-off" ||
        action.id == "org.freedesktop.login1.power-off-multiple-sessions"
       )
    {
        if (subject.isInGroup("root") || subject.isInGroup("ctxadm") || subject.isInGroup("rs-localadmin")) {
            return polkit.Result.YES;
        }
        else {
            return polkit.Result.NO;
        }
    }
});
21:39:06[~]$

CPU Frequency

The cpufrequtils initd script (see /etc/init.d/cpufrequtils) can be configured by /etc/default/cpufrequtils:
ENABLE="true"
GOVERNOR="powersave"
MAX_SPEED="0"
MIN_SPEED="0"