forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
- Loading branch information
1 parent
71c7a2d
commit d92950e
Showing
5 changed files
with
20 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,22 @@ int rl6231_pll_calc(const unsigned int freq_in, | |
} | ||
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 <[email protected]>"); | ||
MODULE_LICENSE("GPL v2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters