2013-04-30 10:07:41

by Belisko Marek

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

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 <[email protected]>
---
.../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


2013-04-30 18:41:00

by Mark Brown

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

On Tue, Apr 30, 2013 at 12:07:18PM +0200, Marek Belisko wrote:
> Add new property tx-rx-clk-separate which we can distinquish between common
> and separate clock for tx and rx blocks.

So, this is a sensible thing to have and in fact the core already has
the symmetric_rates flag for this. This says two things to me. One is
that this patch ought to at least set the symmetric_rates flag so that
the core can tell applications that we can't set different rates in each
direction. The other is that this probably ought to be a generic
property for dai_links so that we can just set this for any driver -
even if the driver doesn't need to do anything it still matters to the
application layer.

What I'd suggest is adding code to check if symmetric_rates is set for
the DAI link and then key off that and then a generic DT thing (or just
set it in the machine driver for now if that makes sense) to enable that
for your board or boards.
machine driver).


Attachments:
(No filename) (956.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments