Skip to contentSkip to conversation

Use of shared resource in designware

PATCH In review Akshu Agrawal 2 participants 4 messages Feb 16, 2018 – Feb 19, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Use of shared resource in designware

This patch will allow the driver to map same registers to multiple instances of driver.

It is useful when playback and capture have same regsiters and are required to be present on separate cpu dais.

This patch is dependant on "Add devm_ioremap_shared_resource()" patch. https://patchwork.kernel.org/patch/10177127/

Akshu Agrawal (1):
ASoC: dwc: Use devm_ioremap_shared_resource

 include/sound/designware_i2s.h |  1 +
 sound/soc/dwc/dwc-i2s.c        | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ASoC: dwc: Use devm_ioremap_shared_resource

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.

---
 include/sound/designware_i2s.h |  1 +
 sound/soc/dwc/dwc-i2s.c        | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
include/sound/designware_i2s.h +1 -0
index 830f5ca..a43a3708 100644
@@ -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 {
sound/soc/dwc/dwc-i2s.c +15 -3
index e27e21f..1e7c285 100644
@@ -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;
 
Signature · 1 line
1.9.1
maintainer
#2 lore raw
In reply to Akshu Agrawal
Quoted 5 lines · Akshu Agrawal

This patch will allow the driver to map same registers to multiple instances of driver.

It is useful when playback and capture have same regsiters and are required to be present on separate cpu dais.

Please don't send cover letters for single patches, if there is anything that needs saying put it in the changelog of the patch or after the --- if it's administrative stuff. This reduces mail volume and ensures that any important information is recorded in the changelog rather than being lost.

#3 lore raw
Quoted 4 lines · Mark Brown
Quoted 3 lines · Akshu Agrawal

This patch will allow the driver to map same registers to multiple instances of driver.

Quoted 9 lines
Quoted 2 lines

It is useful when playback and capture have same regsiters and are required to be present on separate cpu dais.

Please don't send cover letters for single patches, if there is anything that needs saying put it in the changelog of the patch or after the --- if it's administrative stuff. This reduces mail volume and ensures that any important information is recorded in the changelog rather than being lost.

Got it. The reason for making a cover letter was to let you all know that its dependent on "Add devm_ioremap_shared_resource()" patch. https://patchwork.kernel.org/patch/10177127/