Skip to content

Commit 7c15e4c

Browse files
committed
ASoC: cs35l56: Fixes for CS35L63 for production
Merge series from Stefan Binding <[email protected]>: Production silicon for CS36L63 has some small differences compared to pre-production silicon. This requires small fixes in driver. Update firmware addresses, tuning algorithm IDs and remove soundwire clock workaround as no longer necessary. No product was ever released using pre-production silicon, therefore there is no need to keep support for it.
2 parents af24c20 + 8d13d1b commit 7c15e4c

File tree

5 files changed

+30
-78
lines changed

5 files changed

+30
-78
lines changed

include/sound/cs35l56.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
#define CS35L56_DSP1_PMEM_5114 0x3804FE8
108108

109109
#define CS35L63_DSP1_FW_VER CS35L56_DSP1_FW_VER
110-
#define CS35L63_DSP1_HALO_STATE 0x280396C
111-
#define CS35L63_DSP1_PM_CUR_STATE 0x28042C8
110+
#define CS35L63_DSP1_HALO_STATE 0x2803C04
111+
#define CS35L63_DSP1_PM_CUR_STATE 0x2804518
112112
#define CS35L63_PROTECTION_STATUS 0x340009C
113113
#define CS35L63_TRANSDUCER_ACTUAL_PS 0x34000F4
114114
#define CS35L63_MAIN_RENDER_USER_MUTE 0x3400020
@@ -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-sdw.c

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -393,74 +393,6 @@ static int cs35l56_sdw_update_status(struct sdw_slave *peripheral,
393393
return 0;
394394
}
395395

396-
static int cs35l63_sdw_kick_divider(struct cs35l56_private *cs35l56,
397-
struct sdw_slave *peripheral)
398-
{
399-
unsigned int curr_scale_reg, next_scale_reg;
400-
int curr_scale, next_scale, ret;
401-
402-
if (!cs35l56->base.init_done)
403-
return 0;
404-
405-
if (peripheral->bus->params.curr_bank) {
406-
curr_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B1;
407-
next_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B0;
408-
} else {
409-
curr_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B0;
410-
next_scale_reg = SDW_SCP_BUSCLOCK_SCALE_B1;
411-
}
412-
413-
/*
414-
* Current clock scale value must be different to new value.
415-
* Modify current to guarantee this. If next still has the dummy
416-
* value we wrote when it was current, the core code has not set
417-
* a new scale so restore its original good value
418-
*/
419-
curr_scale = sdw_read_no_pm(peripheral, curr_scale_reg);
420-
if (curr_scale < 0) {
421-
dev_err(cs35l56->base.dev, "Failed to read current clock scale: %d\n", curr_scale);
422-
return curr_scale;
423-
}
424-
425-
next_scale = sdw_read_no_pm(peripheral, next_scale_reg);
426-
if (next_scale < 0) {
427-
dev_err(cs35l56->base.dev, "Failed to read next clock scale: %d\n", next_scale);
428-
return next_scale;
429-
}
430-
431-
if (next_scale == CS35L56_SDW_INVALID_BUS_SCALE) {
432-
next_scale = cs35l56->old_sdw_clock_scale;
433-
ret = sdw_write_no_pm(peripheral, next_scale_reg, next_scale);
434-
if (ret < 0) {
435-
dev_err(cs35l56->base.dev, "Failed to modify current clock scale: %d\n",
436-
ret);
437-
return ret;
438-
}
439-
}
440-
441-
cs35l56->old_sdw_clock_scale = curr_scale;
442-
ret = sdw_write_no_pm(peripheral, curr_scale_reg, CS35L56_SDW_INVALID_BUS_SCALE);
443-
if (ret < 0) {
444-
dev_err(cs35l56->base.dev, "Failed to modify current clock scale: %d\n", ret);
445-
return ret;
446-
}
447-
448-
dev_dbg(cs35l56->base.dev, "Next bus scale: %#x\n", next_scale);
449-
450-
return 0;
451-
}
452-
453-
static int cs35l56_sdw_bus_config(struct sdw_slave *peripheral,
454-
struct sdw_bus_params *params)
455-
{
456-
struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev);
457-
458-
if ((cs35l56->base.type == 0x63) && (cs35l56->base.rev < 0xa1))
459-
return cs35l63_sdw_kick_divider(cs35l56, peripheral);
460-
461-
return 0;
462-
}
463-
464396
static int __maybe_unused cs35l56_sdw_clk_stop(struct sdw_slave *peripheral,
465397
enum sdw_clk_stop_mode mode,
466398
enum sdw_clk_stop_type type)
@@ -476,7 +408,6 @@ static const struct sdw_slave_ops cs35l56_sdw_ops = {
476408
.read_prop = cs35l56_sdw_read_prop,
477409
.interrupt_callback = cs35l56_sdw_interrupt,
478410
.update_status = cs35l56_sdw_update_status,
479-
.bus_config = cs35l56_sdw_bus_config,
480411
#ifdef DEBUG
481412
.clk_stop = cs35l56_sdw_clk_stop,
482413
#endif

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);

sound/soc/codecs/cs35l56.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#define CS35L56_SDW_GEN_INT_MASK_1 0xc1
2121
#define CS35L56_SDW_INT_MASK_CODEC_IRQ BIT(0)
2222

23-
#define CS35L56_SDW_INVALID_BUS_SCALE 0xf
24-
2523
#define CS35L56_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
2624
#define CS35L56_TX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE \
2725
| SNDRV_PCM_FMTBIT_S32_LE)
@@ -52,7 +50,6 @@ struct cs35l56_private {
5250
u8 asp_slot_count;
5351
bool tdm_mode;
5452
bool sysclk_set;
55-
u8 old_sdw_clock_scale;
5653
u8 sdw_link_num;
5754
u8 sdw_unique_id;
5855
};

0 commit comments

Comments
 (0)