From: Takashi Iwai Subject: Re: [PATCH 14/31] HDA patch_via.c: Add Jack detect feature for VT1708. Date: Tue, 06 Oct 2009 14:38:12 +0200 Message-ID: References: <16685ee0910050727q4288fc76hdde23b431232d073@mail.gmail.com> <16685ee0910052206ge80ec18yb0546282c4a9945f@mail.gmail.com> <20091006121740.GI17195@prithivi.gnumonks.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 958F92444C for ; Tue, 6 Oct 2009 14:38:13 +0200 (CEST) In-Reply-To: <20091006121740.GI17195@prithivi.gnumonks.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Harald Welte Cc: Li Bo , alsa-devel@alsa-project.org, lydiawang@viatech.com.cn, LoganLi@viatech.com.cn List-Id: alsa-devel@alsa-project.org At Tue, 6 Oct 2009 14:17:40 +0200, Harald Welte wrote: > > Hi all, > > On Tue, Oct 06, 2009 at 08:01:40AM +0200, Takashi Iwai wrote: > > > > As you describe, we implement it with self-reschedule workqueue, acting > > > like a timer. > > > Is there some advice to implement timer-like task, I tested with timer and > > > it will crash the driver. > > > > Right, you can't call it in a softirq. > > > > A few problems, however: > > - present variable should be in struct via_spec, instead of a static > > variable in update_hp_jack_state(). > > I agree > > - This mechanism is unconditionally invoked on VT1708 although, in > > theory, you can have a hardware that doesn't need HP jack detection > > Yes, Logan/Li/Lydia: If we generate this kind of workaround with a timer, > it should only be used on those particular chips that absolutely need it. As far as I see, the code is only for VT1708, so it's already specific to the codec chip. But, even with this chip, you might have a pin configuration that doesn't need the HP jack detection. > > - Waking up each 100ms for the *whole* time is really bad regarding > > the power-saving; can't it be optimized? > > I would personally actually suggest to simply not support headphone plug events > in case you are using such a [buggy?] chipset that does not support them. > > I mean, what do you gain from that event? It's not something super-important. > > waking up unconditionally every 100ms is really a too high burden on the > battery life. > > Another option might be to make it a module load time parameter, so people > can choose if they actually want to pay the high power/batyery price for this > small feature. Yes. Basically, if we can drop the analog-loopback feature, the HP jack probing can be simplified very much. The probing is needed only when the PCM is opened/prepared and running. It can be implemented in a similar way for the volume-update procedure at PCM trigger. And, during PCM running, (relatively) high-frequent polling isn't so critical. thanks, Takashi