This adds a binding for the Marvell PXA audio complex, available in
pxa2xx and pxa3xx variants.
Signed-off-by: Robert Jarzmik <[email protected]>
---
.../bindings/sound/marvell,pxa2xx-ac97.txt | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt
diff --git a/Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt b/Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt
new file mode 100644
index 000000000000..b3f2882d9c7d
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt
@@ -0,0 +1,25 @@
+Marvell PXA2xx audio complex
+
+This descriptions matches the AC97 controller found in pxa2xx and pxa3xx series.
+
+Required properties:
+ - compatible: "marvell,pxa2xx-ac97"
+ - reg: device MMIO address space
+ - interrupts: single interrupt generated by AC97 IP
+ - clocks: input clock of the AC97 IP, refer to clock-bindings.txt
+
+Optional properties:
+ - pinctrl-names, pinctrl-0: refer to pinctrl-bindings.txt
+ - reset-gpio: gpio used for AC97 reset, refer to gpio.txt
+
+Example:
+ ac97: sound@40500000 {
+ compatible = "marvell,pxa2xx-ac97";
+ reg = < 0x40500000 0x1000 >;
+ interrupts = <14>;
+ reset-gpio = <&gpio 113 GPIO_ACTIVE_HIGH>;
+ #sound-dai-cells = <1>;
+ pinctrl-names = "default";
+ pinctrl-0 = < &pmux_ac97_default >;
+ status = "okay";
+ };
--
2.11.0
Add the devicetree support, so that the driver can be used in a
devictree platform.
Signed-off-by: Robert Jarzmik <[email protected]>
---
sound/arm/pxa2xx-ac97-lib.c | 11 +++++++++++
sound/soc/pxa/pxa2xx-ac97.c | 10 ++++++++++
2 files changed, 21 insertions(+)
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 5950a9e218d9..17c3f26b92b9 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -19,6 +19,7 @@
#include <linux/module.h>
#include <linux/io.h>
#include <linux/gpio.h>
+#include <linux/of_gpio.h>
#include <sound/pxa2xx-lib.h>
@@ -337,6 +338,16 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
dev_err(&dev->dev, "Invalid reset GPIO %d\n",
pdata->reset_gpio);
}
+ } else if (!pdata && dev->dev.of_node) {
+ pdata = devm_kzalloc(&dev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+ pdata->reset_gpio = of_get_named_gpio(dev->dev.of_node,
+ "reset-gpio", 0);
+ if (pdata->reset_gpio == -ENOENT)
+ pdata->reset_gpio = -1;
+ else if (pdata->reset_gpio < 0)
+ return pdata->reset_gpio;
} else {
if (cpu_is_pxa27x())
reset_gpio = 113;
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index bd36578ceb86..8fda29262ef1 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -231,6 +231,15 @@ static const struct snd_soc_component_driver pxa_ac97_component = {
.name = "pxa-ac97",
};
+#ifdef CONFIG_OF
+static const struct of_device_id pxa2xx_ac97_dt_ids[] = {
+ { .compatible = "marvell,pxa2xx-ac97", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids);
+
+#endif
+
static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
{
int ret;
@@ -298,6 +307,7 @@ static struct platform_driver pxa2xx_ac97_driver = {
#ifdef CONFIG_PM_SLEEP
.pm = &pxa2xx_ac97_pm_ops,
#endif
+ .of_match_table = of_match_ptr(pxa2xx_ac97_dt_ids),
},
};
--
2.11.0
On Mon, Jun 11, 2018 at 10:22:10PM +0200, Robert Jarzmik wrote:
> This adds a binding for the Marvell PXA audio complex, available in
> pxa2xx and pxa3xx variants.
>
> Signed-off-by: Robert Jarzmik <[email protected]>
> ---
> .../bindings/sound/marvell,pxa2xx-ac97.txt | 25 ++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt
>
> diff --git a/Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt b/Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt
> new file mode 100644
> index 000000000000..b3f2882d9c7d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/marvell,pxa2xx-ac97.txt
> @@ -0,0 +1,25 @@
> +Marvell PXA2xx audio complex
> +
> +This descriptions matches the AC97 controller found in pxa2xx and pxa3xx series.
> +
> +Required properties:
> + - compatible: "marvell,pxa2xx-ac97"
Don't use wildcards in compatible strings. Though this is so old...
> + - reg: device MMIO address space
> + - interrupts: single interrupt generated by AC97 IP
> + - clocks: input clock of the AC97 IP, refer to clock-bindings.txt
> +
> +Optional properties:
> + - pinctrl-names, pinctrl-0: refer to pinctrl-bindings.txt
> + - reset-gpio: gpio used for AC97 reset, refer to gpio.txt
reset-gpios
> +
> +Example:
> + ac97: sound@40500000 {
> + compatible = "marvell,pxa2xx-ac97";
> + reg = < 0x40500000 0x1000 >;
> + interrupts = <14>;
> + reset-gpio = <&gpio 113 GPIO_ACTIVE_HIGH>;
> + #sound-dai-cells = <1>;
> + pinctrl-names = "default";
> + pinctrl-0 = < &pmux_ac97_default >;
> + status = "okay";
Don't show status in examples.
> + };
> --
> 2.11.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring <[email protected]> writes:
> On Mon, Jun 11, 2018 at 10:22:10PM +0200, Robert Jarzmik wrote:
>> This adds a binding for the Marvell PXA audio complex, available in
>> pxa2xx and pxa3xx variants.
>> +Required properties:
>> + - compatible: "marvell,pxa2xx-ac97"
>
> Don't use wildcards in compatible strings. Though this is so old...
Yes, I could use pxa270-ac97.
>> + - reset-gpio: gpio used for AC97 reset, refer to gpio.txt
> reset-gpios
Right, I'm on it.
>> + status = "okay";
>
> Don't show status in examples.
Sure.
Cheers.
--
Robert
On Wed, Jun 13, 2018 at 09:00:19PM +0200, Robert Jarzmik wrote:
> Rob Herring <[email protected]> writes:
> > On Mon, Jun 11, 2018 at 10:22:10PM +0200, Robert Jarzmik wrote:
> >> +Required properties:
> >> + - compatible: "marvell,pxa2xx-ac97"
> > Don't use wildcards in compatible strings. Though this is so old...
> Yes, I could use pxa270-ac97.
If you're going to do that then probably best to put in a compatible
string for each SoC since they are actually meaningfully different, they
seemed to manage to break something with each new revision.