Skip to contentSkip to conversation

ALSA: hda: Make core jack usage unconditional

PATCH In review Mark Brown 2 participants 3 messages Aug 27, 2012 – Aug 28, 2012 Sound

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ALSA: hda: Make core jack usage unconditional

Currently the HDA drivers have a Kconfig variable SND_HDA_INPUT_JACK which disables jack reporting via the ALSA core jack API. This is bad since (modulo the current problems with the HDA-specific reporting API) it means that all reporting mechanisms will get disabled, not just input. It's also not good that this is open coded in an individual driver - if it's useful to have this control it's going to be equally useful for any driver with jack detection support so should be handled in the core.

---
 sound/pci/hda/Kconfig    |    9 +--------
 sound/pci/hda/hda_jack.c |    8 --------
 2 files changed, 1 insertion(+), 16 deletions(-)
sound/pci/hda/Kconfig +1 -8
index 194d625..2c7f626 100644
@@ -2,6 +2,7 @@ menuconfig SND_HDA_INTEL
 	tristate "Intel HD Audio"
 	select SND_PCM
 	select SND_VMASTER
+	select SND_JACK if INPUT=y || INPUT=SND
 	select SND_KCTL_JACK
 	help
 	  Say Y here to include support for Intel "High Definition
@@ -62,14 +63,6 @@ config SND_HDA_INPUT_BEEP_MODE
 	  Set 1 to always enable the digital beep interface for HD-audio by
 	  default.
 
-config SND_HDA_INPUT_JACK
-	bool "Support jack plugging notification via input layer"
-	depends on INPUT=y || INPUT=SND
-	select SND_JACK
-	help
-	  Say Y here to enable the jack plugging notification via
-	  input layer.
-
 config SND_HDA_PATCH_LOADER
 	bool "Support initialization patch loading for HD-audio"
 	depends on EXPERIMENTAL
sound/pci/hda/hda_jack.c +0 -8
index aaccc02..0760d75 100644
@@ -109,7 +109,6 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_new);
 
 void snd_hda_jack_tbl_clear(struct hda_codec *codec)
 {
-#ifdef CONFIG_SND_HDA_INPUT_JACK
 	/* free jack instances manually when clearing/reconfiguring */
 	if (!codec->bus->shutdown && codec->jacktbl.list) {
 		struct hda_jack_tbl *jack = codec->jacktbl.list;
@@ -119,7 +118,6 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec)
 				snd_device_free(codec->bus->card, jack->jack);
 		}
 	}
-#endif
 	snd_array_free(&codec->jacktbl);
 }
 
@@ -225,16 +223,13 @@ void snd_hda_jack_report_sync(struct hda_codec *codec)
 				continue;
 			state = get_jack_plug_state(jack->pin_sense);
 			snd_kctl_jack_report(codec->bus->card, jack->kctl, state);
-#ifdef CONFIG_SND_HDA_INPUT_JACK
 			if (jack->jack)
 				snd_jack_report(jack->jack,
 						state ? jack->type : 0);
-#endif
 		}
 }
 EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);
 
-#ifdef CONFIG_SND_HDA_INPUT_JACK
 /* guess the jack type from the pin-config */
 static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
 {
@@ -261,7 +256,6 @@ static void hda_free_jack_priv(struct snd_jack *jack)
 	jacks->nid = 0;
 	jacks->jack = NULL;
 }
-#endif
 
 /**
  * snd_hda_jack_add_kctl - Add a kctl for the given pin
@@ -292,7 +286,6 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
 
 	state = snd_hda_jack_detect(codec, nid);
 	snd_kctl_jack_report(codec->bus->card, kctl, state);
-#ifdef CONFIG_SND_HDA_INPUT_JACK
 	if (!phantom_jack) {
 		jack->type = get_input_jack_type(codec, nid);
 		err = snd_jack_new(codec->bus->card, name, jack->type,
@@ -303,7 +296,6 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
 		jack->jack->private_free = hda_free_jack_priv;
 		snd_jack_report(jack->jack, state ? jack->type : 0);
 	}
-#endif
 	return 0;
 }
 
Signature · 1 line
1.7.10.4
#1 lore raw

2012-08-27 11:53, Mark Brown skrev:

Quoted 5 lines

Currently the HDA drivers have a Kconfig variable SND_HDA_INPUT_JACK which disables jack reporting via the ALSA core jack API. This is bad since (modulo the current problems with the HDA-specific reporting API) it means that all reporting mechanisms will get disabled, not just input.

Can you explain what other "reporting mechanisms" you are referring to?

Anyway, I don't mind this patch. As you said, if we're having a kconfig to turn on/off reporting through the input devices, we could just as well have it in core so it works for everyone and not just HDA.

Quoted 99 lines

It's also not good that this is open coded in an individual driver - if it's useful to have this control it's going to be equally useful for any driver with jack detection support so should be handled in the core.

---
  sound/pci/hda/Kconfig    |    9 +--------
  sound/pci/hda/hda_jack.c |    8 --------
  2 files changed, 1 insertion(+), 16 deletions(-)
sound/pci/hda/Kconfig +1 -8
index 194d625..2c7f626 100644
@@ -2,6 +2,7 @@ menuconfig SND_HDA_INTEL
  	tristate "Intel HD Audio"
  	select SND_PCM
  	select SND_VMASTER
+	select SND_JACK if INPUT=y || INPUT=SND
  	select SND_KCTL_JACK
  	help
  	  Say Y here to include support for Intel "High Definition
@@ -62,14 +63,6 @@ config SND_HDA_INPUT_BEEP_MODE
  	  Set 1 to always enable the digital beep interface for HD-audio by
  	  default.
 
-config SND_HDA_INPUT_JACK
-	bool "Support jack plugging notification via input layer"
-	depends on INPUT=y || INPUT=SND
-	select SND_JACK
-	help
-	  Say Y here to enable the jack plugging notification via
-	  input layer.
-
  config SND_HDA_PATCH_LOADER
  	bool "Support initialization patch loading for HD-audio"
  	depends on EXPERIMENTAL
sound/pci/hda/hda_jack.c +0 -8
index aaccc02..0760d75 100644
@@ -109,7 +109,6 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_new);
 
  void snd_hda_jack_tbl_clear(struct hda_codec *codec)
  {
-#ifdef CONFIG_SND_HDA_INPUT_JACK
  	/* free jack instances manually when clearing/reconfiguring */
  	if (!codec->bus->shutdown && codec->jacktbl.list) {
  		struct hda_jack_tbl *jack = codec->jacktbl.list;
@@ -119,7 +118,6 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec)
  				snd_device_free(codec->bus->card, jack->jack);
  		}
  	}
-#endif
  	snd_array_free(&codec->jacktbl);
  }
 
@@ -225,16 +223,13 @@ void snd_hda_jack_report_sync(struct hda_codec *codec)
  				continue;
  			state = get_jack_plug_state(jack->pin_sense);
  			snd_kctl_jack_report(codec->bus->card, jack->kctl, state);
-#ifdef CONFIG_SND_HDA_INPUT_JACK
  			if (jack->jack)
  				snd_jack_report(jack->jack,
  						state ? jack->type : 0);
-#endif
  		}
  }
  EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);
 
-#ifdef CONFIG_SND_HDA_INPUT_JACK
  /* guess the jack type from the pin-config */
  static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
  {
@@ -261,7 +256,6 @@ static void hda_free_jack_priv(struct snd_jack *jack)
  	jacks->nid = 0;
  	jacks->jack = NULL;
  }
-#endif
 
  /**
   * snd_hda_jack_add_kctl - Add a kctl for the given pin
@@ -292,7 +286,6 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
 
  	state = snd_hda_jack_detect(codec, nid);
  	snd_kctl_jack_report(codec->bus->card, kctl, state);
-#ifdef CONFIG_SND_HDA_INPUT_JACK
  	if (!phantom_jack) {
  		jack->type = get_input_jack_type(codec, nid);
  		err = snd_jack_new(codec->bus->card, name, jack->type,
@@ -303,7 +296,6 @@ static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
  		jack->jack->private_free = hda_free_jack_priv;
  		snd_jack_report(jack->jack, state ? jack->type : 0);
  	}
-#endif
  	return 0;
  }
 
Signature · 2 lines
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
author
#2 lore raw
Quoted 8 lines · David Henningsson

2012-08-27 11:53, Mark Brown skrev:

Quoted 5 lines

Currently the HDA drivers have a Kconfig variable SND_HDA_INPUT_JACK which disables jack reporting via the ALSA core jack API. This is bad since (modulo the current problems with the HDA-specific reporting API) it means that all reporting mechanisms will get disabled, not just input.

Can you explain what other "reporting mechanisms" you are referring to?

The ctljack stuff when I wrote it - this is the first part of a patch set intended to merge the in kernel APIs for this stuff but there's a bunch of problems with the rest of the series so I never got round to sending it. I figured it did no harm in itself and makes things a little more consistent to userspace.