Re: [PATCH] ASoC: da7219: Fix pole orientation detection on OMTP headsets when playing music

From: Guenter Roeck
Date: Thu Feb 02 2023 - 10:51:29 EST


On Tue, Jan 31, 2023 at 12:08:53PM +0000, Mark Brown wrote:
> On Mon, Jan 30, 2023 at 10:16:06PM -0800, Guenter Roeck wrote:
> > On 1/30/23 19:58, David Rau wrote:
>
> > > Thanks for the kind feedback.
> > > Would you please let me know what kinds of environment such error appears you ever meet?
> > > Ex: da7219_aad->gnd_switch_delay = ?
>
> > We are seeing the problem on various Chromebooks.
>
> > Never mind, though. I really don't have time to keep arguing about this.
> > I would have assumed that it is obvious that a long msleep() in an
> > interrupt handler is not appropriate, but obviously I was wrong.
>
> This is a threaded interrupt handler so it's a bit less clear that it's
> meaningfully different to just disabling the interrupt for debounce or
> whatever. Not to say it's ideal.
>
> > I'll see if I can implement a downstream fix.
>
> If you implement something I don't see a reason not to post it upstream.

I had a look into the code, and concluded that it is too complex for anyone
who doesn't know it to find a proper fix. For example, for an outsider it
is not conceivable (or explained) why the ground switch is enabled only
to be disabled immediately afterwards if a jack was removed.

This is now the top crash reason on affected Chromebooks (so far I
identified Asus C424, HP SeaStar, and HP StingRay) with this patch
applied. I am inclined to revert it from all ChromeOS kernel branches.
At least for us the cure for the problem is much worse than the problem
itself.

Guenter