diff mbox

[02/12] ALSA: hda - Add macro to test pin widget's input capability

Message ID 1472451806-10605-3-git-send-email-subhransu.s.prusty@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Subhransu S. Prusty Aug. 29, 2016, 6:23 a.m. UTC
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/hda/local.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Takashi Iwai Aug. 29, 2016, 8:42 a.m. UTC | #1
On Mon, 29 Aug 2016 08:23:16 +0200,
Subhransu S. Prusty wrote:
> 
> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>

.... missing the reason why?


> ---
>  sound/hda/local.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/sound/hda/local.h b/sound/hda/local.h
> index 0d5bb15..a51f5f6 100644
> --- a/sound/hda/local.h
> +++ b/sound/hda/local.h
> @@ -8,6 +8,16 @@
>  #define get_wcaps(codec, nid) \
>  	snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
>  
> +#define get_pcaps(codec, nid) \
> +	snd_hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)
> +
> +static inline int is_input_pin(struct hdac_device *codec, hda_nid_t nid)

Better to make it bool.


thanks,

Takashi
Subhransu S. Prusty Aug. 29, 2016, 1:01 p.m. UTC | #2
On Mon, Aug 29, 2016 at 10:42:27AM +0200, Takashi Iwai wrote:
> On Mon, 29 Aug 2016 08:23:16 +0200,
> Subhransu S. Prusty wrote:
> > 
> > Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
> > Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> 
> .... missing the reason why?

This macro will be used to identify pins input capability and create DAPM
widgets. Also based on input capability widget parsing is done for DAPM
graph creation.

Will add these details in the commit message.

> 
> 
> > ---
> >  sound/hda/local.h | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/sound/hda/local.h b/sound/hda/local.h
> > index 0d5bb15..a51f5f6 100644
> > --- a/sound/hda/local.h
> > +++ b/sound/hda/local.h
> > @@ -8,6 +8,16 @@
> >  #define get_wcaps(codec, nid) \
> >  	snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
> >  
> > +#define get_pcaps(codec, nid) \
> > +	snd_hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)
> > +
> > +static inline int is_input_pin(struct hdac_device *codec, hda_nid_t nid)
> 
> Better to make it bool.

Sure.

Regards,
Subhransu

> 
> 
> thanks,
> 
> Takashi
diff mbox

Patch

diff --git a/sound/hda/local.h b/sound/hda/local.h
index 0d5bb15..a51f5f6 100644
--- a/sound/hda/local.h
+++ b/sound/hda/local.h
@@ -8,6 +8,16 @@ 
 #define get_wcaps(codec, nid) \
 	snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
 
+#define get_pcaps(codec, nid) \
+	snd_hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)
+
+static inline int is_input_pin(struct hdac_device *codec, hda_nid_t nid)
+{
+	unsigned int pincap = get_pcaps(codec, nid);
+
+	return (pincap & AC_PINCAP_IN) != 0;
+}
+
 /* get the widget type from widget capability bits */
 static inline int get_wcaps_type(unsigned int wcaps)
 {