Skip to content

Commit dcd7936

Browse files
michaelsit-iotgbroonie
authored andcommitted
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: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com> Reviewed-by: Sia Jee Heng <jee.heng.sia@intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200812094631.4698-2-michael.wei.hong.sit@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 549ade5 commit dcd7936

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎sound/soc/codecs/tlv320aic32x4.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ static int aic32x4_set_processing_blocks(struct snd_soc_component *component,
665665
}
666666

667667
static int aic32x4_setup_clocks(struct snd_soc_component *component,
668-
unsigned int sample_rate)
668+
unsigned int sample_rate, unsigned int channel,
669+
unsigned int bit_depth)
669670
{
670671
u8 aosr;
671672
u16 dosr;
@@ -753,7 +754,8 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
753754
dosr);
754755

755756
clk_set_rate(clocks[5].clk,
756-
sample_rate * 32);
757+
sample_rate * channel *
758+
bit_depth);
757759
return 0;
758760
}
759761
}
@@ -775,9 +777,11 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
775777
u8 iface1_reg = 0;
776778
u8 dacsetup_reg = 0;
777779

778-
aic32x4_setup_clocks(component, params_rate(params));
780+
aic32x4_setup_clocks(component, params_rate(params),
781+
params_channels(params),
782+
params_physical_width(params));
779783

780-
switch (params_width(params)) {
784+
switch (params_physical_width(params)) {
781785
case 16:
782786
iface1_reg |= (AIC32X4_WORD_LEN_16BITS <<
783787
AIC32X4_IFACE1_DATALEN_SHIFT);
@@ -862,7 +866,8 @@ static int aic32x4_set_bias_level(struct snd_soc_component *component,
862866

863867
#define AIC32X4_RATES SNDRV_PCM_RATE_8000_192000
864868
#define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
865-
| SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
869+
| SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_3LE \
870+
| SNDRV_PCM_FMTBIT_S32_LE)
866871

867872
static const struct snd_soc_dai_ops aic32x4_ops = {
868873
.hw_params = aic32x4_hw_params,

0 commit comments

Comments
 (0)