[alsa-devel] [PATCH 1/1] ASoC: dwc: Use devm_ioremap_shared_resource
Akshu Agrawal
akshu.agrawal at amd.com
Fri Feb 16 08:43:29 CET 2018
In the event when resgiters are same, this patch checks shared
flag and uses devm_ioremap_shared_resource for mapping. This allows
us to have 2 separate cpu dais for playback and capture having same
register set.
Signed-off-by: Akshu Agrawal <akshu.agrawal at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
---
include/sound/designware_i2s.h | 1 +
sound/soc/dwc/dwc-i2s.c | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/include/sound/designware_i2s.h b/include/sound/designware_i2s.h
index 830f5ca..a43a3708 100644
--- a/include/sound/designware_i2s.h
+++ b/include/sound/designware_i2s.h
@@ -56,6 +56,7 @@ struct i2s_platform_data {
void *capture_dma_data;
bool (*filter)(struct dma_chan *chan, void *slave);
int (*i2s_clk_cfg)(struct i2s_clk_config_data *config);
+ bool shared;
};
struct i2s_dma_data {
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index e27e21f..1e7c285 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -629,9 +629,21 @@ static int dw_i2s_probe(struct platform_device *pdev)
dw_i2s_dai->resume = dw_i2s_resume;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(dev->i2s_base))
- return PTR_ERR(dev->i2s_base);
+ /* For devices which use the same registers for playback
+ * and capture, we would set shared flag for registering
+ * the second cpu dai.
+ */
+ if (pdata && pdata->shared) {
+ dev->i2s_base =
+ devm_ioremap_shared_resource(&pdev->dev, res);
+ if (IS_ERR(dev->i2s_base))
+ return PTR_ERR(dev->i2s_base);
+ } else {
+ dev->i2s_base =
+ devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(dev->i2s_base))
+ return PTR_ERR(dev->i2s_base);
+ }
dev->dev = &pdev->dev;
--
1.9.1
More information about the Alsa-devel
mailing list