linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate
@ 2021-04-27 10:34 Shengjiu Wang
  2021-04-27 10:34 ` [PATCH 2/2] ALSA: pcm: Extend the constraint table for 705.6kHz and 768KHz rate Shengjiu Wang
  2021-04-27 10:55 ` [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Shengjiu Wang @ 2021-04-27 10:34 UTC (permalink / raw)
  To: perex, tiwai, alsa-devel, linux-kernel, broonie

Some high resolution codecs support 705.6KHz and 768KHz rates.
So extend supported sample rate to 768kHz in pcm.h.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 include/sound/pcm.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 2e1200d17d0c..88056824ffec 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -121,6 +121,8 @@ 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_705600		(1<<15)		/* 705600Hz */
+#define SNDRV_PCM_RATE_768000		(1<<16)		/* 768000Hz */
 
 #define SNDRV_PCM_RATE_CONTINUOUS	(1<<30)		/* continuous range */
 #define SNDRV_PCM_RATE_KNOT		(1<<31)		/* supports more non-continuos rates */
@@ -136,6 +138,9 @@ struct snd_pcm_ops {
 #define SNDRV_PCM_RATE_8000_384000	(SNDRV_PCM_RATE_8000_192000|\
 					 SNDRV_PCM_RATE_352800|\
 					 SNDRV_PCM_RATE_384000)
+#define SNDRV_PCM_RATE_8000_768000	(SNDRV_PCM_RATE_8000_768000|\
+					 SNDRV_PCM_RATE_705600|\
+					 SNDRV_PCM_RATE_768000)
 #define _SNDRV_PCM_FMTBIT(fmt)		(1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
 #define SNDRV_PCM_FMTBIT_S8		_SNDRV_PCM_FMTBIT(S8)
 #define SNDRV_PCM_FMTBIT_U8		_SNDRV_PCM_FMTBIT(U8)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ALSA: pcm: Extend the constraint table for 705.6kHz and 768KHz rate
  2021-04-27 10:34 [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Shengjiu Wang
@ 2021-04-27 10:34 ` Shengjiu Wang
  2021-04-27 10:55 ` [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Shengjiu Wang @ 2021-04-27 10:34 UTC (permalink / raw)
  To: perex, tiwai, alsa-devel, linux-kernel, broonie

Some high resolution codecs support 705.6KHz and 768KHz rates
so extend the constraint table for 705.6kHz and 768KHz rate

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/core/pcm_native.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 17a85f4815d5..3e03f34cf3e2 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2370,7 +2370,8 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params,
 
 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,
+	705600, 768000
 };
 
 const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate
  2021-04-27 10:34 [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Shengjiu Wang
  2021-04-27 10:34 ` [PATCH 2/2] ALSA: pcm: Extend the constraint table for 705.6kHz and 768KHz rate Shengjiu Wang
@ 2021-04-27 10:55 ` Takashi Iwai
  2021-04-27 11:12   ` Shengjiu Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2021-04-27 10:55 UTC (permalink / raw)
  To: Shengjiu Wang; +Cc: perex, tiwai, alsa-devel, linux-kernel, broonie

On Tue, 27 Apr 2021 12:34:22 +0200,
Shengjiu Wang wrote:
> 
> Some high resolution codecs support 705.6KHz and 768KHz rates.
> So extend supported sample rate to 768kHz in pcm.h.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>

How many devices require it for now?

I don't want to extend the core definitions blindly unless those rates
are really commonly used.  You can add those specific rates in the
codec driver instead.


thanks,

Takashi

> ---
>  include/sound/pcm.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/sound/pcm.h b/include/sound/pcm.h
> index 2e1200d17d0c..88056824ffec 100644
> --- a/include/sound/pcm.h
> +++ b/include/sound/pcm.h
> @@ -121,6 +121,8 @@ 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_705600		(1<<15)		/* 705600Hz */
> +#define SNDRV_PCM_RATE_768000		(1<<16)		/* 768000Hz */
>  
>  #define SNDRV_PCM_RATE_CONTINUOUS	(1<<30)		/* continuous range */
>  #define SNDRV_PCM_RATE_KNOT		(1<<31)		/* supports more non-continuos rates */
> @@ -136,6 +138,9 @@ struct snd_pcm_ops {
>  #define SNDRV_PCM_RATE_8000_384000	(SNDRV_PCM_RATE_8000_192000|\
>  					 SNDRV_PCM_RATE_352800|\
>  					 SNDRV_PCM_RATE_384000)
> +#define SNDRV_PCM_RATE_8000_768000	(SNDRV_PCM_RATE_8000_768000|\
> +					 SNDRV_PCM_RATE_705600|\
> +					 SNDRV_PCM_RATE_768000)
>  #define _SNDRV_PCM_FMTBIT(fmt)		(1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
>  #define SNDRV_PCM_FMTBIT_S8		_SNDRV_PCM_FMTBIT(S8)
>  #define SNDRV_PCM_FMTBIT_U8		_SNDRV_PCM_FMTBIT(U8)
> -- 
> 2.27.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate
  2021-04-27 10:55 ` [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Takashi Iwai
@ 2021-04-27 11:12   ` Shengjiu Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Shengjiu Wang @ 2021-04-27 11:12 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Shengjiu Wang, linux-kernel, alsa-devel, Mark Brown, Takashi Iwai

On Tue, Apr 27, 2021 at 6:56 PM Takashi Iwai <tiwai@suse.de> wrote:
>
> On Tue, 27 Apr 2021 12:34:22 +0200,
> Shengjiu Wang wrote:
> >
> > Some high resolution codecs support 705.6KHz and 768KHz rates.
> > So extend supported sample rate to 768kHz in pcm.h.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
>
> How many devices require it for now?

I have two devices, AK4458, AK5558.

>
> I don't want to extend the core definitions blindly unless those rates
> are really commonly used.  You can add those specific rates in the
> codec driver instead.

Ok, this is an option.

>
>
> thanks,
>
> Takashi
>
> > ---
> >  include/sound/pcm.h | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/include/sound/pcm.h b/include/sound/pcm.h
> > index 2e1200d17d0c..88056824ffec 100644
> > --- a/include/sound/pcm.h
> > +++ b/include/sound/pcm.h
> > @@ -121,6 +121,8 @@ 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_705600                (1<<15)         /* 705600Hz */
> > +#define SNDRV_PCM_RATE_768000                (1<<16)         /* 768000Hz */
> >
> >  #define SNDRV_PCM_RATE_CONTINUOUS    (1<<30)         /* continuous range */
> >  #define SNDRV_PCM_RATE_KNOT          (1<<31)         /* supports more non-continuos rates */
> > @@ -136,6 +138,9 @@ struct snd_pcm_ops {
> >  #define SNDRV_PCM_RATE_8000_384000   (SNDRV_PCM_RATE_8000_192000|\
> >                                        SNDRV_PCM_RATE_352800|\
> >                                        SNDRV_PCM_RATE_384000)
> > +#define SNDRV_PCM_RATE_8000_768000   (SNDRV_PCM_RATE_8000_768000|\
> > +                                      SNDRV_PCM_RATE_705600|\
> > +                                      SNDRV_PCM_RATE_768000)
> >  #define _SNDRV_PCM_FMTBIT(fmt)               (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
> >  #define SNDRV_PCM_FMTBIT_S8          _SNDRV_PCM_FMTBIT(S8)
> >  #define SNDRV_PCM_FMTBIT_U8          _SNDRV_PCM_FMTBIT(U8)
> > --
> > 2.27.0
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-27 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 10:34 [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Shengjiu Wang
2021-04-27 10:34 ` [PATCH 2/2] ALSA: pcm: Extend the constraint table for 705.6kHz and 768KHz rate Shengjiu Wang
2021-04-27 10:55 ` [PATCH 1/2] ALSA: pcm: Add support for 705.6KHz and 768KHz sample rate Takashi Iwai
2021-04-27 11:12   ` Shengjiu Wang

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).