[PATCH 1/1] ASoC: McASP: Add device tree binding for defining separate clock and sync used by tx and rx.

Marek Belisko marek.belisko at gmail.com
Tue Apr 30 20:07:18 EST 2013


Add new property tx-rx-clk-separate which we can distinquish between common
and separate clock for tx and rx blocks.

Signed-off-by: Marek Belisko <marek.belisko at streamunlimited.com>
---
 .../bindings/sound/davinci-mcasp-audio.txt         |    2 ++
 include/linux/platform_data/davinci_asp.h          |    1 +
 sound/soc/davinci/davinci-mcasp.c                  |   11 ++++++++++-
 sound/soc/davinci/davinci-mcasp.h                  |    1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
index 374e145..9afd2a0 100644
--- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -23,6 +23,8 @@ Optional properties:
 - rx-num-evt : FIFO levels.
 - sram-size-playback : size of sram to be allocated during playback
 - sram-size-capture  : size of sram to be allocated during capture
+- tx-rx-clk-separate : separate clock and frame sync used by transmit and
+				receive sections
 
 Example:
 
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 8db5ae0..da3099b 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -84,6 +84,7 @@ struct snd_platform_data {
 	u8 version;
 	u8 txnumevt;
 	u8 rxnumevt;
+	u8 tx_rx_clk_separate;
 };
 
 enum {
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 2953c55..849a187 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -771,7 +771,12 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
 	for (i = 0; i < active_slots; i++)
 		mask |= (1 << i);
 
-	mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
+	if (dev->tx_rx_clk_separate == 1)
+		mcasp_set_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG,
+				TX_ASYNC);
+	else
+		mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG,
+				TX_ASYNC);
 
 	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		/* bit stream is MSB first  with no delay */
@@ -1121,6 +1126,9 @@ static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
 	if (ret >= 0)
 		pdata->sram_size_capture = val;
 
+	if (of_find_property(np, "tx-rx-clk-separate", NULL))
+		pdata->tx_rx_clk_separate = 1;
+
 	return  pdata;
 
 nodata:
@@ -1191,6 +1199,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 	dev->version = pdata->version;
 	dev->txnumevt = pdata->txnumevt;
 	dev->rxnumevt = pdata->rxnumevt;
+	dev->tx_rx_clk_separate = pdata->tx_rx_clk_separate;
 	dev->dev = &pdev->dev;
 
 	dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index a9ac0c1..4440666 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -39,6 +39,7 @@ struct davinci_audio_dev {
 	u8	*serial_dir;
 	u8	version;
 	u16	bclk_lrclk_ratio;
+	u8	tx_rx_clk_separate;
 
 	/* McASP FIFO related */
 	u8	txnumevt;
-- 
1.7.9.5



More information about the devicetree-discuss mailing list