Skip to contentSkip to conversation

Enable HDMI audio on DCE12

PATCH In review [email protected] 2 participants 7 messages Oct 31, 2017 – Nov 1, 2017 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Enable HDMI audio on DCE12

From: "Leo (Sunpeng) Li" <[email protected]>

This series properly enables audio on DCE12 by adding the relevant registers, and reading them into the software structs.

Previously, this was only working because the registers were being ignored. Now that they're being considered, HDMI audio on DCE12 stopped working due to missing code that fetched the necessary registers.

Leo (Sunpeng) Li (2):
drm/amd: Add DCE12 resource strap registers drm/amd/display: Read resource_straps from registers for DCE12

 drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c   | 15 +++++++++------
 .../drm/amd/include/asic_reg/vega10/DC/dce_12_0_offset.h  |  4 ++++
 .../drm/amd/include/asic_reg/vega10/DC/dce_12_0_sh_mask.h |  8 ++++++++
 3 files changed, 21 insertions(+), 6 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1509481738-31306-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/2 drm/amd: Add DCE12 resource strap registers

From: "Leo (Sunpeng) Li" <[email protected]>

We need them for initializing audio properly.

---
 drivers/gpu/drm/amd/include/asic_reg/vega10/DC/dce_12_0_offset.h  | 4 ++++
 drivers/gpu/drm/amd/include/asic_reg/vega10/DC/dce_12_0_sh_mask.h | 8 ++++++++
 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/include/asic_reg/vega10/DC/dce_12_0_offset.h +4 -0
index 75b660d..f730d06 100644
@@ -1841,6 +1841,10 @@
 #define mmUNIPHYG_CHANNEL_XBAR_CNTL_BASE_IDX                                                           2
 #define mmDCIO_WRCMD_DELAY                                                                             0x2094
 #define mmDCIO_WRCMD_DELAY_BASE_IDX                                                                    2
+#define mmDC_PINSTRAPS                                                                                 0x2096
+#define mmDC_PINSTRAPS_BASE_IDX                                                                        2
+#define mmCC_DC_MISC_STRAPS                                                                            0x2097
+#define mmCC_DC_MISC_STRAPS_BASE_IDX                                                                   2
 #define mmDC_DVODATA_CONFIG                                                                            0x2098
 #define mmDC_DVODATA_CONFIG_BASE_IDX                                                                   2
 #define mmLVTMA_PWRSEQ_CNTL                                                                            0x2099
drivers/gpu/drm/amd/include/asic_reg/vega10/DC/dce_12_0_sh_mask.h +8 -0
index d8ad862..6d3162c 100644
@@ -2447,6 +2447,14 @@
 //DCCG_CBUS_WRCMD_DELAY
 #define DCCG_CBUS_WRCMD_DELAY__CBUS_PLL_WRCMD_DELAY__SHIFT                                                    0x0
 #define DCCG_CBUS_WRCMD_DELAY__CBUS_PLL_WRCMD_DELAY_MASK                                                      0x0000000FL
+//DC_PINSTRAPS
+#define DC_PINSTRAPS__DC_PINSTRAPS_AUDIO__SHIFT                                                               0xe
+#define DC_PINSTRAPS__DC_PINSTRAPS_AUDIO_MASK                                                                 0x0000C000L
+//CC_DC_MISC_STRAPS
+#define CC_DC_MISC_STRAPS__HDMI_DISABLE__SHIFT                                                                0x6
+#define CC_DC_MISC_STRAPS__AUDIO_STREAM_NUMBER__SHIFT                                                         0x8
+#define CC_DC_MISC_STRAPS__HDMI_DISABLE_MASK                                                                  0x00000040L
+#define CC_DC_MISC_STRAPS__AUDIO_STREAM_NUMBER_MASK                                                           0x00000700L
 //DCCG_DS_DTO_INCR
 #define DCCG_DS_DTO_INCR__DCCG_DS_DTO_INCR__SHIFT                                                             0x0
 #define DCCG_DS_DTO_INCR__DCCG_DS_DTO_INCR_MASK                                                               0xFFFFFFFFL
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/2 drm/amd/display: Read resource_straps from registers for DCE12

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Now that the registers exist, assign them to the resource_straps struct.

---
 drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +9 -6
index 3ed28a8..5023a03 100644
@@ -501,12 +501,15 @@ static void read_dce_straps(
 	struct dc_context *ctx,
 	struct resource_straps *straps)
 {
-	/* TODO: Registers are missing */
-	/*REG_GET_2(CC_DC_HDMI_STRAPS,
-			HDMI_DISABLE, &straps->hdmi_disable,
-			AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
-
-	REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);*/
+	uint32_t reg_val = dm_read_reg_soc15(ctx, mmCC_DC_MISC_STRAPS, 0);
+	straps->audio_stream_number = get_reg_field_value(
+			reg_val, CC_DC_MISC_STRAPS, AUDIO_STREAM_NUMBER);
+	straps->hdmi_disable = get_reg_field_value(
+				reg_val, CC_DC_MISC_STRAPS, HDMI_DISABLE);
+
+	reg_val = dm_read_reg_soc15(ctx, mmDC_PINSTRAPS, 0);
+	straps->dc_pinstraps_audio = get_reg_field_value(
+			reg_val, DC_PINSTRAPS, DC_PINSTRAPS_AUDIO);
 }
 
 static struct audio *create_audio(
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1509481738-31306-3-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#5 lore raw

Re: [PATCH 2/2] drm/amd/display: Read resource_straps from registers for DCE12

Quoted 18 lines · On 2017-10-31 04:28 PM, [email protected] wrote:

From: "Leo (Sunpeng) Li" <[email protected]>

Now that the registers exist, assign them to the resource_straps struct.

---
 drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +0 -1
index 3ed28a8..5023a03 100644
@@ -501,12 +501,15 @@ static void read_dce_straps(
 	struct dc_context *ctx,
 	struct resource_straps *straps)
 {
-	/* TODO: Registers are missing */

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c static void read_dce_straps( · line 508

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +5 -5
-	/*REG_GET_2(CC_DC_HDMI_STRAPS,
-			HDMI_DISABLE, &straps->hdmi_disable,
-			AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
-
-	REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);*/
+	uint32_t reg_val = dm_read_reg_soc15(ctx, mmCC_DC_MISC_STRAPS, 0);
+	straps->audio_stream_number = get_reg_field_value(
+			reg_val, CC_DC_MISC_STRAPS, AUDIO_STREAM_NUMBER);
+	straps->hdmi_disable = get_reg_field_value(
+				reg_val, CC_DC_MISC_STRAPS, HDMI_DISABLE);

The indentation looks wrong. I know we have the same in other parts of this code but let's try to consider this for new code.

In particular reg_val should be on the same line as the function call, the rest should be on new lines, aligned with tabs and spaces to reg_val.

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c static void read_dce_straps( · line 512

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +4 -0
+
+	reg_val = dm_read_reg_soc15(ctx, mmDC_PINSTRAPS, 0);
+	straps->dc_pinstraps_audio = get_reg_field_value(
+			reg_val, DC_PINSTRAPS, DC_PINSTRAPS_AUDIO);

Nitpick on indentation here as well.

With those nitpicks addressed the series is

Harry

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c static void read_dce_straps( · line 515

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +0 -0
 }
 
 static struct audio *create_audio(

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw

PATCH v2 2/2 drm/amd/display: Read resource_straps from registers for DCE12

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Now that the registers exist, assign them to the resource_straps struct.

v2: Fix indentation

---
 .../gpu/drm/amd/display/dc/dce120/dce120_resource.c    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +12 -6
index 3ed28a8..15509a8 100644
@@ -501,12 +501,18 @@ static void read_dce_straps(
 	struct dc_context *ctx,
 	struct resource_straps *straps)
 {
-	/* TODO: Registers are missing */
-	/*REG_GET_2(CC_DC_HDMI_STRAPS,
-			HDMI_DISABLE, &straps->hdmi_disable,
-			AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
-
-	REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);*/
+	uint32_t reg_val = dm_read_reg_soc15(ctx, mmCC_DC_MISC_STRAPS, 0);
+	straps->audio_stream_number = get_reg_field_value(reg_val, 
+							  CC_DC_MISC_STRAPS,
+							  AUDIO_STREAM_NUMBER);
+	straps->hdmi_disable = get_reg_field_value(reg_val,
+						   CC_DC_MISC_STRAPS,
+						   HDMI_DISABLE);
+
+	reg_val = dm_read_reg_soc15(ctx, mmDC_PINSTRAPS, 0);
+	straps->dc_pinstraps_audio = get_reg_field_value(reg_val,
+							 DC_PINSTRAPS,
+							 DC_PINSTRAPS_AUDIO);
 }
 
 static struct audio *create_audio(
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#7 lore raw

PATCH v3 2/2 drm/amd/display: Read resource_straps from registers for DCE12

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Now that the registers exist, assign them to the resource_straps struct.

v2: Fix indentation
v3: Fix trailing whitespace and checkpatch warnings.

---
 .../gpu/drm/amd/display/dc/dce120/dce120_resource.c   | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +13 -6
index 3ed28a8..5c48c22 100644
@@ -501,12 +501,19 @@ static void read_dce_straps(
 	struct dc_context *ctx,
 	struct resource_straps *straps)
 {
-	/* TODO: Registers are missing */
-	/*REG_GET_2(CC_DC_HDMI_STRAPS,
-			HDMI_DISABLE, &straps->hdmi_disable,
-			AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
-
-	REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);*/
+	uint32_t reg_val = dm_read_reg_soc15(ctx, mmCC_DC_MISC_STRAPS, 0);
+
+	straps->audio_stream_number = get_reg_field_value(reg_val,
+							  CC_DC_MISC_STRAPS,
+							  AUDIO_STREAM_NUMBER);
+	straps->hdmi_disable = get_reg_field_value(reg_val,
+						   CC_DC_MISC_STRAPS,
+						   HDMI_DISABLE);
+
+	reg_val = dm_read_reg_soc15(ctx, mmDC_PINSTRAPS, 0);
+	straps->dc_pinstraps_audio = get_reg_field_value(reg_val,
+							 DC_PINSTRAPS,
+							 DC_PINSTRAPS_AUDIO);
 }
 
 static struct audio *create_audio(
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1509546291-14336-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#9 lore raw

Re: [PATCH V3 2/2] drm/amd/display: Read resource_straps from registers for DCE12

Quoted 8 lines · On 2017-11-01 10:24 AM, [email protected] wrote:

From: "Leo (Sunpeng) Li" <[email protected]>

Now that the registers exist, assign them to the resource_straps struct.

v2: Fix indentation
v3: Fix trailing whitespace and checkpatch warnings.

Series is

Harry

Quoted 25 lines
---
 .../gpu/drm/amd/display/dc/dce120/dce120_resource.c   | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +6 -6
index 3ed28a8..5c48c22 100644
@@ -501,12 +501,19 @@ static void read_dce_straps(
 	struct dc_context *ctx,
 	struct resource_straps *straps)
 {
-	/* TODO: Registers are missing */
-	/*REG_GET_2(CC_DC_HDMI_STRAPS,
-			HDMI_DISABLE, &straps->hdmi_disable,
-			AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
-
-	REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);*/
+	uint32_t reg_val = dm_read_reg_soc15(ctx, mmCC_DC_MISC_STRAPS, 0);
+
+	straps->audio_stream_number = get_reg_field_value(reg_val,
+							  CC_DC_MISC_STRAPS,
+							  AUDIO_STREAM_NUMBER);
+	straps->hdmi_disable = get_reg_field_value(reg_val,

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c static void read_dce_straps( · line 519

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +7 -0
+						   CC_DC_MISC_STRAPS,
+						   HDMI_DISABLE);
+
+	reg_val = dm_read_reg_soc15(ctx, mmDC_PINSTRAPS, 0);
+	straps->dc_pinstraps_audio = get_reg_field_value(reg_val,
+							 DC_PINSTRAPS,
+							 DC_PINSTRAPS_AUDIO);
 }
 
 static struct audio *create_audio(

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx