I've got LineageOS 20 on my Fairphone 4 and my compass is constantly broken.
After a calibration by doing the figure 8 motion, N/S works pretty okay but it's very jittery; a few degrees which is quite a lot. This might still be acceptable since it'd be smoothed out.
When I point the needle north and rotate the device 90 degrees however, I'm almost 30 degrees off which is borderline unusable.
Google maps claims the compass has low accuracy, no matter how long I do the figure 8 motion.
I don't know a whole bunch on the matter but it could be that the actual IC is damaged. As in, the mechanical components of it are broken or in a state that the IC can't compensate for. Not sure what you can do other than replace the component...
Not 100% sure this device even has a chip. SatStat doesn't show values for orientation; only for magnetic field which I heard Is used to emulate a compass but I'm really not sure.