Skip to content

Commit 92c4406

Browse files
rfvirgilgregkh
authored andcommitted
ASoC: cs35l56: Handle new algorithms IDs for CS35L63
[ Upstream commit 8dadc11 ] CS35L63 uses different algorithm IDs from CS35L56. Add a new mechanism to handle different alg IDs between parts in the CS35L56 driver. Fixes: 9788587 ("ASoC: cs35l56: Add initial support for CS35L63 for I2C and SoundWire") Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Link: https://patch.msgid.link/20250820142209.127575-3-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 22a5164 commit 92c4406

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

include/sound/cs35l56.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ struct cs35l56_base {
306306
struct gpio_desc *reset_gpio;
307307
struct cs35l56_spi_payload *spi_payload_buf;
308308
const struct cs35l56_fw_reg *fw_reg;
309+
const struct cirrus_amp_cal_controls *calibration_controls;
309310
};
310311

311312
static inline bool cs35l56_is_otp_register(unsigned int reg)

sound/soc/codecs/cs35l56-shared.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,15 @@ const struct cirrus_amp_cal_controls cs35l56_calibration_controls = {
838838
};
839839
EXPORT_SYMBOL_NS_GPL(cs35l56_calibration_controls, "SND_SOC_CS35L56_SHARED");
840840

841+
static const struct cirrus_amp_cal_controls cs35l63_calibration_controls = {
842+
.alg_id = 0xbf210,
843+
.mem_region = WMFW_ADSP2_YM,
844+
.ambient = "CAL_AMBIENT",
845+
.calr = "CAL_R",
846+
.status = "CAL_STATUS",
847+
.checksum = "CAL_CHECKSUM",
848+
};
849+
841850
int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base)
842851
{
843852
u64 silicon_uid = 0;
@@ -912,19 +921,31 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED");
912921
void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp)
913922
{
914923
__be32 pid, sid, tid;
924+
unsigned int alg_id;
915925
int ret;
916926

927+
switch (cs35l56_base->type) {
928+
case 0x54:
929+
case 0x56:
930+
case 0x57:
931+
alg_id = 0x9f212;
932+
break;
933+
default:
934+
alg_id = 0xbf212;
935+
break;
936+
}
937+
917938
scoped_guard(mutex, &cs_dsp->pwr_lock) {
918939
ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_PRJCT_ID",
919-
WMFW_ADSP2_XM, 0x9f212),
940+
WMFW_ADSP2_XM, alg_id),
920941
0, &pid, sizeof(pid));
921942
if (!ret)
922943
ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_CHNNL_ID",
923-
WMFW_ADSP2_XM, 0x9f212),
944+
WMFW_ADSP2_XM, alg_id),
924945
0, &sid, sizeof(sid));
925946
if (!ret)
926947
ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_SNPSHT_ID",
927-
WMFW_ADSP2_XM, 0x9f212),
948+
WMFW_ADSP2_XM, alg_id),
928949
0, &tid, sizeof(tid));
929950
}
930951

@@ -974,8 +995,10 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)
974995
case 0x35A54:
975996
case 0x35A56:
976997
case 0x35A57:
998+
cs35l56_base->calibration_controls = &cs35l56_calibration_controls;
977999
break;
9781000
case 0x35A630:
1001+
cs35l56_base->calibration_controls = &cs35l63_calibration_controls;
9791002
devid = devid >> 4;
9801003
break;
9811004
default:

sound/soc/codecs/cs35l56.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ static int cs35l56_write_cal(struct cs35l56_private *cs35l56)
695695
return ret;
696696

697697
ret = cs_amp_write_cal_coeffs(&cs35l56->dsp.cs_dsp,
698-
&cs35l56_calibration_controls,
698+
cs35l56->base.calibration_controls,
699699
&cs35l56->base.cal_data);
700700

701701
wm_adsp_stop(&cs35l56->dsp);

0 commit comments

Comments
 (0)