Skip to contentSkip to conversation

Creating and enabling BT I2S controller instance for AMD APUs

PATCH New Vijendar Mukunda 1 participant 5 messages Feb 16, 2018 1 message not in the archive

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

cover Creating and enabling BT I2S controller instance for AMD APUs

This patch set updates the AMD GPU drivers.
This patch set creates BT I2S controller instance.
Default enabled I2S controller instance is I2S SP instance.
There is a requirement to enable BT I2S controller Instance along with I2S SP controller instance.

The current code is based on drm-next branch.

Akshu Agrawal (2):
drm/amd/amdgpu: Adds DW_I2S_QUIRK_COMP_PARAM1 to BT playback drm/amd/amdgpu: Fixes resource conflict issue on BT instance

Vijendar Mukunda (2):
drm/amd/amdgpu: creating two I2S instances for stoney/cz drm/amd/amdgpu: Enabling BT I2S config for muxed pins

 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 83 +++++++++++++++++++++++++++++----
 1 file changed, 75 insertions(+), 8 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): 1518770646-8538-1-git-send-email-Vijendar.Mukunda-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/4 drm/amd/amdgpu: creating two I2S instances for stoney/cz

Creating two I2S instances for Stoney/cz platforms.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 75 +++++++++++++++++++++++++++++----
 1 file changed, 66 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +66 -9
index a29362f..0f17663 100644
@@ -57,6 +57,12 @@
 #define ACP_I2S_COMP2_CAP_REG_OFFSET		0xa8
 #define ACP_I2S_COMP1_PLAY_REG_OFFSET		0x6c
 #define ACP_I2S_COMP2_PLAY_REG_OFFSET		0x68
+#define ACP_BT_PLAY_REGS_START			0x14970
+#define ACP_BT_PLAY_REGS_END			0x14a24
+#define ACP_BT_CAP_REGS_START			0x14970
+#define ACP_BT_CAP_REGS_END			0x14a24
+#define ACP_BT_COMP1_REG_OFFSET			0xac
+#define ACP_BT_COMP2_REG_OFFSET			0xa8
 
 #define mmACP_PGFSM_RETAIN_REG			0x51c9
 #define mmACP_PGFSM_CONFIG_REG			0x51ca
@@ -77,7 +83,7 @@
 #define ACP_SOFT_RESET_DONE_TIME_OUT_VALUE	0x000000FF
 
 #define ACP_TIMEOUT_LOOP			0x000000FF
-#define ACP_DEVS				3
+#define ACP_DEVS				5
 #define ACP_SRC_ID				162
 
 enum {
@@ -317,14 +323,14 @@ static int acp_hw_init(void *handle)
 	if (adev->acp.acp_cell == NULL)
 		return -ENOMEM;
 
-	adev->acp.acp_res = kzalloc(sizeof(struct resource) * 4, GFP_KERNEL);
+	adev->acp.acp_res = kzalloc(sizeof(struct resource) * 6, GFP_KERNEL);
 
 	if (adev->acp.acp_res == NULL) {
 		kfree(adev->acp.acp_cell);
 		return -ENOMEM;
 	}
 
-	i2s_pdata = kzalloc(sizeof(struct i2s_platform_data) * 2, GFP_KERNEL);
+	i2s_pdata = kzalloc(sizeof(struct i2s_platform_data) * 4, GFP_KERNEL);
 	if (i2s_pdata == NULL) {
 		kfree(adev->acp.acp_res);
 		kfree(adev->acp.acp_cell);
@@ -359,6 +365,36 @@ static int acp_hw_init(void *handle)
 	i2s_pdata[1].i2s_reg_comp1 = ACP_I2S_COMP1_CAP_REG_OFFSET;
 	i2s_pdata[1].i2s_reg_comp2 = ACP_I2S_COMP2_CAP_REG_OFFSET;
 
+	switch (adev->asic_type) {
+	case CHIP_STONEY:
+		i2s_pdata[2].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET |
+			DW_I2S_QUIRK_16BIT_IDX_OVERRIDE;
+		break;
+	default:
+		i2s_pdata[2].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET;
+	}
+
+	i2s_pdata[2].cap = DWC_I2S_PLAY;
+	i2s_pdata[2].snd_rates = SNDRV_PCM_RATE_8000_96000;
+	i2s_pdata[2].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET;
+	i2s_pdata[2].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET;
+
+	switch (adev->asic_type) {
+	case CHIP_STONEY:
+		i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET |
+			DW_I2S_QUIRK_COMP_PARAM1 |
+			DW_I2S_QUIRK_16BIT_IDX_OVERRIDE;
+		break;
+	default:
+		i2s_pdata[3].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET |
+			DW_I2S_QUIRK_COMP_PARAM1;
+	}
+
+	i2s_pdata[3].cap = DWC_I2S_RECORD;
+	i2s_pdata[3].snd_rates = SNDRV_PCM_RATE_8000_96000;
+	i2s_pdata[3].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET;
+	i2s_pdata[3].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET;
+
 	adev->acp.acp_res[0].name = "acp2x_dma";
 	adev->acp.acp_res[0].flags = IORESOURCE_MEM;
 	adev->acp.acp_res[0].start = acp_base;
@@ -374,13 +410,23 @@ static int acp_hw_init(void *handle)
 	adev->acp.acp_res[2].start = acp_base + ACP_I2S_CAP_REGS_START;
 	adev->acp.acp_res[2].end = acp_base + ACP_I2S_CAP_REGS_END;
 
-	adev->acp.acp_res[3].name = "acp2x_dma_irq";
-	adev->acp.acp_res[3].flags = IORESOURCE_IRQ;
-	adev->acp.acp_res[3].start = amdgpu_irq_create_mapping(adev, 162);
-	adev->acp.acp_res[3].end = adev->acp.acp_res[3].start;
+	adev->acp.acp_res[3].name = "acp2x_dw_bt_i2s_play";
+	adev->acp.acp_res[3].flags = IORESOURCE_MEM;
+	adev->acp.acp_res[3].start = acp_base + ACP_BT_PLAY_REGS_START;
+	adev->acp.acp_res[3].end = acp_base + ACP_BT_PLAY_REGS_END;
+
+	adev->acp.acp_res[4].name = "acp2x_dw_bt_i2s_cap";
+	adev->acp.acp_res[4].flags = IORESOURCE_MEM;
+	adev->acp.acp_res[4].start = acp_base + ACP_BT_CAP_REGS_START;
+	adev->acp.acp_res[4].end = acp_base + ACP_BT_CAP_REGS_END;
+
+	adev->acp.acp_res[5].name = "acp2x_dma_irq";
+	adev->acp.acp_res[5].flags = IORESOURCE_IRQ;
+	adev->acp.acp_res[5].start = amdgpu_irq_create_mapping(adev, 162);
+	adev->acp.acp_res[5].end = adev->acp.acp_res[5].start;
 
 	adev->acp.acp_cell[0].name = "acp_audio_dma";
-	adev->acp.acp_cell[0].num_resources = 4;
+	adev->acp.acp_cell[0].num_resources = 6;
 	adev->acp.acp_cell[0].resources = &adev->acp.acp_res[0];
 	adev->acp.acp_cell[0].platform_data = &adev->asic_type;
 	adev->acp.acp_cell[0].pdata_size = sizeof(adev->asic_type);
@@ -397,6 +443,18 @@ static int acp_hw_init(void *handle)
 	adev->acp.acp_cell[2].platform_data = &i2s_pdata[1];
 	adev->acp.acp_cell[2].pdata_size = sizeof(struct i2s_platform_data);
 
+	adev->acp.acp_cell[3].name = "designware-i2s";
+	adev->acp.acp_cell[3].num_resources = 1;
+	adev->acp.acp_cell[3].resources = &adev->acp.acp_res[3];
+	adev->acp.acp_cell[3].platform_data = &i2s_pdata[2];
+	adev->acp.acp_cell[3].pdata_size = sizeof(struct i2s_platform_data);
+
+	adev->acp.acp_cell[4].name = "designware-i2s";
+	adev->acp.acp_cell[4].num_resources = 1;
+	adev->acp.acp_cell[4].resources = &adev->acp.acp_res[4];
+	adev->acp.acp_cell[4].platform_data = &i2s_pdata[3];
+	adev->acp.acp_cell[4].pdata_size = sizeof(struct i2s_platform_data);
+
 	r = mfd_add_hotplug_devices(adev->acp.parent, adev->acp.acp_cell,
 								ACP_DEVS);
 	if (r)
@@ -452,7 +510,6 @@ static int acp_hw_init(void *handle)
 	val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
 	val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
 	cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val);
-
 	return 0;
 }
 
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/4 drm/amd/amdgpu: Enabling BT I2S config for muxed pins

In reply to a message not in the archive

Enabling BT I2S config for muxed pins.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +7 -0
index 0f17663..031c09e 100644
@@ -76,6 +76,8 @@
 #define mmACP_CONTROL				0x5131
 #define mmACP_STATUS				0x5133
 #define mmACP_SOFT_RESET			0x5134
+#define mmACP_BT_UART_PAD_SELECT		0x51D7
+#define ACP_BT_UART_PAD_SELECT_MASK		0x1
 #define ACP_CONTROL__ClkEn_MASK 		0x1
 #define ACP_SOFT_RESET__SoftResetAud_MASK 	0x100
 #define ACP_SOFT_RESET__SoftResetAudDone_MASK	0x1000000
@@ -510,6 +512,11 @@ static int acp_hw_init(void *handle)
 	val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET);
 	val &= ~ACP_SOFT_RESET__SoftResetAud_MASK;
 	cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val);
+	/*For BT instance change pins from UART to BT */
+	val = cgs_read_register(adev->acp.cgs_device, mmACP_BT_UART_PAD_SELECT);
+	val |= ACP_BT_UART_PAD_SELECT_MASK;
+	cgs_write_register(adev->acp.cgs_device, mmACP_BT_UART_PAD_SELECT, val);
+
 	return 0;
 }
 
Signature · 6 lines
2.7.4

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

PATCH 3/4 drm/amd/amdgpu: Adds DW_I2S_QUIRK_COMP_PARAM1 to BT playback

In reply to a message not in the archive

From: Akshu Agrawal <[email protected]>

DW_I2S_QUIRK_COMP_PARAM1 ensures cpu dai for playback shows capability of playback only. This enables the driver to have 2 separate cpu dai for playback and capture each.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +3 -1
index 031c09e..1bc463a 100644
@@ -370,10 +370,12 @@ static int acp_hw_init(void *handle)
 	switch (adev->asic_type) {
 	case CHIP_STONEY:
 		i2s_pdata[2].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET |
+			DW_I2S_QUIRK_COMP_PARAM1 |
 			DW_I2S_QUIRK_16BIT_IDX_OVERRIDE;
 		break;
 	default:
-		i2s_pdata[2].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET;
+		i2s_pdata[2].quirks = DW_I2S_QUIRK_COMP_REG_OFFSET |
+			DW_I2S_QUIRK_COMP_PARAM1;
 	}
 
 	i2s_pdata[2].cap = DWC_I2S_PLAY;
Signature · 6 lines
2.7.4

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

PATCH 4/4 drm/amd/amdgpu: Fixes resource conflict issue on BT instance

In reply to a message not in the archive

From: Akshu Agrawal <[email protected]>

The patch uses shared resources to map same register address space on 2 cpu dais.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +1 -0
index 1bc463a..598921b 100644
@@ -398,6 +398,7 @@ static int acp_hw_init(void *handle)
 	i2s_pdata[3].snd_rates = SNDRV_PCM_RATE_8000_96000;
 	i2s_pdata[3].i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET;
 	i2s_pdata[3].i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET;
+	i2s_pdata[3].shared = true;
 
 	adev->acp.acp_res[0].name = "acp2x_dma";
 	adev->acp.acp_res[0].flags = IORESOURCE_MEM;
Signature · 6 lines
2.7.4

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