All of lore.kernel.org
 help / color / mirror / Atom feed
* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-12  9:08 ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely
  Cc: devicetree, linux-doc, linux-arm-kernel

This set of patches add device tree support for the AC97 controller found
on AT91SAM9263.
The first two patches are minor cleanup, while the last ones add the actual
support.

Regards,
Alexander


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-12  9:08 ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

This set of patches add device tree support for the AC97 controller found
on AT91SAM9263.
The first two patches are minor cleanup, while the last ones add the actual
support.

Regards,
Alexander

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 1/4] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
  2014-04-12  9:08 ` Alexander Stein
@ 2014-04-12  9:08   ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely
  Cc: devicetree, linux-doc, linux-arm-kernel, Alexander Stein

THis reduces some boilerplate code.

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 sound/atmel/ac97c.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index c5f0ddd..9a13875 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -1202,6 +1202,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver atmel_ac97c_driver = {
+	.probe		= atmel_ac97c_probe,
 	.remove		= atmel_ac97c_remove,
 	.driver		= {
 		.name	= "atmel_ac97c",
@@ -1209,19 +1210,7 @@ static struct platform_driver atmel_ac97c_driver = {
 		.pm	= ATMEL_AC97C_PM_OPS,
 	},
 };
-
-static int __init atmel_ac97c_init(void)
-{
-	return platform_driver_probe(&atmel_ac97c_driver,
-			atmel_ac97c_probe);
-}
-module_init(atmel_ac97c_init);
-
-static void __exit atmel_ac97c_exit(void)
-{
-	platform_driver_unregister(&atmel_ac97c_driver);
-}
-module_exit(atmel_ac97c_exit);
+module_platform_driver(atmel_ac97c_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 1/4] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
@ 2014-04-12  9:08   ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

THis reduces some boilerplate code.

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 sound/atmel/ac97c.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index c5f0ddd..9a13875 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -1202,6 +1202,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver atmel_ac97c_driver = {
+	.probe		= atmel_ac97c_probe,
 	.remove		= atmel_ac97c_remove,
 	.driver		= {
 		.name	= "atmel_ac97c",
@@ -1209,19 +1210,7 @@ static struct platform_driver atmel_ac97c_driver = {
 		.pm	= ATMEL_AC97C_PM_OPS,
 	},
 };
-
-static int __init atmel_ac97c_init(void)
-{
-	return platform_driver_probe(&atmel_ac97c_driver,
-			atmel_ac97c_probe);
-}
-module_init(atmel_ac97c_init);
-
-static void __exit atmel_ac97c_exit(void)
-{
-	platform_driver_unregister(&atmel_ac97c_driver);
-}
-module_exit(atmel_ac97c_exit);
+module_platform_driver(atmel_ac97c_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 2/4] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data
  2014-04-12  9:08 ` Alexander Stein
@ 2014-04-12  9:08   ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely
  Cc: devicetree, linux-doc, linux-arm-kernel, Alexander Stein

This platform data member is unsed, so remove it.

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 include/sound/atmel-ac97c.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
index e6aabdb..00e6c289 100644
--- a/include/sound/atmel-ac97c.h
+++ b/include/sound/atmel-ac97c.h
@@ -23,7 +23,6 @@
  * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
  *             optional to use, set to -ENODEV if not in use. AC97 layer will
  *             try to do a software reset of the external codec anyway.
- * @flags: Flags for which directions should be enabled.
  *
  * If the user do not want to use a DMA channel for playback or capture, i.e.
  * only one feature is required on the board. The slave for playback or capture
@@ -33,7 +32,6 @@
 struct ac97c_platform_data {
 	struct dw_dma_slave	rx_dws;
 	struct dw_dma_slave	tx_dws;
-	unsigned int 		flags;
 	int			reset_pin;
 };
 
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 2/4] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data
@ 2014-04-12  9:08   ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

This platform data member is unsed, so remove it.

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 include/sound/atmel-ac97c.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
index e6aabdb..00e6c289 100644
--- a/include/sound/atmel-ac97c.h
+++ b/include/sound/atmel-ac97c.h
@@ -23,7 +23,6 @@
  * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
  *             optional to use, set to -ENODEV if not in use. AC97 layer will
  *             try to do a software reset of the external codec anyway.
- * @flags: Flags for which directions should be enabled.
  *
  * If the user do not want to use a DMA channel for playback or capture, i.e.
  * only one feature is required on the board. The slave for playback or capture
@@ -33,7 +32,6 @@
 struct ac97c_platform_data {
 	struct dw_dma_slave	rx_dws;
 	struct dw_dma_slave	tx_dws;
-	unsigned int 		flags;
 	int			reset_pin;
 };
 
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12  9:08 ` Alexander Stein
@ 2014-04-12  9:08   ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely
  Cc: devicetree, linux-doc, linux-arm-kernel, Alexander Stein

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
 sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
 2 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt

diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
new file mode 100644
index 0000000..9839403
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
@@ -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
+  - atmel,reset-pin: GPIO for resetting the codec
+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>;
+
+	atmel,reset-pin = <&pioC 29 GPIO_ACTIVE_LOW>;
+};
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 9a13875..b84432b 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -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>
@@ -901,6 +904,47 @@ 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);
+	}
+
+	match = of_match_device(atmel_ac97c_dt_ids, dev);
+	if (!match) {
+		dev_err(dev, "Unknown device model\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,
+					     "atmel,reset-pin", 0);
+
+	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;
@@ -921,10 +965,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);
@@ -1208,6 +1253,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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-12  9:08   ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
 sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
 2 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt

diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
new file mode 100644
index 0000000..9839403
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
@@ -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
+  - atmel,reset-pin: GPIO for resetting the codec
+Optional properties:
+  - pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt
+
+Example:
+sound at fffa0000 {
+	compatible = "atmel,atmel_ac97c";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_ac97>;
+	reg = <0xfffa0000 0x4000>;
+	interrupts = <18 IRQ_TYPE_LEVEL_HIGH 5>;
+
+	atmel,reset-pin = <&pioC 29 GPIO_ACTIVE_LOW>;
+};
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 9a13875..b84432b 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -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>
@@ -901,6 +904,47 @@ 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);
+	}
+
+	match = of_match_device(atmel_ac97c_dt_ids, dev);
+	if (!match) {
+		dev_err(dev, "Unknown device model\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,
+					     "atmel,reset-pin", 0);
+
+	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;
@@ -921,10 +965,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);
@@ -1208,6 +1253,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);
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 4/4] ARM: at91/dt: sam9263: Add ac97 device node
  2014-04-12  9:08 ` Alexander Stein
@ 2014-04-12  9:08   ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely
  Cc: devicetree, linux-doc, linux-arm-kernel, Alexander Stein

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 arch/arm/boot/dts/at91sam9263.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index fece866..34db6d8 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -395,6 +395,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@fffff200 {
 					compatible = "atmel,at91rm9200-gpio";
 					reg = <0xfffff200 0x200>;
@@ -506,6 +516,15 @@
 				status = "disabled";
 			};
 
+			ac97: sound@fffa0000 {
+				compatible = "atmel,atmel_ac97c";
+				reg = <0xfffa0000 0x4000>;
+				interrupts = <18 IRQ_TYPE_LEVEL_HIGH 5>;
+				pinctrl-names = "default";
+				pinctrl-0 = <&pinctrl_ac97>;
+				status = "disabled";
+			};
+
 			macb0: ethernet@fffbc000 {
 				compatible = "cdns,at32ap7000-macb", "cdns,macb";
 				reg = <0xfffbc000 0x100>;
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 4/4] ARM: at91/dt: sam9263: Add ac97 device node
@ 2014-04-12  9:08   ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 arch/arm/boot/dts/at91sam9263.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index fece866..34db6d8 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -395,6 +395,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>;
@@ -506,6 +516,15 @@
 				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>;
+				status = "disabled";
+			};
+
 			macb0: ethernet at fffbc000 {
 				compatible = "cdns,at32ap7000-macb", "cdns,macb";
 				reg = <0xfffbc000 0x100>;
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12  9:08   ` Alexander Stein
                     ` (2 preceding siblings ...)
  (?)
@ 2014-04-12 10:31   ` Alexander Shiyan
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Shiyan @ 2014-04-12 10:31 UTC (permalink / raw)
  To: Alexander Stein
  Cc: devicetree, linux-arm-kernel, linux-doc, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Randy Dunlap,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Jaroslav Kysela, Takashi Iwai, Grant Likely

Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> ---
>  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
>  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> new file mode 100644
> index 0000000..9839403
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> @@ -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
> +  - atmel,reset-pin: GPIO for resetting the codec

Why standard "gpios" property cannot be used here?

---


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
       [not found]   ` <1397293707-26890-4-git-send-email-alexanders83-S0/GAf8tV78@public.gmane.org>
@ 2014-04-12 10:31     ` Alexander Shiyan
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Shiyan @ 2014-04-12 10:31 UTC (permalink / raw)
  To: Alexander Stein
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-doc-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Randy Dunlap,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Jaroslav Kysela, Takashi Iwai, Grant Likely

Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> ---
>  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
>  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> new file mode 100644
> index 0000000..9839403
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> @@ -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
> +  - atmel,reset-pin: GPIO for resetting the codec

Why standard "gpios" property cannot be used here?

---


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12  9:08   ` Alexander Stein
@ 2014-04-12 10:31     ` Alexander Shiyan
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Shiyan @ 2014-04-12 10:31 UTC (permalink / raw)
  To: Alexander Stein
  Cc: devicetree, linux-arm-kernel, linux-doc, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Randy Dunlap,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Jaroslav Kysela, Takashi Iwai, Grant Likely

Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> ---
>  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
>  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> new file mode 100644
> index 0000000..9839403
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> @@ -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
> +  - atmel,reset-pin: GPIO for resetting the codec

Why standard "gpios" property cannot be used here?

---


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-12 10:31     ` Alexander Shiyan
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Shiyan @ 2014-04-12 10:31 UTC (permalink / raw)
  To: linux-arm-kernel

Sat, 12 Apr 2014 11:08:26 +0200 ?? Alexander Stein <alexanders83@web.de>:
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> ---
>  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
>  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> new file mode 100644
> index 0000000..9839403
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> @@ -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
> +  - atmel,reset-pin: GPIO for resetting the codec

Why standard "gpios" property cannot be used here?

---

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12 10:31     ` Alexander Shiyan
@ 2014-04-12 10:42       ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12 10:42 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: Mark Rutland, devicetree, Randy Dunlap, Pawel Moll, linux-doc,
	Takashi Iwai, Ian Campbell, Nicolas Ferre, Jaroslav Kysela,
	Rob Herring, Kumar Gala, Grant Likely,
	Jean-Christophe Plagniol-Villard, Andrew Victor,
	linux-arm-kernel

On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > ---
> >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> >  2 files changed, 69 insertions(+), 3 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > new file mode 100644
> > index 0000000..9839403
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > @@ -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
> > +  - atmel,reset-pin: GPIO for resetting the codec
> 
> Why standard "gpios" property cannot be used here?

I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
If this is the recommended way, I'll gladly change that.

Alexander


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-12 10:42       ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-12 10:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> Sat, 12 Apr 2014 11:08:26 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > ---
> >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> >  2 files changed, 69 insertions(+), 3 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > new file mode 100644
> > index 0000000..9839403
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > @@ -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
> > +  - atmel,reset-pin: GPIO for resetting the codec
> 
> Why standard "gpios" property cannot be used here?

I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
If this is the recommended way, I'll gladly change that.

Alexander

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12 10:42       ` Alexander Stein
@ 2014-04-12 10:48         ` Alexander Shiyan
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Shiyan @ 2014-04-12 10:48 UTC (permalink / raw)
  To: Alexander Stein
  Cc: devicetree, linux-arm-kernel, linux-doc, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Randy Dunlap,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Jaroslav Kysela, Takashi Iwai, Grant Likely

Sat, 12 Apr 2014 12:42:18 +0200 от Alexander Stein <alexanders83@web.de>:
> On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > ---
> > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > new file mode 100644
> > > index 0000000..9839403
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > @@ -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
> > > +  - atmel,reset-pin: GPIO for resetting the codec
> > 
> > Why standard "gpios" property cannot be used here?
> 
> I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> If this is the recommended way, I'll gladly change that.

Another question is whether this property should refer to the controller,
as it is clear that it refers to the codec ....

---


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-12 10:48         ` Alexander Shiyan
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Shiyan @ 2014-04-12 10:48 UTC (permalink / raw)
  To: linux-arm-kernel

Sat, 12 Apr 2014 12:42:18 +0200 ?? Alexander Stein <alexanders83@web.de>:
> On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > Sat, 12 Apr 2014 11:08:26 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > ---
> > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > 
> > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > new file mode 100644
> > > index 0000000..9839403
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > @@ -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
> > > +  - atmel,reset-pin: GPIO for resetting the codec
> > 
> > Why standard "gpios" property cannot be used here?
> 
> I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> If this is the recommended way, I'll gladly change that.

Another question is whether this property should refer to the controller,
as it is clear that it refers to the codec ....

---

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12 10:48         ` Alexander Shiyan
@ 2014-04-13  8:32           ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-13  8:32 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: devicetree, linux-arm-kernel, linux-doc, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, Randy Dunlap,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Jaroslav Kysela, Takashi Iwai, Grant Likely

On Saturday 12 April 2014, 14:48:17 wrote Alexander Shiyan:
> Sat, 12 Apr 2014 12:42:18 +0200 от Alexander Stein <alexanders83@web.de>:
> > On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > > Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> > > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > > ---
> > > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > new file mode 100644
> > > > index 0000000..9839403
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > @@ -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
> > > > +  - atmel,reset-pin: GPIO for resetting the codec
> > > 
> > > Why standard "gpios" property cannot be used here?
> > 
> > I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> > If this is the recommended way, I'll gladly change that.
> 
> Another question is whether this property should refer to the controller,
> as it is clear that it refers to the codec ....

AFAICT the codec itself has no representation in the devicetree. It gets detected by the controller which uses the reset GPIO.

Alexander


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-13  8:32           ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-13  8:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday 12 April 2014, 14:48:17 wrote Alexander Shiyan:
> Sat, 12 Apr 2014 12:42:18 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > > Sat, 12 Apr 2014 11:08:26 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > > ---
> > > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > new file mode 100644
> > > > index 0000000..9839403
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > @@ -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
> > > > +  - atmel,reset-pin: GPIO for resetting the codec
> > > 
> > > Why standard "gpios" property cannot be used here?
> > 
> > I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> > If this is the recommended way, I'll gladly change that.
> 
> Another question is whether this property should refer to the controller,
> as it is clear that it refers to the codec ....

AFAICT the codec itself has no representation in the devicetree. It gets detected by the controller which uses the reset GPIO.

Alexander

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Device tree support for Atmel AC97 controller on AT91SAM9263
  2014-04-12  9:08 ` Alexander Stein
@ 2014-04-14  8:39   ` Bo Shen
  -1 siblings, 0 replies; 47+ messages in thread
From: Bo Shen @ 2014-04-14  8:39 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely, devicetree, linux-doc, linux-arm-kernel

Hi Alexander,

On 04/12/2014 05:08 PM, Alexander Stein wrote:
> This set of patches add device tree support for the AC97 controller found
> on AT91SAM9263.
> The first two patches are minor cleanup, while the last ones add the actual
> support.

I just test the whole patch series, and find issues to work with device 
tree kernel.
When we use dt kernel, no where assign the device id (so take it as 
"-1"), so when register devices, it will be /dev/snd/pcmC0D-1p and 
/dev/snd/pcmC0D-1c. So, the sound won't work.

The root cause is that when call "snd_pcm_new", it will pass 
"chip->pdev->id" as parameter.

So, I am thinking whether this should be fix in <sound/atmel/ac97c.c> or 
in <sound/core/pcm.c>

> Regards,
> Alexander

Best Regards,
Bo Shen

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-14  8:39   ` Bo Shen
  0 siblings, 0 replies; 47+ messages in thread
From: Bo Shen @ 2014-04-14  8:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alexander,

On 04/12/2014 05:08 PM, Alexander Stein wrote:
> This set of patches add device tree support for the AC97 controller found
> on AT91SAM9263.
> The first two patches are minor cleanup, while the last ones add the actual
> support.

I just test the whole patch series, and find issues to work with device 
tree kernel.
When we use dt kernel, no where assign the device id (so take it as 
"-1"), so when register devices, it will be /dev/snd/pcmC0D-1p and 
/dev/snd/pcmC0D-1c. So, the sound won't work.

The root cause is that when call "snd_pcm_new", it will pass 
"chip->pdev->id" as parameter.

So, I am thinking whether this should be fix in <sound/atmel/ac97c.c> or 
in <sound/core/pcm.c>

> Regards,
> Alexander

Best Regards,
Bo Shen

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Device tree support for Atmel AC97 controller on AT91SAM9263
  2014-04-12  9:08 ` Alexander Stein
@ 2014-04-14  8:42   ` Takashi Iwai
  -1 siblings, 0 replies; 47+ messages in thread
From: Takashi Iwai @ 2014-04-14  8:42 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Grant Likely,
	devicetree, linux-doc, linux-arm-kernel

At Sat, 12 Apr 2014 11:08:23 +0200,
Alexander Stein wrote:
> 
> This set of patches add device tree support for the AC97 controller found
> on AT91SAM9263.
> The first two patches are minor cleanup, while the last ones add the actual
> support.

Do you really need work on this driver?  The sound/atmel/* stuff is an
old one before ASoC was introduced, mostly obsoleted nowadays.


Takashi

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-14  8:42   ` Takashi Iwai
  0 siblings, 0 replies; 47+ messages in thread
From: Takashi Iwai @ 2014-04-14  8:42 UTC (permalink / raw)
  To: linux-arm-kernel

At Sat, 12 Apr 2014 11:08:23 +0200,
Alexander Stein wrote:
> 
> This set of patches add device tree support for the AC97 controller found
> on AT91SAM9263.
> The first two patches are minor cleanup, while the last ones add the actual
> support.

Do you really need work on this driver?  The sound/atmel/* stuff is an
old one before ASoC was introduced, mostly obsoleted nowadays.


Takashi

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: Device tree support for Atmel AC97 controller on AT91SAM9263
  2014-04-14  8:39   ` Bo Shen
@ 2014-04-14 18:34     ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-14 18:34 UTC (permalink / raw)
  To: Bo Shen
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely, devicetree, linux-doc, linux-arm-kernel

Hello Bo,

On Monday 14 April 2014, 16:39:43 wrote Bo Shen:
> On 04/12/2014 05:08 PM, Alexander Stein wrote:
> > This set of patches add device tree support for the AC97 controller found
> > on AT91SAM9263.
> > The first two patches are minor cleanup, while the last ones add the actual
> > support.
> 
> I just test the whole patch series, and find issues to work with device 
> tree kernel.
> When we use dt kernel, no where assign the device id (so take it as 
> "-1"), so when register devices, it will be /dev/snd/pcmC0D-1p and 
> /dev/snd/pcmC0D-1c. So, the sound won't work.
> 
> The root cause is that when call "snd_pcm_new", it will pass 
> "chip->pdev->id" as parameter.
> 
> So, I am thinking whether this should be fix in <sound/atmel/ac97c.c> or 
> in <sound/core/pcm.c>

Ah. thanks for figuring out. I also noticed later that e.g. aplay actually doesn't work, but could not figure out why. pcmC0D-1c looked valid at first glance I wasn't aware that this includes a -1 :)
I was already happy that the controller found the codec.

Best regards,
Alexander


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-14 18:34     ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-14 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Bo,

On Monday 14 April 2014, 16:39:43 wrote Bo Shen:
> On 04/12/2014 05:08 PM, Alexander Stein wrote:
> > This set of patches add device tree support for the AC97 controller found
> > on AT91SAM9263.
> > The first two patches are minor cleanup, while the last ones add the actual
> > support.
> 
> I just test the whole patch series, and find issues to work with device 
> tree kernel.
> When we use dt kernel, no where assign the device id (so take it as 
> "-1"), so when register devices, it will be /dev/snd/pcmC0D-1p and 
> /dev/snd/pcmC0D-1c. So, the sound won't work.
> 
> The root cause is that when call "snd_pcm_new", it will pass 
> "chip->pdev->id" as parameter.
> 
> So, I am thinking whether this should be fix in <sound/atmel/ac97c.c> or 
> in <sound/core/pcm.c>

Ah. thanks for figuring out. I also noticed later that e.g. aplay actually doesn't work, but could not figure out why. pcmC0D-1c looked valid at first glance I wasn't aware that this includes a -1 :)
I was already happy that the controller found the codec.

Best regards,
Alexander

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: Device tree support for Atmel AC97 controller on AT91SAM9263
  2014-04-14  8:42   ` Takashi Iwai
@ 2014-04-14 18:43     ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-14 18:43 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Grant Likely,
	devicetree, linux-doc, linux-arm-kernel

Hello Takashi,

On Monday 14 April 2014, 10:42:06 wrote Takashi Iwai:
> At Sat, 12 Apr 2014 11:08:23 +0200,
> Alexander Stein wrote:
> > 
> > This set of patches add device tree support for the AC97 controller found
> > on AT91SAM9263.
> > The first two patches are minor cleanup, while the last ones add the 
actual
> > support.
> 
> Do you really need work on this driver?  The sound/atmel/* stuff is an
> old one before ASoC was introduced, mostly obsoleted nowadays.

Ah, ok. I wasn't aware of that. But is there a replacement for the ac97c 
driver? All I found in sound/soc/atmel is using the SSC peripheral. Not 
something I can use.
Regards,
Alexander


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-14 18:43     ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-14 18:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Takashi,

On Monday 14 April 2014, 10:42:06 wrote Takashi Iwai:
> At Sat, 12 Apr 2014 11:08:23 +0200,
> Alexander Stein wrote:
> > 
> > This set of patches add device tree support for the AC97 controller found
> > on AT91SAM9263.
> > The first two patches are minor cleanup, while the last ones add the 
actual
> > support.
> 
> Do you really need work on this driver?  The sound/atmel/* stuff is an
> old one before ASoC was introduced, mostly obsoleted nowadays.

Ah, ok. I wasn't aware of that. But is there a replacement for the ac97c 
driver? All I found in sound/soc/atmel is using the SSC peripheral. Not 
something I can use.
Regards,
Alexander

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: Device tree support for Atmel AC97 controller on AT91SAM9263
  2014-04-14 18:43     ` Alexander Stein
@ 2014-04-14 22:47       ` Alexandre Belloni
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 22:47 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Takashi Iwai, Mark Rutland, devicetree, linux-doc, Pawel Moll,
	Ian Campbell, Randy Dunlap, Nicolas Ferre, Jaroslav Kysela,
	Rob Herring, Kumar Gala, Grant Likely,
	Jean-Christophe Plagniol-Villard, Andrew Victor,
	linux-arm-kernel

On 14/04/2014 at 20:43:02 +0200, Alexander Stein wrote :
> Hello Takashi,
> 
> On Monday 14 April 2014, 10:42:06 wrote Takashi Iwai:
> > At Sat, 12 Apr 2014 11:08:23 +0200,
> > Alexander Stein wrote:
> > > 
> > > This set of patches add device tree support for the AC97 controller found
> > > on AT91SAM9263.
> > > The first two patches are minor cleanup, while the last ones add the 
> actual
> > > support.
> > 
> > Do you really need work on this driver?  The sound/atmel/* stuff is an
> > old one before ASoC was introduced, mostly obsoleted nowadays.
> 
> Ah, ok. I wasn't aware of that. But is there a replacement for the ac97c 
> driver? All I found in sound/soc/atmel is using the SSC peripheral. Not 
> something I can use.

I guess what Takashi wanted to say was: shouldn't we rewrite the driver
completely to take advantage of the ASoC infrastructure ?

I'm actually quite interesting in getting it to work as this is the la
peripheral that doesn't have DT support on the SAM9RL.

I'll make some comments on your patches but I'm not sure whether we
should keep that driver or move to ASoC. Maybe that could be an
intermediate step. I'll try to have a look this week.

Thank you for your work !

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-14 22:47       ` Alexandre Belloni
  0 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 22:47 UTC (permalink / raw)
  To: linux-arm-kernel

On 14/04/2014 at 20:43:02 +0200, Alexander Stein wrote :
> Hello Takashi,
> 
> On Monday 14 April 2014, 10:42:06 wrote Takashi Iwai:
> > At Sat, 12 Apr 2014 11:08:23 +0200,
> > Alexander Stein wrote:
> > > 
> > > This set of patches add device tree support for the AC97 controller found
> > > on AT91SAM9263.
> > > The first two patches are minor cleanup, while the last ones add the 
> actual
> > > support.
> > 
> > Do you really need work on this driver?  The sound/atmel/* stuff is an
> > old one before ASoC was introduced, mostly obsoleted nowadays.
> 
> Ah, ok. I wasn't aware of that. But is there a replacement for the ac97c 
> driver? All I found in sound/soc/atmel is using the SSC peripheral. Not 
> something I can use.

I guess what Takashi wanted to say was: shouldn't we rewrite the driver
completely to take advantage of the ASoC infrastructure ?

I'm actually quite interesting in getting it to work as this is the la
peripheral that doesn't have DT support on the SAM9RL.

I'll make some comments on your patches but I'm not sure whether we
should keep that driver or move to ASoC. Maybe that could be an
intermediate step. I'll try to have a look this week.

Thank you for your work !

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/4] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
  2014-04-12  9:08   ` Alexander Stein
@ 2014-04-14 22:48     ` Alexandre Belloni
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 22:48 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely, devicetree, linux-arm-kernel, linux-doc

On 12/04/2014 at 11:08:24 +0200, Alexander Stein wrote :
> THis reduces some boilerplate code.
   ^
   small typo
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
else
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  sound/atmel/ac97c.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
> index c5f0ddd..9a13875 100644
> --- a/sound/atmel/ac97c.c
> +++ b/sound/atmel/ac97c.c
> @@ -1202,6 +1202,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
>  }
>  
>  static struct platform_driver atmel_ac97c_driver = {
> +	.probe		= atmel_ac97c_probe,
>  	.remove		= atmel_ac97c_remove,
>  	.driver		= {
>  		.name	= "atmel_ac97c",
> @@ -1209,19 +1210,7 @@ static struct platform_driver atmel_ac97c_driver = {
>  		.pm	= ATMEL_AC97C_PM_OPS,
>  	},
>  };
> -
> -static int __init atmel_ac97c_init(void)
> -{
> -	return platform_driver_probe(&atmel_ac97c_driver,
> -			atmel_ac97c_probe);
> -}
> -module_init(atmel_ac97c_init);
> -
> -static void __exit atmel_ac97c_exit(void)
> -{
> -	platform_driver_unregister(&atmel_ac97c_driver);
> -}
> -module_exit(atmel_ac97c_exit);
> +module_platform_driver(atmel_ac97c_driver);
>  
>  MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 1/4] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
@ 2014-04-14 22:48     ` Alexandre Belloni
  0 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 22:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/04/2014 at 11:08:24 +0200, Alexander Stein wrote :
> THis reduces some boilerplate code.
   ^
   small typo
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
else
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  sound/atmel/ac97c.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
> index c5f0ddd..9a13875 100644
> --- a/sound/atmel/ac97c.c
> +++ b/sound/atmel/ac97c.c
> @@ -1202,6 +1202,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
>  }
>  
>  static struct platform_driver atmel_ac97c_driver = {
> +	.probe		= atmel_ac97c_probe,
>  	.remove		= atmel_ac97c_remove,
>  	.driver		= {
>  		.name	= "atmel_ac97c",
> @@ -1209,19 +1210,7 @@ static struct platform_driver atmel_ac97c_driver = {
>  		.pm	= ATMEL_AC97C_PM_OPS,
>  	},
>  };
> -
> -static int __init atmel_ac97c_init(void)
> -{
> -	return platform_driver_probe(&atmel_ac97c_driver,
> -			atmel_ac97c_probe);
> -}
> -module_init(atmel_ac97c_init);
> -
> -static void __exit atmel_ac97c_exit(void)
> -{
> -	platform_driver_unregister(&atmel_ac97c_driver);
> -}
> -module_exit(atmel_ac97c_exit);
> +module_platform_driver(atmel_ac97c_driver);
>  
>  MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/4] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data
  2014-04-12  9:08   ` Alexander Stein
@ 2014-04-14 22:51     ` Alexandre Belloni
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 22:51 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely, devicetree, linux-arm-kernel, linux-doc

On 12/04/2014 at 11:08:25 +0200, Alexander Stein wrote :
> This platform data member is unsed, so remove it.
                                 ^
                                 another typo :)
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
I would say that it doesn't matter anymore but no code is better tahn
dead code.

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  include/sound/atmel-ac97c.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
> index e6aabdb..00e6c289 100644
> --- a/include/sound/atmel-ac97c.h
> +++ b/include/sound/atmel-ac97c.h
> @@ -23,7 +23,6 @@
>   * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
>   *             optional to use, set to -ENODEV if not in use. AC97 layer will
>   *             try to do a software reset of the external codec anyway.
> - * @flags: Flags for which directions should be enabled.
>   *
>   * If the user do not want to use a DMA channel for playback or capture, i.e.
>   * only one feature is required on the board. The slave for playback or capture
> @@ -33,7 +32,6 @@
>  struct ac97c_platform_data {
>  	struct dw_dma_slave	rx_dws;
>  	struct dw_dma_slave	tx_dws;
> -	unsigned int 		flags;
>  	int			reset_pin;
>  };
>  
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 2/4] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data
@ 2014-04-14 22:51     ` Alexandre Belloni
  0 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 22:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/04/2014 at 11:08:25 +0200, Alexander Stein wrote :
> This platform data member is unsed, so remove it.
                                 ^
                                 another typo :)
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
I would say that it doesn't matter anymore but no code is better tahn
dead code.

Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  include/sound/atmel-ac97c.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
> index e6aabdb..00e6c289 100644
> --- a/include/sound/atmel-ac97c.h
> +++ b/include/sound/atmel-ac97c.h
> @@ -23,7 +23,6 @@
>   * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
>   *             optional to use, set to -ENODEV if not in use. AC97 layer will
>   *             try to do a software reset of the external codec anyway.
> - * @flags: Flags for which directions should be enabled.
>   *
>   * If the user do not want to use a DMA channel for playback or capture, i.e.
>   * only one feature is required on the board. The slave for playback or capture
> @@ -33,7 +32,6 @@
>  struct ac97c_platform_data {
>  	struct dw_dma_slave	rx_dws;
>  	struct dw_dma_slave	tx_dws;
> -	unsigned int 		flags;
>  	int			reset_pin;
>  };
>  
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-12  9:08   ` Alexander Stein
@ 2014-04-14 23:07     ` Alexandre Belloni
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 23:07 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Andrew Victor, Nicolas Ferre,
	Jean-Christophe Plagniol-Villard, Jaroslav Kysela, Takashi Iwai,
	Grant Likely, devicetree, linux-arm-kernel, linux-doc

On 12/04/2014 at 11:08:26 +0200, Alexander Stein wrote :

Even if dead simple, please try to include a commit log.

> Signed-off-by: Alexander Stein <alexanders83@web.de>
> ---
>  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
>  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--

You should separate the documentation from the rest of the patch. The
patch adding documentation is actually the only one of the series that
should go to devicetree@vger.kernel.org and the devicetree maintainers.

>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> new file mode 100644
> index 0000000..9839403
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> @@ -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
> +  - atmel,reset-pin: GPIO for resetting the codec
> +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>;
> +
> +	atmel,reset-pin = <&pioC 29 GPIO_ACTIVE_LOW>;
> +};
> diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
> index 9a13875..b84432b 100644
> --- a/sound/atmel/ac97c.c
> +++ b/sound/atmel/ac97c.c
> @@ -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>
> @@ -901,6 +904,47 @@ 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);
> +	}
> +
> +	match = of_match_device(atmel_ac97c_dt_ids, dev);
> +	if (!match) {
> +		dev_err(dev, "Unknown device model\n");
> +		return ERR_PTR(-EINVAL);
> +	}

You probably don't need that, it will always match. You would need it if
you were actually using match (for example to get the .data member).

> +
> +	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return ERR_PTR(-ENOMEM);
> +
> +	pdata->reset_pin = of_get_named_gpio(dev->of_node,
> +					     "atmel,reset-pin", 0);
> +
> +	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;
> @@ -921,10 +965,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);
> @@ -1208,6 +1253,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);
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-14 23:07     ` Alexandre Belloni
  0 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 23:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/04/2014 at 11:08:26 +0200, Alexander Stein wrote :

Even if dead simple, please try to include a commit log.

> Signed-off-by: Alexander Stein <alexanders83@web.de>
> ---
>  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
>  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--

You should separate the documentation from the rest of the patch. The
patch adding documentation is actually the only one of the series that
should go to devicetree at vger.kernel.org and the devicetree maintainers.

>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> new file mode 100644
> index 0000000..9839403
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> @@ -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
> +  - atmel,reset-pin: GPIO for resetting the codec
> +Optional properties:
> +  - pinctrl-names, pinctrl-0: Please refer to pinctrl-bindings.txt
> +
> +Example:
> +sound at fffa0000 {
> +	compatible = "atmel,atmel_ac97c";
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pinctrl_ac97>;
> +	reg = <0xfffa0000 0x4000>;
> +	interrupts = <18 IRQ_TYPE_LEVEL_HIGH 5>;
> +
> +	atmel,reset-pin = <&pioC 29 GPIO_ACTIVE_LOW>;
> +};
> diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
> index 9a13875..b84432b 100644
> --- a/sound/atmel/ac97c.c
> +++ b/sound/atmel/ac97c.c
> @@ -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>
> @@ -901,6 +904,47 @@ 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);
> +	}
> +
> +	match = of_match_device(atmel_ac97c_dt_ids, dev);
> +	if (!match) {
> +		dev_err(dev, "Unknown device model\n");
> +		return ERR_PTR(-EINVAL);
> +	}

You probably don't need that, it will always match. You would need it if
you were actually using match (for example to get the .data member).

> +
> +	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return ERR_PTR(-ENOMEM);
> +
> +	pdata->reset_pin = of_get_named_gpio(dev->of_node,
> +					     "atmel,reset-pin", 0);
> +
> +	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;
> @@ -921,10 +965,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);
> @@ -1208,6 +1253,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);
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-13  8:32           ` Alexander Stein
@ 2014-04-14 23:21             ` Alexandre Belloni
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 23:21 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Alexander Shiyan, Mark Rutland, devicetree, Randy Dunlap,
	Pawel Moll, linux-doc, Takashi Iwai, Ian Campbell, Nicolas Ferre,
	Jaroslav Kysela, Rob Herring, Kumar Gala, Grant Likely,
	Jean-Christophe Plagniol-Villard, Andrew Victor,
	linux-arm-kernel

On 13/04/2014 at 10:32:09 +0200, Alexander Stein wrote :
> On Saturday 12 April 2014, 14:48:17 wrote Alexander Shiyan:
> > Sat, 12 Apr 2014 12:42:18 +0200 от Alexander Stein <alexanders83@web.de>:
> > > On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > > > Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> > > > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > > > ---
> > > > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > > > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > > > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > > > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > 
> > > > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > new file mode 100644
> > > > > index 0000000..9839403
> > > > > --- /dev/null
> > > > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > @@ -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
> > > > > +  - atmel,reset-pin: GPIO for resetting the codec
> > > > 
> > > > Why standard "gpios" property cannot be used here?
> > > 
> > > I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> > > If this is the recommended way, I'll gladly change that.
> > 
> > Another question is whether this property should refer to the controller,
> > as it is clear that it refers to the codec ....
> 
> AFAICT the codec itself has no representation in the devicetree. It gets detected by the controller which uses the reset GPIO.
>

Yeah, maybe we can already go for ac97-gpios, there. It actually takes a
list of gpios: ac97-sync, ac97-sdata and ac97-reset. You may want to
have a look at Documentation/devicetree/bindings/sound/soc-ac97link.txt
and snd_soc_set_ac97_ops_of_reset(), snd_soc_ac97_parse_pinctl() in
sound/soc/core.c

The goal would be to be able to keep the same bindings when switching
over to ASoC.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-14 23:21             ` Alexandre Belloni
  0 siblings, 0 replies; 47+ messages in thread
From: Alexandre Belloni @ 2014-04-14 23:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 13/04/2014 at 10:32:09 +0200, Alexander Stein wrote :
> On Saturday 12 April 2014, 14:48:17 wrote Alexander Shiyan:
> > Sat, 12 Apr 2014 12:42:18 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > > On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > > > Sat, 12 Apr 2014 11:08:26 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > > > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > > > ---
> > > > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > > > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > > > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > > > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > 
> > > > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > new file mode 100644
> > > > > index 0000000..9839403
> > > > > --- /dev/null
> > > > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > @@ -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
> > > > > +  - atmel,reset-pin: GPIO for resetting the codec
> > > > 
> > > > Why standard "gpios" property cannot be used here?
> > > 
> > > I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> > > If this is the recommended way, I'll gladly change that.
> > 
> > Another question is whether this property should refer to the controller,
> > as it is clear that it refers to the codec ....
> 
> AFAICT the codec itself has no representation in the devicetree. It gets detected by the controller which uses the reset GPIO.
>

Yeah, maybe we can already go for ac97-gpios, there. It actually takes a
list of gpios: ac97-sync, ac97-sdata and ac97-reset. You may want to
have a look at Documentation/devicetree/bindings/sound/soc-ac97link.txt
and snd_soc_set_ac97_ops_of_reset(), snd_soc_ac97_parse_pinctl() in
sound/soc/core.c

The goal would be to be able to keep the same bindings when switching
over to ASoC.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: Device tree support for Atmel AC97 controller on AT91SAM9263
  2014-04-14 22:47       ` Alexandre Belloni
@ 2014-04-15  5:59         ` Takashi Iwai
  -1 siblings, 0 replies; 47+ messages in thread
From: Takashi Iwai @ 2014-04-15  5:59 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alexander Stein, Mark Rutland, devicetree, linux-doc, Pawel Moll,
	Ian Campbell, Randy Dunlap, Nicolas Ferre, Jaroslav Kysela,
	Rob Herring, Kumar Gala, Grant Likely,
	Jean-Christophe Plagniol-Villard, Andrew Victor,
	linux-arm-kernel

At Tue, 15 Apr 2014 00:47:11 +0200,
Alexandre Belloni wrote:
> 
> On 14/04/2014 at 20:43:02 +0200, Alexander Stein wrote :
> > Hello Takashi,
> > 
> > On Monday 14 April 2014, 10:42:06 wrote Takashi Iwai:
> > > At Sat, 12 Apr 2014 11:08:23 +0200,
> > > Alexander Stein wrote:
> > > > 
> > > > This set of patches add device tree support for the AC97 controller found
> > > > on AT91SAM9263.
> > > > The first two patches are minor cleanup, while the last ones add the 
> > actual
> > > > support.
> > > 
> > > Do you really need work on this driver?  The sound/atmel/* stuff is an
> > > old one before ASoC was introduced, mostly obsoleted nowadays.
> > 
> > Ah, ok. I wasn't aware of that. But is there a replacement for the ac97c 
> > driver? All I found in sound/soc/atmel is using the SSC peripheral. Not 
> > something I can use.
> 
> I guess what Takashi wanted to say was: shouldn't we rewrite the driver
> completely to take advantage of the ASoC infrastructure ?

Yep, exactly.  Thanks for my sparse word completion :)

> I'm actually quite interesting in getting it to work as this is the la
> peripheral that doesn't have DT support on the SAM9RL.
> 
> I'll make some comments on your patches but I'm not sure whether we
> should keep that driver or move to ASoC. Maybe that could be an
> intermediate step. I'll try to have a look this week.

OK, if people think it's still useful, I can take the patches without
problems.  The changes are small and easy enough.  But, the only
condition is that it's assured that the changes / binding is
applicable to ASoC (in future, if any).  That said, it'd be great if
anyone can work on the proper integration to ASoC at the same time. 


thanks,

Takashi

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Device tree support for Atmel AC97 controller on AT91SAM9263
@ 2014-04-15  5:59         ` Takashi Iwai
  0 siblings, 0 replies; 47+ messages in thread
From: Takashi Iwai @ 2014-04-15  5:59 UTC (permalink / raw)
  To: linux-arm-kernel

At Tue, 15 Apr 2014 00:47:11 +0200,
Alexandre Belloni wrote:
> 
> On 14/04/2014 at 20:43:02 +0200, Alexander Stein wrote :
> > Hello Takashi,
> > 
> > On Monday 14 April 2014, 10:42:06 wrote Takashi Iwai:
> > > At Sat, 12 Apr 2014 11:08:23 +0200,
> > > Alexander Stein wrote:
> > > > 
> > > > This set of patches add device tree support for the AC97 controller found
> > > > on AT91SAM9263.
> > > > The first two patches are minor cleanup, while the last ones add the 
> > actual
> > > > support.
> > > 
> > > Do you really need work on this driver?  The sound/atmel/* stuff is an
> > > old one before ASoC was introduced, mostly obsoleted nowadays.
> > 
> > Ah, ok. I wasn't aware of that. But is there a replacement for the ac97c 
> > driver? All I found in sound/soc/atmel is using the SSC peripheral. Not 
> > something I can use.
> 
> I guess what Takashi wanted to say was: shouldn't we rewrite the driver
> completely to take advantage of the ASoC infrastructure ?

Yep, exactly.  Thanks for my sparse word completion :)

> I'm actually quite interesting in getting it to work as this is the la
> peripheral that doesn't have DT support on the SAM9RL.
> 
> I'll make some comments on your patches but I'm not sure whether we
> should keep that driver or move to ASoC. Maybe that could be an
> intermediate step. I'll try to have a look this week.

OK, if people think it's still useful, I can take the patches without
problems.  The changes are small and easy enough.  But, the only
condition is that it's assured that the changes / binding is
applicable to ASoC (in future, if any).  That said, it'd be great if
anyone can work on the proper integration to ASoC at the same time. 


thanks,

Takashi

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
  2014-04-12  9:08 ` Alexander Stein
                   ` (6 preceding siblings ...)
  (?)
@ 2014-04-15 17:38 ` Alexander Stein
  2014-04-15 17:38   ` [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data Alexander Stein
                     ` (2 more replies)
  -1 siblings, 3 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-15 17:38 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: Alexander Stein, Nicolas Ferre, alsa-devel, Alexandre Belloni

This reduces some boilerplate code.

Signed-off-by: Alexander Stein <alexanders83@web.de>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 sound/atmel/ac97c.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 05ec049..a04d2317 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -1198,6 +1198,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver atmel_ac97c_driver = {
+	.probe		= atmel_ac97c_probe,
 	.remove		= atmel_ac97c_remove,
 	.driver		= {
 		.name	= "atmel_ac97c",
@@ -1205,19 +1206,7 @@ static struct platform_driver atmel_ac97c_driver = {
 		.pm	= ATMEL_AC97C_PM_OPS,
 	},
 };
-
-static int __init atmel_ac97c_init(void)
-{
-	return platform_driver_probe(&atmel_ac97c_driver,
-			atmel_ac97c_probe);
-}
-module_init(atmel_ac97c_init);
-
-static void __exit atmel_ac97c_exit(void)
-{
-	platform_driver_unregister(&atmel_ac97c_driver);
-}
-module_exit(atmel_ac97c_exit);
+module_platform_driver(atmel_ac97c_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data
  2014-04-15 17:38 ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Alexander Stein
@ 2014-04-15 17:38   ` Alexander Stein
  2014-04-16  7:39     ` Nicolas Ferre
  2014-04-16  7:39   ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Nicolas Ferre
  2014-04-16  8:23   ` Takashi Iwai
  2 siblings, 1 reply; 47+ messages in thread
From: Alexander Stein @ 2014-04-15 17:38 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: Alexander Stein, Nicolas Ferre, alsa-devel, Alexandre Belloni

This platform data member is unused, so remove it.

Signed-off-by: Alexander Stein <alexanders83@web.de>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 include/sound/atmel-ac97c.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
index e6aabdb..00e6c289 100644
--- a/include/sound/atmel-ac97c.h
+++ b/include/sound/atmel-ac97c.h
@@ -23,7 +23,6 @@
  * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
  *             optional to use, set to -ENODEV if not in use. AC97 layer will
  *             try to do a software reset of the external codec anyway.
- * @flags: Flags for which directions should be enabled.
  *
  * If the user do not want to use a DMA channel for playback or capture, i.e.
  * only one feature is required on the board. The slave for playback or capture
@@ -33,7 +32,6 @@
 struct ac97c_platform_data {
 	struct dw_dma_slave	rx_dws;
 	struct dw_dma_slave	tx_dws;
-	unsigned int 		flags;
 	int			reset_pin;
 };
 
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: Re: Re: [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
  2014-04-14 23:21             ` Alexandre Belloni
@ 2014-04-15 19:17               ` Alexander Stein
  -1 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-15 19:17 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alexander Shiyan, Mark Rutland, devicetree, Randy Dunlap,
	Pawel Moll, linux-doc, Takashi Iwai, Ian Campbell, Nicolas Ferre,
	Jaroslav Kysela, Rob Herring, Kumar Gala, Grant Likely,
	Jean-Christophe Plagniol-Villard, Andrew Victor,
	linux-arm-kernel

On Tuesday 15 April 2014, 01:21:34 wrote Alexandre Belloni:
> On 13/04/2014 at 10:32:09 +0200, Alexander Stein wrote :
> > On Saturday 12 April 2014, 14:48:17 wrote Alexander Shiyan:
> > > Sat, 12 Apr 2014 12:42:18 +0200 от Alexander Stein <alexanders83@web.de>:
> > > > On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > > > > Sat, 12 Apr 2014 11:08:26 +0200 от Alexander Stein <alexanders83@web.de>:
> > > > > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > > > > ---
> > > > > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > > > > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > > > > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > > > > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > > 
> > > > > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > > new file mode 100644
> > > > > > index 0000000..9839403
> > > > > > --- /dev/null
> > > > > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > > @@ -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
> > > > > > +  - atmel,reset-pin: GPIO for resetting the codec
> > > > > 
> > > > > Why standard "gpios" property cannot be used here?
> > > > 
> > > > I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> > > > If this is the recommended way, I'll gladly change that.
> > > 
> > > Another question is whether this property should refer to the controller,
> > > as it is clear that it refers to the codec ....
> > 
> > AFAICT the codec itself has no representation in the devicetree. It gets detected by the controller which uses the reset GPIO.
> >
> 
> Yeah, maybe we can already go for ac97-gpios, there. It actually takes a
> list of gpios: ac97-sync, ac97-sdata and ac97-reset. You may want to
> have a look at Documentation/devicetree/bindings/sound/soc-ac97link.txt
> and snd_soc_set_ac97_ops_of_reset(), snd_soc_ac97_parse_pinctl() in
> sound/soc/core.c
> 
> The goal would be to be able to keep the same bindings when switching
> over to ASoC.

Those bindings are only for the description an AC97 codec attached, right?
I'm just wondering what is ac97-sdata actually?
The datasheet to my microcontroller (atmel ac97c) has 4 signals:
* AC97CK - this would be omitted in the description as it's fixed 12,288MHz
* AC97RX - sdata_in
* AC97FS - is this ac97-sync?
* AC97TX - sdata_out

ac97-reset would be board-specific. Is ac97-reset one of those AC97TX or AC97RX?

Best regards,
Alexander

PS: I splitted Patch 3 to separate the device-tree binding and removed the device match as you suggested.


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support
@ 2014-04-15 19:17               ` Alexander Stein
  0 siblings, 0 replies; 47+ messages in thread
From: Alexander Stein @ 2014-04-15 19:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 15 April 2014, 01:21:34 wrote Alexandre Belloni:
> On 13/04/2014 at 10:32:09 +0200, Alexander Stein wrote :
> > On Saturday 12 April 2014, 14:48:17 wrote Alexander Shiyan:
> > > Sat, 12 Apr 2014 12:42:18 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > > > On Saturday 12 April 2014, 14:31:28 wrote Alexander Shiyan:
> > > > > Sat, 12 Apr 2014 11:08:26 +0200 ?? Alexander Stein <alexanders83@web.de>:
> > > > > > Signed-off-by: Alexander Stein <alexanders83@web.de>
> > > > > > ---
> > > > > >  .../devicetree/bindings/sound/atmel_ac97c.txt      | 20 +++++++++
> > > > > >  sound/atmel/ac97c.c                                | 52 ++++++++++++++++++++--
> > > > > >  2 files changed, 69 insertions(+), 3 deletions(-)
> > > > > >  create mode 100644 Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > > 
> > > > > > diff --git a/Documentation/devicetree/bindings/sound/atmel_ac97c.txt b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > > new file mode 100644
> > > > > > index 0000000..9839403
> > > > > > --- /dev/null
> > > > > > +++ b/Documentation/devicetree/bindings/sound/atmel_ac97c.txt
> > > > > > @@ -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
> > > > > > +  - atmel,reset-pin: GPIO for resetting the codec
> > > > > 
> > > > > Why standard "gpios" property cannot be used here?
> > > > 
> > > > I guess they can. I have no experience defining a devicetree binding, so I just stuck to the platformdata member name.
> > > > If this is the recommended way, I'll gladly change that.
> > > 
> > > Another question is whether this property should refer to the controller,
> > > as it is clear that it refers to the codec ....
> > 
> > AFAICT the codec itself has no representation in the devicetree. It gets detected by the controller which uses the reset GPIO.
> >
> 
> Yeah, maybe we can already go for ac97-gpios, there. It actually takes a
> list of gpios: ac97-sync, ac97-sdata and ac97-reset. You may want to
> have a look at Documentation/devicetree/bindings/sound/soc-ac97link.txt
> and snd_soc_set_ac97_ops_of_reset(), snd_soc_ac97_parse_pinctl() in
> sound/soc/core.c
> 
> The goal would be to be able to keep the same bindings when switching
> over to ASoC.

Those bindings are only for the description an AC97 codec attached, right?
I'm just wondering what is ac97-sdata actually?
The datasheet to my microcontroller (atmel ac97c) has 4 signals:
* AC97CK - this would be omitted in the description as it's fixed 12,288MHz
* AC97RX - sdata_in
* AC97FS - is this ac97-sync?
* AC97TX - sdata_out

ac97-reset would be board-specific. Is ac97-reset one of those AC97TX or AC97RX?

Best regards,
Alexander

PS: I splitted Patch 3 to separate the device-tree binding and removed the device match as you suggested.

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
  2014-04-15 17:38 ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Alexander Stein
  2014-04-15 17:38   ` [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data Alexander Stein
@ 2014-04-16  7:39   ` Nicolas Ferre
  2014-04-16  8:23   ` Takashi Iwai
  2 siblings, 0 replies; 47+ messages in thread
From: Nicolas Ferre @ 2014-04-16  7:39 UTC (permalink / raw)
  To: Alexander Stein, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, Alexandre Belloni

On 15/04/2014 19:38, Alexander Stein :
> This reduces some boilerplate code.
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks

> ---
>  sound/atmel/ac97c.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
> index 05ec049..a04d2317 100644
> --- a/sound/atmel/ac97c.c
> +++ b/sound/atmel/ac97c.c
> @@ -1198,6 +1198,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
>  }
>  
>  static struct platform_driver atmel_ac97c_driver = {
> +	.probe		= atmel_ac97c_probe,
>  	.remove		= atmel_ac97c_remove,
>  	.driver		= {
>  		.name	= "atmel_ac97c",
> @@ -1205,19 +1206,7 @@ static struct platform_driver atmel_ac97c_driver = {
>  		.pm	= ATMEL_AC97C_PM_OPS,
>  	},
>  };
> -
> -static int __init atmel_ac97c_init(void)
> -{
> -	return platform_driver_probe(&atmel_ac97c_driver,
> -			atmel_ac97c_probe);
> -}
> -module_init(atmel_ac97c_init);
> -
> -static void __exit atmel_ac97c_exit(void)
> -{
> -	platform_driver_unregister(&atmel_ac97c_driver);
> -}
> -module_exit(atmel_ac97c_exit);
> +module_platform_driver(atmel_ac97c_driver);
>  
>  MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data
  2014-04-15 17:38   ` [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data Alexander Stein
@ 2014-04-16  7:39     ` Nicolas Ferre
  0 siblings, 0 replies; 47+ messages in thread
From: Nicolas Ferre @ 2014-04-16  7:39 UTC (permalink / raw)
  To: Alexander Stein, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, Alexandre Belloni

On 15/04/2014 19:38, Alexander Stein :
> This platform data member is unused, so remove it.
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  include/sound/atmel-ac97c.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
> index e6aabdb..00e6c289 100644
> --- a/include/sound/atmel-ac97c.h
> +++ b/include/sound/atmel-ac97c.h
> @@ -23,7 +23,6 @@
>   * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
>   *             optional to use, set to -ENODEV if not in use. AC97 layer will
>   *             try to do a software reset of the external codec anyway.
> - * @flags: Flags for which directions should be enabled.
>   *
>   * If the user do not want to use a DMA channel for playback or capture, i.e.
>   * only one feature is required on the board. The slave for playback or capture
> @@ -33,7 +32,6 @@
>  struct ac97c_platform_data {
>  	struct dw_dma_slave	rx_dws;
>  	struct dw_dma_slave	tx_dws;
> -	unsigned int 		flags;
>  	int			reset_pin;
>  };
>  
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver
  2014-04-15 17:38 ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Alexander Stein
  2014-04-15 17:38   ` [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data Alexander Stein
  2014-04-16  7:39   ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Nicolas Ferre
@ 2014-04-16  8:23   ` Takashi Iwai
  2 siblings, 0 replies; 47+ messages in thread
From: Takashi Iwai @ 2014-04-16  8:23 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Nicolas Ferre, alsa-devel, Alexandre Belloni

At Tue, 15 Apr 2014 19:38:56 +0200,
Alexander Stein wrote:
> 
> This reduces some boilerplate code.
> 
> Signed-off-by: Alexander Stein <alexanders83@web.de>
> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Thanks, applied these two cleanup patches now.


Takashi

> ---
>  sound/atmel/ac97c.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
> index 05ec049..a04d2317 100644
> --- a/sound/atmel/ac97c.c
> +++ b/sound/atmel/ac97c.c
> @@ -1198,6 +1198,7 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
>  }
>  
>  static struct platform_driver atmel_ac97c_driver = {
> +	.probe		= atmel_ac97c_probe,
>  	.remove		= atmel_ac97c_remove,
>  	.driver		= {
>  		.name	= "atmel_ac97c",
> @@ -1205,19 +1206,7 @@ static struct platform_driver atmel_ac97c_driver = {
>  		.pm	= ATMEL_AC97C_PM_OPS,
>  	},
>  };
> -
> -static int __init atmel_ac97c_init(void)
> -{
> -	return platform_driver_probe(&atmel_ac97c_driver,
> -			atmel_ac97c_probe);
> -}
> -module_init(atmel_ac97c_init);
> -
> -static void __exit atmel_ac97c_exit(void)
> -{
> -	platform_driver_unregister(&atmel_ac97c_driver);
> -}
> -module_exit(atmel_ac97c_exit);
> +module_platform_driver(atmel_ac97c_driver);
>  
>  MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
> -- 
> 1.9.2
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2014-04-16  8:23 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-12  9:08 Device tree support for Atmel AC97 controller on AT91SAM9263 Alexander Stein
2014-04-12  9:08 ` Alexander Stein
2014-04-12  9:08 ` [PATCH 1/4] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Alexander Stein
2014-04-12  9:08   ` Alexander Stein
2014-04-14 22:48   ` Alexandre Belloni
2014-04-14 22:48     ` Alexandre Belloni
2014-04-12  9:08 ` [PATCH 2/4] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data Alexander Stein
2014-04-12  9:08   ` Alexander Stein
2014-04-14 22:51   ` Alexandre Belloni
2014-04-14 22:51     ` Alexandre Belloni
2014-04-12  9:08 ` [PATCH 3/4] ALSA: sound/atmel/ac97c.c: Add device tree support Alexander Stein
2014-04-12  9:08   ` Alexander Stein
     [not found]   ` <1397293707-26890-4-git-send-email-alexanders83-S0/GAf8tV78@public.gmane.org>
2014-04-12 10:31     ` Alexander Shiyan
2014-04-12 10:31   ` Alexander Shiyan
2014-04-12 10:31     ` Alexander Shiyan
2014-04-12 10:42     ` Alexander Stein
2014-04-12 10:42       ` Alexander Stein
2014-04-12 10:48       ` Alexander Shiyan
2014-04-12 10:48         ` Alexander Shiyan
2014-04-13  8:32         ` Alexander Stein
2014-04-13  8:32           ` Alexander Stein
2014-04-14 23:21           ` Alexandre Belloni
2014-04-14 23:21             ` Alexandre Belloni
2014-04-15 19:17             ` Re: " Alexander Stein
2014-04-15 19:17               ` Alexander Stein
2014-04-12 10:31   ` Alexander Shiyan
2014-04-14 23:07   ` Alexandre Belloni
2014-04-14 23:07     ` Alexandre Belloni
2014-04-12  9:08 ` [PATCH 4/4] ARM: at91/dt: sam9263: Add ac97 device node Alexander Stein
2014-04-12  9:08   ` Alexander Stein
2014-04-14  8:39 ` Device tree support for Atmel AC97 controller on AT91SAM9263 Bo Shen
2014-04-14  8:39   ` Bo Shen
2014-04-14 18:34   ` Alexander Stein
2014-04-14 18:34     ` Alexander Stein
2014-04-14  8:42 ` Takashi Iwai
2014-04-14  8:42   ` Takashi Iwai
2014-04-14 18:43   ` Alexander Stein
2014-04-14 18:43     ` Alexander Stein
2014-04-14 22:47     ` Alexandre Belloni
2014-04-14 22:47       ` Alexandre Belloni
2014-04-15  5:59       ` Takashi Iwai
2014-04-15  5:59         ` Takashi Iwai
2014-04-15 17:38 ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Alexander Stein
2014-04-15 17:38   ` [PATCH v2 2/2] ALSA: sound/atmel-ac97c.h: Remove unused flags from platform data Alexander Stein
2014-04-16  7:39     ` Nicolas Ferre
2014-04-16  7:39   ` [PATCH v2 1/2] ALSA: sound/atmel/ac97c.c: Convert to module_platform_driver Nicolas Ferre
2014-04-16  8:23   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.