summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/rl6231.c
diff options
context:
space:
mode:
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");