alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jassi Brar <jassisinghbrar@gmail.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>,
	pl bossart <bossart.nospam@gmail.com>,
	General PulseAudio Discussion
	<pulseaudio-discuss@mail.0pointer.de>,
	Clemens Ladisch <clemens@ladisch.de>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/3] add API to allow disabling period interrupts
Date: Tue, 18 May 2010 18:11:07 +0900	[thread overview]
Message-ID: <AANLkTikDjFjXo3gmQd-Mb0UULlFDpwWTpNV4P62TFUQq@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1005171611250.6856@eeebox2.perex-int.cz>

On Mon, May 17, 2010 at 11:42 PM, Jaroslav Kysela <perex@perex.cz> wrote:
> On Mon, 17 May 2010, Jassi Brar wrote:
>
>> On Mon, May 17, 2010 at 8:16 PM, Clemens Ladisch <clemens@ladisch.de>
>> wrote:
>>>
>>> Jassi Brar wrote:
>>>>
>>>> I am in favor of support variable hw_interrupt at lowest level, i.e, in
>>>> ring buffer driver, instead of disabling hw_interrupt altogether.
>>>
>>> Removing the constant-sized periods restriction would certainly be
>>> useful.  However, it doesn't look as if anybody has the time to redesign
>>> the ALSA API, the kernel framework and all the drivers.
>>
>> No need to redesign ALSA API and certainly no need to change _any_ driver,
>> just like this interrupt disable call is optional so would period resize
>> be.
>>
>> I only ask to make this newly added call as period-resize rather than
>> a special case of period-disable.
>
> This is very good point. But I have two comments:
>
> 1) Period-disable function is OK, but it should not have a name "no
>   period irq": SNDRV_PCM_INFO_PERIOD_DISABLE or DISABLE_PERIOD looks
>   better. This change does imply to set the period size automatically in
>   the driver - probably to highest value (applications cannot choose/set
>   the period size in this operation mode - it's useless anyway).
> 2) The avail_min parameter in sw_params was overlooked. The lowlevel
>   drivers can use this value to compute the wake-up point and set hw
>   appropriately, to do wake-up at requested time. We can add a support
>   functions like "return how many samples are expected to be transferred
>   for next wake-up point" to linux/sound/pcm.h. In case when this value
>   is high, no interrupts (wake ups) will be processed in the driver. If
>   hardware cannot do the precise transfers, we can program a system
>   timer as the wake-up source.
Sounds good, though I had a different implementation in mind...
A new _optionally_ supported call to set the ratio of h/w period
to ring buffer.
The fields are returned with actually set ratio by the low
level driver upon call return. The boundary case of say 0/0
can be interpreted as intr disable and n/n as period := ring
The call can be used to query current ratio by asking for
a/b where a > b i.e, invalid ratio.
Depending upon the capability of the h/w and it's driver,
fine-tuning can be achieved to max possible extent.


something like....

snd_pcm_uframes_t prd, ring;

/* Get current ratio */
prd = 257, ring = 256; /* Invalid ratio */
snd_pcm_set_ratio(&prd, &ring);

/* Increase the period by desirable amount */
prd += incr;
snd_pcm_set_ratio(&prd, &ring);

/* Disable period interrupts */
prd = 0, ring = 0;
snd_pcm_set_ratio(&prd, &ring);
if (!prd && !ring) {
   Interrupts are successfull disabled;
} else {
    prd/ring ratio is max supported by h/w
}
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2010-05-18  9:11 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 22:38 [RFC] disabling ALSA period interrupts pl bossart
2010-04-29 23:18 ` Raymond Yau
     [not found]   ` <k2j6160a5131004291644rd8645dc7oecee28ee290b683f@mail.gmail.com>
2010-04-30  0:59     ` Raymond Yau
2010-04-30  1:09 ` Raymond Yau
2010-04-30 13:46   ` pl bossart
2010-04-30 22:51     ` Raymond Yau
2010-04-30  3:47 ` Raymond Yau
2010-04-30 11:24 ` Clemens Ladisch
2010-04-30 13:44   ` pl bossart
2010-05-06  1:24     ` Raymond Yau
2010-05-14  8:12     ` Takashi Iwai
2010-05-14 13:36       ` pl bossart
2010-05-14 21:03         ` pl bossart
2010-05-17  9:12           ` Clemens Ladisch
2010-05-17  9:14             ` [PATCH 1/3] add API to allow disabling " Clemens Ladisch
2010-05-17  9:23               ` Jassi Brar
2010-05-17 11:16                 ` Clemens Ladisch
2010-05-17 11:27                   ` Jassi Brar
2010-05-17 14:42                     ` Jaroslav Kysela
2010-05-17 16:05                       ` pl bossart
2010-05-17 16:22                         ` Jaroslav Kysela
2010-05-17 16:37                           ` pl bossart
2010-05-17 16:54                             ` Jaroslav Kysela
2010-05-18  9:11                       ` Jassi Brar [this message]
2010-05-17 13:59               ` pl bossart
2010-05-17  9:14             ` [PATCH 2/3] ALSA: hda-intel: add support for disabling period irq Clemens Ladisch
2010-05-17 14:05               ` pl bossart
2010-05-17  9:15             ` [PATCH 3/3] ALSA: oxygen: " Clemens Ladisch
2010-05-17 14:17             ` [RFC] disabling ALSA period interrupts pl bossart
2010-05-20 14:50           ` Clemens Ladisch
2010-04-30 16:44 ` Liam Girdwood
2010-04-30 17:39   ` pl bossart
2010-05-04  3:18     ` Raymond Yau
2010-05-07 23:25 ` [alsa-devel] " Lennart Poettering
2010-05-08  3:12   ` pl bossart
2010-05-12  4:00     ` pl bossart
2010-05-12 13:00       ` Jaroslav Kysela
2010-05-12 17:10         ` [alsa-devel] " pl bossart
2010-05-12 18:15           ` Jaroslav Kysela
2010-05-13  3:56             ` pl bossart
2010-05-12  7:22   ` James Courtier-Dutton
2010-05-12 12:42     ` pl bossart
2010-05-13  0:37       ` Raymond Yau
2010-05-14  0:43       ` Raymond Yau
2010-05-14  1:51         ` pl bossart
2010-05-14  2:45           ` Raymond Yau
2010-05-14  3:09           ` Raymond Yau
2010-05-14  4:03           ` Raymond Yau
2010-05-12 13:08 ` Jassi Brar
2010-05-12 13:50   ` [alsa-devel] " pl bossart
2010-05-12 14:15     ` Jassi Brar
2010-05-12 14:16     ` Mark Brown
2010-05-13  0:04       ` Raymond Yau
2010-05-14  4:07       ` Jassi Brar
2010-05-14  4:39         ` pl bossart
2010-05-14  5:27           ` Jassi Brar
2010-05-12 14:41     ` Raymond Yau
2010-05-13  7:27     ` Raymond Yau

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=AANLkTikDjFjXo3gmQd-Mb0UULlFDpwWTpNV4P62TFUQq@mail.gmail.com \
    --to=jassisinghbrar@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bossart.nospam@gmail.com \
    --cc=clemens@ladisch.de \
    --cc=perex@perex.cz \
    --cc=pulseaudio-discuss@mail.0pointer.de \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).