Skip to content

Commit 2ad63dc

Browse files
V Sujith Kumar Reddybroonie
authored andcommitted
ASoC: qcom: sc7180: Add support for audio over DP
Add support for audio playback over DP in lpass sc7180 platform driver. Update lpass_variant structure for hdmi data configuaration. Signed-off-by: V Sujith Kumar Reddy <[email protected]> Signed-off-by: Srinivasa Rao <[email protected]> Tested-by: Srinivas Kandagatla <[email protected]> Reviewed-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 03f20e2 commit 2ad63dc

File tree

1 file changed

+102
-14
lines changed

1 file changed

+102
-14
lines changed

sound/soc/qcom/lpass-sc7180.c

Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,38 +60,65 @@ static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
6060
.probe = &asoc_qcom_lpass_cpu_dai_probe,
6161
.ops = &asoc_qcom_lpass_cpu_dai_ops,
6262
},
63+
[LPASS_DP_RX] = {
64+
.id = LPASS_DP_RX,
65+
.name = "Hdmi",
66+
.playback = {
67+
.stream_name = "Hdmi Playback",
68+
.formats = SNDRV_PCM_FMTBIT_S24,
69+
.rates = SNDRV_PCM_RATE_48000,
70+
.rate_min = 48000,
71+
.rate_max = 48000,
72+
.channels_min = 2,
73+
.channels_max = 2,
74+
},
75+
.ops = &asoc_qcom_lpass_hdmi_dai_ops,
76+
},
6377
};
6478

6579
static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
66-
int direction)
80+
int direction, unsigned int dai_id)
6781
{
6882
struct lpass_variant *v = drvdata->variant;
6983
int chan = 0;
7084

71-
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
72-
chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
73-
v->rdma_channels);
85+
if (dai_id == LPASS_DP_RX) {
86+
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
87+
chan = find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
88+
v->hdmi_rdma_channels);
89+
90+
if (chan >= v->hdmi_rdma_channels)
91+
return -EBUSY;
92+
}
93+
set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
94+
} else {
95+
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
96+
chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
97+
v->rdma_channels);
7498

7599
if (chan >= v->rdma_channels)
76100
return -EBUSY;
77-
} else {
78-
chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
101+
} else {
102+
chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
79103
v->wrdma_channel_start +
80104
v->wrdma_channels,
81105
v->wrdma_channel_start);
82106

83-
if (chan >= v->wrdma_channel_start + v->wrdma_channels)
84-
return -EBUSY;
85-
}
86-
87-
set_bit(chan, &drvdata->dma_ch_bit_map);
107+
if (chan >= v->wrdma_channel_start + v->wrdma_channels)
108+
return -EBUSY;
109+
}
88110

111+
set_bit(chan, &drvdata->dma_ch_bit_map);
112+
}
89113
return chan;
90114
}
91115

92-
static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
116+
static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, unsigned int dai_id)
93117
{
94-
clear_bit(chan, &drvdata->dma_ch_bit_map);
118+
if (dai_id == LPASS_DP_RX)
119+
clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
120+
else
121+
clear_bit(chan, &drvdata->dma_ch_bit_map);
95122

96123
return 0;
97124
}
@@ -144,6 +171,9 @@ static struct lpass_variant sc7180_data = {
144171
.rdma_reg_base = 0xC000,
145172
.rdma_reg_stride = 0x1000,
146173
.rdma_channels = 5,
174+
.hdmi_rdma_reg_base = 0x64000,
175+
.hdmi_rdma_reg_stride = 0x1000,
176+
.hdmi_rdma_channels = 4,
147177
.dmactl_audif_start = 1,
148178
.wrdma_reg_base = 0x18000,
149179
.wrdma_reg_stride = 0x1000,
@@ -163,7 +193,7 @@ static struct lpass_variant sc7180_data = {
163193
.rdma_dyncclk = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
164194
.rdma_bursten = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
165195
.rdma_wpscnt = REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
166-
.rdma_intf = REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
196+
.rdma_intf = REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
167197
.rdma_fifowm = REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
168198
.rdma_enable = REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
169199

@@ -174,6 +204,64 @@ static struct lpass_variant sc7180_data = {
174204
.wrdma_fifowm = REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
175205
.wrdma_enable = REG_FIELD_ID(0x18000, 0, 0, 4, 0x1000),
176206

207+
.hdmi_tx_ctl_addr = 0x1000,
208+
.hdmi_legacy_addr = 0x1008,
209+
.hdmi_vbit_addr = 0x610c0,
210+
.hdmi_ch_lsb_addr = 0x61048,
211+
.hdmi_ch_msb_addr = 0x6104c,
212+
.ch_stride = 0x8,
213+
.hdmi_parity_addr = 0x61034,
214+
.hdmi_dmactl_addr = 0x61038,
215+
.hdmi_dma_stride = 0x4,
216+
.hdmi_DP_addr = 0x610c8,
217+
.hdmi_sstream_addr = 0x6101c,
218+
.hdmi_irq_reg_base = 0x63000,
219+
.hdmi_irq_ports = 1,
220+
221+
.hdmi_rdma_dyncclk = REG_FIELD_ID(0x64000, 14, 14, 4, 0x1000),
222+
.hdmi_rdma_bursten = REG_FIELD_ID(0x64000, 13, 13, 4, 0x1000),
223+
.hdmi_rdma_burst8 = REG_FIELD_ID(0x64000, 15, 15, 4, 0x1000),
224+
.hdmi_rdma_burst16 = REG_FIELD_ID(0x64000, 16, 16, 4, 0x1000),
225+
.hdmi_rdma_dynburst = REG_FIELD_ID(0x64000, 18, 18, 4, 0x1000),
226+
.hdmi_rdma_wpscnt = REG_FIELD_ID(0x64000, 10, 12, 4, 0x1000),
227+
.hdmi_rdma_fifowm = REG_FIELD_ID(0x64000, 1, 5, 4, 0x1000),
228+
.hdmi_rdma_enable = REG_FIELD_ID(0x64000, 0, 0, 4, 0x1000),
229+
230+
.sstream_en = REG_FIELD(0x6101c, 0, 0),
231+
.dma_sel = REG_FIELD(0x6101c, 1, 2),
232+
.auto_bbit_en = REG_FIELD(0x6101c, 3, 3),
233+
.layout = REG_FIELD(0x6101c, 4, 4),
234+
.layout_sp = REG_FIELD(0x6101c, 5, 8),
235+
.set_sp_on_en = REG_FIELD(0x6101c, 10, 10),
236+
.dp_audio = REG_FIELD(0x6101c, 11, 11),
237+
.dp_staffing_en = REG_FIELD(0x6101c, 12, 12),
238+
.dp_sp_b_hw_en = REG_FIELD(0x6101c, 13, 13),
239+
240+
.mute = REG_FIELD(0x610c8, 0, 0),
241+
.as_sdp_cc = REG_FIELD(0x610c8, 1, 3),
242+
.as_sdp_ct = REG_FIELD(0x610c8, 4, 7),
243+
.aif_db4 = REG_FIELD(0x610c8, 8, 15),
244+
.frequency = REG_FIELD(0x610c8, 16, 21),
245+
.mst_index = REG_FIELD(0x610c8, 28, 29),
246+
.dptx_index = REG_FIELD(0x610c8, 30, 31),
247+
248+
.soft_reset = REG_FIELD(0x1000, 31, 31),
249+
.force_reset = REG_FIELD(0x1000, 30, 30),
250+
251+
.use_hw_chs = REG_FIELD(0x61038, 0, 0),
252+
.use_hw_usr = REG_FIELD(0x61038, 1, 1),
253+
.hw_chs_sel = REG_FIELD(0x61038, 2, 4),
254+
.hw_usr_sel = REG_FIELD(0x61038, 5, 6),
255+
256+
.replace_vbit = REG_FIELD(0x610c0, 0, 0),
257+
.vbit_stream = REG_FIELD(0x610c0, 1, 1),
258+
259+
.legacy_en = REG_FIELD(0x1008, 0, 0),
260+
.calc_en = REG_FIELD(0x61034, 0, 0),
261+
.lsb_bits = REG_FIELD(0x61048, 0, 31),
262+
.msb_bits = REG_FIELD(0x6104c, 0, 31),
263+
264+
177265
.clk_name = (const char*[]) {
178266
"pcnoc-sway-clk",
179267
"audio-core",

0 commit comments

Comments
 (0)