From owner-freebsd-multimedia@FreeBSD.ORG  Tue Sep  9 23:08:57 2008
Return-Path: <owner-freebsd-multimedia@FreeBSD.ORG>
Delivered-To: freebsd-multimedia@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84203106567E;
	Tue,  9 Sep 2008 23:08:57 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121])
	by mx1.freebsd.org (Postfix) with ESMTP id B328D8FC0A;
	Tue,  9 Sep 2008 23:08:56 +0000 (UTC) (envelope-from mav@FreeBSD.org)
X-Spam-Flag: SKIP
X-Spam-Yversion: Spamooborona-2.1.0
Received: from [212.86.226.226] (account mav@alkar.net HELO
	mavbook.mavhome.dp.ua)
	by cmail.optima.ua (CommuniGate Pro SMTP 5.1.14)
	with ESMTPSA id 220448011; Wed, 10 Sep 2008 02:08:55 +0300
Message-ID: <48C701FA.8010807@FreeBSD.org>
Date: Wed, 10 Sep 2008 02:08:42 +0300
From: Alexander Motin <mav@FreeBSD.org>
User-Agent: Thunderbird 2.0.0.16 (X11/20080726)
MIME-Version: 1.0
To: Rui Paulo <rpaulo@FreeBSD.org>
References: <1219692182.00003969.1219680004@10.7.7.3>
	<48B30A83.1030206@FreeBSD.org> <20080825204941.GA68247@alpha.local>
	<48C44BE0.5090500@FreeBSD.org> <20080908205502.GF89070@alpha.local>
	<48C5952F.5040805@FreeBSD.org> <20080908211715.GH89070@alpha.local>
	<48C66DDD.2010803@FreeBSD.org> <20080909124811.GA35538@alpha.local>
In-Reply-To: <20080909124811.GA35538@alpha.local>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: freebsd-multimedia@FreeBSD.org
Subject: Re: snd_hda suspend/resume support
X-BeenThere: freebsd-multimedia@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Multimedia discussions <freebsd-multimedia.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-multimedia>, 
	<mailto:freebsd-multimedia-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-multimedia>
List-Post: <mailto:freebsd-multimedia@freebsd.org>
List-Help: <mailto:freebsd-multimedia-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-multimedia>, 
	<mailto:freebsd-multimedia-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Sep 2008 23:08:57 -0000

Rui Paulo wrote:
> On Tue, Sep 09, 2008 at 03:36:45PM +0300, Alexander Motin wrote:
>> Rui Paulo wrote:
>>> On Tue, Sep 09, 2008 at 12:12:15AM +0300, Alexander Motin wrote:
>>>> Rui Paulo wrote:
>>>>> Great work! This works fine! I just wish I didn't had to stop my media
>>>>> player before resume. That probably needs more work on the sound layer.
>>>> When I am calling suspend and resume myself on alive system for several 
>>>> seconds playback restores fine. Whats happening if you don't stop media 
>>>> player?
>>> No sound is output after resume. I can't play anything after resume and
>>> only a reboot fixes it (kldunload/kldload doesn't do the job).
>> Any errors? Player progress bar is moving? What happens if you press
>> stop and then play?
> 
> No errors whatsoever. I hear nothing if I press stop and then play.

I have changed suspend/resume sequences a bit. Now I am doing more 
complete codec power up on resume. On my system I am able to call 
suspend() and then 15 seconds later resume() call successfully restores 
the sound after complete HDA controller, bus and codecs.

If you still have a problem - try to reproduce my experiment using 
temporal hack in a last version:
sysctl dev.hdac.0.pindump=100  <= hdac_suspend()
sysctl dev.hdac.0.pindump=101  <= hdac_resume()

Also I have made suspend() to left HDA bus in reset state which saves 
about 200mW of power according to my laptop battery stats.

-- 
Alexander Motin