Thread (1 message) 1 message, 1 author, 2014-03-11

Re: [PATCH v2 1/2] mfd: Support SiRF audio modules

From: Lee Jones <hidden>
Date: 2014-03-11 06:44:01

From: Rongjun Ying <redacted>

The audio modules consist of an internal audio codec, internal
audio port and i2s controller.

These modules sharing same register address space.
sirf-audio.c provides common regmap mmio handling for all audio modules.
The sound drivers will get regmap from sirf audio mfd driver.

Signed-off-by: Rongjun Ying <redacted>
---
-v2:
1. Fixed a lot of english syntax error
2. Add "OF" depend
3. Get codec compatible from child node of dts
4. Use a standard header

 drivers/mfd/Kconfig            |   10 +++
 drivers/mfd/Makefile           |    1 +
 drivers/mfd/sirf-audio.c       |  128 ++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/sirf/audio.h |   22 +++++++
 4 files changed, 161 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/sirf-audio.c
 create mode 100644 include/linux/mfd/sirf/audio.h
<snip>
+static struct mfd_cell sirf_audio_devs[] = {
+	{
+		.name = "sirf-audio-codec",
+	}, {
+		.of_compatible = "sirf,prima2-i2s",
+		.name = "sirf-i2s",
+	}, {
+		.of_compatible = "sirf,audio-port",
+		.name = "sirf-audio-port",
+	}
+};
The compatible string for the CODEC is mentioned in the Documentation,
but missing here.

Nit: Also please put .name first and .of_compatible second.

<snip>
+	regmap = devm_regmap_init_mmio(&pdev->dev, base,
+					    &sirf_audio_regmap_config);
Odd tabbing here. It's neither tabs, nor '(' aligned.
+	compatible = of_get_property(codec_np, "compatible", &cplen);
+	if (!compatible)
+		return -EINVAL;
+
+	/* Overwrite internal codec compatible string */
+	sirf_audio_devs[0].of_compatible = kstrdup(compatible, GFP_KERNEL);
Oh wow, but no.

Use of_platform_populate() instead of fiddling with the DT like this.
+	ret =  mfd_add_devices(&pdev->dev, -1, sirf_audio_devs,
+			ARRAY_SIZE(sirf_audio_devs),
+			NULL, 0, NULL);
+	if (ret) {
+		dev_err(&pdev->dev, "add mfd devices failed: %d\n", ret);
+		goto err_add_devs;
+	}
+
+	return 0;
+
+err_add_devs:
+	kfree(sirf_audio_devs[0].of_compatible);
<snip>
+static int sirf_audio_remove(struct platform_device *pdev)
+{
+	kfree(sirf_audio_devs[0].of_compatible);
Gross.
+	mfd_remove_devices(&pdev->dev);
+	return 0;
+}
<snip>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help