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
This commit is contained in:
andy.hu 2022-09-07 06:04:54 +00:00
commit 1d221d0a3c
4 changed files with 27 additions and 5 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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;
}

6
sound/soc/starfive/starfive_pdm.c Normal file → Executable file
View file

@ -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) {