[alsa-devel] [PATCH 1/3] ASoC: Add device tree binding for WM8770
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com --- 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
diff --git a/Documentation/devicetree/bindings/sound/wm8770.txt b/Documentation/devicetree/bindings/sound/wm8770.txt new file mode 100644 index 0000000..866e00c --- /dev/null +++ b/Documentation/devicetree/bindings/sound/wm8770.txt @@ -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>; +}; diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 19b92ba..aa05e65 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -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)
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com --- 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
diff --git a/Documentation/devicetree/bindings/sound/wm8776.txt b/Documentation/devicetree/bindings/sound/wm8776.txt new file mode 100644 index 0000000..3b9ca49 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/wm8776.txt @@ -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>; +}; diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 367a990..0cfbfc1 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -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),
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com --- 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
diff --git a/Documentation/devicetree/bindings/sound/wm8804.txt b/Documentation/devicetree/bindings/sound/wm8804.txt new file mode 100644 index 0000000..4d3a56f --- /dev/null +++ b/Documentation/devicetree/bindings/sound/wm8804.txt @@ -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>; +}; diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 9a5e67c..9ee072b 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -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),
On Mon, Aug 29, 2011 at 8:27 AM, Mark Brown broonie@opensource.wolfsonmicro.com wrote:
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com
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?
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
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com
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.
Mark Brown wrote:
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.
On Tue, Aug 30, 2011 at 01:15:07PM -0500, Timur Tabi wrote:
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).
On Mon, Aug 29, 2011 at 02:27:49PM +0100, Mark Brown wrote:
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com
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.
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
diff --git a/Documentation/devicetree/bindings/sound/wm8770.txt b/Documentation/devicetree/bindings/sound/wm8770.txt new file mode 100644 index 0000000..866e00c --- /dev/null +++ b/Documentation/devicetree/bindings/sound/wm8770.txt @@ -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>;
+}; diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 19b92ba..aa05e65 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -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,
}, .probe = wm8770_spi_probe, .remove = __devexit_p(wm8770_spi_remove).of_match_table = wm8770_of_match,
-- 1.7.5.4
On 29/08/11 14:27, Mark Brown wrote:
Signed-off-by: Mark Brown broonie@opensource.wolfsonmicro.com
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
These all look fine to me wrt ASoC. All
Acked-by: Liam Girdwood lrg@ti.com
participants (5)
-
Grant Likely
-
Liam Girdwood
-
Mark Brown
-
Tabi Timur-B04825
-
Timur Tabi