Repository navigation
ASoC: rk817: re-enable I2S after digital clock restarts - #401
Open
einars-soundtrack wants to merge 1 commit into
Open
einars-soundtrack wants to merge 1 commit into
einars-soundtrack wants to merge 1 commit into
Conversation
DAC_DIG_CLK_MASK and ADC_DIG_CLK_MASK cover the whole nibble of RK817_CODEC_DTOP_DIGEN_CLKE, so every DAC or ADC digital clock restart and every path power-up also clears I2SRX_EN (bit 0) or I2STX_EN (bit 4). Only mute_stream(mute=0) sets them again, and it runs from PCM prepare. Changing 'Playback Path' from OFF after the PCM was prepared therefore leaves the codec ignoring the I2S data: ALSA reports RUNNING and the output is silent until the stream is prepared again. The same holds for 'Capture MIC Path' and I2STX_EN. Clearing the enable during the restart is wanted. Narrowing the masks so that I2SRX_EN stays set across the restart restores the audio, but left and right then come up swapped at random, as the I2S receiver must only be enabled once its clocks run. Fix this by tracking, for playback and for capture, whether the stream is currently unmuted. At the end of every digital clock restart, set I2SRX_EN or I2STX_EN again if it is. The usual sequences are not affected. When the path is selected before the stream is prepared, or when hw_params runs again after hw_free, the stream is still muted during the restart, so nothing is re-enabled and the register writes are the same as before. Tested on an RK3562 board with an RK809 (chip id 0x8090), playback through dmix with a 500 Hz / 1 kHz left/right test signal on an oscilloscope: 20 switches of 'Playback Path' OFF -> HP under a running stream and 5 runs of stream first, path second, all kept the channel order. With narrowed masks the same test swapped the channels on about every second switch. Capture is changed the same way but was not run on hardware. Fixes: 4a68fd5 ("ASoC: rk817: Fix L/R channel order") Signed-off-by: Einārs Netlis-Galejs <einars@soundtrack.io>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changing 'Playback Path' from OFF while a stream is already running leaves the RK817/RK809 codec silent until the stream is prepared again; with this patch the audio comes up, with left and right in the right order.
DAC_DIG_CLK_MASKandADC_DIG_CLK_MASKcoverI2SRX_ENandI2STX_EN, so every digital clock restart and path power-up clears them, and onlymute_stream(mute=0)from PCM prepare sets them again.