diff options
author | andy.hu <andy.hu@starfivetech.com> | 2022-09-07 09:04:54 +0300 |
---|---|---|
committer | andy.hu <andy.hu@starfivetech.com> | 2022-09-07 09:04:54 +0300 |
commit | 1d221d0a3c14d8b25e31160e0960464917dc1d16 (patch) | |
tree | 5646f205b9aebfba8758efce2202c51ffe62ad36 | |
parent | 9fe2ff084981027fe7132336348b413dc7107774 (diff) | |
parent | caeab3fe0ac53a62dc2ea2e0ec21501681055d3d (diff) | |
download | linux-1d221d0a3c14d8b25e31160e0960464917dc1d16.tar.xz |
Merge branch 'CR_2076_515_I2S_AC108_Xingyu.Wu' into 'jh7110-5.15.y-devel'
CR_2076 & 2077 & 2078 & 2075 :I2S and AC108
See merge request sdk/linux!469
-rwxr-xr-x | sound/soc/codecs/ac108.c | 12 | ||||
-rwxr-xr-x | sound/soc/codecs/wm8960.c | 9 | ||||
-rwxr-xr-x | sound/soc/dwc/dwc-i2s.c | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | sound/soc/starfive/starfive_pdm.c | 6 |
4 files changed, 27 insertions, 5 deletions
diff --git a/sound/soc/codecs/ac108.c b/sound/soc/codecs/ac108.c index a4afb1fba258..4aaa1f6cfe86 100755 --- a/sound/soc/codecs/ac108.c +++ b/sound/soc/codecs/ac108.c @@ -160,10 +160,10 @@ static const struct pll_div ac108_pll_div_list[] = { /* AC108 definition */ #define AC108_CHANNELS_MAX 8 /* range[1, 16] */ #define AC108_RATES (SNDRV_PCM_RATE_8000_96000 & \ - ~(SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_64000 | \ + ~(SNDRV_PCM_RATE_64000 | \ SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)) -#define AC108_FORMATS (/*SNDRV_PCM_FMTBIT_S16_LE | \ - SNDRV_PCM_FMTBIT_S20_3LE | \ +#define AC108_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ + /*SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE |*/ \ SNDRV_PCM_FMTBIT_S32_LE) @@ -1200,6 +1200,12 @@ static int ac108_codec_probe(struct snd_soc_codec *codec) ac101_codec_probe(codec); } + /* change default volume */ + ac108_multi_update_bits(ADC1_DVOL_CTRL, 0xff, 0xc8, ac10x); + ac108_multi_update_bits(ADC2_DVOL_CTRL, 0xff, 0xc8, ac10x); + ac108_multi_update_bits(ADC3_DVOL_CTRL, 0xff, 0xc8, ac10x); + ac108_multi_update_bits(ADC4_DVOL_CTRL, 0xff, 0xc8, ac10x); + return 0; } diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index fbcf9e7fa4bd..22e0a447ab0a 100755 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -137,6 +137,8 @@ struct wm8960_priv { bool is_stream_in_use[2]; struct wm8960_data pdata; struct dentry *debug_file; + bool first_capture; + bool is_capture; }; #define wm8960_reset(c) regmap_write(c, WM8960_RESET, 0) @@ -822,6 +824,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream, u16 word_length = 0; int ret; + wm8960->is_capture = substream->stream == SNDRV_PCM_STREAM_CAPTURE; wm8960->bclk = snd_soc_params_to_bclk(params); if (params_channels(params) == 1) wm8960->bclk *= 2; @@ -1002,6 +1005,10 @@ static int wm8960_set_bias_level_out3(struct snd_soc_component *component, switch (level) { case SND_SOC_BIAS_ON: + if (wm8960->first_capture && wm8960->is_capture) { + msleep(800); + wm8960->first_capture = false; + } break; case SND_SOC_BIAS_PREPARE: @@ -1594,6 +1601,8 @@ static int wm8960_i2c_probe(struct i2c_client *i2c, } } + wm8960->first_capture = true; + /* Latch the update bits */ regmap_update_bits(wm8960->regmap, WM8960_LINVOL, 0x100, 0x100); regmap_update_bits(wm8960->regmap, WM8960_RINVOL, 0x100, 0x100); diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index f2ddcfd375c8..b45e7215e1df 100755 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -256,7 +256,7 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: - if (config->sample_rate == 8000) { + if ((config->sample_rate == 8000) && (txrx == SNDRV_PCM_STREAM_PLAYBACK)) { dev_err(dev->dev, "I2S: unsupported 8000 rate with S16_LE, Stereo.\n"); return -EINVAL; } @@ -277,7 +277,8 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, break; case SNDRV_PCM_FORMAT_S32_LE: - if ((config->sample_rate == 16000) && (config->chan_nr == 1)) { + if ((config->sample_rate == 16000) && (config->chan_nr == 1) && + (txrx == SNDRV_PCM_STREAM_PLAYBACK)) { dev_err(dev->dev, "I2S: unsupported 16000 rate with S32_LE, Mono.\n"); return -EINVAL; } diff --git a/sound/soc/starfive/starfive_pdm.c b/sound/soc/starfive/starfive_pdm.c index 5f8e910a8b4f..b7a64d6f1064 100644..100755 --- a/sound/soc/starfive/starfive_pdm.c +++ b/sound/soc/starfive/starfive_pdm.c @@ -29,6 +29,7 @@ struct sf_pdm { struct clk *clk_mclk_out; struct reset_control *rst_pdm_dmic; struct reset_control *rst_pdm_apb; + unsigned char flag_first; }; static const DECLARE_TLV_DB_SCALE(volume_tlv, -9450, 150, 0); @@ -69,6 +70,10 @@ static int sf_pdm_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + if (priv->flag_first) { + priv->flag_first = 0; + mdelay(200); + } sf_pdm_enable(priv->pdm_map); return 0; @@ -398,6 +403,7 @@ static int sf_pdm_probe(struct platform_device *pdev) } priv->dev = &pdev->dev; + priv->flag_first = 1; ret = sf_pdm_clock_init(pdev, priv); if (ret) { |