mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 04:56:13 +02:00
ASoC: tas2770: Fix and redo I/V sense TDM slot setting logic
The former code sets the V slot from inside set_bitwidth according to the bitwidth of the PCM format. That's wrong, since: * It overrides the V slot parsed from DT binding. * The V slot is set shifted behind the I slot by the length of the PCM bitwidth, but the PCM bitwidth has no assured relation to the TDM slot width. Replace the former logic by setting up the I/V sense transmission only in case of both I/V slots being specified in devicetree, and never override those values. In case the slots are left unspecified, disable the transmission completely. There's an improbable case someone is relying on the old behavior, but if so, that's a setup that only works by accident, and cannot be sanely supported going forward. There's no indication anyone is consuming the I/V sense data up to today, so break the former behavior. Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250227-apple-codec-changes-v3-6-cbb130030acf@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
6553ee024b
commit
f0066c8d1d
|
|
@ -224,19 +224,16 @@ static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth)
|
|||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
|
||||
TAS2770_TDM_CFG_REG2_RXW_MASK,
|
||||
TAS2770_TDM_CFG_REG2_RXW_16BITS);
|
||||
tas2770->v_sense_slot = tas2770->i_sense_slot + 2;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S24_LE:
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
|
||||
TAS2770_TDM_CFG_REG2_RXW_MASK,
|
||||
TAS2770_TDM_CFG_REG2_RXW_24BITS);
|
||||
tas2770->v_sense_slot = tas2770->i_sense_slot + 4;
|
||||
break;
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2,
|
||||
TAS2770_TDM_CFG_REG2_RXW_MASK,
|
||||
TAS2770_TDM_CFG_REG2_RXW_32BITS);
|
||||
tas2770->v_sense_slot = tas2770->i_sense_slot + 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -246,11 +243,6 @@ static int tas2770_set_bitwidth(struct tas2770_priv *tas2770, int bitwidth)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot,
|
||||
tas2770->v_sense_slot);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -505,6 +497,7 @@ static int tas2770_codec_probe(struct snd_soc_component *component)
|
|||
{
|
||||
struct tas2770_priv *tas2770 =
|
||||
snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
tas2770->component = component;
|
||||
|
||||
|
|
@ -516,6 +509,14 @@ static int tas2770_codec_probe(struct snd_soc_component *component)
|
|||
tas2770_reset(tas2770);
|
||||
regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap);
|
||||
|
||||
if (tas2770->i_sense_slot != -1 && tas2770->v_sense_slot != -1) {
|
||||
ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot,
|
||||
tas2770->v_sense_slot);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -643,7 +644,7 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770)
|
|||
dev_info(tas2770->dev, "Property %s is missing setting default slot\n",
|
||||
"ti,imon-slot-no");
|
||||
|
||||
tas2770->i_sense_slot = 0;
|
||||
tas2770->i_sense_slot = -1;
|
||||
}
|
||||
|
||||
rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no",
|
||||
|
|
@ -652,7 +653,7 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770)
|
|||
dev_info(tas2770->dev, "Property %s is missing setting default slot\n",
|
||||
"ti,vmon-slot-no");
|
||||
|
||||
tas2770->v_sense_slot = 2;
|
||||
tas2770->v_sense_slot = -1;
|
||||
}
|
||||
|
||||
tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user