Commit dcd79364 authored by Michael Sit Wei Hong's avatar Michael Sit Wei Hong Committed by Mark Brown

ASoC: codec: tlv3204: Enable 24 bit audio support

Enable 24 bit in 32 bit container audio support.
Using the params_physical_width to differentiate
24 bit in 32 bit container and 24 bit in 24 bit container modes.
Use the sample rate, bit depth and channel parameters to
calculate the bit clock needed.
Signed-off-by: default avatarMichael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Reviewed-by: default avatarSia Jee Heng <jee.heng.sia@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200812094631.4698-2-michael.wei.hong.sit@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 549ade57
......@@ -665,7 +665,8 @@ static int aic32x4_set_processing_blocks(struct snd_soc_component *component,
}
static int aic32x4_setup_clocks(struct snd_soc_component *component,
unsigned int sample_rate)
unsigned int sample_rate, unsigned int channel,
unsigned int bit_depth)
{
u8 aosr;
u16 dosr;
......@@ -753,7 +754,8 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
dosr);
clk_set_rate(clocks[5].clk,
sample_rate * 32);
sample_rate * channel *
bit_depth);
return 0;
}
}
......@@ -775,9 +777,11 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
u8 iface1_reg = 0;
u8 dacsetup_reg = 0;
aic32x4_setup_clocks(component, params_rate(params));
aic32x4_setup_clocks(component, params_rate(params),
params_channels(params),
params_physical_width(params));
switch (params_width(params)) {
switch (params_physical_width(params)) {
case 16:
iface1_reg |= (AIC32X4_WORD_LEN_16BITS <<
AIC32X4_IFACE1_DATALEN_SHIFT);
......@@ -862,7 +866,8 @@ static int aic32x4_set_bias_level(struct snd_soc_component *component,
#define AIC32X4_RATES SNDRV_PCM_RATE_8000_192000
#define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
| SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
| SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_3LE \
| SNDRV_PCM_FMTBIT_S32_LE)
static const struct snd_soc_dai_ops aic32x4_ops = {
.hw_params = aic32x4_hw_params,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment