Re: [PATCH v2 5/6] ASoC: qcom: sm8250: shut down MI2S/TDM AFE port clocks

Val Packett <[email protected]>
Newsgroups org.kernel.vger.phone-devel,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <[email protected]>
On 5/7/26 5:57 AM, Srinivas Kandagatla wrote:
> On 5/6/26 8:33 PM, Val Packett wrote:
>> These port clocks were never being turned off, leading to increased
>> power consumption after a sound was played through any of these ports
>> for the first time. Use enable counters to disable the clocks in the
>> shutdown callback, similar to how it's done for sdm845.
>>
>> Signed-off-by: Val Packett <[email protected]>
>> ---
>>   sound/soc/qcom/sm8250.c | 150 +++++++++++++++++++++++++++++++---------
>>   1 file changed, 119 insertions(+), 31 deletions(-)
>>
>> diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
>> index b64fd3970ba1..9f0f846a14bb 100644
>> --- a/sound/soc/qcom/sm8250.c
>> +++ b/sound/soc/qcom/sm8250.c
>> @@ -24,6 +24,7 @@ static unsigned int tdm_slot_offset[8] = {0, 4, 8, 12, 16, 20, 24, 28};
>>   
>>   struct sm8250_snd_data {
>>   	bool stream_prepared[AFE_PORT_MAX];
>> +	uint32_t clk_count[AFE_PORT_MAX];
> In your setup are you sharing BE dais to multiple FE?
>
> if not you would really not need the count, startup and shutdown are
> paired for single PCM stream.
>
> If yes, then you need some protection against these counters.

Hmm, possibly not? I don't entirely understand how the q6 hardware 
works, sorry.. Who's the BE in this situation?

Basically what we have is e.g.:

- a dai-link between speakers (<&aw88261_l>, <&aw88261_r>) and the 
digital interface they're connected to (<&q6afedai SENARY_MI2S_RX>) 
defined in the device tree
- one q6asmdai frontend (MultiMedia1) connected to it in the mixer, i.e. 
cset name='QUIN_MI2S_RX Audio Mixer MultiMedia1' 1
- VoiceMMode1 (currently only via an out-of-tree hacky patchset but 
someone's reworking that) also connected to it like that during voice 
calls, but we can definitely "unplug" the MultiMedia when that happens

> [..]

Thanks,
~val
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.