[alsa-devel] [PATCH] ALSA: hda - delay resume haswell hdmi codec in system resume

David Henningsson david.henningsson at canonical.com
Tue Apr 9 11:15:13 CEST 2013


On 04/09/2013 10:18 AM, Lin, Mengdong wrote:
>> -----Original Message-----
>> From: Takashi Iwai [mailto:tiwai at suse.de]
>> Sent: Tuesday, April 09, 2013 3:43 PM
>> To: David Henningsson
>> Cc: Lin, Mengdong; alsa-devel at alsa-project.org; Girdwood, Liam R
>> Subject: Re: [alsa-devel] [PATCH] ALSA: hda - delay resume haswell hdmi codec
>> in system resume
>
>>>>> I've been answering the power_save questions a little bit uncertain
>>>>> so far, and that's because I don't really know. I've not
>>>>> investigated power management much.
>>>>>
>>>>> But the person with the hardware reports that this problem happens
>>>>> when on AC power only. And that makes sense with your observations
>>>>> about power_save - there could very well be something that turns
>>>>> power_save off when on AC power and on when on battery power.
>>>>>
>>>>> So, if it's just a matter of re-initializing the pin, what do you
>>>>> think about this solution:
>>>>>
>>>>>     - Resume as normal (this will enable unsol events)
>>>>>     - Any time an unsol event comes in, have a haswell specific
>>>>> function that checks relevant pins to see that is still in D0 and
>>>>> mute state correct. If not, correct it.
>>>>>     - This check could possibly also be done in the prepare hook for
>>>>> extra safety.
>>>>
>>>> It won't work reliably.  The problem is that the codec might be set
>>>> up wrongly if it's used before the unsol event comes up.  For
>>>> example, a PCM resume may be performed immediately after the normal
>>>> resume is finished.  Meanwhile the first unsol may arrive much later than
>> that.
>>>
>>> Right, but if this will only mean a few samples (max 300 ms?) will
>>> never reach the HDMI cable, it might be the least bad workaround.
>
> I've tried enabling the unsol event on system resume, the unsol event will arrive in 70~80ms for HDMI and about 10ms for DP.
>
>> It's not only about the missing few samples.  The whole setup isn't reliable at
>> that point, and you don't know what to re-setup for the
>> *running* stream.
>>
>>>> Thus we need to delay the resume operation in anyway.  And if so,
>>>> there is no merit to perform the normal resume operation at the
>>>> first step.
>>>
>>> The normal resume operation enables unsol events, which is important,
>>> otherwise we don't get the unsol notification from when the gfx
>>> pipeline has finished.
>>
>> It seems that the intrinsic unsol event is always issued once when the unsol
>> event is enabled, according to Intel.  So, you won't miss it.
>>
>> But heck, we need more test coverage, obviously.
>>
>>> I guess the question here is how much of the codec setup is really
>>> destroyed by the gfx driver? Is it just a pin in D3 and a right
>>> channel mute, or is it much more that needs to be re-done after the
>>> gfx driver has finished?
>>
>> I'm afraid it's too native to assume that...
>
> Actually, we're not sure how much setting are destroyed, although it seems only the pin power state and mute status are affected.

I made a test patch (attached), sprinkled with printk, and asked the 
person with hw to test it. He said it fixed the issue. Now, I'm sure he 
did a simple playback test only, rather than having streams running 
during S3 or anything like that.

The patch simply sets the pin to D0 and the copies the mute value from 
the left channel to the right channel. The printk's confirmed this happened.

But at least it should show that not too much of the settings are 
destroyed...or would that be jumping to conclusions too early?

Also, a different thought: what are the possibilities that Mengdong can 
fix the gfx driver side not to destroy the settings in the first place?

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hsw_d3_workaround.patch
Type: text/x-patch
Size: 2276 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20130409/4f0b2fd9/attachment.bin>


More information about the Alsa-devel mailing list