Fixing the Audio on a Pinebook Pro after resume

I recently purchased a Pinebook Pro, which is a Linux laptop based on the Arm processor. It is a great travel laptop, and surprisingly, I have found this to now be my primary personal device.

Everything has worked well, except one annoying bug: after resuming from sleep, the audio stops working. After digging around, I found that a simple command to write some data to the device to unbind it, then rebind it resolves it. I incorporated this into a systemd script that it is automatically run upon resume.

Create a new file called: /usr/lib/systemd/system-sleep/audio with the following (sudo vim /usr/lib/systemd/system-sleep/audio)

#!/bin/sh
#
# mwd - 20200726
# This is a script to reload the audio module
#  upon resume.
case $1 in
    post|resume)
        tee /sys/bus/i2c/drivers/es8316/{un,}bind <<< 1-0011
        ;;
esac

Save this file and make sure it is executable:

sudo chmod +x /usr/lib/systemd/system-sleep/audio