From 1d83ac3eb9aa04651e3c8e80383f188764ac651a Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 14 Nov 2012 18:28:39 +0800 Subject: [PATCH] --- yaml --- r: 342657 b: refs/heads/master c: 385a4c2e286571ba824ee5312f506f198866c3b5 h: refs/heads/master i: 342655: c136e0523cbae262a8e5c3126cf43aec4fa2c8ad v: v3 --- [refs] | 2 +- .../devicetree/bindings/sound/ak4104.txt | 5 +++++ trunk/sound/soc/codecs/ak4104.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index c14e774e587b..7dac243f8b6f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ac5dbea0d483bc0f6281f55261fab1dee7e6ac96 +refs/heads/master: 385a4c2e286571ba824ee5312f506f198866c3b5 diff --git a/trunk/Documentation/devicetree/bindings/sound/ak4104.txt b/trunk/Documentation/devicetree/bindings/sound/ak4104.txt index 1f8e5066d443..b902ee39cf89 100644 --- a/trunk/Documentation/devicetree/bindings/sound/ak4104.txt +++ b/trunk/Documentation/devicetree/bindings/sound/ak4104.txt @@ -8,6 +8,11 @@ Required properties: - reg : The chip select number on the SPI bus +Optional properties: + + - reset-gpio : a GPIO spec for the reset pin. If specified, it will be + deasserted before communication to the device starts. + Example: spdif: ak4104@0 { diff --git a/trunk/sound/soc/codecs/ak4104.c b/trunk/sound/soc/codecs/ak4104.c index d4d485808894..eec086b226f7 100644 --- a/trunk/sound/soc/codecs/ak4104.c +++ b/trunk/sound/soc/codecs/ak4104.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include /* AK4104 registers addresses */ @@ -204,6 +206,7 @@ static const struct regmap_config ak4104_regmap = { static int ak4104_spi_probe(struct spi_device *spi) { + struct device_node *np = spi->dev.of_node; struct ak4104_private *ak4104; unsigned int val; int ret; @@ -225,6 +228,20 @@ static int ak4104_spi_probe(struct spi_device *spi) return ret; } + if (np) { + enum of_gpio_flags flags; + int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags); + + if (gpio_is_valid(gpio)) { + ret = devm_gpio_request_one(&spi->dev, gpio, + flags & OF_GPIO_ACTIVE_LOW ? + GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, + "ak4104 reset"); + if (ret < 0) + return ret; + } + } + /* read the 'reserved' register - according to the datasheet, it * should contain 0x5b. Not a good way to verify the presence of * the device, but there is no hardware ID register. */