Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: tscs454: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

A fixup is also required to use the width directly rather than relying
on the format in hw_params, now both little and big endian would be
supported. It is worth noting this changes the behaviour of S24_LE to
use a word length of 24 rather than 32. This would appear to be a
correction since the fact S24_LE is stored as 32 bits should not be
presented over the bus.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-26-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Charles Keepax and committed by
Mark Brown
ff69ec96 f5e0084b

+6 -6
+6 -6
sound/soc/codecs/tscs454.c
··· 3120 3120 unsigned int width; 3121 3121 int ret; 3122 3122 3123 - switch (format) { 3124 - case SNDRV_PCM_FORMAT_S16_LE: 3123 + switch (snd_pcm_format_width(format)) { 3124 + case 16: 3125 3125 width = FV_WL_16; 3126 3126 break; 3127 - case SNDRV_PCM_FORMAT_S20_3LE: 3127 + case 20: 3128 3128 width = FV_WL_20; 3129 3129 break; 3130 - case SNDRV_PCM_FORMAT_S24_3LE: 3130 + case 24: 3131 3131 width = FV_WL_24; 3132 3132 break; 3133 - case SNDRV_PCM_FORMAT_S24_LE: 3134 - case SNDRV_PCM_FORMAT_S32_LE: 3133 + case 32: 3135 3134 width = FV_WL_32; 3136 3135 break; 3137 3136 default: ··· 3325 3326 .num_dapm_routes = ARRAY_SIZE(tscs454_intercon), 3326 3327 .controls = tscs454_snd_controls, 3327 3328 .num_controls = ARRAY_SIZE(tscs454_snd_controls), 3329 + .endianness = 1, 3328 3330 }; 3329 3331 3330 3332 #define TSCS454_RATES SNDRV_PCM_RATE_8000_96000