diff mbox

ASoC: fsl_sai: Make Synchronous and Asynchronous modes exclusive

Message ID 1407494479-9877-1-git-send-email-nicoleotsuka@gmail.com
State Accepted, archived
Commit ce7344a4ebabe90e064d3e087727f45624cdc942
Headers show

Commit Message

Nicolin Chen Aug. 8, 2014, 10:41 a.m. UTC
The previous patch (ASoC: fsl_sai: Add asynchronous mode support) added
new Device Tree bindings for Asynchronous and Synchronous modes support.
However, these two shall not be present at the same time.

So this patch just simply makes them exclusive so as to avoid incorrect
Device Tree binding usage.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 Documentation/devicetree/bindings/sound/fsl-sai.txt | 3 +--
 sound/soc/fsl/fsl_sai.c                             | 7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Mark Brown Aug. 13, 2014, 11:05 a.m. UTC | #1
On Fri, Aug 08, 2014 at 06:41:19PM +0800, Nicolin Chen wrote:

> The previous patch (ASoC: fsl_sai: Add asynchronous mode support) added
> new Device Tree bindings for Asynchronous and Synchronous modes support.
> However, these two shall not be present at the same time.

Applied, thanks.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/sound/fsl-sai.txt b/Documentation/devicetree/bindings/sound/fsl-sai.txt
index 77864f4..dc9f9c3 100644
--- a/Documentation/devicetree/bindings/sound/fsl-sai.txt
+++ b/Documentation/devicetree/bindings/sound/fsl-sai.txt
@@ -38,8 +38,7 @@  Note:
   default synchronous mode (sync Rx with Tx) will be used, which means both
   transimitter and receiver will send and receive data by following clocks
   of transimitter.
-- fsl,sai-asynchronous will be ignored if fsl,sai-synchronous-rx property is
-  already present.
+- fsl,sai-asynchronous and fsl,sai-synchronous-rx are exclusive.
 
 Example:
 sai2: sai@40031000 {
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index ef7c758..4c9e71c 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -634,6 +634,13 @@  static int fsl_sai_probe(struct platform_device *pdev)
 	fsl_sai_dai.symmetric_channels = 1;
 	fsl_sai_dai.symmetric_samplebits = 1;
 
+	if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
+	    of_find_property(np, "fsl,sai-asynchronous", NULL)) {
+		/* error out if both synchronous and asynchronous are present */
+		dev_err(&pdev->dev, "invalid binding for synchronous mode\n");
+		return -EINVAL;
+	}
+
 	if (of_find_property(np, "fsl,sai-synchronous-rx", NULL)) {
 		/* Sync Rx with Tx */
 		sai->synchronous[RX] = false;