@@ -81,7 +81,7 @@ 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);
#endif
-void snd_jack_report(struct snd_jack *jack, int status);
+void snd_jack_report(struct snd_jack *jack, int status, bool sw_inject);
#else
static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
@@ -95,7 +95,7 @@ static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name
return 0;
}
-static inline void snd_jack_report(struct snd_jack *jack, int status)
+static inline void snd_jack_report(struct snd_jack *jack, int status, bool sw_inject)
{
}
@@ -336,8 +336,9 @@ EXPORT_SYMBOL(snd_jack_set_key);
*
* @jack: The jack to report status for
* @status: The current status of the jack
+ * @sw_inject: Indicate if this is called from jack software inject
*/
-void snd_jack_report(struct snd_jack *jack, int status)
+void snd_jack_report(struct snd_jack *jack, int status, bool sw_inject)
{
struct snd_jack_kctl *jack_kctl;
#ifdef CONFIG_SND_JACK_INPUT_DEV
@@ -414,10 +414,10 @@ void snd_hda_jack_report_sync(struct hda_codec *codec)
state = jack->button_state;
if (get_jack_plug_state(jack->pin_sense))
state |= jack->type;
- snd_jack_report(jack->jack, state);
+ snd_jack_report(jack->jack, state, false);
if (jack->button_state) {
snd_jack_report(jack->jack,
- state & ~jack->button_state);
+ state & ~jack->button_state, false);
jack->button_state = 0; /* button released */
}
}
@@ -503,7 +503,7 @@ int snd_hda_jack_add_kctl_mst(struct hda_codec *codec, hda_nid_t nid,
}
state = snd_hda_jack_detect_mst(codec, nid, dev_id);
- snd_jack_report(jack->jack, state ? jack->type : 0);
+ snd_jack_report(jack->jack, state ? jack->type : 0, false);
return 0;
}
@@ -1590,7 +1590,7 @@ static void update_eld(struct hda_codec *codec,
if (eld_changed && pcm_jack)
snd_jack_report(pcm_jack,
(eld->monitor_present && eld->eld_valid) ?
- SND_JACK_AVOUT : 0);
+ SND_JACK_AVOUT : 0, false);
}
/* update ELD and jack state via HD-audio verbs */
@@ -251,7 +251,7 @@ static void xonar_ds_handle_hp_jack(struct oxygen *chip)
reg |= WM8766_MUTEALL;
wm8766_write_cached(chip, WM8766_DAC_CTRL, reg);
- snd_jack_report(data->hp_jack, hp_plugged ? SND_JACK_HEADPHONE : 0);
+ snd_jack_report(data->hp_jack, hp_plugged ? SND_JACK_HEADPHONE : 0, false);
mutex_unlock(&chip->mutex);
}
@@ -78,7 +78,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
if (sync)
snd_soc_dapm_sync(dapm);
- snd_jack_report(jack->jack, jack->status);
+ snd_jack_report(jack->jack, jack->status, false);
mutex_unlock(&jack->mutex);
}
@@ -1363,7 +1363,7 @@ static void had_process_hot_plug(struct snd_intelhad *intelhaddata)
had_substream_put(intelhaddata);
}
- snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT);
+ snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT, false);
}
/* process hot unplug, called from wq with mutex locked */
@@ -1398,7 +1398,7 @@ static void had_process_hot_unplug(struct snd_intelhad *intelhaddata)
had_substream_put(intelhaddata);
}
- snd_jack_report(intelhaddata->jack, 0);
+ snd_jack_report(intelhaddata->jack, 0, false);
}
/*
This is the preparation for supporting jack software plug in/out injection, when users enable the software injection, the jack state shouldn't be changed by hw events or other non-injection events anymore, so adding a parameter in the snd_jack_report() to distinguish if the function is called from software injection or not. Signed-off-by: Hui Wang <hui.wang@canonical.com> --- include/sound/jack.h | 4 ++-- sound/core/jack.c | 3 ++- sound/pci/hda/hda_jack.c | 6 +++--- sound/pci/hda/patch_hdmi.c | 2 +- sound/pci/oxygen/xonar_wm87x6.c | 2 +- sound/soc/soc-jack.c | 2 +- sound/x86/intel_hdmi_audio.c | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-)