summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.cirrus.com>2021-09-14 17:13:45 +0300
committerMark Brown <broonie@kernel.org>2021-09-15 15:12:31 +0300
commit3a2eb0b4b02060340af10a1db3c452472471be2f (patch)
tree561da0225d4e8ce02cbd1c94461db3d818819b7f /sound/soc
parentc2f14cc2bcdd532f8a18450407ffc27bbbff2319 (diff)
downloadlinux-3a2eb0b4b02060340af10a1db3c452472471be2f.tar.xz
ASoC: cs35l41: Use regmap_read_poll_timeout to wait for OTP boot
Just clean up the code a little by using the helper rather than open coding waiting for OTP_BOOT_DONE. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210914141349.30218-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/cs35l41.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index d2a11cc33683..8c2c695813cd 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -1323,7 +1323,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,
{
u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match;
int irq_pol = 0;
- int timeout;
int ret;
if (pdata) {
@@ -1377,18 +1376,14 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,
usleep_range(2000, 2100);
- timeout = 100;
- do {
- if (timeout == 0) {
- dev_err(cs35l41->dev,
- "Timeout waiting for OTP_BOOT_DONE\n");
- ret = -EBUSY;
- goto err;
- }
- usleep_range(1000, 1100);
- regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS4, &int_status);
- timeout--;
- } while (!(int_status & CS35L41_OTP_BOOT_DONE));
+ ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS4,
+ int_status, int_status & CS35L41_OTP_BOOT_DONE,
+ 1000, 100000);
+ if (ret) {
+ dev_err(cs35l41->dev,
+ "Failed waiting for OTP_BOOT_DONE: %d\n", ret);
+ goto err;
+ }
regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_status);
if (int_status & CS35L41_OTP_BOOT_ERR) {