diff mbox

[v2,1/2] ALSA: Add params_set_format helper

Message ID 1423440097-95191-1-git-send-email-yang.a.fang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

yang.a.fang@intel.com Feb. 9, 2015, 12:01 a.m. UTC
From: "Fang, Yang A" <yang.a.fang@intel.com>

Add a helper to set pcm format directly from params

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
---
 include/sound/pcm_params.h |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Takashi Iwai Feb. 9, 2015, 6:40 a.m. UTC | #1
At Sun,  8 Feb 2015 16:01:36 -0800,
yang.a.fang@intel.com wrote:
> 
> From: "Fang, Yang A" <yang.a.fang@intel.com>
> 
> Add a helper to set pcm format directly from params
> 
> Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
> ---
>  include/sound/pcm_params.h |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
> index 6b1c78f..e6fe584 100644
> --- a/include/sound/pcm_params.h
> +++ b/include/sound/pcm_params.h
> @@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p)
>  	return snd_pcm_format_physical_width(params_format(p));
>  }
>  
> +static inline void
> +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
> +{
> +	snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
> +		SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);

Use hw_params_mask().


Takashi
yang.a.fang@intel.com Feb. 9, 2015, 6:58 a.m. UTC | #2
> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Sunday, February 08, 2015 10:41 PM
> To: Fang, Yang A
> Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org;
> N, Harshapriya; Koul, Vinod; Jain, Praveen K; Iriawan, Denny; Strasser, Kevin;
> Lin, Mengdong
> Subject: Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
> 
> At Sun,  8 Feb 2015 16:01:36 -0800,
> yang.a.fang@intel.com wrote:
> >
> > From: "Fang, Yang A" <yang.a.fang@intel.com>
> >
> > Add a helper to set pcm format directly from params
> >
> > Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
> > ---
> >  include/sound/pcm_params.h |    7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
> > index 6b1c78f..e6fe584 100644
> > --- a/include/sound/pcm_params.h
> > +++ b/include/sound/pcm_params.h
> > @@ -366,4 +366,11 @@ params_physical_width(const struct
> snd_pcm_hw_params *p)
> >  	return snd_pcm_format_physical_width(params_format(p));
> >  }
> >
> > +static inline void
> > +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t
> fmt)
> > +{
> > +	snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
> > +		SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
> 
> Use hw_params_mask().
> 
> 
> Takashi

Did not find hw_params_mask .
Do you mean change params_set_format (struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
To 
hw_params_mask(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) ?

Thanks,
Yang
Takashi Iwai Feb. 9, 2015, 7:54 a.m. UTC | #3
At Mon, 9 Feb 2015 06:58:39 +0000,
Fang, Yang A wrote:
> 
> 
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai@suse.de]
> > Sent: Sunday, February 08, 2015 10:41 PM
> > To: Fang, Yang A
> > Cc: broonie@kernel.org; lgirdwood@gmail.com; alsa-devel@alsa-project.org;
> > N, Harshapriya; Koul, Vinod; Jain, Praveen K; Iriawan, Denny; Strasser, Kevin;
> > Lin, Mengdong
> > Subject: Re: [PATCH v2 1/2] ALSA: Add params_set_format helper
> > 
> > At Sun,  8 Feb 2015 16:01:36 -0800,
> > yang.a.fang@intel.com wrote:
> > >
> > > From: "Fang, Yang A" <yang.a.fang@intel.com>
> > >
> > > Add a helper to set pcm format directly from params
> > >
> > > Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
> > > ---
> > >  include/sound/pcm_params.h |    7 +++++++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
> > > index 6b1c78f..e6fe584 100644
> > > --- a/include/sound/pcm_params.h
> > > +++ b/include/sound/pcm_params.h
> > > @@ -366,4 +366,11 @@ params_physical_width(const struct
> > snd_pcm_hw_params *p)
> > >  	return snd_pcm_format_physical_width(params_format(p));
> > >  }
> > >
> > > +static inline void
> > > +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t
> > fmt)
> > > +{
> > > +	snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
> > > +		SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
> > 
> > Use hw_params_mask().
> > 
> > 
> > Takashi
> 
> Did not find hw_params_mask .
> Do you mean change params_set_format (struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
> To 
> hw_params_mask(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) ?

No, just like

static inline void params_set_format(struct snd_pcm_hw_params *p,
				     snd_pcm_format_t fmt)
{
	snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT),
		     (__force int)fmt);
}


Takashi
diff mbox

Patch

diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 6b1c78f..e6fe584 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -366,4 +366,11 @@  params_physical_width(const struct snd_pcm_hw_params *p)
 	return snd_pcm_format_physical_width(params_format(p));
 }
 
+static inline void
+params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt)
+{
+	snd_mask_set(&p->masks[SNDRV_PCM_HW_PARAM_FORMAT -
+		SNDRV_PCM_HW_PARAM_FIRST_MASK], (__force int)fmt);
+}
+
 #endif /* __SOUND_PCM_PARAMS_H */