This code can be reused for HDMI, so extract it into a reusable function. Signed-off-by: Thierry Reding <[email protected]>