diff options
author | Javier Martin <javier.martin@vista-silicon.com> | 2012-10-31 06:53:34 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-01 10:35:56 -0400 |
commit | 1858fe97c87c33c4975e291ecbbd6c1a20315674 (patch) | |
tree | 357738191450f4d437e97f15d5f567065c7a15e9 | |
parent | a405387c6825b1fc1956e22b10160b0f31536f3f (diff) |
ASoC: tlv320aic32x4: Add rstn gpio to platform data.
Add the possibility to specify a gpio through platform data
so that a HW reset can be issued to the codec.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/sound/tlv320aic32x4.h | 1 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic32x4.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/sound/tlv320aic32x4.h b/include/sound/tlv320aic32x4.h index c009f70b4029..24e5d991f148 100644 --- a/include/sound/tlv320aic32x4.h +++ b/include/sound/tlv320aic32x4.h | |||
@@ -26,6 +26,7 @@ struct aic32x4_pdata { | |||
26 | u32 power_cfg; | 26 | u32 power_cfg; |
27 | u32 micpga_routing; | 27 | u32 micpga_routing; |
28 | bool swapdacs; | 28 | bool swapdacs; |
29 | int rstn_gpio; | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | #endif | 32 | #endif |
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index d7d0e18f794c..e39e08d5d8e4 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/pm.h> | 30 | #include <linux/pm.h> |
31 | #include <linux/gpio.h> | ||
31 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
32 | #include <linux/cdev.h> | 33 | #include <linux/cdev.h> |
33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
@@ -65,6 +66,7 @@ struct aic32x4_priv { | |||
65 | u32 power_cfg; | 66 | u32 power_cfg; |
66 | u32 micpga_routing; | 67 | u32 micpga_routing; |
67 | bool swapdacs; | 68 | bool swapdacs; |
69 | int rstn_gpio; | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | /* 0dB min, 1dB steps */ | 72 | /* 0dB min, 1dB steps */ |
@@ -627,10 +629,20 @@ static int aic32x4_probe(struct snd_soc_codec *codec) | |||
627 | { | 629 | { |
628 | struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); | 630 | struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); |
629 | u32 tmp_reg; | 631 | u32 tmp_reg; |
632 | int ret; | ||
630 | 633 | ||
631 | codec->hw_write = (hw_write_t) i2c_master_send; | 634 | codec->hw_write = (hw_write_t) i2c_master_send; |
632 | codec->control_data = aic32x4->control_data; | 635 | codec->control_data = aic32x4->control_data; |
633 | 636 | ||
637 | if (aic32x4->rstn_gpio >= 0) { | ||
638 | ret = devm_gpio_request_one(codec->dev, aic32x4->rstn_gpio, | ||
639 | GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn"); | ||
640 | if (ret != 0) | ||
641 | return ret; | ||
642 | ndelay(10); | ||
643 | gpio_set_value(aic32x4->rstn_gpio, 1); | ||
644 | } | ||
645 | |||
634 | snd_soc_write(codec, AIC32X4_RESET, 0x01); | 646 | snd_soc_write(codec, AIC32X4_RESET, 0x01); |
635 | 647 | ||
636 | /* Power platform configuration */ | 648 | /* Power platform configuration */ |
@@ -723,10 +735,12 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c, | |||
723 | aic32x4->power_cfg = pdata->power_cfg; | 735 | aic32x4->power_cfg = pdata->power_cfg; |
724 | aic32x4->swapdacs = pdata->swapdacs; | 736 | aic32x4->swapdacs = pdata->swapdacs; |
725 | aic32x4->micpga_routing = pdata->micpga_routing; | 737 | aic32x4->micpga_routing = pdata->micpga_routing; |
738 | aic32x4->rstn_gpio = pdata->rstn_gpio; | ||
726 | } else { | 739 | } else { |
727 | aic32x4->power_cfg = 0; | 740 | aic32x4->power_cfg = 0; |
728 | aic32x4->swapdacs = false; | 741 | aic32x4->swapdacs = false; |
729 | aic32x4->micpga_routing = 0; | 742 | aic32x4->micpga_routing = 0; |
743 | aic32x4->rstn_gpio = -1; | ||
730 | } | 744 | } |
731 | 745 | ||
732 | ret = snd_soc_register_codec(&i2c->dev, | 746 | ret = snd_soc_register_codec(&i2c->dev, |