From d86472234c483b1c23708b2bbb98fa7edd66bf15 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Mon, 28 May 2018 22:31:26 +0800 Subject: [PATCH] ASoC: rockchip: add 'rockchip,no-dmaengine' for i2s/tdm/pdm This patch add support for property 'rockchip,no-dmaengine'. it is a boolean property. if present, driver will do not register pcm dmaengine, only just register dai. if the dai is part of multi-dais, the property should be present. Please refer to rockchip,multidais.txt about multi-dais usage. Change-Id: I9aa2ddb15f5a27202f90bf32804f214435cc0b73 Signed-off-by: Sugar Zhang --- Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.txt | 4 ++++ Documentation/devicetree/bindings/sound/rockchip,pdm.txt | 4 ++++ Documentation/devicetree/bindings/sound/rockchip-i2s.txt | 4 ++++ sound/soc/rockchip/rockchip_i2s.c | 2 ++ sound/soc/rockchip/rockchip_i2s_tdm.c | 2 ++ sound/soc/rockchip/rockchip_pdm.c | 3 +++ 6 files changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.txt b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.txt index 01b83ddf4330..beadf8bc0ad8 100644 --- a/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.txt +++ b/Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.txt @@ -21,6 +21,10 @@ Required properties: - 0: both tx_lrck/bclk and rx_lrck/bclk are used - 1: only tx_lrck/bclk is used - 2: only rx_lrck/bclk is used +- rockchip,no-dmaengine: This is a boolean property. If present, driver will do not + register pcm dmaengine, only just register dai. if the dai is part of multi-dais, + the property should be present. Please refer to rockchip,multidais.txt about + multi-dais usage. Example for rk3308 I2S/TDM controller: diff --git a/Documentation/devicetree/bindings/sound/rockchip,pdm.txt b/Documentation/devicetree/bindings/sound/rockchip,pdm.txt index 39737228f863..63cf10066e8b 100644 --- a/Documentation/devicetree/bindings/sound/rockchip,pdm.txt +++ b/Documentation/devicetree/bindings/sound/rockchip,pdm.txt @@ -16,6 +16,10 @@ Required properties: - "pdm_clk" : clock for PDM controller - resets: a list of phandle + reset-specifer paris, one for each entry in reset-names. - reset-names: reset names, should include "pdm-m". +- rockchip,no-dmaengine: This is a boolean property. If present, driver will do not + register pcm dmaengine, only just register dai. if the dai is part of multi-dais, + the property should be present. Please refer to rockchip,multidais.txt about + multi-dais usage. - pinctrl-names: Must contain a "default" entry. - pinctrl-N: One property must exist for each entry in pinctrl-names. See ../pinctrl/pinctrl-bindings.txt diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt index e00254719457..9ebd9df63d6c 100644 --- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt +++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt @@ -28,6 +28,10 @@ Required properties: - rockchip,playback-channels: max playback channels, if not set, 8 channels default. - rockchip,capture-channels: max capture channels, if not set, 2 channels default. - rockchip,bclk-fs: configure the i2s bclk fs. +- rockchip,no-dmaengine: This is a boolean property. If present, driver will do not + register pcm dmaengine, only just register dai. if the dai is part of multi-dais, + the property should be present. Please refer to rockchip,multidais.txt about + multi-dais usage. Required properties for controller which support multi channels playback/capture: diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 41a25e50edd3..504d79ef6554 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -697,6 +697,8 @@ static int rockchip_i2s_probe(struct platform_device *pdev) goto err_suspend; } + if (of_property_read_bool(node, "rockchip,no-dmaengine")) + return ret; ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); if (ret) { dev_err(&pdev->dev, "Could not register PCM\n"); diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index f4f3ba01e587..542ad77c90ac 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -1233,6 +1233,8 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) goto err_suspend; } + if (of_property_read_bool(node, "rockchip,no-dmaengine")) + return ret; ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); if (ret) { dev_err(&pdev->dev, "Could not register PCM\n"); diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c index 5096fded79a7..b9843e764ba6 100644 --- a/sound/soc/rockchip/rockchip_pdm.c +++ b/sound/soc/rockchip/rockchip_pdm.c @@ -465,6 +465,7 @@ MODULE_DEVICE_TABLE(of, rockchip_pdm_match); static int rockchip_pdm_probe(struct platform_device *pdev) { + struct device_node *node = pdev->dev.of_node; const struct of_device_id *match; struct rk_pdm_dev *pdm; struct resource *res; @@ -531,6 +532,8 @@ static int rockchip_pdm_probe(struct platform_device *pdev) } rockchip_pdm_rxctrl(pdm, 0); + if (of_property_read_bool(node, "rockchip,no-dmaengine")) + return ret; ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); if (ret) { dev_err(&pdev->dev, "could not register pcm: %d\n", ret);