summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/rl6231.c
diff options
context:
space:
mode:
authorOder Chiou <oder_chiou@realtek.com>2014-05-20 11:01:55 +0400
committerMark Brown <broonie@linaro.org>2014-06-01 23:04:30 +0400
commitd92950e755328a0293af66e18096e0cae29996f1 (patch)
treef4f5a06ad7856bb3d34cb80663c2f3183a87359e /sound/soc/codecs/rl6231.c
parent71c7a2d675c8fe9b6ab284dcf586f30a7109c96c (diff)
downloadlinux-d92950e755328a0293af66e18096e0cae29996f1.tar.xz
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 <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/rl6231.c')
-rw-r--r--sound/soc/codecs/rl6231.c16
1 files changed, 16 insertions, 0 deletions
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 <oder_chiou@realtek.com>");
MODULE_LICENSE("GPL v2");