Skip to content

Commit b823961

Browse files
simontrimmerbroonie
authored andcommitted
ASoC: cs35l56: Allow a wider range for reset pulse width
There is no reason to have such a tight usleep range of 400us and it is acceptable to allow MIN_US * 2. Also wrap the usleep in an inline function. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/168147949455.26.3401634900657387799@mailman-core.alsa-project.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7d72351 commit b823961

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

sound/soc/codecs/cs35l56.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,12 @@ static int cs35l56_wait_for_firmware_boot(struct cs35l56_private *cs35l56)
835835
return 0;
836836
}
837837

838+
static inline void cs35l56_wait_min_reset_pulse(void)
839+
{
840+
/* Satisfy minimum reset pulse width spec */
841+
usleep_range(CS35L56_RESET_PULSE_MIN_US, 2 * CS35L56_RESET_PULSE_MIN_US);
842+
}
843+
838844
static const struct reg_sequence cs35l56_system_reset_seq[] = {
839845
REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET),
840846
};
@@ -1236,7 +1242,7 @@ int cs35l56_system_suspend_late(struct device *dev)
12361242
*/
12371243
if (cs35l56->reset_gpio) {
12381244
gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
1239-
usleep_range(CS35L56_RESET_PULSE_MIN_US, CS35L56_RESET_PULSE_MIN_US + 400);
1245+
cs35l56_wait_min_reset_pulse();
12401246
}
12411247

12421248
regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies);
@@ -1289,7 +1295,7 @@ int cs35l56_system_resume_early(struct device *dev)
12891295
/* Ensure a spec-compliant RESET pulse. */
12901296
if (cs35l56->reset_gpio) {
12911297
gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
1292-
usleep_range(CS35L56_RESET_PULSE_MIN_US, CS35L56_RESET_PULSE_MIN_US + 400);
1298+
cs35l56_wait_min_reset_pulse();
12931299
}
12941300

12951301
/* Enable supplies before releasing RESET. */
@@ -1440,9 +1446,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56)
14401446
return dev_err_probe(cs35l56->dev, ret, "Failed to enable supplies\n");
14411447

14421448
if (cs35l56->reset_gpio) {
1443-
/* satisfy minimum reset pulse width spec */
1444-
usleep_range(CS35L56_RESET_PULSE_MIN_US,
1445-
CS35L56_RESET_PULSE_MIN_US + 400);
1449+
cs35l56_wait_min_reset_pulse();
14461450
gpiod_set_value_cansleep(cs35l56->reset_gpio, 1);
14471451
}
14481452

0 commit comments

Comments
 (0)