diff options
author | Daniel Mack <zonque@gmail.com> | 2012-11-14 05:28:39 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-23 10:09:03 -0500 |
commit | 385a4c2e286571ba824ee5312f506f198866c3b5 (patch) | |
tree | cd50dafd2916208b81aee183794a6b05739512e0 | |
parent | ac5dbea0d483bc0f6281f55261fab1dee7e6ac96 (diff) |
ASoC: ak4104: add reset line property to DT bindings
This device doesn't have a pdata definition for legacy boards, and
unless anyone need to control the reset GPIO, it's not worth adding one.
So this feature is only available to DT users for now.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | Documentation/devicetree/bindings/sound/ak4104.txt | 5 | ||||
-rw-r--r-- | sound/soc/codecs/ak4104.c | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/ak4104.txt b/Documentation/devicetree/bindings/sound/ak4104.txt index 1f8e5066d443..b902ee39cf89 100644 --- a/Documentation/devicetree/bindings/sound/ak4104.txt +++ b/Documentation/devicetree/bindings/sound/ak4104.txt | |||
@@ -8,6 +8,11 @@ Required properties: | |||
8 | 8 | ||
9 | - reg : The chip select number on the SPI bus | 9 | - reg : The chip select number on the SPI bus |
10 | 10 | ||
11 | Optional properties: | ||
12 | |||
13 | - reset-gpio : a GPIO spec for the reset pin. If specified, it will be | ||
14 | deasserted before communication to the device starts. | ||
15 | |||
11 | Example: | 16 | Example: |
12 | 17 | ||
13 | spdif: ak4104@0 { | 18 | spdif: ak4104@0 { |
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index d4d485808894..eec086b226f7 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <sound/soc.h> | 15 | #include <sound/soc.h> |
16 | #include <sound/initval.h> | 16 | #include <sound/initval.h> |
17 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
18 | #include <linux/of_device.h> | ||
19 | #include <linux/of_gpio.h> | ||
18 | #include <sound/asoundef.h> | 20 | #include <sound/asoundef.h> |
19 | 21 | ||
20 | /* AK4104 registers addresses */ | 22 | /* AK4104 registers addresses */ |
@@ -204,6 +206,7 @@ static const struct regmap_config ak4104_regmap = { | |||
204 | 206 | ||
205 | static int ak4104_spi_probe(struct spi_device *spi) | 207 | static int ak4104_spi_probe(struct spi_device *spi) |
206 | { | 208 | { |
209 | struct device_node *np = spi->dev.of_node; | ||
207 | struct ak4104_private *ak4104; | 210 | struct ak4104_private *ak4104; |
208 | unsigned int val; | 211 | unsigned int val; |
209 | int ret; | 212 | int ret; |
@@ -225,6 +228,20 @@ static int ak4104_spi_probe(struct spi_device *spi) | |||
225 | return ret; | 228 | return ret; |
226 | } | 229 | } |
227 | 230 | ||
231 | if (np) { | ||
232 | enum of_gpio_flags flags; | ||
233 | int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags); | ||
234 | |||
235 | if (gpio_is_valid(gpio)) { | ||
236 | ret = devm_gpio_request_one(&spi->dev, gpio, | ||
237 | flags & OF_GPIO_ACTIVE_LOW ? | ||
238 | GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, | ||
239 | "ak4104 reset"); | ||
240 | if (ret < 0) | ||
241 | return ret; | ||
242 | } | ||
243 | } | ||
244 | |||
228 | /* read the 'reserved' register - according to the datasheet, it | 245 | /* read the 'reserved' register - according to the datasheet, it |
229 | * should contain 0x5b. Not a good way to verify the presence of | 246 | * should contain 0x5b. Not a good way to verify the presence of |
230 | * the device, but there is no hardware ID register. */ | 247 | * the device, but there is no hardware ID register. */ |