Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jie Yang <yang.jie@intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	tanu.kaskinen@linux.intel.com, liam.r.girdwood@intel.com
Subject: Re: [PATCH v8 1/7] ALSA: jack: implement kctl creating for jack device
Date: Wed, 22 Apr 2015 13:27:56 +0200	[thread overview]
Message-ID: <s5hegncmmgz.wl-tiwai@suse.de> (raw)
In-Reply-To: <1429682633-10765-2-git-send-email-yang.jie@intel.com>

At Wed, 22 Apr 2015 14:03:47 +0800,
Jie Yang wrote:
> 
> Currently the ALSA jack core registers only input devices for each jack
> registered. These jack input devices are not readable by userspace devices
> that run as non root. This patch and the following series patches will
> implement kctls inside the core jack part, including kctls creating, status
> changing report, for both HD-Audio and ASoC jack. This allows non root
> userspace to read jack status and act on it.
> 
> This patch implement snd_jack_add_new_kctl(), which will create a kcontrol,
> add it to the card, and also attach it to the jack kctl list.
> 
> The patch also initial the jack kctl list after jack is newed, and report
> kctl status when doing jack report.
> 
> In the following patches, We will update snd_jack_new() to support phantom
> jack creating, and also enable a kcontrol creating at this jack new stage.
> After that, we can remove these part from HDA jack, and leave jack kctls
> handled by core part thoroughly.
> 
> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
> Modified-by: Jie Yang <yang.jie@intel.com>
> Signed-off-by: Jie Yang <yang.jie@intel.com>
> Reveiwed-by: Mark Brown <broonie@kernel.org>
> ---
>  include/sound/jack.h  |  15 +++++++-
>  sound/core/Kconfig    |   3 --
>  sound/core/Makefile   |   3 +-
>  sound/core/jack.c     | 104 +++++++++++++++++++++++++++++++++++++++++++++++++-
>  sound/pci/hda/Kconfig |   1 -
>  5 files changed, 118 insertions(+), 8 deletions(-)
> 
> diff --git a/include/sound/jack.h b/include/sound/jack.h
> index 2182350..9781e75 100644
> --- a/include/sound/jack.h
> +++ b/include/sound/jack.h
> @@ -73,6 +73,8 @@ enum snd_jack_types {
>  
>  struct snd_jack {
>  	struct input_dev *input_dev;
> +	struct list_head kctl_list;
> +	struct snd_card *card;
>  	int registered;
>  	int type;
>  	const char *id;
> @@ -82,10 +84,17 @@ struct snd_jack {
>  	void (*private_free)(struct snd_jack *);
>  };
>  
> +struct snd_jack_kctl {
> +	struct snd_kcontrol *kctl;
> +	struct list_head list;		/* list of controls belong to the same jack */
> +	unsigned int mask_bits;	/* one of the corresponding bits of status change will report to this kctl */
> +};

This struct isn't referred outside jack.c, so we can move it to
jack.c.  This hides the internal implementation details.


>  #ifdef CONFIG_SND_JACK
>  
>  int snd_jack_new(struct snd_card *card, const char *id, int type,
>  		 struct snd_jack **jack);
> +int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask);
>  void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
>  int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
>  		     int keytype);
> @@ -93,13 +102,17 @@ int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
>  void snd_jack_report(struct snd_jack *jack, int status);
>  
>  #else
> -
>  static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
>  			       struct snd_jack **jack)
>  {
>  	return 0;
>  }
>  
> +static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask)
> +{
> +	return 0;
> +}
> +
>  static inline void snd_jack_set_parent(struct snd_jack *jack,
>  				       struct device *parent)
>  {
> diff --git a/sound/core/Kconfig b/sound/core/Kconfig
> index 313f22e..63cc2e9 100644
> --- a/sound/core/Kconfig
> +++ b/sound/core/Kconfig
> @@ -221,9 +221,6 @@ config SND_PCM_XRUN_DEBUG
>  config SND_VMASTER
>  	bool
>  
> -config SND_KCTL_JACK
> -	bool
> -
>  config SND_DMA_SGBUF
>  	def_bool y
>  	depends on X86
> diff --git a/sound/core/Makefile b/sound/core/Makefile
> index 4daf2f5..e041dc2 100644
> --- a/sound/core/Makefile
> +++ b/sound/core/Makefile
> @@ -7,8 +7,7 @@ snd-y     := sound.o init.o memory.o info.o control.o misc.o device.o
>  snd-$(CONFIG_ISA_DMA_API) += isadma.o
>  snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o
>  snd-$(CONFIG_SND_VMASTER) += vmaster.o
> -snd-$(CONFIG_SND_KCTL_JACK) += ctljack.o
> -snd-$(CONFIG_SND_JACK)	  += jack.o
> +snd-$(CONFIG_SND_JACK)	  += ctljack.o jack.o

I guess this breaks the build when CONFIG_SND_HDA_INPUT_JACK=n.


Takashi

  reply	other threads:[~2015-04-22 11:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22  6:03 [PATCH v8 0/7] ALSA: jack: Refactoring for jack kctls Jie Yang
2015-04-22  6:03 ` [PATCH v8 1/7] ALSA: jack: implement kctl creating for jack device Jie Yang
2015-04-22 11:27   ` Takashi Iwai [this message]
2015-04-22 12:08     ` Jie, Yang
2015-04-22  6:03 ` [PATCH v8 2/7] ALSA: Jack: refactoring snd_kctl_jack_new to support embedded kctl Jie Yang
2015-04-22 11:32   ` Takashi Iwai
2015-04-22 12:40     ` Jie, Yang
2015-04-22 12:58       ` Takashi Iwai
2015-04-22 13:23         ` Jie, Yang
2015-04-22 13:56         ` Jie, Yang
2015-04-22 14:08           ` Takashi Iwai
2015-04-22 14:19             ` Jie, Yang
2015-04-22  6:03 ` [PATCH v8 3/7] ALSA: jack: extend snd_jack_new to support phantom jack Jie Yang
2015-04-22 11:30   ` Takashi Iwai
2015-04-22 12:49     ` Jie, Yang
2015-04-22  6:03 ` [PATCH v8 4/7] ALSA: hda - Update to use the new jack kctls method Jie Yang
2015-04-22  6:03 ` [PATCH v8 5/7] ASoC: jack: create kctls according to jack pins info Jie Yang
2015-04-22  6:03 ` [PATCH v8 6/7] ALSA: jack: remove exporting ctljack functions Jie Yang
2015-04-22  6:03 ` [PATCH v8 7/7] ALSA: Docs: Add documentation for Jack kcontrols Jie Yang

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=s5hegncmmgz.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tanu.kaskinen@linux.intel.com \
    --cc=yang.jie@intel.com \
    /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