Before componentisation any part registered as a CODEC would have automatically supported both little and big endian, ie. the core would duplicate any supported LE or BE PCM format to support the other endian as well. As componentisation removed the distinction between CODEC drivers and platform drivers, a flag was added to specify if this behaviour is required for a particular component. However, as most systems tend to use little endian the absence of the flag is rarely noticed. Also the naming of the flag "endianness" is a little unobvious as to if it should be applied to a particular component.
This series adds a comment to better explain the meaning of the flag and then tidys up the usage of the flag. A couple of uses of the flag are removed where is has been used inappropriately on the CPU side of the DAI link, this is clearly not valid in the cases it has been used, and I suspect never would be valid. Then some redundant formats are removed, since they would be covered by existing endianness flags. And finally a bunch of devices that are missing the flag have it added.
It is worth noting that since componenisation there are now a couple of cases where it is not entire clear to me that the flag should be applied to all CODECs as it was before. In those cases I haven't updated the driver to add the flag and they are outlined here:
1) Build into the AP CODECs, these are actual silicon inside the main processor and they typically receive audio directly from an internal bus. It is not obvious to me that these can happily ignore endian. On the CODEC side these include: jz4725b.c, jz4760.c, jz4770.c, rk3328_codec.c, lpass-va-macro.c, lpass-rx-macro.c, lpass-tx-macro.c, lpass-wsa-macro.c. There are also some examples of this scattered around the various platform support directories in sound/soc.
2) Devices behind non-audio buses, SPI just moves bits and doesn't really define an endian for audio data on the bus. Thus it seems the CODEC probably can care about the endian. The only devices that fall into this group (mostly for AoV) are: rt5514-spi.c, rt5677-spi.c, cros_ec_codec.c (only the AoV).
3) CODECs with no DAIs, these could specify the flag and plenty of them do; CODECs from the initial conversion to componentisation. But the flag makes no difference here since there is nothing for it to apply to. This includes purely analogue CODECs: aw8738.c, ssm2305.c, tpa6130a2.c, tda7419.c, max9759.c, max9768.c, max9877.c, lm4857.c, simple-mux.c, simple-amplifier.c. And devices that only do jack detection: ts3a227e.c, mt6359-accdet.c.
If there are any opinions on adding the flag to any of those three groups they would be greatfully received. But I am leaning towards leaving 1,2 without endianness flags since it feels inappropriate, and removing the endian flag from devices in catagory 3 that already have it. Assuming no one objects to that I will do a follow up series for that.
Thanks, Charles
Charles Keepax (38): ASoC: soc-component: Add comment for the endianness flag ASoC: atmel-pdmic: Remove endianness flag on pdmic component ASoC: atmel-classd: Remove endianness flag on class d component ASoC: cs4270: Remove redundant big endian formats ASoC: cs42l51: Remove redundant big endian formats ASoC: cs4349: Remove redundant big endian formats ASoC: hdmi-codec: Remove redundant big endian formats ASoC: sta32x: Remove redundant big endian formats ASoC: sta350: Remove redundant big endian formats ASoC: hdac_hda: Add endianness flag in snd_soc_component_driver ASoC: max98504: Add endianness flag in snd_soc_component_driver ASoC: adau1372: Add endianness flag in snd_soc_component_driver ASoC: cs4234: Add endianness flag in snd_soc_component_driver ASoC: cs35l41: Add endianness flag in snd_soc_component_driver ASoC: cx2072x: Add endianness flag in snd_soc_component_driver ASoC: lochnagar: Add endianness flag in snd_soc_component_driver ASoC: mt6351: Add endianness flag in snd_soc_component_driver ASoC: mt6358: Add endianness flag in snd_soc_component_driver ASoC: mt6359: Add endianness flag in snd_soc_component_driver ASoC: mt6660: Add endianness flag in snd_soc_component_driver ASoC: pcm3060: Add endianness flag in snd_soc_component_driver ASoC: rt1019: Add endianness flag in snd_soc_component_driver ASoC: rt9120: Add endianness flag in snd_soc_component_driver ASoC: tlv320adc3xxx: Add endianness flag in snd_soc_component_driver ASoC: tscs454: Add endianness flag in snd_soc_component_driver ASoC: cros_ec_codec: Add endianness flag in i2s_rx_component_driver ASoC: wcd934x: Add endianness flag in snd_soc_component_driver ASoC: wcd9335: Add endianness flag in snd_soc_component_driver ASoC: rt700: Add endianness flag in snd_soc_component_driver ASoC: rt711: Add endianness flag in snd_soc_component_driver ASoC: rt711-sdca: Add endianness flag in snd_soc_component_driver ASoC: rt715: Add endianness flag in snd_soc_component_driver ASoC: rt715-sdca: Add endianness flag in snd_soc_component_driver ASoC: rt1308-sdw: Add endianness flag in snd_soc_component_driver ASoC: rt1316-sdw: Add endianness flag in snd_soc_component_driver ASoC: wcd938x: Add endianness flag in snd_soc_component_driver ASoC: wsa881x: Add endianness flag in snd_soc_component_driver ASoC: sdw-mockup: Add endianness flag in snd_soc_component_driver
include/sound/soc-component.h | 9 +++++++++ sound/soc/atmel/atmel-classd.c | 1 - sound/soc/atmel/atmel-pdmic.c | 1 - sound/soc/codecs/adau1372.c | 1 + sound/soc/codecs/cros_ec_codec.c | 7 ++++--- sound/soc/codecs/cs35l41.c | 2 ++ sound/soc/codecs/cs4234.c | 1 + sound/soc/codecs/cs4270.c | 15 +++------------ sound/soc/codecs/cs42l51.c | 7 ++----- sound/soc/codecs/cs4349.c | 9 +++------ sound/soc/codecs/cx2072x.c | 1 + sound/soc/codecs/hdac_hda.c | 15 ++++++++------- sound/soc/codecs/hdmi-codec.c | 15 +++++---------- sound/soc/codecs/lochnagar-sc.c | 5 +++-- sound/soc/codecs/max98504.c | 1 + sound/soc/codecs/mt6351.c | 10 ++++------ sound/soc/codecs/mt6358.c | 10 ++++------ sound/soc/codecs/mt6359.c | 10 ++++------ sound/soc/codecs/mt6660.c | 1 + sound/soc/codecs/pcm3060.c | 1 + sound/soc/codecs/rt1019.c | 3 ++- sound/soc/codecs/rt1308-sdw.c | 1 + sound/soc/codecs/rt1316-sdw.c | 1 + sound/soc/codecs/rt700.c | 1 + sound/soc/codecs/rt711-sdca.c | 1 + sound/soc/codecs/rt711.c | 1 + sound/soc/codecs/rt715-sdca.c | 1 + sound/soc/codecs/rt715.c | 1 + sound/soc/codecs/rt9120.c | 1 + sound/soc/codecs/sdw-mockup.c | 1 + sound/soc/codecs/sta32x.c | 9 +++------ sound/soc/codecs/sta350.c | 9 +++------ sound/soc/codecs/tlv320adc3xxx.c | 11 ++++++----- sound/soc/codecs/tscs454.c | 12 ++++++------ sound/soc/codecs/wcd9335.c | 1 + sound/soc/codecs/wcd934x.c | 1 + sound/soc/codecs/wcd938x.c | 1 + sound/soc/codecs/wsa881x.c | 1 + 38 files changed, 90 insertions(+), 89 deletions(-)