From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
<patches@opensource.cirrus.com>,
Simon Trimmer <simont@opensource.cirrus.com>,
Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: [PATCH 2/5] ASoC: cs35l56: Allow a wider range for reset pulse width
Date: Fri, 14 Apr 2023 14:37:50 +0100 [thread overview]
Message-ID: <20230414133753.653139-3-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20230414133753.653139-1-rf@opensource.cirrus.com>
From: Simon Trimmer <simont@opensource.cirrus.com>
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>
---
sound/soc/codecs/cs35l56.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 5ea7f419cda6..d60095162bfa 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -835,6 +835,12 @@ static int cs35l56_wait_for_firmware_boot(struct cs35l56_private *cs35l56)
return 0;
}
+static inline void cs35l56_wait_min_reset_pulse(void)
+{
+ /* Satisfy minimum reset pulse width spec */
+ usleep_range(CS35L56_RESET_PULSE_MIN_US, 2 * CS35L56_RESET_PULSE_MIN_US);
+}
+
static const struct reg_sequence cs35l56_system_reset_seq[] = {
REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET),
};
@@ -1236,7 +1242,7 @@ int cs35l56_system_suspend_late(struct device *dev)
*/
if (cs35l56->reset_gpio) {
gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
- usleep_range(CS35L56_RESET_PULSE_MIN_US, CS35L56_RESET_PULSE_MIN_US + 400);
+ cs35l56_wait_min_reset_pulse();
}
regulator_bulk_disable(ARRAY_SIZE(cs35l56->supplies), cs35l56->supplies);
@@ -1289,7 +1295,7 @@ int cs35l56_system_resume_early(struct device *dev)
/* Ensure a spec-compliant RESET pulse. */
if (cs35l56->reset_gpio) {
gpiod_set_value_cansleep(cs35l56->reset_gpio, 0);
- usleep_range(CS35L56_RESET_PULSE_MIN_US, CS35L56_RESET_PULSE_MIN_US + 400);
+ cs35l56_wait_min_reset_pulse();
}
/* Enable supplies before releasing RESET. */
@@ -1440,9 +1446,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56)
return dev_err_probe(cs35l56->dev, ret, "Failed to enable supplies\n");
if (cs35l56->reset_gpio) {
- /* satisfy minimum reset pulse width spec */
- usleep_range(CS35L56_RESET_PULSE_MIN_US,
- CS35L56_RESET_PULSE_MIN_US + 400);
+ cs35l56_wait_min_reset_pulse();
gpiod_set_value_cansleep(cs35l56->reset_gpio, 1);
}
--
2.30.2
next prev parent reply other threads:[~2023-04-14 13:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 13:37 [PATCH 0/5] ASoC: cs35l56: Code improvements Richard Fitzgerald
2023-04-14 13:37 ` [PATCH 1/5] ASoC: cs35l56: Rework IRQ allocation Richard Fitzgerald
2023-04-14 13:37 ` Richard Fitzgerald [this message]
2023-04-14 13:37 ` [PATCH 3/5] ASoC: cs35l56: Wait for init_complete in cs35l56_component_probe() Richard Fitzgerald
2023-04-14 13:37 ` [PATCH 4/5] ASoC: cs35l56: Remove redundant dsp_ready_completion Richard Fitzgerald
2023-04-14 13:37 ` [PATCH 5/5] ASoC: cs35l56: Don't return a value from cs35l56_remove() Richard Fitzgerald
2023-04-17 20:27 ` [PATCH 0/5] ASoC: cs35l56: Code improvements Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230414133753.653139-3-rf@opensource.cirrus.com \
--to=rf@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=simont@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox