From d92950e755328a0293af66e18096e0cae29996f1 Mon Sep 17 00:00:00 2001 From: Oder Chiou Date: Tue, 20 May 2014 15:01:55 +0800 Subject: ASoC: rt5640: Add the function "get_clk_info" to RL6231 shared support The patch adds the function "get_clk_info" to RL6231 shared support. Signed-off-by: Oder Chiou Signed-off-by: Mark Brown --- sound/soc/codecs/rl6231.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sound/soc/codecs/rl6231.c') diff --git a/sound/soc/codecs/rl6231.c b/sound/soc/codecs/rl6231.c index 289024be1d40..7b82fbe0d14c 100644 --- a/sound/soc/codecs/rl6231.c +++ b/sound/soc/codecs/rl6231.c @@ -131,6 +131,22 @@ code_find: } EXPORT_SYMBOL_GPL(rl6231_pll_calc); +int rl6231_get_clk_info(int sclk, int rate) +{ + int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16}; + + if (sclk <= 0 || rate <= 0) + return -EINVAL; + + rate = rate << 8; + for (i = 0; i < ARRAY_SIZE(pd); i++) + if (sclk == rate * pd[i]) + return i; + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(rl6231_get_clk_info); + MODULE_DESCRIPTION("RL6231 class device shared support"); MODULE_AUTHOR("Oder Chiou "); MODULE_LICENSE("GPL v2"); -- cgit v1.2.3-58-ga151