All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@gmail.com>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: Krzysztof Helt <krzysztof.h1@gmail.com>, alsa-devel@alsa-project.org
Subject: Re: [PATCH] ad1848 ac loop
Date: Wed, 19 Sep 2007 09:15:34 +0200	[thread overview]
Message-ID: <46F0CC96.6090307@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0709181930050.27377@shell4.speakeasy.net>

On 09/19/2007 07:22 AM, Trent Piepho wrote:

> I'm not an expert on this chip by any means, but from looking at the code
> I think there are few things that could be fixed.

I'd agree, although I'd suggest to at this point keep anything (in ad1848, 
cs4231 wants a similar setup in its mce_down) not completely trivial for 
after 1.0.15.

> The reg_lock spinlock isn't acquired from the irq handler, as the handler
> doesn't use any of the indirect registers.  I think this means that is
> isn't necessary to use the irq disabling versions of the spin_lock
> functions with reg_lock.

This would appear to be the case yes.

> It does look like there is a different SMP race condition wrt the irq handler.
> From snd_ad1848_interrupt():
> 578         if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream &&
> 579             (chip->mode & AD1848_MODE_RUNNING))
> 580                 snd_pcm_period_elapsed(chip->playback_substream);
> 
> Another CPU could close the substream between the check and the call to
> snd_pcm_period_elapsed().  snd_pcm_period_elapsed() could be called with
> either NULL or a stale substream pointer depending on how the code compiled.
> I'd think creating an irq spinlock would be an easy way to fix this.  The irq
> handler would grab it, and the same with the open() and close() functions
> around the code that sets the substream pointers.  Alternatively, one could
> disabled the irq handler during open and close.

Also sounds sensible, and the irq spinlock the expected method.

> I think there might also be problem with setting mixers controls during 
> auto-calibration . While waiting for auto-calibration to finish, the chip
> isn't locked. If another thread tries to set the volume via the mixer 
> interface, it won't be blocked and will try to talk to the chip during
> AC. The datasheet just says to wait for auto-calibration to finish, it
> doesn't say what happens if you don't. So maybe there isn't any problem
> here.

Guess we should be testing this, but generallt, "hand-off" would be the best 
policy yes.

Rene.

  parent reply	other threads:[~2007-09-19  7:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19  5:22 [PATCH] ad1848 ac loop Trent Piepho
2007-09-19  6:58 ` Rene Herman
2007-09-19  7:15 ` Rene Herman [this message]
2007-09-19  9:24 ` Krzysztof Helt
2007-09-19 19:50   ` Trent Piepho
2007-09-19 20:55     ` Krzysztof Helt
2007-09-21  1:05       ` Trent Piepho
2007-09-21  3:15         ` Lee Revell
2007-09-21  9:31           ` Trent Piepho
2007-09-19 19:48 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46F0CC96.6090307@gmail.com \
    --to=rene.herman@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=krzysztof.h1@gmail.com \
    --cc=xyzzy@speakeasy.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.