Hi,
I’ve a problem with HDMI audio output. It seems that the HDMI audio is ok only with HDMI resolution >= 1920x1080. If I set a lower resolution, the HDMI audio stops to work and it doens’t work also if I return to a resolution >= 1920x1080. This happens on different types of HDMI screen, so I don’t think that it is a monitor problem.
Steps to reproduce:
-
start the system (automatically setted resolution is 1920x1080)
-
execute:
/usr/bin/speaker-test --channels 2 --rate 48000 --device hw:0,3
→ audio is ok
-
execute:
/usr/bin/xrandr --output HDMI-0 --mode 800x600
/usr/bin/speaker-test --channels 2 --rate 48000 --device hw:0,3
→ audio is NOT ok, I can’t hear anything
-
execute:
/usr/bin/xrandr --output HDMI-0 --mode 1920x1080
/usr/bin/speaker-test --channels 2 --rate 48000 --device hw:0,3
→ audio is NOT ok, I can’t hear anything
-
reboot the system (automatically setted resolution is 1920x1080)
-
execute:
/usr/bin/speaker-test --channels 2 --rate 48000 --device hw:0,3
→ audio is ok
Note that when I set the 800x600 resolution, I have those message in dmesg:
tegradc tegradc.1: hdmi: can’t set audio to 48000 at 49500000 pix_clock
Maybe I’ve to change some settings?
Thanks, best regards.
Ivan
IvanGolob,
Thanks for reporting. I’ll help check this.
Please check if this patch helps.
diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c
index a732263..5edd950 100644
--- a/drivers/video/tegra/dc/hdmi.c
+++ b/drivers/video/tegra/dc/hdmi.c
@@ -4,7 +4,7 @@
* Copyright (C) 2010 Google, Inc.
* Author: Erik Gilling <konkers@android.com>
*
- * Copyright (c) 2010-2015, NVIDIA CORPORATION, All rights reserved.
+ * Copyright (c) 2010-2016, NVIDIA CORPORATION, All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -445,6 +445,72 @@
return NULL;
}
+struct tegra_hdmi_audio_config tegra_hdmi_audio_config_default[] = {
+ {148500000, 24576, 148500, 24000},
+ {0, 0, 0, 0},
+};
+
+static const struct tegra_hdmi_audio_config
+*tegra_hdmi_get_audio_config_default(unsigned audio_freq, unsigned pix_clock)
+{
+ struct tegra_hdmi_audio_config *table;
+ unsigned cts, N, fs, aval;
+
+ table = tegra_hdmi_audio_config_default;
+
+ /* N values are copied from spec for corresponding freq band */
+ switch (audio_freq) {
+ case AUDIO_FREQ_32K:
+ N = 4096;
+ fs = 32000;
+ aval = 24000;
+ break;
+ case AUDIO_FREQ_44_1K:
+ N = 6272;
+ fs = 44100;
+ aval = 20000;
+ break;
+ case AUDIO_FREQ_48K:
+ N = 6144;
+ fs = 48000;
+ aval = 24000;
+ break;
+ case AUDIO_FREQ_88_2K:
+ N = 12544;
+ fs = 88200;
+ aval = 20000;
+ break;
+ case AUDIO_FREQ_96K:
+ N = 12288;
+ fs = 96000;
+ aval = 24000;
+ break;
+ case AUDIO_FREQ_176_4K:
+ N = 25088;
+ fs = 176400;
+ aval = 20000;
+ break;
+ case AUDIO_FREQ_192K:
+ N = 24576;
+ fs = 192000;
+ aval = 24000;
+ break;
+ default:
+ /* we have non-matching freq band. Try to return default
+ value instead of null table */
+ return table;
+ }
+
+ /* (Average CTS value) = (fTMDS_clock * N ) / (128 * fS) */
+ cts = ((pix_clock) / (128 * fs)) * N;
+
+ table->pix_clock = pix_clock;
+ table->cts = cts;
+ table->n = N;
+ table->aval = aval;
+
+ return table;
+}
unsigned long tegra_hdmi_readl(struct tegra_dc_hdmi_data *hdmi,
unsigned long reg)
@@ -1585,7 +1651,10 @@
dev_err(&dc->ndev->dev,
"hdmi: can't set audio to %d at %d pix_clock",
audio_freq, dc->mode.pclk);
- return -EINVAL;
+ dev_err(&dc->ndev->dev,
+ "hdmi: falling back default configuration");
+ config = tegra_hdmi_get_audio_config_default(audio_freq,
+ dc->mode.pclk);
}
tegra_hdmi_writel(hdmi, 0, HDMI_NV_PDISP_HDMI_ACR_CTRL);
WayneWWW,
yes, the patch resolves the problem.
Thank you, best regards.
Ivan