Skip to content

Commit cf6e748

Browse files
simontrimmerbroonie
authored andcommitted
ASoC: cs35l56: Make cs35l56_system_reset() code more generic
The function can be more easily reused in HDA if the tracking of whether a soft reset is being performed and whether the device is connected to a SoundWire bus is moved out of the function. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230721132120.5523-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 898673b commit cf6e748

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sound/soc/codecs/cs35l56.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,8 @@ static const struct reg_sequence cs35l56_system_reset_seq[] = {
802802
REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET),
803803
};
804804

805-
static void cs35l56_system_reset(struct cs35l56_private *cs35l56)
805+
static void cs35l56_system_reset(struct cs35l56_private *cs35l56, bool is_soundwire)
806806
{
807-
cs35l56->soft_resetting = true;
808-
809807
/*
810808
* Must enter cache-only first so there can't be any more register
811809
* accesses other than the controlled system reset sequence below.
@@ -816,7 +814,7 @@ static void cs35l56_system_reset(struct cs35l56_private *cs35l56)
816814
ARRAY_SIZE(cs35l56_system_reset_seq));
817815

818816
/* On SoundWire the registers won't be accessible until it re-enumerates. */
819-
if (cs35l56->sdw_peripheral)
817+
if (is_soundwire)
820818
return;
821819

822820
usleep_range(CS35L56_CONTROL_PORT_READY_US, CS35L56_CONTROL_PORT_READY_US + 400);
@@ -883,7 +881,8 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56)
883881

884882
init_completion(&cs35l56->init_completion);
885883

886-
cs35l56_system_reset(cs35l56);
884+
cs35l56->soft_resetting = true;
885+
cs35l56_system_reset(cs35l56, !!cs35l56->sdw_peripheral);
887886

888887
if (cs35l56->sdw_peripheral) {
889888
/*
@@ -1547,7 +1546,8 @@ int cs35l56_init(struct cs35l56_private *cs35l56)
15471546

15481547
if (!cs35l56->base.reset_gpio) {
15491548
dev_dbg(cs35l56->base.dev, "No reset gpio: using soft reset\n");
1550-
cs35l56_system_reset(cs35l56);
1549+
cs35l56->soft_resetting = true;
1550+
cs35l56_system_reset(cs35l56, !!cs35l56->sdw_peripheral);
15511551
if (cs35l56->sdw_peripheral) {
15521552
/* Keep alive while we wait for re-enumeration */
15531553
pm_runtime_get_noresume(cs35l56->base.dev);

0 commit comments

Comments
 (0)