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.
Merge series from Jerome Brunet <[email protected]>: This patchset fixes 2 problems on TDM which both find a solution by properly implementing the .trigger() callback for the TDM backend. ATM, enabling the TDM formatters is done by the .prepare() callback because handling the formatter is slow due to necessary calls to CCF. The first problem affects the TDMIN. Because .prepare() is called on DPCM backend first, the formatter are started before the FIFOs and this may cause a random channel shifts if the TDMIN use multiple lanes with more than 2 slots per lanes. Using trigger() allows to set the FE/BE order, solving the problem. There has already been an attempt to fix this 3y ago [1] and reverted [2] It triggered a 'sleep in irq' error on the period IRQ. The solution is to just use the bottom half of threaded IRQ. This is patch #1. Patch #2 and #3 remain mostly the same as 3y ago. For TDMOUT, the problem is on pause. ATM pause only stops the FIFO and the TDMOUT just starves. When it does, it will actually repeat the last sample continuously. Depending on the platform, if there is no high-pass filter on the analog path, this may translate to a constant position of the speaker membrane. There is no audible glitch but it may damage the speaker coil. Properly stopping the TDMOUT in pause solves the problem. There is behaviour change associated with that fix. Clocks used to be continuous on pause because of the problem above. They will now be gated on pause by default, as they should. The last change introduce the proper support for continuous clocks, if needed. [1]: https://lore.kernel.org/linux-amlogic/[email protected] [2]: https://lore.kernel.org/linux-amlogic/[email protected]
- Loading branch information
Showing
5 changed files
with
93 additions
and
20 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
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
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