SolidRun / linux-fslc

Linux kernel source tree
Other
12 stars 26 forks source link

imx-hdmi-dma: Shift 24bit data to the right when assembling IEC958 frame #47

Closed warped-rudi closed 6 years ago

warped-rudi commented 6 years ago

This is most likely a workaround for a bug in the PCM subsystem that is not present in 3.x kernels.

Signed-off-by: Rudi r.ihle@s-t.de

warped-rudi commented 6 years ago

I think we have a bigger problem. I could not test this, but most likely SPDIF and SGTL5000 are affected by this as well. So we really have to fix it in the upper layer.

jnettlet commented 6 years ago

Thanks for the heads up. I get back to my testbed in Denmark tonight and will run it through its paces tomorrow.

On Sun, Feb 4, 2018, 7:44 AM Rudi Ihle notifications@github.com wrote:

I think we have a bigger problem. I could not test this, but most likely SPDIF and SGTL5000 are affected by this as well. So we really have to fix it in the upper layer.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/SolidRun/linux-fslc/pull/47#issuecomment-362882763, or mute the thread https://github.com/notifications/unsubscribe-auth/AhtJbFwfdAsoAiHifg-Cf1CKqNsxHMaTks5tRUOzgaJpZM4R4S8D .

warped-rudi commented 6 years ago

I tried to figure out what's going on here. But it's quite tricky. Even though I don't know why, the SGTL5000 is not affected. SPDIF does not work at all (gives an i/o error when trying to write to it). So I cannot tell how it will behave. What's happening with HDMI is, that with the new kernel the number of significant bits (snd_pcm_hw_params.msbits) is different from what it used to be (i.e. 24 instead of 32). This forces Kodi (and probably other applications as well) to feed MSB-aligned data, which we currently compensate by this patch. The behaviour change is mostly caused by this function. I think this is incorrect and that msbits should only be set different from sample_bits when MSB alignment is in effect. But it's hard to tell without knowing the intention of this change.

warped-rudi commented 6 years ago

Finally I've figured out what's going on here. The problem is the following: The new version of hdmi-codec.c sets _hdmi_i2s_dai.playback.sigbits to 24. In earlier kernels, this field was not set (i.e. 0), which would effectively result in a value of 32 to be reported back to applications. Kodi uses this value to distinguish between LSB- and MSB-justification. This does not work with the new hdmi-codec as 24 is now reported in both cases. Obviously, Kodi's (and maybe other application's) detection method is flawed and will - even with old kernels - only work for codecs, that don't specify _sigbits = 24. Which actually explains, why SGTL5000 and SPDIF will not suffer from this problem. The question is how to solve this. We could:

I'll vote for the third approach...