RPi4 Upstream Kernel

I have figured out a config for Torvalds upstream kernel on the pi4 and I have tested it on my pi4 4G & 8G booting on a sdcard and my usb M.2 usb adapter. I am providing this so one can see where upstream is at with the pi4 64bit kernel so if you like to test; try it out.

Notes:

Although my usb MSD booted ok I have no clue how others will do like some use quirks= in /boot/cmdline.txt for example. your old cmdline.txt will be saved as cmdline.txt.pacsave if you need to reference it. Also the old config.txt will be saved as config.txt.pacsave if you need to find your custom monitor settings.

Upstream does not have V3D yet so there is not gpu acceleration but the performance is not really all that bad.

Upstream does not build overlays so if you have been enabling any overlays in config.txt they will not work.

I have never been able to boot on my pi4 with the RPi kernel with out specifying a custom config for my VIZIO tv but with this upstream kernel It will boot with out the custom config but it boots with 1920x1080 which I do not like so I still use my custom config so I can have 1366x768. There is no option in the Monitor Settings to change it in the desktop. When I get time I will create a custom edid.dat file and load it at boot and see if I get any choices to change the resolution. If and when they have V3d then this may not be an issue.

My second monitor died so I am not able to test to see if or how 2 monitors work but with out V3d if they do work it may not work in extended mode like our current RPi kernels do.

This package will provide new /boot config.txt and cmdline.txt files and remove the /boot/overlays directory and of course will provide the new kernel/modules and bcm2711-rpi4.dtb. You can edit /boot/config.txt and provide your overclocking. I have my overclocking there but have it disabled. It works but I have no clue if higher values will work with this upstream kernel.

Install (DO NOT LEAVE OUT ANY STEPS BELOW):

Download tarball and unpack and install the kernel and headers. 
DO NOT REBOOT!
sudo pacman -S xf86-video-fbturbo-git

As of right now the upstream will not recognize root=LABEL=ROOT_MNJRO at boot so it needs to be changed to root=PARTUUID=. As a place holder I have my
root=PARTUUID=81435af5-02 as a place holder but it has to be changed to what your
PARTUUID for your root device. To get it run:

sudo blkid /dev/mmcblk0p2 for sdcard or sudo blkid /dev/sda2 for usb drive

Look for the PARTUUID="???" value and replace my value with it in /boot/comdline.txt. (with out the quotes)

Reboot the pi and at boot you should see 4 penguins instead of 4 raspberry’s

To go back to what kernel you had previously just reinstall the kernel you were running.
ADDED: Uninstall xf86-video-fbturbo-git and reboot.

This upstream kernel is the latest they committed last Sunday.

md5sum:
02b34d2fb4c05307c7a2838e7f413631 linux-rpi4-upstream_590-rc5.tar

https://drive.google.com/file/d/1N4ILAIOlVwpiSWYOAjKRX0tOfmzggENP/view?usp=sharing

2 Likes

I am having issues with the lack of audio and my lack of understanding how all of the audio stuff fits together.
Here is where it stands at the moment:
$ aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I think this means that ALSA does see two audio playback devices, both being audio out via the two HDMI ports. Still missing headphones.

$ aplay -L

null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault
    Default Audio Device
iec958
    IEC958 (S/PDIF) Digital Audio Output
pipewire
    PipeWire Sound Server
default
    Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=vc4hdmi0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Default Audio Device
front:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Front output / input
iec958:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    IEC958 (S/PDIF) Digital Audio Output
sysdefault:CARD=vc4hdmi1
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Default Audio Device
front:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Front output / input
iec958:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    IEC958 (S/PDIF) Digital Audio Output

When I list the PCM (whatever that is exactly) it also shows “front” which should be headphones. So I think the kernel is correctly detecting both digital output via hdmi and analog output via the headphone device.

So this seems all very promising…

However, if I run alsamixer, I get:

This sound device does not have any controls.

I am currently running KDE Plasma and when I access the audio level settings, no playback devices are available.

$ inxi -Aazy

Audio:
  Device-1: bcm2711-hdmi0 driver: vc4_hdmi bus-ID: N/A chip-ID: brcm:fef00700
    class-ID: hdmi
  Device-2: bcm2711-hdmi1 driver: vc4_hdmi bus-ID: N/A
    chip-ID: brcm:fef05700 class-ID: hdmi
  Sound Server-1: ALSA v: k5.16.0-rc8-2-MANJARO-ARM running: yes
  Sound Server-2: JACK v: 1.9.20 running: no
  Sound Server-3: PulseAudio v: 15.0 running: no
  Sound Server-4: PipeWire v: 0.3.43 running: yes

I have no clue where the breakdown is. ALSA seems to detect but then does not use the audio devices.

Are you saying you have no sound at all or no headphone sound. inxi will not show headphones for some reason with upstream kernel. Dou you have “snd_bcm2835.enable_headphones=1” in cmdline.txt?

My pipewire install:

[ray@pi4 ~]$ pacman -Ss pipewire | grep installed
extra/gst-plugin-pipewire 1:0.3.43-1.1 [installed: 1:0.3.42-2]
extra/libpipewire02 0.2.7-2 [installed]
extra/pipewire 1:0.3.43-1.1 [installed: 1:0.3.42-2]
extra/pipewire-alsa 1:0.3.43-1.1 [installed: 1:0.3.42-2]
extra/pipewire-media-session 1:0.4.1-1 [installed]
extra/pipewire-pulse 1:0.3.43-1.1 [installed: 1:0.3.42-2]
extra/pipewire-v4l2 1:0.3.43-1.1 [installed: 1:0.3.42-2]
extra/pipewire-zeroconf 1:0.3.43-1.1 [installed: 1:0.3.42-2]

aplay -L:

[ray@pi4 ~]$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pipewire
    PipeWire Sound Server
pulse
    PulseAudio Sound Server
speex
    Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
default
    Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
usbstream:CARD=ALSA
    bcm2835 ALSA
    USB Stream Output
sysdefault:CARD=Headphones
    bcm2835 Headphones, bcm2835 Headphones
    Default Audio Device
usbstream:CARD=Headphones
    bcm2835 Headphones
    USB Stream Output
sysdefault:CARD=vc4hdmi0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Default Audio Device
front:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Front output / input
iec958:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    IEC958 (S/PDIF) Digital Audio Output
usbstream:CARD=vc4hdmi0
    vc4-hdmi-0
    USB Stream Output
sysdefault:CARD=vc4hdmi1
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Default Audio Device
front:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Front output / input
iec958:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    IEC958 (S/PDIF) Digital Audio Output
usbstream:CARD=vc4hdmi1
    vc4-hdmi-1
    USB Stream Output

[ray@pi4 ~]$ uname -r
5.16.1-1-MANJARO-ARM

If I look at some pipewire stuff, I see this:
$ ls -1 ~/.local/state/pipewire/media-session.d/

bluez-autoswitch
default-nodes
default-profile
default-routes
restore-stream

And then cat all of the files to take a quick peek:

{ }{
 "default.configured.audio.sink": { "name": "alsa_output.platform-fef00700.hdmi.iec958-stereo" }
}{
 "default.profile.alsa_card.platform-bcm2835_audio": { "name": "output:stereo-fallback" },
 "default.profile.alsa_card.platform-fef05700.hdmi": { "name": "pro-audio" },
 "default.profile.alsa_card.platform-fef00700.hdmi": { "name": "pro-audio" }
}{
 "default.route.alsa_card.platform-bcm2835_audio:profile:off": [ ],
 "default.route.alsa_card.platform-bcm2835_audio.2:profile:off": [ ],
 "default.route.alsa_card.platform-bcm2835_audio:profile:output:stereo-fallback": [ ],
 "default.route.alsa_card.platform-bcm2835_audio.2:profile:output:stereo-fallback": [ "analog-output-headphones" ],
 "default.route.alsa_card.platform-fef00700.hdmi:profile:off": [ ],
 "default.route.alsa_card.platform-fef00700.hdmi:profile:output:iec958-stereo": [ "iec958-stereo-output" ],
 "default.route.alsa_card.platform-fef00700.hdmi:output:iec958-stereo-output": { "mute": false, "volumes": [ 0.421875, 0.421875 ], "channels": [ "FL", "FR" ], "latencyOffsetNsec": 0 },
 "default.route.alsa_card.platform-bcm2835_audio:output:analog-output": { "mute": false, "volumes": [ 0.085185, 0.085185 ], "channels": [ "FL", "FR" ], "latencyOffsetNsec": 0 },
 "default.route.alsa_card.platform-bcm2835_audio.3:profile:off": [ ],
 "default.route.alsa_card.platform-bcm2835_audio.3:profile:output:stereo-fallback": [ "analog-output-headphones" ],
 "default.route.alsa_card.platform-bcm2835_audio.2:output:analog-output": { "mute": false, "volumes": [ 0.328512, 0.328512 ], "channels": [ "FL", "FR" ], "latencyOffsetNsec": 0 },
 "default.route.alsa_card.platform-bcm2835_audio.3:output:analog-output-headphones": { "mute": false, "volumes": [ 0.035938, 0.035938 ], "channels": [ "FL", "FR" ], "latencyOffsetNsec": 0 },
 "default.route.alsa_card.platform-bcm2835_audio:output:analog-output-headphones": { "mute": false, "volumes": [ 0.132647, 0.132647 ], "channels": [ "FL", "FR" ], "latencyOffsetNsec": 0 },
 "default.route.alsa_card.platform-bcm2835_audio.2:output:analog-output-headphones": { "mute": false, "volumes": [ 0.474550, 0.474550 ], "channels": [ "FL", "FR" ], "latencyOffsetNsec": 0 },
 "default.route.alsa_card.platform-fef00700.hdmi:profile:pro-audio": [ ],
 "default.route.alsa_card.platform-bcm2835_audio:profile:pro-audio": [ ]
}{
 "restore.stream.Input/Audio.application.name:Plasma PA": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000 ], "channels": [ "FL", "FR" ] },
 "restore.stream.Output/Audio.media.role:Notification": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000 ], "channels": [ "FL", "FR" ], "target-node": "alsa_output.platform-fef00700.hdmi.iec958-stereo" },
 "restore.stream.Output/Audio.application.name:Firefox": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000 ], "channels": [ "FL", "FR" ], "target-node": "alsa_output.platform-fef00700.hdmi.iec958-stereo" },
 "restore.stream.Output/Audio.application.name:gpartedbin": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000 ], "channels": [ "FL", "FR" ], "target-node": "alsa_output.platform-fef00700.hdmi.iec958-stereo" },
 "restore.stream.Output/Audio.application.name:Chromium": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000 ], "channels": [ "FL", "FR" ], "target-node": "alsa_output.platform-fef00700.hdmi.iec958-stereo" },
 "restore.stream.Output/Audio.media.role:Test": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000 ], "channels": [ "AUX6" ] },
 "restore.stream.Audio/Sink.node.name:alsa_output.platform-bcm2835_audio.pro-output-0": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000 ], "channels": [ "AUX0", "AUX1", "AUX2", "AUX3", "AUX4", "AUX5", "AUX6", "AUX7" ] }

These look a little confusing or maybe where my issue is at.
This is on my multi-linux setup, so it runs with different kernels and configurations… maybe I am confusing pipewire?

Currently I have no sound devices in the Plasma volume control app.

I think maybe I should rename the ~/.local/state directory and restart… see if pipewire remakes these files.

Hmm, my installed pipewire files are:
$ pacman -Ss pipewire | grep installed

extra/pipewire 1:0.3.43-1.1 [installed]
extra/pipewire-alsa 1:0.3.43-1.1 [installed]
extra/pipewire-media-session 1:0.4.1-1 [installed]
extra/pipewire-pulse 1:0.3.43-1.1 [installed]
extra/pipewire-zeroconf 1:0.3.43-1.1 [installed]

libpipewire02 should be installed I would imagine.

I renamed the ~/.local/.state directory and rebooted… now I have audio via hdmi once again.
The headphones do not show up as a device, but I can live without it.

When pipewire remade the state files, this is what it made:

bluez-autoswitch
default-routes
restore-stream

cat *

{ }{
 "default.route.alsa_card.platform-fef00700.hdmi:profile:off": [ ],
 "default.route.alsa_card.platform-fef00700.hdmi:profile:output:iec958-stereo": [ ]
}{
 "restore.stream.Input/Audio.application.name:Plasma PA": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000, 1.000000 ], "channels": [ "FL", "FR" ] },
 "restore.stream.Output/Audio.media.role:Test": { "volume": 1.000000, "mute": false, "volumes": [ 1.000000 ], "channels": [ "FR" ] }
}

So maybe I am confusing pipewire by changing kernels.

Do you have “snd_bcm2835.enable_headphones=1” in the cmdline. They will not show up unless you do with upstream kernel.

cat /proc/cmdline

cat /proc/cmdline 
BOOT_IMAGE=/linux-rc/kernel8.img root=UUID=67f980ac-ed2d-4c24-9b33-d26967fad293 rw rootflags=subvol=@ rootwait console=tty0 audit=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_headphones=1

I remember you had working headphones at one time with the upstream kernel. What does aplay -l say?

Yes, I do believe I had headphones with the upstream kernel at one time.

$ aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

[ray@pi4 ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 3/3
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
card 2: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 3: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

I do have dtparam=audio=on set in config.txt, I would think that should create the bcm2835 ALSA headphone device.

I’m going to install linux-rc like you have and see if any diff here.

$ lsmod | grep bcm

bcm_phy_lib            28672  1 broadcom
bcm2711_thermal        16384  0
bcm2835_wdt            20480  0
mdio_bcm_unimac        20480  0
i2c_bcm2835            20480  1

$ lsmod | grep vc4

vc4                   245760  5
drm_kms_helper        286720  3 vc4
drm                   606208  4 drm_kms_helper,vc4
cec                    73728  1 vc4

$ lsmod | grep snd

snd_seq_dummy          16384  0
snd_hrtimer            16384  1
snd_seq                81920  7 snd_seq_dummy
snd_seq_device         20480  1 snd_seq
snd_soc_hdmi_codec     24576  2

It seems to me that I used to have some type of snd driver associated with the vc4 module, but do not see it currently.

Currently, I have an Inactive Card… not sure I have ever seen that before. If I click profile, I have a choice of Off and Pro Audio. I wonder if this is the headphones and I need to make some configuration adjustment?

No idea but could be hdmi1 which is detected but no monitor is attached.

Probably built in the kernel instead of a module.

Get rid of snd_bcm2835.enable_compat_alsa=0 in your cmdline.

$ cat /proc/cmdline

BOOT_IMAGE=/linux-rc/kernel8.img root=UUID=67f980ac-ed2d-4c24-9b33-d26967fad293 rw rootflags=subvol=@ rootwait console=tty0 audit=0 snd_bcm2835.enable_headphones=1

Done, but I can not find any difference… same modules loaded, same devices in aplay -l, and aplay-L. And the same audio devices in the plasma audio app.