diff options
-rw-r--r-- | Documentation/devicetree/bindings/sound/cs4270.txt | 5 | ||||
-rw-r--r-- | sound/soc/codecs/cs4270.c | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/cs4270.txt b/Documentation/devicetree/bindings/sound/cs4270.txt index 7f0bfd84d3fc..6b222f9b8ef5 100644 --- a/Documentation/devicetree/bindings/sound/cs4270.txt +++ b/Documentation/devicetree/bindings/sound/cs4270.txt | |||
@@ -8,6 +8,11 @@ Required properties: | |||
8 | 8 | ||
9 | - reg : the I2C address of the device for I2C | 9 | - reg : the I2C address of the device for I2C |
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 codec starts. | ||
15 | |||
11 | Example: | 16 | Example: |
12 | 17 | ||
13 | codec: cs4270@48 { | 18 | codec: cs4270@48 { |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 4b71b01ecbcd..fd11bb646d40 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/regulator/consumer.h> | 31 | #include <linux/regulator/consumer.h> |
32 | #include <linux/of_device.h> | 32 | #include <linux/of_device.h> |
33 | #include <linux/of_gpio.h> | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * The codec isn't really big-endian or little-endian, since the I2S | 36 | * The codec isn't really big-endian or little-endian, since the I2S |
@@ -660,9 +661,25 @@ MODULE_DEVICE_TABLE(of, cs4270_of_match); | |||
660 | static int cs4270_i2c_probe(struct i2c_client *i2c_client, | 661 | static int cs4270_i2c_probe(struct i2c_client *i2c_client, |
661 | const struct i2c_device_id *id) | 662 | const struct i2c_device_id *id) |
662 | { | 663 | { |
664 | struct device_node *np = i2c_client->dev.of_node; | ||
663 | struct cs4270_private *cs4270; | 665 | struct cs4270_private *cs4270; |
664 | int ret; | 666 | int ret; |
665 | 667 | ||
668 | /* See if we have a way to bring the codec out of reset */ | ||
669 | if (np) { | ||
670 | enum of_gpio_flags flags; | ||
671 | int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags); | ||
672 | |||
673 | if (gpio_is_valid(gpio)) { | ||
674 | ret = devm_gpio_request_one(&i2c_client->dev, gpio, | ||
675 | flags & OF_GPIO_ACTIVE_LOW ? | ||
676 | GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, | ||
677 | "cs4270 reset"); | ||
678 | if (ret < 0) | ||
679 | return ret; | ||
680 | } | ||
681 | } | ||
682 | |||
666 | /* Verify that we have a CS4270 */ | 683 | /* Verify that we have a CS4270 */ |
667 | 684 | ||
668 | ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); | 685 | ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); |