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

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Martin Povišer and committed by
Mark Brown
f0066c8d 6553ee02

+11 -10
+11 -10
sound/soc/codecs/tas2770.c
··· 224 224 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2, 225 225 TAS2770_TDM_CFG_REG2_RXW_MASK, 226 226 TAS2770_TDM_CFG_REG2_RXW_16BITS); 227 - tas2770->v_sense_slot = tas2770->i_sense_slot + 2; 228 227 break; 229 228 case SNDRV_PCM_FORMAT_S24_LE: 230 229 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2, 231 230 TAS2770_TDM_CFG_REG2_RXW_MASK, 232 231 TAS2770_TDM_CFG_REG2_RXW_24BITS); 233 - tas2770->v_sense_slot = tas2770->i_sense_slot + 4; 234 232 break; 235 233 case SNDRV_PCM_FORMAT_S32_LE: 236 234 ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG2, 237 235 TAS2770_TDM_CFG_REG2_RXW_MASK, 238 236 TAS2770_TDM_CFG_REG2_RXW_32BITS); 239 - tas2770->v_sense_slot = tas2770->i_sense_slot + 4; 240 237 break; 241 238 242 239 default: 243 240 return -EINVAL; 244 241 } 245 242 246 - if (ret < 0) 247 - return ret; 248 - 249 - ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot, 250 - tas2770->v_sense_slot); 251 243 if (ret < 0) 252 244 return ret; 253 245 ··· 497 505 { 498 506 struct tas2770_priv *tas2770 = 499 507 snd_soc_component_get_drvdata(component); 508 + int ret; 500 509 501 510 tas2770->component = component; 502 511 ··· 508 515 509 516 tas2770_reset(tas2770); 510 517 regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); 518 + 519 + if (tas2770->i_sense_slot != -1 && tas2770->v_sense_slot != -1) { 520 + ret = tas2770_set_ivsense_transmit(tas2770, tas2770->i_sense_slot, 521 + tas2770->v_sense_slot); 522 + 523 + if (ret < 0) 524 + return ret; 525 + } 511 526 512 527 return 0; 513 528 } ··· 644 643 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", 645 644 "ti,imon-slot-no"); 646 645 647 - tas2770->i_sense_slot = 0; 646 + tas2770->i_sense_slot = -1; 648 647 } 649 648 650 649 rc = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no", ··· 653 652 dev_info(tas2770->dev, "Property %s is missing setting default slot\n", 654 653 "ti,vmon-slot-no"); 655 654 656 - tas2770->v_sense_slot = 2; 655 + tas2770->v_sense_slot = -1; 657 656 } 658 657 659 658 tas2770->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH);