Skip to content

Commit 7d90c8e

Browse files
saschahauerbroonie
authored andcommitted
ASoC: tlv320adcx140: Fix tx_mask check
The tx_mask check doesn't reflect what the driver and the chip support. The check currently checks for exactly two slots being enabled. The tlv320adcx140 supports anything between one and eight channels, so relax the check accordingly. The tlv320adcx140 supports arbitrary tx_mask settings, but the driver currently only supports adjacent slots beginning with the first slot, so extend the check to check that the first slot is being used and that there are no holes in the tx_mask. Leave a comment to make it's the driver that limits the tx_mask settings, not the chip itself. While at it remove the set-but-unused struct adcx140p_priv::tdm_delay field. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.kernel.org/r/20220624105716.2579539-1-s.hauer@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9e51ac6 commit 7d90c8e

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

sound/soc/codecs/tlv320adcx140.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ struct adcx140_priv {
3333
bool micbias_vg;
3434

3535
unsigned int dai_fmt;
36-
unsigned int tdm_delay;
3736
unsigned int slot_width;
3837
};
3938

@@ -792,12 +791,13 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
792791
{
793792
struct snd_soc_component *component = codec_dai->component;
794793
struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
795-
unsigned int lsb;
796794

797-
/* TDM based on DSP mode requires slots to be adjacent */
798-
lsb = __ffs(tx_mask);
799-
if ((lsb + 1) != __fls(tx_mask)) {
800-
dev_err(component->dev, "Invalid mask, slots must be adjacent\n");
795+
/*
796+
* The chip itself supports arbitrary masks, but the driver currently
797+
* only supports adjacent slots beginning at the first slot.
798+
*/
799+
if (tx_mask != GENMASK(__fls(tx_mask), 0)) {
800+
dev_err(component->dev, "Only lower adjacent slots are supported\n");
801801
return -EINVAL;
802802
}
803803

@@ -812,7 +812,6 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
812812
return -EINVAL;
813813
}
814814

815-
adcx140->tdm_delay = lsb;
816815
adcx140->slot_width = slot_width;
817816

818817
return 0;

0 commit comments

Comments
 (0)