Commit 83f8bf4b authored by Thierry Reding's avatar Thierry Reding

drm/tegra: hdmi: Setup audio only if configured

The audio configuration is only valid if the HDMI codec has been
properly set up. Do not attempt to set up audio before that happens
because it causes a division by zero.

Note that this is only problematic on Tegra20 and Tegra30. Later chips
implement the division instructions which return zero when dividing by
zero and don't throw an exception.

Fixes: db5adf4d ("drm/tegra: hdmi: Fix audio to work with any pixel clock rate")
Reported-by: default avatarMarcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 8bbad1ba
...@@ -1260,9 +1260,15 @@ static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder) ...@@ -1260,9 +1260,15 @@ static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder)
hdmi->dvi = !tegra_output_is_hdmi(output); hdmi->dvi = !tegra_output_is_hdmi(output);
if (!hdmi->dvi) { if (!hdmi->dvi) {
err = tegra_hdmi_setup_audio(hdmi); /*
if (err < 0) * Make sure that the audio format has been configured before
hdmi->dvi = true; * enabling audio, otherwise we may try to divide by zero.
*/
if (hdmi->format.sample_rate > 0) {
err = tegra_hdmi_setup_audio(hdmi);
if (err < 0)
hdmi->dvi = true;
}
} }
if (hdmi->config->has_hda) if (hdmi->config->has_hda)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment