Skip to content

Commit 6f39afd

Browse files
committed
clk: hifiberry-dacpro: add delay on clock prepare/deprepare
Add a delay to make sure the PCM512x codec can detect SCLK presence. The initial code from the Raspberry tree used msleep(2), which can be up to 20ms. A delay of 5-10ms seems fine in practice. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent c07cc17 commit 6f39afd

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/clk/clk-hifiberry-dacpro.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/clk-provider.h>
1111
#include <linux/clkdev.h>
12+
#include <linux/delay.h>
1213
#include <linux/gpio/consumer.h>
1314
#include <linux/gpio/machine.h>
1415
#include <linux/kernel.h>
@@ -145,6 +146,8 @@ static int clk_hifiberry_dacpro_prepare(struct clk_hw *hw)
145146
default:
146147
return -EINVAL;
147148
}
149+
/* wait for SCLK update to be detected by PCM512x codec */
150+
usleep_range(5000, 10000);
148151

149152
clk->prepared = 1;
150153

@@ -168,6 +171,8 @@ static void clk_hifiberry_dacpro_unprepare(struct clk_hw *hw)
168171
default:
169172
return;
170173
}
174+
/* wait for SCLK update to be detected by PCM512x codec */
175+
usleep_range(5000, 10000);
171176

172177
clk->prepared = false;
173178
}

0 commit comments

Comments
 (0)