ALSA: sound/atmel/ac97c.c: Add device tree support
Subsystems (5)
PATCH v2 1/1 ALSA: sound/atmel/ac97c.c: Add device tree support
This adds device tree support for the AC97 controller. It uses the soc-ac97link bindings, but actually only ac97-reset is used.
---
Changes in v2:
* It now uses the soc-ac97link bindings (partly) instead of defining its own. This should ease the transition to ASoC once a new driver has been written.
sound/atmel/ac97c.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-)
sound/atmel/ac97c.c +42 -3
@@ -22,6 +22,9 @@#include <linux/gpio.h> #include <linux/types.h> #include <linux/io.h> +#include <linux/of.h> +#include <linux/of_gpio.h> +#include <linux/of_device.h> #include <sound/core.h> #include <sound/initval.h>
@@ -902,6 +905,40 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip) } } +#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible ="atmel,atmel_ac97c" , }, + { } +}; +MODULE_DEVICE_TABLE (of, atmel_ac97c_dt_ids); + +static struct ac97c_platform_data *atmel_ac97c_probe_dt (struct device *dev) +{ +struct ac97c_platform_data *pdata; +struct device_node *node = dev->of_node; +const struct of_device_id *match; + +if (!node) { +dev_err (dev,"Device does not have associated DT data\n" ); +return ERR_PTR (-EINVAL ); + } + + pdata =devm_kzalloc (dev,sizeof (*pdata),GFP_KERNEL ); +if (!pdata) +return ERR_PTR (-ENOMEM ); + + pdata->reset_pin =of_get_named_gpio (dev->of_node,"ac97-gpios" ,2 ); + +return pdata; +} +#else +static struct ac97c_platform_data *atmel_ac97c_probe_dt (struct device *dev) +{ +dev_err (dev,"no platform data defined\n" ); +return ERR_PTR (-ENXIO ); +} +#endif +static int atmel_ac97c_probe (struct platform_device *pdev) {struct snd_card *card;
@@ -922,10 +959,11 @@ static int atmel_ac97c_probe(struct platform_device *pdev)return -ENXIO ; } - pdata = pdev->dev.platform_data; + pdata =dev_get_platdata (&pdev->dev);if (!pdata) { -dev_dbg (&pdev->dev,"no platform data\n" ); -return -ENXIO ; + pdata =atmel_ac97c_probe_dt (&pdev->dev); +if (IS_ERR (pdata)) +return PTR_ERR (pdata); } irq =platform_get_irq (pdev,0 );
@@ -1205,6 +1243,7 @@ static struct platform_driver atmel_ac97c_driver = { .name = "atmel_ac97c", .owner = THIS_MODULE, .pm = ATMEL_AC97C_PM_OPS, + .of_match_table = of_match_ptr(atmel_ac97c_dt_ids), }, };module_platform_driver (atmel_ac97c_driver);
Signature · 1 line
2.2.0
PATCH v2 1/1 ARM: at91/dt: sam9263: Add ac97 device node
--- arch/arm/boot/dts/at91sam9263.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/at91sam9263.dtsi +21 -0
@@ -692,6 +692,16 @@ }; }; + ac97 { + pinctrl_ac97: ac97-0 { + atmel,pins = + <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A AC97FS pin */ + AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A AC97CK pin */ + AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A AC97TX pin */ + AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB14 periph A AC97RX pin */ + }; + }; + pioA: gpio at fffff200 { compatible = "atmel,at91rm9200-gpio"; reg = <0xfffff200 0x200>;
@@ -820,6 +830,17 @@ status = "disabled"; }; + ac97: sound at fffa0000 { + compatible = "atmel,atmel_ac97c"; + reg = <0xfffa0000 0x4000>; + interrupts = <18 IRQ_TYPE_LEVEL_HIGH 5>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ac97>; + clocks = <&ac97_clk>; + clock-names = "ac97_clk"; + status = "disabled"; + }; + macb0: ethernet at fffbc000 { compatible = "cdns,at32ap7000-macb", "cdns,macb"; reg = <0xfffbc000 0x100>;
Signature · 1 line
2.2.0
A message that is not in the archive (sent off-list or not yet received): 1418241578-17049-1-git-send-email-alexanders83-S0/[email protected]
PATCH v2 1/1 dt: atmel_ac97c: Add device tree documentation
This adds the bindings for AC97 controller device tree support.
---
Changes in v2:
* Split from commit adding actual code
.../devicetree/bindings/sound/atmel_ac97c.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
Documentation/devicetree/bindings/sound/atmel_ac97c.txt new file +20 -0
@@ -0,0 +1,20 @@ +* Atmel AC97 controller + +Required properties: + - compatible: "atmel,atmel_ac97c" + - reg: Address and length of the register set for the device + - interrupts: Should contain AC97 interrupt + - ac97-gpios: Please refer to soc-ac97link.txt, only ac97-reset is used +Optional properties: + - pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt + +Example: +sound@fffa0000 { + compatible = "atmel,atmel_ac97c"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ac97>; + reg = <0xfffa0000 0x4000>; + interrupts = <18 IRQ_TYPE_LEVEL_HIGH 5>; + + ac97-gpios = <&pioB 0 0 &pioB 2 0 &pioC 29 GPIO_ACTIVE_LOW>; +};
Signature · 6 lines
2.2.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
Quoted 8 lines · Alexander Stein
This adds device tree support for the AC97 controller. It uses the soc-ac97link bindings, but actually only ac97-reset is used.
Signed-off-by Alexander Stein <[email protected]>---
Changes in v2:
* It now uses the soc-ac97link bindings (partly) instead of defining its own. This should ease the transition to ASoC once a new driver has been written.
Partly? How do they differ? And why do they differ? The devicetree should describe the hardware, which I guess is the same in both cases.
- Lars
On Wednesday 10 December 2014, 21:04:54 wrote Lars-Peter Clausen:
Quoted 12 lines · Alexander Stein
Quoted 8 lines
This adds device tree support for the AC97 controller. It uses the soc-ac97link bindings, but actually only ac97-reset is used.
Signed-off-by Alexander Stein <[email protected]>---
Changes in v2:
* It now uses the soc-ac97link bindings (partly) instead of defining its own. This should ease the transition to ASoC once a new driver has been written.Partly? How do they differ? And why do they differ? The devicetree should describe the hardware, which I guess is the same in both cases.
The devicetree is defined the same way, but not all set properties are used.
The soc-ac97link binding defines 3 GPIOs where 2 are used in conjunction with different pinctl modes for different reset modes. The rather old atmel_ac97c driver only supports reset per Reset-GPIO which is the 3rd one given in devicetree. Because this driver only uses the 3rd GPIO I've written 'partly'.
Best regards,
Alexander
Hi,
sound/atmel/ac97c.c static void atmel_ac97c_reset(struct atmel_ac97c *chip) · line 910
Quoted 3 lines · Alexander Stein
sound/atmel/ac97c.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible = "atmel,atmel_ac97c", },
I would use atmel,at91sam9263-ac97c, we never now, maybe they will have another ac97 IP at some point in time ;)
Quoted 4 lines
sound/atmel/ac97c.c +4
-0+ { } +}; +MODULE_DEVICE_TABLE (of, atmel_ac97c_dt_ids); +
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Quoted 10 lines · Alexandre Belloni
Hi,
sound/atmel/ac97c.c static void atmel_ac97c_reset(struct atmel_ac97c *chip) · line 910
Quoted 3 lines · Alexander Stein
sound/atmel/ac97c.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible = "atmel,atmel_ac97c", },I would use atmel,at91sam9263-ac97c, we never now, maybe they will have another ac97 IP at some point in time ;)
This applies for the other patches, else I'm fine with the series.
Maybe you could add CONFIG_SND_ATMEL_AC97C=y in at91_dt_defconfig as all the other defconfigs have disappeared.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
On Friday 19 December 2014, 21:47:24 wrote Alexandre Belloni:
Quoted 12 lines · Alexandre Belloni
Quoted 10 lines
Hi,
sound/atmel/ac97c.c static void atmel_ac97c_reset(struct atmel_ac97c *chip) · line 910
Quoted 3 lines · Alexander Stein
sound/atmel/ac97c.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible = "atmel,atmel_ac97c", },I would use atmel,at91sam9263-ac97c, we never now, maybe they will have another ac97 IP at some point in time ;)
Quoted 1 line
This applies for the other patches, else I'm fine with the series.
Is this an
Quoted 1 line
Acked-By Alexandre Belloni <[email protected]>
?
Quoted 2 lines
Maybe you could add
CONFIG_SND_ATMEL_AC97C=yinat91_dt_defconfigas all the other defconfigs have disappeared.
Sure, I'll add both suggestions and respin nother round next week.
Best regards,
Alexander
Quoted 13 lines · Alexander Stein
On Friday 19 December 2014, 21:47:24 wrote Alexandre Belloni:
Quoted 12 lines · Alexandre Belloni
Quoted 10 lines
Hi,
sound/atmel/ac97c.c static void atmel_ac97c_reset(struct atmel_ac97c *chip) · line 910
Quoted 3 lines · Alexander Stein
sound/atmel/ac97c.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible = "atmel,atmel_ac97c", },I would use atmel,at91sam9263-ac97c, we never now, maybe they will have another ac97 IP at some point in time ;)
Quoted 5 lines
Quoted 1 line
This applies for the other patches, else I'm fine with the series.
Is this an
Quoted 1 line
Acked-By Alexandre Belloni <[email protected]>
?
Yes :)
Quoted 9 lines
Quoted 3 lines
Maybe you could add
CONFIG_SND_ATMEL_AC97C=yinat91_dt_defconfigas all the other defconfigs have disappeared.Sure, I'll add both suggestions and respin nother round next week.
Best regards,
Alexander
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
On Friday 19 December 2014, 21:47:24 wrote Alexandre Belloni:
Quoted 12 lines · Alexandre Belloni
Quoted 10 lines
Hi,
sound/atmel/ac97c.c static void atmel_ac97c_reset(struct atmel_ac97c *chip) · line 910
Quoted 3 lines · Alexander Stein
sound/atmel/ac97c.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible = "atmel,atmel_ac97c", },I would use atmel,at91sam9263-ac97c, we never now, maybe they will have another ac97 IP at some point in time ;)
Quoted 4 lines
This applies for the other patches, else I'm fine with the series.
Maybe you could add
CONFIG_SND_ATMEL_AC97C=yinat91_dt_defconfigas all the other defconfigs have disappeared.
BTW: Shouldn't this be rather CONFIG_SND_ATMEL_AC97C=m since it is only applicable on a single microcontroller (AT91SAM9263). There is no need to compile this driver into the kernel on all at91 variants.
Best regards,
Alexander
Quoted 13 lines · Alexander Stein
On Friday 19 December 2014, 21:47:24 wrote Alexandre Belloni:
Quoted 12 lines · Alexandre Belloni
Quoted 10 lines
Hi,
sound/atmel/ac97c.c static void atmel_ac97c_reset(struct atmel_ac97c *chip) · line 910
Quoted 3 lines · Alexander Stein
sound/atmel/ac97c.c +3
-0+#ifdef CONFIG_OF +static const struct of_device_id atmel_ac97c_dt_ids[] = { + { .compatible = "atmel,atmel_ac97c", },I would use atmel,at91sam9263-ac97c, we never now, maybe they will have another ac97 IP at some point in time ;)
Quoted 7 lines
Quoted 4 lines
This applies for the other patches, else I'm fine with the series.
Maybe you could add
CONFIG_SND_ATMEL_AC97C=yinat91_dt_defconfigas all the other defconfigs have disappeared.BTW: Shouldn't this be rather
CONFIG_SND_ATMEL_AC97C=msince it is only applicable on a single microcontroller (AT91SAM9263). There is no need to compile this driver into the kernel on all at91 variants.
I think compiling statically is preferred by Nicolas (added in Cc). It is actually also applicable to sam9g45 and sam9rl.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com