forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASoC: meson: axg-tdm: add continuous clock support
Some devices may need the clocks running, even while paused. Add support for this use case. Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -392,6 +392,46 @@ void axg_tdm_stream_free(struct axg_tdm_stream *ts) | |
} | ||
EXPORT_SYMBOL_GPL(axg_tdm_stream_free); | ||
|
||
int axg_tdm_stream_set_cont_clocks(struct axg_tdm_stream *ts, | ||
unsigned int fmt) | ||
{ | ||
int ret = 0; | ||
|
||
if (fmt & SND_SOC_DAIFMT_CONT) { | ||
/* Clock are already enabled - skipping */ | ||
if (ts->clk_enabled) | ||
return 0; | ||
|
||
ret = clk_prepare_enable(ts->iface->mclk); | ||
if (ret) | ||
return ret; | ||
|
||
ret = clk_prepare_enable(ts->iface->sclk); | ||
if (ret) | ||
goto err_sclk; | ||
|
||
ret = clk_prepare_enable(ts->iface->lrclk); | ||
if (ret) | ||
goto err_lrclk; | ||
|
||
ts->clk_enabled = true; | ||
return 0; | ||
} | ||
|
||
/* Clocks are already disabled - skipping */ | ||
if (!ts->clk_enabled) | ||
return 0; | ||
|
||
clk_disable_unprepare(ts->iface->lrclk); | ||
err_lrclk: | ||
clk_disable_unprepare(ts->iface->sclk); | ||
err_sclk: | ||
clk_disable_unprepare(ts->iface->mclk); | ||
ts->clk_enabled = false; | ||
return ret; | ||
} | ||
EXPORT_SYMBOL_GPL(axg_tdm_stream_set_cont_clocks); | ||
|
||
MODULE_DESCRIPTION("Amlogic AXG TDM formatter driver"); | ||
MODULE_AUTHOR("Jerome Brunet <[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