diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-01 23:35:14 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-01 23:35:14 -0500 |
| commit | 9f82b0440eb5fda4d7c4e4b5adf3be8c325ed578 (patch) | |
| tree | af897a5e475537fd0051628958db190e409e022b | |
| parent | cc43b45684018fc94ea9e007961bcf20ed8aaed8 (diff) | |
| parent | 1858fe97c87c33c4975e291ecbbd6c1a20315674 (diff) | |
Merge remote-tracking branch 'asoc/topic/tlv320aic32x4' into asoc-next
| -rw-r--r-- | include/sound/tlv320aic32x4.h | 1 | ||||
| -rw-r--r-- | sound/soc/codecs/tlv320aic32x4.c | 24 | ||||
| -rw-r--r-- | sound/soc/codecs/tlv320aic32x4.h | 3 |
3 files changed, 28 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 f230292ba96b..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 */ |
| @@ -675,6 +687,16 @@ static int aic32x4_probe(struct snd_soc_codec *codec) | |||
| 675 | ARRAY_SIZE(aic32x4_snd_controls)); | 687 | ARRAY_SIZE(aic32x4_snd_controls)); |
| 676 | aic32x4_add_widgets(codec); | 688 | aic32x4_add_widgets(codec); |
| 677 | 689 | ||
| 690 | /* | ||
| 691 | * Workaround: for an unknown reason, the ADC needs to be powered up | ||
| 692 | * and down for the first capture to work properly. It seems related to | ||
| 693 | * a HW BUG or some kind of behavior not documented in the datasheet. | ||
| 694 | */ | ||
| 695 | tmp_reg = snd_soc_read(codec, AIC32X4_ADCSETUP); | ||
| 696 | snd_soc_write(codec, AIC32X4_ADCSETUP, tmp_reg | | ||
| 697 | AIC32X4_LADC_EN | AIC32X4_RADC_EN); | ||
| 698 | snd_soc_write(codec, AIC32X4_ADCSETUP, tmp_reg); | ||
| 699 | |||
| 678 | return 0; | 700 | return 0; |
| 679 | } | 701 | } |
| 680 | 702 | ||
| @@ -713,10 +735,12 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c, | |||
| 713 | aic32x4->power_cfg = pdata->power_cfg; | 735 | aic32x4->power_cfg = pdata->power_cfg; |
| 714 | aic32x4->swapdacs = pdata->swapdacs; | 736 | aic32x4->swapdacs = pdata->swapdacs; |
| 715 | aic32x4->micpga_routing = pdata->micpga_routing; | 737 | aic32x4->micpga_routing = pdata->micpga_routing; |
| 738 | aic32x4->rstn_gpio = pdata->rstn_gpio; | ||
| 716 | } else { | 739 | } else { |
| 717 | aic32x4->power_cfg = 0; | 740 | aic32x4->power_cfg = 0; |
| 718 | aic32x4->swapdacs = false; | 741 | aic32x4->swapdacs = false; |
| 719 | aic32x4->micpga_routing = 0; | 742 | aic32x4->micpga_routing = 0; |
| 743 | aic32x4->rstn_gpio = -1; | ||
| 720 | } | 744 | } |
| 721 | 745 | ||
| 722 | ret = snd_soc_register_codec(&i2c->dev, | 746 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h index aae2b2440398..35774223fd91 100644 --- a/sound/soc/codecs/tlv320aic32x4.h +++ b/sound/soc/codecs/tlv320aic32x4.h | |||
| @@ -94,6 +94,9 @@ | |||
| 94 | #define AIC32X4_WORD_LEN_24BITS 0x02 | 94 | #define AIC32X4_WORD_LEN_24BITS 0x02 |
| 95 | #define AIC32X4_WORD_LEN_32BITS 0x03 | 95 | #define AIC32X4_WORD_LEN_32BITS 0x03 |
| 96 | 96 | ||
| 97 | #define AIC32X4_LADC_EN (1 << 7) | ||
| 98 | #define AIC32X4_RADC_EN (1 << 6) | ||
| 99 | |||
| 97 | #define AIC32X4_I2S_MODE 0x00 | 100 | #define AIC32X4_I2S_MODE 0x00 |
| 98 | #define AIC32X4_DSP_MODE 0x01 | 101 | #define AIC32X4_DSP_MODE 0x01 |
| 99 | #define AIC32X4_RIGHT_JUSTIFIED_MODE 0x02 | 102 | #define AIC32X4_RIGHT_JUSTIFIED_MODE 0x02 |
