All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jie, Yang" <yang.jie@intel.com>
To: David Henningsson <david.henningsson@canonical.com>,
	Tanu Kaskinen <tanu.kaskinen@linux.intel.com>,
	Takashi Iwai <tiwai@suse.de>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"Girdwood, Liam R" <liam.r.girdwood@intel.com>
Subject: Re: [PATCH v2 1/2] ALSA: jack: create jack kcontrols for every jack input device
Date: Thu, 26 Mar 2015 12:39:53 +0000	[thread overview]
Message-ID: <E7B1D079BA13FB44A978CC8F69C7D6A901BDDBAF@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <5513CBE3.2090908@canonical.com>


OK, then I am thinking we can add jack kctls creating code like below: 

snd_jack_new(struct snd_card *card, const char *id, int type, struct snd_jack **jjack) {
...
	Switch(type | SND_JACK_HEADSET)
	{
		case SND_JACK_MICROPHONE:
			create "Mic Jack" kctl;
			break;
		case SND_JACK_HEADSET:
			if (id == "Headphone Mic Headset") {
				create " Headphone Mic Jack " kctl;
				create " Headset Mic Jack " kctl;
			} else {
				create " Headphone Jack " kctl;
				create " Headset Mic Jack " kctl;
			}
			break;
		case SND_JACK_HEADPHONE:
			if (id == "Headset Mic") {
				create " Headphone Jack " kctl;
			//	create " Headset Mic Phantom Jack " kctl;
			} else if (id == "Headphone Mic")  {
				create " Headphone Mic Jack " kctl;
			} else if (id == "Headset Headphone Mic")  {
				create " Headphone Mic Jack " kctl;
			//	create " Headset Mic Phantom Jack " kctl;
			} else {
				create " Headphone Jack " kctl;
			}
			break;
		default:
			create "Mic Jack" kctl;
			break;
	}
...
}


Jack Type			Jack name			kctls/switches name
SND_JACK_HEADPHONE	Headphone			Headphone Jack
SND_JACK_MICROPHONE	Mic				Mic Jack
SND_JACK_HEADSET		Headset			Headphone Jack
								Headset Mic Jack
SND_JACK_HEADPHONE	Headset Mic			Headphone Jack
								Headset Mic Phantom Jack
SND_JACK_HEADPHONE 	Headphone Mic		Headphone Mic Jack
SND_JACK_HEADPHONE 	Headset Headphone Mic	Headphone Mic Jack
								Headset Mic Phantom Jack
SND_JACK_HEADSET 		Headphone Mic Headset	Headphone Mic Jack
								Headset Mic Jack

~Keyon

> -----Original Message-----
> From: David Henningsson [mailto:david.henningsson@canonical.com]
> Sent: Thursday, March 26, 2015 5:06 PM
> To: Jie, Yang; Tanu Kaskinen; Takashi Iwai
> Cc: perex@perex.cz; broonie@kernel.org; alsa-devel@alsa-project.org;
> Girdwood, Liam R; Liam Girdwood
> Subject: Re: [PATCH v2 1/2] ALSA: jack: create jack kcontrols for every jack
> input device
> 
> 
> 
> On 2015-03-26 09:29, Jie, Yang wrote:
> >
> > Thank you so much, David!
> >
> > So, I summarized as below table:
> 
> I've added how I see them with the new API, see below for further
> comments:
> 
> >
> > Jack Type					kctls/switches name
> 				detection
> 
> 			description
> >
> > Headphone					Headphone Jack
> 				HP plugged in/unplugged
> 
> SND_JACK_HEADPHONE
> 
> >
> > Mic						Mic Jack
> 				Mic plugged in/unplugged
> 
> SND_JACK_MICROPHONE
> 
> >
> > Headset					Headphone Jack
> 				Nothing plugged in:   ""Headphone Jack"" =
> false, ""Headset Mic Jack"" = false
> > 						Headset Mic Jack"
> 				Headphones plugged in:   ""Headphone
> Jack"" = true, ""Headset Mic Jack"" = false
> >
> 				Headset plugged in:   ""Headphone Jack"" =
> true, ""Headset Mic Jack"" = true
> >
> 				Mic plugged in:   ""Headphone Jack"" = true
> ""Headset Mic Jack"" = false(should not plugged in Mic, detect wrongly)"
> 		independent switches
> 
> SND_JACK_HEADSET
> 
> "Mic plugged in" case is irrelevant - not supported by hw
> 
> >
> > Headset Mic					Headphone Jack
> 				Nothing plugged in:   ""Headphone Jack"" =
> false, ""Headset Mic Phantom Jack"" = false
> > 						Headset Mic Phantom Jack
> 				Headphones plugged in:   ""Headphone
> Jack"" = true, ""Headset Mic Phantom Jack"" = false?
> >
> 				Headset plugged in:   ""Headphone Jack"" =
> false, ""Headset Mic Phantom Jack"" = true ?
> >
> 				Mic plugged in:   ""Headphone Jack"" = true,
> ""Headset Mic Phantom Jack"" = false(should not plugged in Mic, detect
> wrongly)"    one hw switch only
> 
> SND_JACK_HEADPHONE, the "Headset Mic Phantom Jack" is created
> manually
> 
> > Headphone Mic				Headphone Mic Jack
> 				Nothing plugged in:   ""Headphone Mic Jack""
> = false
> >
> 				Headphones plugged in:   ""Headphone Mic
> Jack"" = true
> >
> 				Mic plugged in:   ""Headphone Mic Jack"" =
> true
> >
> 				Headset plugged in:   ""Headphone Mic
> Jack"" = true?"
> 			one hw switch
> 
> SND_JACK_HEADPHONE (probably)
> 
> > Headset Headphone Mic			Headphone Mic Jack
> 				Nothing plugged in:   ""Headphone Mic Jack""
> = false, ""Headset Mic Phantom Jack"" = false
> > 						Headset Mic Phantom Jack
> 				Headphones plugged in:   ""Headphone Mic
> Jack"" = true, ""Headset Mic Phantom Jack"" = false
> >
> 				Headset plugged in:   ""Headphone Mic
> Jack"" = false, ""Headset Mic Phantom Jack"" = true ?
> >
> 				Mic plugged in:   ""Headphone Mic Jack"" =
> true, ""Headset Mic Phantom Jack"" = false"
> 	one hw switch only
> 
> SND_JACK_HEADPHONE (probably), the "Headset Mic Phantom Jack" is
> created manually
> 
> > Headphone Mic Headset			Headphone Mic Jack
> 				Nothing plugged in:   ""Headphone Mic Jack""
> = false, ""Headset Mic Jack"" = false
> > 						Headset Mic Jack
> 				Headphones plugged in:   ""Headphone Mic
> Jack"" = true, ""Headset Mic Jack"" = false
> >
> 				Headset plugged in:   ""Headphone Mic
> Jack"" = true, ""Headset Mic Jack"" = true
> >
> 				Mic plugged in:   ""Headphone Mic Jack"" =
> true, ""Headset Mic Jack"" = false
> >
> 
> 							one switch for hp/mic
> and the other for the
> > headset mic
> 
> SND_JACK_HEADSET (probably)
> 
> >
> > so, we may need extend snd_jack_types enum, by adding types:  Headset
> Mic, Headphone Mic, Headset Headphone Mic, Headphone Mic Headset.
> >
> > enum snd_jack_types {
> > 	SND_JACK_HEADPHONE	= 0x0001,
> > 	SND_JACK_MICROPHONE	= 0x0002,
> > 	SND_JACK_HEADSET	= SND_JACK_HEADPHONE |
> SND_JACK_MICROPHONE,
> > 	SND_JACK_LINEOUT	= 0x0004,
> > 	SND_JACK_MECHANICAL	= 0x0008, /* If detected separately */
> > 	SND_JACK_VIDEOOUT	= 0x0010,
> > 	SND_JACK_AVOUT		= SND_JACK_LINEOUT |
> SND_JACK_VIDEOOUT,
> > 	SND_JACK_LINEIN		= 0x0020,
> >
> > 	SND_JACK_HEADSET_MIC	= 0x0040, /* one hw switch only */
> > 	SND_JACK_HEADPHONE_MIC	= 0x0080, /* one hw switch only,
> headphone, or mic */
> > 	SND_JACK_HEADSET_ HEADPHONE_MIC	= 0x0100, /* one hw
> switch only,  headset, headphone, or mic*/
> > 	SND_JACK_ HEADPHONE_HEADSET_ MIC	= 0x0200, /* headset,
> headphone, or mic; one switch for hp/mic and the other for the headset mic
> */
> 
> This seems overly complex. I don't think we really need to add all of that.
> 
> First, for the phantom jacks. We'll need phantom jacks not only for "Headset
> Mic Phantom Jack" but also for "Internal Speaker Phantom Jack"
> and "Internal Mic Phantom Jack", and probably some others as well. So that
> means that the HDA driver needs to still create some kctls using the current
> kctl API instead of your new unified API.
> 
> A phantom jack is merely a marker to userspace indicating what hardware is
> present. It always returns "plugged in" when trying to read it.
> 
> With the phantom jacks dealt with separately, the question remains about
> the Headphone Mic stuff. If the name remains the way it is, maybe all we
> need is a SND_JACK_HEADPHONE (or SND_JACK_HEADSET) jack with the
> "Headphone Mic Jack" name and then userspace would know that this jack
> could potentially accomodate a microphone too. Otherwise we might need
> to add a SND_JACK_HEADPHONE_OR_MIC constant, but I prefer that the
> names are kept properly, because there might be other relevant info added
> to the name too (e g "Front Headphone Jack" instead of "Headphone Jack").
> 
> --
> David Henningsson, Canonical Ltd.
> https://launchpad.net/~diwic

  reply	other threads:[~2015-03-26 12:39 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20  8:55 [PATCH v2 0/2] ALSA: jack: Refactoring for jack kctls Jie Yang
2015-03-20  8:55 ` Jie Yang
2015-03-20  8:55 ` [PATCH v2 1/2] ALSA: jack: create jack kcontrols for every jack input device Jie Yang
2015-03-20  9:27   ` Takashi Iwai
2015-03-20  9:29     ` Takashi Iwai
2015-03-20 12:22     ` Jie, Yang
2015-03-20 12:26       ` Takashi Iwai
2015-03-20 12:50         ` Jie, Yang
2015-03-20 13:21           ` Takashi Iwai
2015-03-20 13:49             ` Jie, Yang
2015-03-20 14:18               ` Takashi Iwai
2015-03-23 10:56                 ` Tanu Kaskinen
2015-03-23 11:51                   ` David Henningsson
2015-03-23 11:59                     ` Takashi Iwai
2015-03-23 16:41                     ` Mark Brown
2015-03-24  6:50                       ` David Henningsson
2015-03-24 17:57                         ` Mark Brown
2015-03-25  0:48                           ` Raymond Yau
2015-03-25  2:14                         ` Raymond Yau
2015-03-25 13:53                     ` Jie, Yang
2015-03-25 16:13                       ` Raymond Yau
2015-03-26  6:42                       ` David Henningsson
2015-03-26  8:29                         ` Jie, Yang
2015-03-26  9:05                           ` David Henningsson
2015-03-26 12:39                             ` Jie, Yang [this message]
2015-03-27  0:39                               ` Raymond Yau
2015-03-27  2:13                                 ` Jie, Yang
2015-03-26 12:43                             ` Jie, Yang
2015-03-27  6:50                               ` David Henningsson
2015-03-27  7:45                                 ` Jie, Yang
2015-03-27  8:01                                   ` David Henningsson
2015-03-27  9:11                                     ` Jie, Yang
2015-03-30  7:27                                       ` David Henningsson
2015-03-26  2:34                     ` Raymond Yau
2015-03-25  7:53                   ` Jie, Yang
2015-03-25  9:27                     ` Tanu Kaskinen
2015-03-25 14:13                       ` Jie, Yang
2015-03-28  6:09           ` Raymond Yau
2015-03-20 10:30   ` Raymond Yau
2015-03-20  8:55 ` [PATCH v2 2/2] ALSA: hda - Remove jack kctls 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=E7B1D079BA13FB44A978CC8F69C7D6A901BDDBAF@SHSMSX101.ccr.corp.intel.com \
    --to=yang.jie@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=david.henningsson@canonical.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tanu.kaskinen@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.