Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: hda - Simplify phantom jack handling for HDMI/DP

The HDMI codec parser may create a phantom jack, but the helper
function snd_hda_jack_add_kctl() treats always as a normal jack. This
is superfluous as the jack query is executed at each time the jack
sync is performed.

Since the HDMI codec parser is the only caller of this function, it's
easier to change back this directly calling the original
__snd_hda_jack_add_kctl() with phantom_jack parameter.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+8 -19
+2 -16
sound/pci/hda/hda_jack.c
··· 383 383 * This assigns a jack-detection kctl to the given pin. The kcontrol 384 384 * will have the given name and index. 385 385 */ 386 - static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, 386 + int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, 387 387 const char *name, bool phantom_jack) 388 388 { 389 389 struct hda_jack_tbl *jack; ··· 409 409 snd_jack_report(jack->jack, state ? jack->type : 0); 410 410 411 411 return 0; 412 - } 413 - 414 - /** 415 - * snd_hda_jack_add_kctl - Add a jack kctl for the given pin 416 - * @codec: the HDA codec 417 - * @nid: pin NID 418 - * @name: the name string for the jack ctl 419 - * 420 - * This is a simple helper calling __snd_hda_jack_add_kctl(). 421 - */ 422 - int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, 423 - const char *name) 424 - { 425 - return __snd_hda_jack_add_kctl(codec, nid, name, false); 426 412 } 427 413 EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctl); 428 414 ··· 437 451 if (phantom_jack) 438 452 /* Example final name: "Internal Mic Phantom Jack" */ 439 453 strncat(name, " Phantom", sizeof(name) - strlen(name) - 1); 440 - err = __snd_hda_jack_add_kctl(codec, nid, name, phantom_jack); 454 + err = snd_hda_jack_add_kctl(codec, nid, name, phantom_jack); 441 455 if (err < 0) 442 456 return err; 443 457
+1 -1
sound/pci/hda/hda_jack.h
··· 82 82 bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid); 83 83 84 84 int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, 85 - const char *name); 85 + const char *name, bool phantom_jack); 86 86 int snd_hda_jack_add_kctls(struct hda_codec *codec, 87 87 const struct auto_pin_cfg *cfg); 88 88
+5 -2
sound/pci/hda/patch_hdmi.c
··· 2097 2097 struct hdmi_spec *spec = codec->spec; 2098 2098 struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); 2099 2099 int pcmdev = get_pcm_rec(spec, pin_idx)->device; 2100 + bool phantom_jack; 2100 2101 2101 2102 if (pcmdev > 0) 2102 2103 sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); 2103 - if (!is_jack_detectable(codec, per_pin->pin_nid)) 2104 + phantom_jack = !is_jack_detectable(codec, per_pin->pin_nid); 2105 + if (phantom_jack) 2104 2106 strncat(hdmi_str, " Phantom", 2105 2107 sizeof(hdmi_str) - strlen(hdmi_str) - 1); 2106 2108 2107 - return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str); 2109 + return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 2110 + phantom_jack); 2108 2111 } 2109 2112 2110 2113 static int generic_hdmi_build_controls(struct hda_codec *codec)