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: cs530x: Calculate proper bclk rate using TDM

Calculate the proper bclk rate using the number of tdm slots
and the width of the tdm data.

Fixes: 2884c29152c0 ("ASoC: cs530x: Support for cs530x ADCs")
Signed-off-by: Paul Handrigan <paulha@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240710160416.2617173-1-paulha@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Paul Handrigan and committed by
Mark Brown
c62bec0f e021e0ee

+11 -5
+10 -5
sound/soc/codecs/cs530x.c
··· 526 526 regmap_update_bits(regmap, CS530X_CLK_CFG_1, 527 527 CS530X_SAMPLE_RATE_MASK, fs_val); 528 528 529 - if (cs530x->tdm_slots) { 529 + 530 + if (regmap_test_bits(regmap, CS530X_SIGNAL_PATH_CFG, 531 + CS530X_TDM_EN_MASK)) { 530 532 dev_dbg(component->dev, "Configuring for %d %d bit TDM slots\n", 531 533 cs530x->tdm_slots, cs530x->tdm_width); 532 - cs530x->bclk = snd_soc_calc_bclk(cs530x->fs, 533 - cs530x->tdm_width, 534 - params_channels(params), 535 - cs530x->tdm_slots); 534 + cs530x->bclk = snd_soc_tdm_params_to_bclk(params, 535 + cs530x->tdm_width, 536 + cs530x->tdm_slots, 537 + 1); 536 538 } else { 537 539 cs530x->bclk = snd_soc_params_to_bclk(params); 538 540 } ··· 656 654 dev_err(component->dev, "Invalid TX slot(s) 0x%x\n", tx_mask); 657 655 return -EINVAL; 658 656 } 657 + 658 + cs530x->tdm_width = slot_width; 659 + cs530x->tdm_slots = slots; 659 660 660 661 return regmap_update_bits(regmap, CS530X_SIGNAL_PATH_CFG, 661 662 CS530X_ASP_TDM_SLOT_MASK,
+1
sound/soc/codecs/cs530x.h
··· 96 96 #define CS530X_ASP_TDM_SLOT_MASK GENMASK(5, 3) 97 97 #define CS530X_ASP_TDM_SLOT_SHIFT 3 98 98 #define CS530X_ASP_CH_REVERSE BIT(9) 99 + #define CS530X_TDM_EN_MASK BIT(2) 99 100 #define CS530X_ASP_FMT_I2S 0 100 101 #define CS530X_ASP_FMT_LJ 1 101 102 #define CS530X_ASP_FMT_DSP_A 0x6