Commit 3a2eb0b4 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

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: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210914141349.30218-2-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c2f14cc2
...@@ -1323,7 +1323,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ...@@ -1323,7 +1323,6 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,
{ {
u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match; u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match;
int irq_pol = 0; int irq_pol = 0;
int timeout;
int ret; int ret;
if (pdata) { if (pdata) {
...@@ -1377,18 +1376,14 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, ...@@ -1377,18 +1376,14 @@ int cs35l41_probe(struct cs35l41_private *cs35l41,
usleep_range(2000, 2100); usleep_range(2000, 2100);
timeout = 100; ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS4,
do { int_status, int_status & CS35L41_OTP_BOOT_DONE,
if (timeout == 0) { 1000, 100000);
dev_err(cs35l41->dev, if (ret) {
"Timeout waiting for OTP_BOOT_DONE\n"); dev_err(cs35l41->dev,
ret = -EBUSY; "Failed waiting for OTP_BOOT_DONE: %d\n", ret);
goto err; goto err;
} }
usleep_range(1000, 1100);
regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS4, &int_status);
timeout--;
} while (!(int_status & CS35L41_OTP_BOOT_DONE));
regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_status); regmap_read(cs35l41->regmap, CS35L41_IRQ1_STATUS3, &int_status);
if (int_status & CS35L41_OTP_BOOT_ERR) { if (int_status & CS35L41_OTP_BOOT_ERR) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment