Skip to contentSkip to conversation

ASoC: Add device tree binding for WM8770

PATCH In review Mark Brown 6 participants 9 messages Aug 29, 2011 – Aug 31, 2011 3 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/3 ASoC: Add device tree binding for WM8770

---
 Documentation/devicetree/bindings/sound/wm8770.txt |   16 ++++++++++++++++
 sound/soc/codecs/wm8770.c                          |    8 ++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8770.txt
Documentation/devicetree/bindings/sound/wm8770.txt new file +16 -0
new file mode 100644
index 0000000..866e00c
@@ -0,0 +1,16 @@
+WM8770 audio CODEC
+
+This device supports SPI.
+
+Required properties:
+
+  - compatible : "wlf,wm8770"
+
+  - reg : the chip select number.
+
+Example:
+
+codec: wm8770@1 {
+	compatible = "wlf,wm8770";
+	reg = <1>;
+};
sound/soc/codecs/wm8770.c +8 -0
index 19b92ba..aa05e65 100644
@@ -14,6 +14,7 @@
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/of_device.h>
 #include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
@@ -684,6 +685,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8770 = {
 	.reg_cache_default = wm8770_reg_defs
 };
 
+static const struct of_device_id wm8770_of_match[] = {
+	{ .compatible = "wlf,wm8770", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wm8770_of_match);
+
 #if defined(CONFIG_SPI_MASTER)
 static int __devinit wm8770_spi_probe(struct spi_device *spi)
 {
@@ -715,6 +722,7 @@ static struct spi_driver wm8770_spi_driver = {
 	.driver = {
 		.name = "wm8770",
 		.owner = THIS_MODULE,
+		.of_match_table = wm8770_of_match,
 	},
 	.probe = wm8770_spi_probe,
 	.remove = __devexit_p(wm8770_spi_remove)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 2/3 ASoC: Add device tree binding for WM8776

---
 Documentation/devicetree/bindings/sound/wm8776.txt |   18 ++++++++++++++++++
 sound/soc/codecs/wm8776.c                          |    9 +++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8776.txt
Documentation/devicetree/bindings/sound/wm8776.txt new file +18 -0
new file mode 100644
index 0000000..3b9ca49
@@ -0,0 +1,18 @@
+WM8776 audio CODEC
+
+This device supports both I2C and SPI (configured with pin strapping
+on the board).
+
+Required properties:
+
+  - compatible : "wlf,wm8776"
+
+  - reg : the I2C address of the device for I2C, the chip select
+          number for SPI.
+
+Example:
+
+codec: wm8776@1a {
+	compatible = "wlf,wm8776";
+	reg = <0x1a>;
+};
sound/soc/codecs/wm8776.c +9 -0
index 367a990..0cfbfc1 100644
@@ -18,6 +18,7 @@
 #include <linux/delay.h>
 #include <linux/pm.h>
 #include <linux/i2c.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 #include <linux/slab.h>
@@ -452,6 +453,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8776 = {
 	.reg_cache_default = wm8776_reg,
 };
 
+static const struct of_device_id wm8776_of_match[] = {
+	{ .compatible = "wlf,wm8776", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wm8776_of_match);
+
 #if defined(CONFIG_SPI_MASTER)
 static int __devinit wm8776_spi_probe(struct spi_device *spi)
 {
@@ -483,6 +490,7 @@ static struct spi_driver wm8776_spi_driver = {
 	.driver = {
 		.name	= "wm8776",
 		.owner	= THIS_MODULE,
+		.of_match_table = wm8776_of_match,
 	},
 	.probe		= wm8776_spi_probe,
 	.remove		= __devexit_p(wm8776_spi_remove),
@@ -527,6 +535,7 @@ static struct i2c_driver wm8776_i2c_driver = {
 	.driver = {
 		.name = "wm8776",
 		.owner = THIS_MODULE,
+		.of_match_table = wm8776_of_match,
 	},
 	.probe =    wm8776_i2c_probe,
 	.remove =   __devexit_p(wm8776_i2c_remove),
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 3/3 ASoC: Add device tree binding for WM8804

In reply to Mark Brown
---
 Documentation/devicetree/bindings/sound/wm8804.txt |   18 ++++++++++++++++++
 sound/soc/codecs/wm8804.c                          |    9 +++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8804.txt
Documentation/devicetree/bindings/sound/wm8804.txt new file +18 -0
new file mode 100644
index 0000000..4d3a56f
@@ -0,0 +1,18 @@
+WM8804 audio CODEC
+
+This device supports both I2C and SPI (configured with pin strapping
+on the board).
+
+Required properties:
+
+  - compatible : "wlf,wm8804"
+
+  - reg : the I2C address of the device for I2C, the chip select
+          number for SPI.
+
+Example:
+
+codec: wm8804@1a {
+	compatible = "wlf,wm8804";
+	reg = <0x1a>;
+};
sound/soc/codecs/wm8804.c +9 -0
index 9a5e67c..9ee072b 100644
@@ -16,6 +16,7 @@
 #include <linux/delay.h>
 #include <linux/pm.h>
 #include <linux/i2c.h>
+#include <linux/of_device.h>
 #include <linux/spi/spi.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
@@ -717,6 +718,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8804 = {
 	.volatile_register = wm8804_volatile
 };
 
+static const struct of_device_id wm8804_of_match[] = {
+	{ .compatible = "wlf,wm8804", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wm8804_of_match);
+
 #if defined(CONFIG_SPI_MASTER)
 static int __devinit wm8804_spi_probe(struct spi_device *spi)
 {
@@ -748,6 +755,7 @@ static struct spi_driver wm8804_spi_driver = {
 	.driver = {
 		.name = "wm8804",
 		.owner = THIS_MODULE,
+		.of_match_table = wm8804_of_match,
 	},
 	.probe = wm8804_spi_probe,
 	.remove = __devexit_p(wm8804_spi_remove)
@@ -792,6 +800,7 @@ static struct i2c_driver wm8804_i2c_driver = {
 	.driver = {
 		.name = "wm8804",
 		.owner = THIS_MODULE,
+		.of_match_table = wm8804_of_match,
 	},
 	.probe = wm8804_i2c_probe,
 	.remove = __devexit_p(wm8804_i2c_remove),
Signature · 1 line
1.7.5.4
#3 lore raw
In reply to Mark Brown
Quoted 3 lines · Mark Brown

---
 Documentation/devicetree/bindings/sound/wm8770.txt |   16 ++++++++++++++++

I don't think we should have a separate text file for each codec. We'll soon have dozens of files that are almost identical. Can't we have one text file that describes most of the codec nodes, and only add new text files for exceptions?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#10 lore raw
In reply to a message not in the archive
Quoted 1 line · Mark Brown

All three look fine.

I do agree with Timur that if the bindings don't have anything device specific in them, then it would be fine to have one text file for all of them.

g.

Quoted 64 lines
---
 Documentation/devicetree/bindings/sound/wm8770.txt |   16 ++++++++++++++++
 sound/soc/codecs/wm8770.c                          |    8 ++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/wm8770.txt
Documentation/devicetree/bindings/sound/wm8770.txt new file +16 -0
new file mode 100644
index 0000000..866e00c
@@ -0,0 +1,16 @@
+WM8770 audio CODEC
+
+This device supports SPI.
+
+Required properties:
+
+  - compatible : "wlf,wm8770"
+
+  - reg : the chip select number.
+
+Example:
+
+codec: wm8770@1 {
+	compatible = "wlf,wm8770";
+	reg = <1>;
+};
sound/soc/codecs/wm8770.c +8 -0
index 19b92ba..aa05e65 100644
@@ -14,6 +14,7 @@
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/of_device.h>
 #include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
@@ -684,6 +685,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8770 = {
 	.reg_cache_default = wm8770_reg_defs
 };
 
+static const struct of_device_id wm8770_of_match[] = {
+	{ .compatible = "wlf,wm8770", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wm8770_of_match);
+
 #if defined(CONFIG_SPI_MASTER)
 static int __devinit wm8770_spi_probe(struct spi_device *spi)
 {
@@ -715,6 +722,7 @@ static struct spi_driver wm8770_spi_driver = {
 	.driver = {
 		.name = "wm8770",
 		.owner = THIS_MODULE,
+		.of_match_table = wm8770_of_match,
 	},
 	.probe = wm8770_spi_probe,
 	.remove = __devexit_p(wm8770_spi_remove)
Signature · 1 line
1.7.5.4
author
#5 lore raw
In reply to a message not in the archive
Quoted 10 lines · On Tue, Aug 30, 2011 at 03:48:44PM +0000, Tabi Timur-B04825 wrote:

On Mon, Aug 29, 2011 at 8:27 AM, Mark Brown

Quoted 3 lines

 Documentation/devicetree/bindings/sound/wm8770.txt |   16 ++++++++++++++++

I don't think we should have a separate text file for each codec. We'll soon have dozens of files that are almost identical. Can't we have one text file that describes most of the codec nodes, and only add new text files for exceptions?

I did say this before; personally I find having binding documentation at all for the basic I2C/SPI bus binding of a device to be a complete waste of time and would rather just not bother unless we have properties.

#6 lore raw
Quoted 3 lines · Mark Brown

I did say this before; personally I find having binding documentation at all for the basic I2C/SPI bus binding of a device to be a complete waste of time and would rather just not bother unless we have properties.

I'm okay with that, but it's not my decision. :-)

The codec node bindings that my audio driver expects are documented in ssi.txt.
Note that I require a clock-frequency property to indicate the input clock
frequency on the codec itself.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
author
#8 lore raw
In reply to a message not in the archive
Quoted 2 lines · Timur Tabi

Note that I require a clock-frequency property to indicate the input clock
frequency on the codec itself.

It's listed as optional in the binding (and would in general need to be).