All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>,
	Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
Cc: cezary.rojewski@intel.com, alsa-devel@alsa-project.org,
	patch@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com
Subject: Re: [alsa-devel] [RFC PATCH 2/3] ALSA:core: Add rate 24kHz
Date: Thu, 5 Sep 2019 08:11:43 -0500	[thread overview]
Message-ID: <9b997691-a609-e7b5-94a6-d42e26dfa080@linux.intel.com> (raw)
In-Reply-To: <s5ha7bjgup9.wl-tiwai@suse.de>

On 9/5/19 12:48 AM, Takashi Iwai wrote:
> On Thu, 05 Sep 2019 07:33:00 +0200,
> Pawel Harlozinski wrote:
>>
>> Adds SNDRV_PCM_RATE_24000 at the bottom to keep backward compability
>> with alsa library.
>>
>> Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com>
> 
> No.  Such a fancy rate has to be handled inside the driver locally
> instead of adding to the common rate.

It's not that crazy, this is supported in the HDaudio spec:

Sample Base Rate Divisor (DIV):
000 = Divide by 1 (48 kHz, 44.1 kHz)
001 = Divide by 2 (24 kHz, 22.05 kHz)

I am not sure why 22.05 made the cut and not 24 kHz, they are both 
derived from common clocks with the same divider... Same for 11.025 and 
12...

> 
> 
> Takashi
> 
>> ---
>>   include/sound/pcm.h     | 1 +
>>   sound/core/pcm_native.c | 4 ++--
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/sound/pcm.h b/include/sound/pcm.h
>> index bbe6eb1ff5d2..09d0a2a2dce8 100644
>> --- a/include/sound/pcm.h
>> +++ b/include/sound/pcm.h
>> @@ -119,6 +119,7 @@ struct snd_pcm_ops {
>>   #define SNDRV_PCM_RATE_192000		(1<<12)		/* 192000Hz */
>>   #define SNDRV_PCM_RATE_352800		(1<<13)		/* 352800Hz */
>>   #define SNDRV_PCM_RATE_384000		(1<<14)		/* 384000Hz */
>> +#define SNDRV_PCM_RATE_24000		(1<<15)		/* 24000Hz */
>>   
>>   #define SNDRV_PCM_RATE_CONTINUOUS	(1<<30)		/* continuous range */
>>   #define SNDRV_PCM_RATE_KNOT		(1<<31)		/* supports more non-continuos rates */
>> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
>> index 11e653c8aa0e..f52f28e3edb1 100644
>> --- a/sound/core/pcm_native.c
>> +++ b/sound/core/pcm_native.c
>> @@ -2164,13 +2164,13 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
>>   	return snd_interval_refine(hw_param_interval(params, rule->var), &t);
>>   }
>>   
>> -#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12
>> +#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12 ||  SNDRV_PCM_RATE_24000 != 1 << 15
>>   #error "Change this table"
>>   #endif
>>   
>>   static const unsigned int rates[] = {
>>   	5512, 8000, 11025, 16000, 22050, 32000, 44100,
>> -	48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000
>> +	48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000, 24000
>>   };
>>   
>>   const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
>> -- 
>> 2.17.1
>>

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-09-05 13:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05  5:32 [alsa-devel] [RFC PATCH 1/3] ALSA:hda: Simplify and clear calculating SDxFMT Pawel Harlozinski
2019-09-05  5:33 ` [alsa-devel] [RFC PATCH 2/3] ALSA:core: Add rate 24kHz Pawel Harlozinski
2019-09-05  5:48   ` Takashi Iwai
2019-09-05 13:11     ` Pierre-Louis Bossart [this message]
2019-09-05 13:16       ` Takashi Iwai
2019-09-05 14:00         ` Pierre-Louis Bossart
2019-09-05 14:09           ` Takashi Iwai
2019-09-05  5:33 ` [alsa-devel] [RFC PATCH 3/3] ALSA:hda: Add rates 24kHz, 64kHz Pawel Harlozinski
2019-09-05  5:33 ` Pawel Harlozinski
2019-09-05  5:47 ` [alsa-devel] [RFC PATCH 1/3] ALSA:hda: Simplify and clear calculating SDxFMT Takashi Iwai
2019-09-06 13:41   ` Harlozinski, Pawel
2019-09-06 14:16     ` 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=9b997691-a609-e7b5-94a6-d42e26dfa080@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=patch@alsa-project.org \
    --cc=pawel.harlozinski@linux.intel.com \
    --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 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.