ASoC: ssm2602: add device tree bindings
authorStefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Mon, 29 Sep 2014 19:41:10 +0000 (22:41 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 30 Sep 2014 12:27:27 +0000 (13:27 +0100)
Allow the ssm2602/ssm2603/ssm2604 codec driver to be
instantiated from the device tree.

Also, add Kconfig prompts to allow manual selection of both the
I2C and SPI configuration versions of the driver.

Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Documentation/devicetree/bindings/sound/adi,ssm2602.txt [new file with mode: 0644]
sound/soc/codecs/Kconfig
sound/soc/codecs/ssm2602-i2c.c
sound/soc/codecs/ssm2602-spi.c

diff --git a/Documentation/devicetree/bindings/sound/adi,ssm2602.txt b/Documentation/devicetree/bindings/sound/adi,ssm2602.txt
new file mode 100644 (file)
index 0000000..3b3302f
--- /dev/null
@@ -0,0 +1,19 @@
+Analog Devices SSM2602, SSM2603 and SSM2604 I2S audio CODEC devices
+
+SSM2602 support both I2C and SPI as the configuration interface,
+the selection is made by the MODE strap-in pin.
+SSM2603 and SSM2604 only support I2C as the configuration interface.
+
+Required properties:
+
+  - compatible : One of "adi,ssm2602", "adi,ssm2603" or "adi,ssm2604"
+
+  - reg : the I2C address of the device for I2C, the chip select
+          number for SPI.
+
+ Example:
+
+       ssm2602: ssm2602@1a {
+               compatible = "adi,ssm2602";
+               reg = <0x1a>;
+       };
index 8838838e25ed89a9525e80b86cd92575701a75d9..3649e7399ec7fb5a79b957dbe9d616a9c75dd239 100644 (file)
@@ -520,12 +520,16 @@ config SND_SOC_SSM2602
        tristate
 
 config SND_SOC_SSM2602_SPI
+       tristate "Analog Devices SSM2602 CODEC - SPI"
+       depends on SPI_MASTER
        select SND_SOC_SSM2602
-       tristate
+       select REGMAP_SPI
 
 config SND_SOC_SSM2602_I2C
+       tristate "Analog Devices SSM2602 CODEC - I2C"
+       depends on I2C
        select SND_SOC_SSM2602
-       tristate
+       select REGMAP_I2C
 
 config SND_SOC_STA32X
        tristate
index abd63d5371733d36cf3e31dfe6ed4a2e79692bfc..0d9779d6bfda7fced8b472d283a04ad9d91c7f75 100644 (file)
@@ -41,10 +41,19 @@ static const struct i2c_device_id ssm2602_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ssm2602_i2c_id);
 
+static const struct of_device_id ssm2602_of_match[] = {
+       { .compatible = "adi,ssm2602", },
+       { .compatible = "adi,ssm2603", },
+       { .compatible = "adi,ssm2604", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, ssm2602_of_match);
+
 static struct i2c_driver ssm2602_i2c_driver = {
        .driver = {
                .name = "ssm2602",
                .owner = THIS_MODULE,
+               .of_match_table = ssm2602_of_match,
        },
        .probe = ssm2602_i2c_probe,
        .remove = ssm2602_i2c_remove,
index 2bf55e24a7bbfce316cc90a3431beca554bd7b8a..b5df14fbe3adabd9f0604b0af536caa4df6182e6 100644 (file)
@@ -26,10 +26,17 @@ static int ssm2602_spi_remove(struct spi_device *spi)
        return 0;
 }
 
+static const struct of_device_id ssm2602_of_match[] = {
+       { .compatible = "adi,ssm2602", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, ssm2602_of_match);
+
 static struct spi_driver ssm2602_spi_driver = {
        .driver = {
                .name   = "ssm2602",
                .owner  = THIS_MODULE,
+               .of_match_table = ssm2602_of_match,
        },
        .probe          = ssm2602_spi_probe,
        .remove         = ssm2602_spi_remove,