Skip to content

Commit 4a5883a

Browse files
committed
cs35l56: Log tuning unique identifiers during firmware
Merge series from Simon Trimmer <simont@opensource.cirrus.com>: These two patches introduce a log message when provisioning the cs35l56 family of devices that uniquely identifies the firmware tuning.
2 parents dd4eb86 + db13e3d commit 4a5883a

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

include/sound/cs35l56.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_ds
360360
int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base);
361361
int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
362362
bool *fw_missing, unsigned int *fw_version);
363+
void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
363364
int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
364365
int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);
365366
int cs35l56_get_bclk_freq_id(unsigned int freq);

sound/pci/hda/cs35l56_hda.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
676676
if (ret)
677677
cs_dsp_stop(&cs35l56->cs_dsp);
678678

679+
cs35l56_log_tuning(&cs35l56->base, &cs35l56->cs_dsp);
680+
679681
err_powered_up:
680682
if (!cs35l56->base.fw_patched)
681683
cs_dsp_power_down(&cs35l56->cs_dsp);

sound/soc/codecs/cs35l56-shared.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,33 @@ int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
909909
}
910910
EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED");
911911

912+
void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp)
913+
{
914+
__be32 pid, sid, tid;
915+
int ret;
916+
917+
scoped_guard(mutex, &cs_dsp->pwr_lock) {
918+
ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_PRJCT_ID",
919+
WMFW_ADSP2_XM, 0x9f212),
920+
0, &pid, sizeof(pid));
921+
if (!ret)
922+
ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_CHNNL_ID",
923+
WMFW_ADSP2_XM, 0x9f212),
924+
0, &sid, sizeof(sid));
925+
if (!ret)
926+
ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_SNPSHT_ID",
927+
WMFW_ADSP2_XM, 0x9f212),
928+
0, &tid, sizeof(tid));
929+
}
930+
931+
if (ret)
932+
dev_warn(cs35l56_base->dev, "Can't read tuning IDs");
933+
else
934+
dev_info(cs35l56_base->dev, "Tuning PID: %#x, SID: %#x, TID: %#x\n",
935+
be32_to_cpu(pid), be32_to_cpu(sid), be32_to_cpu(tid));
936+
}
937+
EXPORT_SYMBOL_NS_GPL(cs35l56_log_tuning, "SND_SOC_CS35L56_SHARED");
938+
912939
int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)
913940
{
914941
int ret;
@@ -1249,3 +1276,4 @@ MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
12491276
MODULE_AUTHOR("Simon Trimmer <simont@opensource.cirrus.com>");
12501277
MODULE_LICENSE("GPL");
12511278
MODULE_IMPORT_NS("SND_SOC_CS_AMP_LIB");
1279+
MODULE_IMPORT_NS("FW_CS_DSP");

sound/soc/codecs/cs35l56.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ static void cs35l56_dsp_work(struct work_struct *work)
847847
else
848848
cs35l56_patch(cs35l56, firmware_missing);
849849

850+
cs35l56_log_tuning(&cs35l56->base, &cs35l56->dsp.cs_dsp);
850851
err:
851852
pm_runtime_mark_last_busy(cs35l56->base.dev);
852853
pm_runtime_put_autosuspend(cs35l56->base.dev);

0 commit comments

Comments
 (0)