From: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: abdoulaye berthe <abdoulaye.berthe@amd.com>,
Wenjing Liu <Wenjing.Liu@amd.com>
Subject: [PATCH 01/30] drm/amd/display: add automated audio test support
Date: Mon, 11 Nov 2019 19:32:55 -0500 [thread overview]
Message-ID: <20191112003324.8419-2-Rodrigo.Siqueira@amd.com> (raw)
Message-ID: <20191112003255.KxvY1igHgA3y0CWC0-0oonq7nbQ_MetwHj5CW3iVoDg@z> (raw)
In-Reply-To: <20191112003324.8419-1-Rodrigo.Siqueira@amd.com>
From: abdoulaye berthe <abdoulaye.berthe@amd.com>
Signed-off-by: abdoulaye berthe <abdoulaye.berthe@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
---
.../gpu/drm/amd/display/dc/core/dc_link_dp.c | 92 +++++++++++++++++++
drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 48 ++++++++--
drivers/gpu/drm/amd/display/dc/dc_link.h | 1 +
3 files changed, 134 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index 65de32fbcc83..68749c205fa0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -2546,6 +2546,92 @@ static void dp_test_send_link_test_pattern(struct dc_link *link)
0);
}
+static void dp_test_get_audio_test_data(struct dc_link *link, bool disable_video)
+{
+ union audio_test_mode dpcd_test_mode = {0};
+ struct audio_test_pattern_type dpcd_pattern_type = {0};
+ union audio_test_pattern_period dpcd_pattern_period[AUDIO_CHANNELS_COUNT] = {0};
+ enum dp_test_pattern test_pattern = DP_TEST_PATTERN_AUDIO_OPERATOR_DEFINED;
+
+ struct pipe_ctx *pipes = link->dc->current_state->res_ctx.pipe_ctx;
+ struct pipe_ctx *pipe_ctx = &pipes[0];
+ unsigned int channel_count;
+ unsigned int channel = 0;
+ unsigned int modes = 0;
+ unsigned int sampling_rate_in_hz = 0;
+
+ // get audio test mode and test pattern parameters
+ core_link_read_dpcd(
+ link,
+ DP_TEST_AUDIO_MODE,
+ &dpcd_test_mode.raw,
+ sizeof(dpcd_test_mode));
+
+ core_link_read_dpcd(
+ link,
+ DP_TEST_AUDIO_PATTERN_TYPE,
+ &dpcd_pattern_type.value,
+ sizeof(dpcd_pattern_type));
+
+ channel_count = dpcd_test_mode.bits.channel_count + 1;
+
+ // read pattern periods for requested channels when sawTooth pattern is requested
+ if (dpcd_pattern_type.value == AUDIO_TEST_PATTERN_SAWTOOTH ||
+ dpcd_pattern_type.value == AUDIO_TEST_PATTERN_OPERATOR_DEFINED) {
+
+ test_pattern = (dpcd_pattern_type.value == AUDIO_TEST_PATTERN_SAWTOOTH) ?
+ DP_TEST_PATTERN_AUDIO_SAWTOOTH : DP_TEST_PATTERN_AUDIO_OPERATOR_DEFINED;
+ // read period for each channel
+ for (channel = 0; channel < channel_count; channel++) {
+ core_link_read_dpcd(
+ link,
+ DP_TEST_AUDIO_PERIOD_CH1 + channel,
+ &dpcd_pattern_period[channel].raw,
+ sizeof(dpcd_pattern_period[channel]));
+ }
+ }
+
+ // translate sampling rate
+ switch (dpcd_test_mode.bits.sampling_rate) {
+ case AUDIO_SAMPLING_RATE_32KHZ:
+ sampling_rate_in_hz = 32000;
+ break;
+ case AUDIO_SAMPLING_RATE_44_1KHZ:
+ sampling_rate_in_hz = 44100;
+ break;
+ case AUDIO_SAMPLING_RATE_48KHZ:
+ sampling_rate_in_hz = 48000;
+ break;
+ case AUDIO_SAMPLING_RATE_88_2KHZ:
+ sampling_rate_in_hz = 88200;
+ break;
+ case AUDIO_SAMPLING_RATE_96KHZ:
+ sampling_rate_in_hz = 96000;
+ break;
+ case AUDIO_SAMPLING_RATE_176_4KHZ:
+ sampling_rate_in_hz = 176400;
+ break;
+ case AUDIO_SAMPLING_RATE_192KHZ:
+ sampling_rate_in_hz = 192000;
+ break;
+ default:
+ sampling_rate_in_hz = 0;
+ break;
+ }
+
+ link->audio_test_data.flags.test_requested = 1;
+ link->audio_test_data.flags.disable_video = disable_video;
+ link->audio_test_data.sampling_rate = sampling_rate_in_hz;
+ link->audio_test_data.channel_count = channel_count;
+ link->audio_test_data.pattern_type = test_pattern;
+
+ if (test_pattern == DP_TEST_PATTERN_AUDIO_SAWTOOTH) {
+ for (modes = 0; modes < pipe_ctx->stream->audio_info.mode_count; modes++) {
+ link->audio_test_data.pattern_period[modes] = dpcd_pattern_period[modes].bits.pattern_period;
+ }
+ }
+}
+
static void handle_automated_test(struct dc_link *link)
{
union test_request test_request;
@@ -2575,6 +2661,12 @@ static void handle_automated_test(struct dc_link *link)
dp_test_send_link_test_pattern(link);
test_response.bits.ACK = 1;
}
+
+ if (test_request.bits.AUDIO_TEST_PATTERN) {
+ dp_test_get_audio_test_data(link, test_request.bits.TEST_AUDIO_DISABLED_VIDEO);
+ test_response.bits.ACK = 1;
+ }
+
if (test_request.bits.PHY_TEST_PATTERN) {
dp_test_send_phy_test_pattern(link);
test_response.bits.ACK = 1;
diff --git a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h
index 4d3378d61938..1b68d7c13085 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h
@@ -469,13 +469,13 @@ union training_aux_rd_interval {
/* Automated test structures */
union test_request {
struct {
- uint8_t LINK_TRAINING :1;
- uint8_t LINK_TEST_PATTRN :1;
- uint8_t EDID_READ :1;
- uint8_t PHY_TEST_PATTERN :1;
- uint8_t AUDIO_TEST_PATTERN :1;
- uint8_t RESERVED :1;
- uint8_t TEST_STEREO_3D :1;
+ uint8_t LINK_TRAINING :1;
+ uint8_t LINK_TEST_PATTRN :1;
+ uint8_t EDID_READ :1;
+ uint8_t PHY_TEST_PATTERN :1;
+ uint8_t RESERVED :1;
+ uint8_t AUDIO_TEST_PATTERN :1;
+ uint8_t TEST_AUDIO_DISABLED_VIDEO :1;
} bits;
uint8_t raw;
};
@@ -534,6 +534,40 @@ union test_misc {
unsigned char raw;
};
+union audio_test_mode {
+ struct {
+ unsigned char sampling_rate :4;
+ unsigned char channel_count :4;
+ } bits;
+ unsigned char raw;
+};
+
+union audio_test_pattern_period {
+ struct {
+ unsigned char pattern_period :4;
+ unsigned char reserved :4;
+ } bits;
+ unsigned char raw;
+};
+
+struct audio_test_pattern_type {
+ unsigned char value;
+};
+
+struct dp_audio_test_data_flags {
+ uint8_t test_requested :1;
+ uint8_t disable_video :1;
+};
+
+struct dp_audio_test_data {
+
+ struct dp_audio_test_data_flags flags;
+ uint8_t sampling_rate;
+ uint8_t channel_count;
+ uint8_t pattern_type;
+ uint8_t pattern_period[8];
+};
+
/* FEC capability DPCD register field bits-*/
union dpcd_fec_capability {
struct {
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h b/drivers/gpu/drm/amd/display/dc/dc_link.h
index 8971ce3a5480..314d2043cd78 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_link.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -94,6 +94,7 @@ struct dc_link {
struct dc_lane_settings cur_lane_setting;
struct dc_link_settings preferred_link_setting;
struct dc_link_training_overrides preferred_training_settings;
+ struct dp_audio_test_data audio_test_data;
uint8_t ddc_hw_inst;
--
2.24.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-11-12 0:33 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 0:32 [PATCH 00/30] DC Patches 11 Nov 2019 Rodrigo Siqueira
2019-11-12 0:32 ` Rodrigo Siqueira
[not found] ` <20191112003324.8419-1-Rodrigo.Siqueira-5C7GfCeVMHo@public.gmane.org>
2019-11-12 0:32 ` Rodrigo Siqueira [this message]
2019-11-12 0:32 ` [PATCH 01/30] drm/amd/display: add automated audio test support Rodrigo Siqueira
2019-11-12 0:32 ` [PATCH 02/30] drm/amd/display: Renoir chroma viewport WA change formula Rodrigo Siqueira
2019-11-12 0:32 ` Rodrigo Siqueira
2019-11-12 0:32 ` [PATCH 03/30] drm/amd/display: Renoir chroma viewport WA Read the correct register Rodrigo Siqueira
2019-11-12 0:32 ` Rodrigo Siqueira
2019-11-12 0:32 ` [PATCH 04/30] drm/amd/display: Add hubp clock status in DTN log for Navi Rodrigo Siqueira
2019-11-12 0:32 ` Rodrigo Siqueira
2019-11-12 0:32 ` [PATCH 05/30] drm/amd/display: Update background color in bottommost mpcc Rodrigo Siqueira
2019-11-12 0:32 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 06/30] drm/amd/display: Fix incorrect deep color setting in YCBCR420 modes Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 07/30] drm/amd/display: 3.2.59 Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 08/30] drm/amd/display: Fix stereo with DCC enabled Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 09/30] drm/amd/display: Changes in dc to allow full update in some cases Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 10/30] drm/amd/display: Add DMUB service function check if hw initialized Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 11/30] drm/amd/display: Add DMUB param to load inst const from driver Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 12/30] drm/amd/display: Add debugfs initalization on mst connectors Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 13/30] drm/amd/display: Connect DIG FE to its BE before link training starts Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 14/30] drm/amd/display: Clean up some code with unused registers Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 15/30] drm/amd/display: revert change causing DTN hang for RV Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 16/30] drm/amd/display: Fix debugfs on MST connectors Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 17/30] drm/amd/display: cleanup of construct and destruct funcs Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 18/30] drm/amd/display: add color space option when sending link test pattern Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 19/30] drm/amd/display: Adjust DML workaround threshold Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 20/30] drm/amd/display: Add debug trace for dmcub FW autoload Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 21/30] drm/amd/display: 3.2.60 Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 22/30] drm/amd/display: add debugfs sdp hook up function for Navi Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 23/30] drm/amd/display: Avoid conflict between HDR multiplier and 3dlut Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 24/30] drm/amd/display: Don't spin forever waiting for DMCUB phy/auto init Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 25/30] drm/amd/display: cleanup of function pointer tables Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 26/30] drm/amd/display: DML Validation Dump/Check with Logging Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 27/30] drm/amd/display: Spin for DMCUB PHY init in DC Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 28/30] drm/amd/display: Use a temporary copy of the current state when updating DSC config Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 29/30] drm/amd/display: Add DSC 422Native debug option Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
2019-11-12 0:33 ` [PATCH 30/30] drm/amd/display: Add Navi10 DMUB VBIOS code Rodrigo Siqueira
2019-11-12 0:33 ` Rodrigo Siqueira
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191112003324.8419-2-Rodrigo.Siqueira@amd.com \
--to=rodrigo.siqueira@amd.com \
--cc=Wenjing.Liu@amd.com \
--cc=abdoulaye.berthe@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).