On Fri, Sep 13, 2024 at 10:12:39PM +0100, Hugh Cole-Baker wrote: > Hi Geraldo, and apologies for resurrecting a 2 year old thread... > > On 17/10/2022 13:04, Geraldo Nascimento wrote: > > Hi Mark, resending this as it failed to apply in my last submission. Added > > Neil Armstrong to Cc: as hopefully he will be able to better review this. > > > > Thanks, > > Geraldo Nascimento > > > > --- > > > > Starting with version 2.10a of Synopsys DesignWare HDMI controller the > > insert_pcuv bit was introduced. On RK3399pro SoM (Radxa Rock Pi N10), > > for example, if we neglect to set this bit and proceed to enable hdmi_sound > > and i2s2 on the device tree there will be extreme clipping of sound > > output, to the point that music sounds like white noise. Problem > > could also manifest as just mild cracking depending of HDMI audio > > implementation of sink. Setting insert_pcuv bit (bit 2 of > > aud_conf2 Audio Sample register) fixes this. > > > > Signed-off-by: Geraldo Nascimento <geraldogabriel@xxxxxxxxx> > > I also had the HDMI audio clipping issue described here, on a RK3399. This was > on a 6.1.23 kernel based on the one used by LibreELEC.tv with their out-of-tree > patches for video decoding, 4k HDMI support, etc. When testing this patch I > also updated my kernel tree to 6.10.3, and found that even without this patch, > on 6.10.3 the problem no longer happens. > > I added printk to show the value of AUD_CONF2, and found that on 6.1.23, the > value is 0 before the code in this patch sets the insert_pcuv bit. On 6.10.3 > the value is 4, i.e. insert_pcuv is already set. > > According to the RK3399 TRM, the value-after-reset of the insert_pcuv bit is 1, > so apparently on the 6.1.23 kernel something is clearing the bit after HW reset > but before this driver sets the hw_params, and this patch sets it back to the > correct value. On 6.10.3 the bit is not cleared, i.e. this patch is seemingly > no longer necessary (but is a harmless no-op). > I found out that for my hardware even with 6.13-rc5 I still suffer from really distorted audio if I don't apply this patch.