Skip to content

Commit 08e02fa

Browse files
bastien-curutchetbroonie
authored andcommitted
ASoC: ti: davinci-i2s: Add T1 framing support
McBSP's data delay can be configured from 0 to 2 bit clock periods. 0 is used for DSP_B format, 1 is used for DSP_A format, 2 is unused. A data delay of 2 bit clock periods can be used to interface to 'T1 framing' devices where data stream is preceded by a 'framing bit'. On transmission, McBSP inserts a blank period (high-impedance period) before the first data bit to leave an opportunity for other devices to set this 'framing bit'. On reception, McBSP discards the 'framing bit' that precedes the data stream. Add support for the 'framing bit' according to the 'ti,T1-framing-[tx/rx]' device-tree properties. If a flag is present, the data delay is set to 2 bit clock periods regardless of the selected DAI format. Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Link: https://msgid.link/r/20240402071213.11671-14-bastien.curutchet@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 609302c commit 08e02fa

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

sound/soc/ti/davinci-i2s.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ struct davinci_mcbsp_dev {
161161

162162
int tdm_slots;
163163
int slot_width;
164+
165+
bool tx_framing_bit;
166+
bool rx_framing_bit;
164167
};
165168

166169
static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev,
@@ -580,6 +583,15 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
580583
xcr |= DAVINCI_MCBSP_XCR_XDATDLY(1);
581584
}
582585

586+
if (dev->tx_framing_bit) {
587+
xcr &= ~DAVINCI_MCBSP_XCR_XDATDLY(1);
588+
xcr |= DAVINCI_MCBSP_XCR_XDATDLY(2);
589+
}
590+
if (dev->rx_framing_bit) {
591+
rcr &= ~DAVINCI_MCBSP_RCR_RDATDLY(1);
592+
rcr |= DAVINCI_MCBSP_RCR_RDATDLY(2);
593+
}
594+
583595
if (params_channels(params) == 2) {
584596
element_cnt = 2;
585597
if (double_fmt[fmt] && dev->enable_channel_combine) {
@@ -796,6 +808,9 @@ static int davinci_i2s_probe(struct platform_device *pdev)
796808

797809
dev->base = io_base;
798810

811+
dev->tx_framing_bit = of_property_read_bool(pdev->dev.of_node, "ti,T1-framing-tx");
812+
dev->rx_framing_bit = of_property_read_bool(pdev->dev.of_node, "ti,T1-framing-rx");
813+
799814
/* setup DMA, first TX, then RX */
800815
dma_data = &dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
801816
dma_data->addr = (dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);

0 commit comments

Comments
 (0)