Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342657
b: refs/heads/master
c: 385a4c2
h: refs/heads/master
i:
  342655: c136e05
v: v3
  • Loading branch information
Daniel Mack authored and Mark Brown committed Nov 23, 2012
1 parent b47c292 commit 1d83ac3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac5dbea0d483bc0f6281f55261fab1dee7e6ac96
refs/heads/master: 385a4c2e286571ba824ee5312f506f198866c3b5
5 changes: 5 additions & 0 deletions trunk/Documentation/devicetree/bindings/sound/ak4104.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
17 changes: 17 additions & 0 deletions trunk/sound/soc/codecs/ak4104.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <sound/soc.h>
#include <sound/initval.h>
#include <linux/spi/spi.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <sound/asoundef.h>

/* AK4104 registers addresses */
Expand Down Expand Up @@ -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;
Expand All @@ -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. */
Expand Down

0 comments on commit 1d83ac3

Please sign in to comment.