2019-05-21 01:08:11 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2011-10-28 04:12:46 +08:00
|
|
|
/*
|
|
|
|
* Jack-detection handling for HD-audio
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/slab.h>
|
2011-11-16 21:28:33 +08:00
|
|
|
#include <linux/export.h>
|
2011-10-28 04:12:46 +08:00
|
|
|
#include <sound/core.h>
|
2011-10-28 06:03:22 +08:00
|
|
|
#include <sound/control.h>
|
2011-11-02 15:54:51 +08:00
|
|
|
#include <sound/jack.h>
|
2018-08-23 04:24:57 +08:00
|
|
|
#include <sound/hda_codec.h>
|
2011-10-28 04:12:46 +08:00
|
|
|
#include "hda_local.h"
|
2012-05-07 23:42:31 +08:00
|
|
|
#include "hda_auto_parser.h"
|
2011-10-28 04:12:46 +08:00
|
|
|
#include "hda_jack.h"
|
|
|
|
|
2014-10-29 23:03:58 +08:00
|
|
|
/**
|
|
|
|
* is_jack_detectable - Check whether the given pin is jack-detectable
|
|
|
|
* @codec: the HDA codec
|
|
|
|
* @nid: pin NID
|
|
|
|
*
|
|
|
|
* Check whether the given pin is capable to report the jack detection.
|
|
|
|
* The jack detection might not work by various reasons, e.g. the jack
|
|
|
|
* detection is prohibited in the codec level, the pin config has
|
|
|
|
* AC_DEFCFG_MISC_NO_PRESENCE bit, no unsol support, etc.
|
|
|
|
*/
|
2012-02-13 18:41:42 +08:00
|
|
|
bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
|
|
|
|
{
|
2012-02-13 18:55:02 +08:00
|
|
|
if (codec->no_jack_detect)
|
|
|
|
return false;
|
2012-02-13 18:41:42 +08:00
|
|
|
if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT))
|
|
|
|
return false;
|
2012-09-07 13:25:44 +08:00
|
|
|
if (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
|
|
|
|
AC_DEFCFG_MISC_NO_PRESENCE)
|
2012-02-13 18:41:42 +08:00
|
|
|
return false;
|
2013-01-07 19:11:33 +08:00
|
|
|
if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) &&
|
|
|
|
!codec->jackpoll_interval)
|
2012-02-13 18:41:42 +08:00
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(is_jack_detectable);
|
2012-02-13 18:41:42 +08:00
|
|
|
|
2011-10-28 04:12:46 +08:00
|
|
|
/* execute pin sense measurement */
|
2019-11-19 16:47:08 +08:00
|
|
|
static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid, int dev_id)
|
2011-10-28 04:12:46 +08:00
|
|
|
{
|
|
|
|
u32 pincap;
|
2012-12-21 22:31:41 +08:00
|
|
|
u32 val;
|
2011-10-28 04:12:46 +08:00
|
|
|
|
|
|
|
if (!codec->no_trigger_sense) {
|
|
|
|
pincap = snd_hda_query_pin_caps(codec, nid);
|
|
|
|
if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
|
|
|
|
snd_hda_codec_read(codec, nid, 0,
|
|
|
|
AC_VERB_SET_PIN_SENSE, 0);
|
|
|
|
}
|
2012-12-21 22:31:41 +08:00
|
|
|
val = snd_hda_codec_read(codec, nid, 0,
|
2019-11-19 16:47:08 +08:00
|
|
|
AC_VERB_GET_PIN_SENSE, dev_id);
|
2012-12-21 22:31:41 +08:00
|
|
|
if (codec->inv_jack_detect)
|
|
|
|
val ^= AC_PINSENSE_PRESENCE;
|
|
|
|
return val;
|
2011-10-28 04:12:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-11-19 16:47:08 +08:00
|
|
|
* snd_hda_jack_tbl_get_mst - query the jack-table entry for the given NID
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @nid: pin NID to refer to
|
2019-11-19 16:47:08 +08:00
|
|
|
* @dev_id: pin device entry id
|
2011-10-28 04:12:46 +08:00
|
|
|
*/
|
|
|
|
struct hda_jack_tbl *
|
2019-11-19 16:47:08 +08:00
|
|
|
snd_hda_jack_tbl_get_mst(struct hda_codec *codec, hda_nid_t nid, int dev_id)
|
2011-10-28 04:12:46 +08:00
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jack = codec->jacktbl.list;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!nid || !jack)
|
|
|
|
return NULL;
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++)
|
2019-11-19 16:47:08 +08:00
|
|
|
if (jack->nid == nid && jack->dev_id == dev_id)
|
2011-10-28 04:12:46 +08:00
|
|
|
return jack;
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-11-19 16:47:08 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_mst);
|
2011-10-28 04:12:46 +08:00
|
|
|
|
2011-10-28 07:16:55 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @tag: tag value to refer to
|
2019-11-19 16:47:08 +08:00
|
|
|
* @dev_id: pin device entry id
|
2011-10-28 07:16:55 +08:00
|
|
|
*/
|
|
|
|
struct hda_jack_tbl *
|
2019-11-19 16:47:08 +08:00
|
|
|
snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec,
|
|
|
|
unsigned char tag, int dev_id)
|
2011-10-28 07:16:55 +08:00
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jack = codec->jacktbl.list;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!tag || !jack)
|
|
|
|
return NULL;
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++)
|
2019-11-19 16:47:08 +08:00
|
|
|
if (jack->tag == tag && jack->dev_id == dev_id)
|
2011-10-28 07:16:55 +08:00
|
|
|
return jack;
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_tbl_get_from_tag);
|
2011-10-28 07:16:55 +08:00
|
|
|
|
2019-11-19 16:47:08 +08:00
|
|
|
static struct hda_jack_tbl *
|
|
|
|
any_jack_tbl_get_from_nid(struct hda_codec *codec, hda_nid_t nid)
|
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jack = codec->jacktbl.list;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!nid || !jack)
|
|
|
|
return NULL;
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++)
|
|
|
|
if (jack->nid == nid)
|
|
|
|
return jack;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-28 04:12:46 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_tbl_new - create a jack-table entry for the given NID
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @nid: pin NID to assign
|
2020-01-14 05:14:04 +08:00
|
|
|
* @dev_id: pin device entry id
|
2011-10-28 04:12:46 +08:00
|
|
|
*/
|
2014-09-11 20:22:03 +08:00
|
|
|
static struct hda_jack_tbl *
|
2019-11-19 16:47:08 +08:00
|
|
|
snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid, int dev_id)
|
2011-10-28 04:12:46 +08:00
|
|
|
{
|
2019-11-19 16:47:08 +08:00
|
|
|
struct hda_jack_tbl *jack =
|
|
|
|
snd_hda_jack_tbl_get_mst(codec, nid, dev_id);
|
|
|
|
struct hda_jack_tbl *existing_nid_jack =
|
|
|
|
any_jack_tbl_get_from_nid(codec, nid);
|
|
|
|
|
|
|
|
WARN_ON(dev_id != 0 && !codec->dp_mst);
|
|
|
|
|
2011-10-28 04:12:46 +08:00
|
|
|
if (jack)
|
|
|
|
return jack;
|
|
|
|
jack = snd_array_new(&codec->jacktbl);
|
|
|
|
if (!jack)
|
|
|
|
return NULL;
|
|
|
|
jack->nid = nid;
|
2019-11-19 16:47:08 +08:00
|
|
|
jack->dev_id = dev_id;
|
2011-10-28 04:12:46 +08:00
|
|
|
jack->jack_dirty = 1;
|
2019-11-19 16:47:08 +08:00
|
|
|
if (existing_nid_jack) {
|
|
|
|
jack->tag = existing_nid_jack->tag;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy jack_detect from existing_nid_jack to avoid
|
|
|
|
* snd_hda_jack_detect_enable_callback_mst() making multiple
|
|
|
|
* SET_UNSOLICITED_ENABLE calls on the same pin.
|
|
|
|
*/
|
|
|
|
jack->jack_detect = existing_nid_jack->jack_detect;
|
|
|
|
} else {
|
|
|
|
jack->tag = codec->jacktbl.used;
|
|
|
|
}
|
|
|
|
|
2011-10-28 04:12:46 +08:00
|
|
|
return jack;
|
|
|
|
}
|
|
|
|
|
|
|
|
void snd_hda_jack_tbl_clear(struct hda_codec *codec)
|
|
|
|
{
|
2014-09-11 21:22:46 +08:00
|
|
|
struct hda_jack_tbl *jack = codec->jacktbl.list;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++) {
|
|
|
|
struct hda_jack_callback *cb, *next;
|
2015-04-27 21:20:59 +08:00
|
|
|
|
2014-09-11 21:22:46 +08:00
|
|
|
/* free jack instances manually when clearing/reconfiguring */
|
|
|
|
if (!codec->bus->shutdown && jack->jack)
|
2015-02-27 23:09:22 +08:00
|
|
|
snd_device_free(codec->card, jack->jack);
|
2015-04-27 21:20:59 +08:00
|
|
|
|
2014-09-11 21:22:46 +08:00
|
|
|
for (cb = jack->callback; cb; cb = next) {
|
|
|
|
next = cb->next;
|
|
|
|
kfree(cb);
|
2011-12-02 00:41:36 +08:00
|
|
|
}
|
|
|
|
}
|
2011-10-28 04:12:46 +08:00
|
|
|
snd_array_free(&codec->jacktbl);
|
|
|
|
}
|
|
|
|
|
2012-11-20 02:48:07 +08:00
|
|
|
#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
|
|
|
|
|
2011-10-28 04:12:46 +08:00
|
|
|
/* update the cached value and notification flag if needed */
|
|
|
|
static void jack_detect_update(struct hda_codec *codec,
|
|
|
|
struct hda_jack_tbl *jack)
|
|
|
|
{
|
2012-06-04 15:33:51 +08:00
|
|
|
if (!jack->jack_dirty)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (jack->phantom_jack)
|
|
|
|
jack->pin_sense = AC_PINSENSE_PRESENCE;
|
|
|
|
else
|
2019-11-19 16:47:08 +08:00
|
|
|
jack->pin_sense = read_pin_sense(codec, jack->nid,
|
|
|
|
jack->dev_id);
|
2012-06-04 15:33:51 +08:00
|
|
|
|
2012-11-20 02:48:07 +08:00
|
|
|
/* A gating jack indicates the jack is invalid if gating is unplugged */
|
2019-11-19 16:47:08 +08:00
|
|
|
if (jack->gating_jack &&
|
|
|
|
!snd_hda_jack_detect_mst(codec, jack->gating_jack, jack->dev_id))
|
2012-11-20 02:48:07 +08:00
|
|
|
jack->pin_sense &= ~AC_PINSENSE_PRESENCE;
|
|
|
|
|
2012-06-04 15:33:51 +08:00
|
|
|
jack->jack_dirty = 0;
|
2012-11-20 02:48:07 +08:00
|
|
|
|
|
|
|
/* If a jack is gated by this one update it. */
|
|
|
|
if (jack->gated_jack) {
|
|
|
|
struct hda_jack_tbl *gated =
|
2019-11-19 16:47:08 +08:00
|
|
|
snd_hda_jack_tbl_get_mst(codec, jack->gated_jack,
|
|
|
|
jack->dev_id);
|
2012-11-20 02:48:07 +08:00
|
|
|
if (gated) {
|
|
|
|
gated->jack_dirty = 1;
|
|
|
|
jack_detect_update(codec, gated);
|
|
|
|
}
|
|
|
|
}
|
2011-10-28 04:12:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_hda_set_dirty_all - Mark all the cached as dirty
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
2011-10-28 04:12:46 +08:00
|
|
|
*
|
|
|
|
* This function sets the dirty flag to all entries of jack table.
|
|
|
|
* It's called from the resume path in hda_codec.c.
|
|
|
|
*/
|
|
|
|
void snd_hda_jack_set_dirty_all(struct hda_codec *codec)
|
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jack = codec->jacktbl.list;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++)
|
|
|
|
if (jack->nid)
|
|
|
|
jack->jack_dirty = 1;
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_set_dirty_all);
|
2011-10-28 04:12:46 +08:00
|
|
|
|
|
|
|
/**
|
2019-11-19 16:47:07 +08:00
|
|
|
* snd_hda_jack_pin_sense - execute pin sense measurement
|
2011-10-28 04:12:46 +08:00
|
|
|
* @codec: the CODEC to sense
|
|
|
|
* @nid: the pin NID to sense
|
2020-01-14 05:14:04 +08:00
|
|
|
* @dev_id: pin device entry id
|
2011-10-28 04:12:46 +08:00
|
|
|
*
|
|
|
|
* Execute necessary pin sense measurement and return its Presence Detect,
|
|
|
|
* Impedance, ELD Valid etc. status bits.
|
|
|
|
*/
|
2019-11-19 16:47:08 +08:00
|
|
|
u32 snd_hda_jack_pin_sense(struct hda_codec *codec, hda_nid_t nid, int dev_id)
|
2011-10-28 04:12:46 +08:00
|
|
|
{
|
2019-11-19 16:47:08 +08:00
|
|
|
struct hda_jack_tbl *jack =
|
|
|
|
snd_hda_jack_tbl_get_mst(codec, nid, dev_id);
|
2011-10-28 04:12:46 +08:00
|
|
|
if (jack) {
|
|
|
|
jack_detect_update(codec, jack);
|
|
|
|
return jack->pin_sense;
|
|
|
|
}
|
2019-11-19 16:47:08 +08:00
|
|
|
return read_pin_sense(codec, nid, dev_id);
|
2011-10-28 04:12:46 +08:00
|
|
|
}
|
2019-11-19 16:47:07 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_pin_sense);
|
2011-10-28 04:12:46 +08:00
|
|
|
|
|
|
|
/**
|
2019-11-19 16:47:08 +08:00
|
|
|
* snd_hda_jack_detect_state_mst - query pin Presence Detect status
|
2011-10-28 04:12:46 +08:00
|
|
|
* @codec: the CODEC to sense
|
|
|
|
* @nid: the pin NID to sense
|
2019-11-19 16:47:08 +08:00
|
|
|
* @dev_id: pin device entry id
|
2011-10-28 04:12:46 +08:00
|
|
|
*
|
ALSA: hda - Add snd_hda_jack_detect_state() helper function
snd_hda_jack_detect() function returns a boolean value for a jack
plugged in or not, but it also returns always true when the
corresponding pin is phantom (i.e. fixed). This is OK in most cases,
but it makes the generic parser misbehaving about the auto-mute or
auto-mic switching, e.g. when one of headphone pins is a fixed.
Namely, the driver decides whether to mute the speaker or not, just
depending on the headphone plug state: if one of the headphone jacks
is seen as active, then the speaker is muted. Thus this will result
always in the muted speaker output.
So, the problem is the function returns a boolean, after all, although
we need to think of "phantom" jack. Now a new function,
snd_hda_jack_detect_state() is introduced to return these tristates.
The generic parser uses this function for checking the headphone or
mic jack states.
Meanwhile, the behavior of snd_hda_jack_detect() is kept as is, for
keeping compatibility in other driver codes.
Acked-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-19 22:59:46 +08:00
|
|
|
* Query and return the pin's Presence Detect status, as either
|
|
|
|
* HDA_JACK_NOT_PRESENT, HDA_JACK_PRESENT or HDA_JACK_PHANTOM.
|
2011-10-28 04:12:46 +08:00
|
|
|
*/
|
2019-11-19 16:47:08 +08:00
|
|
|
int snd_hda_jack_detect_state_mst(struct hda_codec *codec,
|
|
|
|
hda_nid_t nid, int dev_id)
|
2011-10-28 04:12:46 +08:00
|
|
|
{
|
2019-11-19 16:47:08 +08:00
|
|
|
struct hda_jack_tbl *jack =
|
|
|
|
snd_hda_jack_tbl_get_mst(codec, nid, dev_id);
|
ALSA: hda - Add snd_hda_jack_detect_state() helper function
snd_hda_jack_detect() function returns a boolean value for a jack
plugged in or not, but it also returns always true when the
corresponding pin is phantom (i.e. fixed). This is OK in most cases,
but it makes the generic parser misbehaving about the auto-mute or
auto-mic switching, e.g. when one of headphone pins is a fixed.
Namely, the driver decides whether to mute the speaker or not, just
depending on the headphone plug state: if one of the headphone jacks
is seen as active, then the speaker is muted. Thus this will result
always in the muted speaker output.
So, the problem is the function returns a boolean, after all, although
we need to think of "phantom" jack. Now a new function,
snd_hda_jack_detect_state() is introduced to return these tristates.
The generic parser uses this function for checking the headphone or
mic jack states.
Meanwhile, the behavior of snd_hda_jack_detect() is kept as is, for
keeping compatibility in other driver codes.
Acked-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-19 22:59:46 +08:00
|
|
|
if (jack && jack->phantom_jack)
|
|
|
|
return HDA_JACK_PHANTOM;
|
2019-11-19 16:47:08 +08:00
|
|
|
else if (snd_hda_jack_pin_sense(codec, nid, dev_id) &
|
|
|
|
AC_PINSENSE_PRESENCE)
|
ALSA: hda - Add snd_hda_jack_detect_state() helper function
snd_hda_jack_detect() function returns a boolean value for a jack
plugged in or not, but it also returns always true when the
corresponding pin is phantom (i.e. fixed). This is OK in most cases,
but it makes the generic parser misbehaving about the auto-mute or
auto-mic switching, e.g. when one of headphone pins is a fixed.
Namely, the driver decides whether to mute the speaker or not, just
depending on the headphone plug state: if one of the headphone jacks
is seen as active, then the speaker is muted. Thus this will result
always in the muted speaker output.
So, the problem is the function returns a boolean, after all, although
we need to think of "phantom" jack. Now a new function,
snd_hda_jack_detect_state() is introduced to return these tristates.
The generic parser uses this function for checking the headphone or
mic jack states.
Meanwhile, the behavior of snd_hda_jack_detect() is kept as is, for
keeping compatibility in other driver codes.
Acked-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-07-19 22:59:46 +08:00
|
|
|
return HDA_JACK_PRESENT;
|
|
|
|
else
|
|
|
|
return HDA_JACK_NOT_PRESENT;
|
2011-10-28 04:12:46 +08:00
|
|
|
}
|
2019-11-19 16:47:08 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_state_mst);
|
2011-10-28 04:12:46 +08:00
|
|
|
|
|
|
|
/**
|
2019-11-19 16:47:08 +08:00
|
|
|
* snd_hda_jack_detect_enable_mst - enable the jack-detection
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @nid: pin NID to enable
|
|
|
|
* @func: callback function to register
|
2019-11-19 16:47:08 +08:00
|
|
|
* @dev_id: pin device entry id
|
2014-09-11 20:39:09 +08:00
|
|
|
*
|
|
|
|
* In the case of error, the return value will be a pointer embedded with
|
|
|
|
* errno. Check and handle the return value appropriately with standard
|
|
|
|
* macros such as @IS_ERR() and @PTR_ERR().
|
2011-10-28 04:12:46 +08:00
|
|
|
*/
|
2014-09-11 21:22:46 +08:00
|
|
|
struct hda_jack_callback *
|
2019-11-19 16:47:08 +08:00
|
|
|
snd_hda_jack_detect_enable_callback_mst(struct hda_codec *codec, hda_nid_t nid,
|
|
|
|
int dev_id, hda_jack_callback_fn func)
|
2011-10-28 04:12:46 +08:00
|
|
|
{
|
2014-09-11 21:22:46 +08:00
|
|
|
struct hda_jack_tbl *jack;
|
|
|
|
struct hda_jack_callback *callback = NULL;
|
2014-09-11 20:39:09 +08:00
|
|
|
int err;
|
|
|
|
|
2019-11-19 16:47:08 +08:00
|
|
|
jack = snd_hda_jack_tbl_new(codec, nid, dev_id);
|
2011-10-28 04:12:46 +08:00
|
|
|
if (!jack)
|
2014-09-11 20:39:09 +08:00
|
|
|
return ERR_PTR(-ENOMEM);
|
2014-09-11 21:22:46 +08:00
|
|
|
if (func) {
|
|
|
|
callback = kzalloc(sizeof(*callback), GFP_KERNEL);
|
|
|
|
if (!callback)
|
|
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
callback->func = func;
|
2016-02-09 17:23:52 +08:00
|
|
|
callback->nid = jack->nid;
|
2019-11-19 16:47:08 +08:00
|
|
|
callback->dev_id = jack->dev_id;
|
2014-09-11 21:22:46 +08:00
|
|
|
callback->next = jack->callback;
|
|
|
|
jack->callback = callback;
|
|
|
|
}
|
|
|
|
|
2011-10-28 07:16:55 +08:00
|
|
|
if (jack->jack_detect)
|
2014-09-11 21:22:46 +08:00
|
|
|
return callback; /* already registered */
|
2011-10-28 07:16:55 +08:00
|
|
|
jack->jack_detect = 1;
|
2012-10-17 20:45:05 +08:00
|
|
|
if (codec->jackpoll_interval > 0)
|
2014-09-11 21:22:46 +08:00
|
|
|
return callback; /* No unsol if we're polling instead */
|
2014-09-11 20:39:09 +08:00
|
|
|
err = snd_hda_codec_write_cache(codec, nid, 0,
|
2011-10-28 04:12:46 +08:00
|
|
|
AC_VERB_SET_UNSOLICITED_ENABLE,
|
2011-10-28 07:16:55 +08:00
|
|
|
AC_USRSP_EN | jack->tag);
|
2014-09-11 20:39:09 +08:00
|
|
|
if (err < 0)
|
|
|
|
return ERR_PTR(err);
|
2014-09-11 21:22:46 +08:00
|
|
|
return callback;
|
2011-10-28 04:12:46 +08:00
|
|
|
}
|
2019-11-19 16:47:08 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable_callback_mst);
|
2012-09-25 17:30:59 +08:00
|
|
|
|
2014-10-29 23:03:58 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_detect_enable - Enable the jack detection on the given pin
|
|
|
|
* @codec: the HDA codec
|
|
|
|
* @nid: pin NID to enable jack detection
|
2019-11-19 16:47:08 +08:00
|
|
|
* @dev_id: pin device entry id
|
2014-10-29 23:03:58 +08:00
|
|
|
*
|
|
|
|
* Enable the jack detection with the default callback. Returns zero if
|
|
|
|
* successful or a negative error code.
|
|
|
|
*/
|
2019-11-19 16:47:08 +08:00
|
|
|
int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid,
|
|
|
|
int dev_id)
|
2012-09-25 17:30:59 +08:00
|
|
|
{
|
2019-11-19 16:47:08 +08:00
|
|
|
return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback_mst(codec,
|
|
|
|
nid,
|
|
|
|
dev_id,
|
|
|
|
NULL));
|
2012-09-25 17:30:59 +08:00
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_detect_enable);
|
2011-10-28 06:03:22 +08:00
|
|
|
|
2012-11-20 02:48:07 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_set_gating_jack - Set gating jack.
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @gated_nid: gated pin NID
|
|
|
|
* @gating_nid: gating pin NID
|
2012-11-20 02:48:07 +08:00
|
|
|
*
|
|
|
|
* Indicates the gated jack is only valid when the gating jack is plugged.
|
|
|
|
*/
|
|
|
|
int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid,
|
|
|
|
hda_nid_t gating_nid)
|
|
|
|
{
|
2019-11-19 16:47:08 +08:00
|
|
|
struct hda_jack_tbl *gated = snd_hda_jack_tbl_new(codec, gated_nid, 0);
|
|
|
|
struct hda_jack_tbl *gating =
|
|
|
|
snd_hda_jack_tbl_new(codec, gating_nid, 0);
|
|
|
|
|
|
|
|
WARN_ON(codec->dp_mst);
|
2012-11-20 02:48:07 +08:00
|
|
|
|
|
|
|
if (!gated || !gating)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
gated->gating_jack = gating_nid;
|
|
|
|
gating->gated_jack = gated_nid;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_set_gating_jack);
|
2012-11-20 02:48:07 +08:00
|
|
|
|
2011-10-28 06:03:22 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_report_sync - sync the states of all jacks and report if changed
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
2011-10-28 06:03:22 +08:00
|
|
|
*/
|
|
|
|
void snd_hda_jack_report_sync(struct hda_codec *codec)
|
|
|
|
{
|
2012-11-20 02:48:07 +08:00
|
|
|
struct hda_jack_tbl *jack;
|
2011-11-02 15:36:06 +08:00
|
|
|
int i, state;
|
2011-10-28 06:03:22 +08:00
|
|
|
|
2012-11-20 02:48:07 +08:00
|
|
|
/* update all jacks at first */
|
|
|
|
jack = codec->jacktbl.list;
|
2011-10-28 06:03:22 +08:00
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++)
|
2012-11-20 02:48:07 +08:00
|
|
|
if (jack->nid)
|
2011-10-28 06:03:22 +08:00
|
|
|
jack_detect_update(codec, jack);
|
2012-11-20 02:48:07 +08:00
|
|
|
|
|
|
|
/* report the updated jacks; it's done after updating all jacks
|
|
|
|
* to make sure that all gating jacks properly have been set
|
|
|
|
*/
|
|
|
|
jack = codec->jacktbl.list;
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++)
|
|
|
|
if (jack->nid) {
|
2015-04-27 21:20:59 +08:00
|
|
|
if (!jack->jack || jack->block_report)
|
2011-11-12 00:53:03 +08:00
|
|
|
continue;
|
2018-11-28 21:25:37 +08:00
|
|
|
state = jack->button_state;
|
|
|
|
if (get_jack_plug_state(jack->pin_sense))
|
|
|
|
state |= jack->type;
|
|
|
|
snd_jack_report(jack->jack, state);
|
|
|
|
if (jack->button_state) {
|
|
|
|
snd_jack_report(jack->jack,
|
|
|
|
state & ~jack->button_state);
|
|
|
|
jack->button_state = 0; /* button released */
|
|
|
|
}
|
2011-10-28 06:03:22 +08:00
|
|
|
}
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_report_sync);
|
2011-10-28 06:03:22 +08:00
|
|
|
|
2011-12-02 00:41:36 +08:00
|
|
|
/* guess the jack type from the pin-config */
|
|
|
|
static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
|
|
|
|
{
|
|
|
|
unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
|
|
|
|
switch (get_defcfg_device(def_conf)) {
|
|
|
|
case AC_JACK_LINE_OUT:
|
|
|
|
case AC_JACK_SPEAKER:
|
|
|
|
return SND_JACK_LINEOUT;
|
|
|
|
case AC_JACK_HP_OUT:
|
|
|
|
return SND_JACK_HEADPHONE;
|
|
|
|
case AC_JACK_SPDIF_OUT:
|
|
|
|
case AC_JACK_DIG_OTHER_OUT:
|
|
|
|
return SND_JACK_AVOUT;
|
|
|
|
case AC_JACK_MIC_IN:
|
|
|
|
return SND_JACK_MICROPHONE;
|
|
|
|
default:
|
|
|
|
return SND_JACK_LINEIN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void hda_free_jack_priv(struct snd_jack *jack)
|
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jacks = jack->private_data;
|
|
|
|
jacks->nid = 0;
|
|
|
|
jacks->jack = NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-28 06:03:22 +08:00
|
|
|
/**
|
2019-11-19 16:47:08 +08:00
|
|
|
* snd_hda_jack_add_kctl_mst - Add a kctl for the given pin
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @nid: pin NID to assign
|
2019-11-19 16:47:08 +08:00
|
|
|
* @dev_id : pin device entry id
|
2014-10-29 22:06:01 +08:00
|
|
|
* @name: string name for the jack
|
|
|
|
* @phantom_jack: flag to deal as a phantom jack
|
2018-11-28 21:25:37 +08:00
|
|
|
* @type: jack type bits to be reported, 0 for guessing from pincfg
|
|
|
|
* @keymap: optional jack / key mapping
|
2011-10-28 06:03:22 +08:00
|
|
|
*
|
|
|
|
* This assigns a jack-detection kctl to the given pin. The kcontrol
|
|
|
|
* will have the given name and index.
|
|
|
|
*/
|
2019-11-19 16:47:08 +08:00
|
|
|
int snd_hda_jack_add_kctl_mst(struct hda_codec *codec, hda_nid_t nid,
|
|
|
|
int dev_id, const char *name, bool phantom_jack,
|
|
|
|
int type, const struct hda_jack_keymap *keymap)
|
2011-10-28 06:03:22 +08:00
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jack;
|
2018-11-28 21:25:37 +08:00
|
|
|
const struct hda_jack_keymap *map;
|
|
|
|
int err, state, buttons;
|
2011-10-28 06:03:22 +08:00
|
|
|
|
2019-11-19 16:47:08 +08:00
|
|
|
jack = snd_hda_jack_tbl_new(codec, nid, dev_id);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (!jack)
|
|
|
|
return 0;
|
2015-04-27 21:20:59 +08:00
|
|
|
if (jack->jack)
|
2011-10-28 06:03:22 +08:00
|
|
|
return 0; /* already created */
|
2015-04-27 21:20:59 +08:00
|
|
|
|
2018-11-28 21:25:37 +08:00
|
|
|
if (!type)
|
|
|
|
type = get_input_jack_type(codec, nid);
|
|
|
|
|
|
|
|
buttons = 0;
|
|
|
|
if (keymap) {
|
|
|
|
for (map = keymap; map->type; map++)
|
|
|
|
buttons |= map->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = snd_jack_new(codec->card, name, type | buttons,
|
2015-04-27 21:20:59 +08:00
|
|
|
&jack->jack, true, phantom_jack);
|
2011-12-02 00:41:36 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2012-06-04 15:33:51 +08:00
|
|
|
|
2015-04-27 21:20:59 +08:00
|
|
|
jack->phantom_jack = !!phantom_jack;
|
|
|
|
jack->type = type;
|
2018-11-28 21:25:37 +08:00
|
|
|
jack->button_state = 0;
|
2015-04-27 21:20:59 +08:00
|
|
|
jack->jack->private_data = jack;
|
|
|
|
jack->jack->private_free = hda_free_jack_priv;
|
2018-11-28 21:25:37 +08:00
|
|
|
if (keymap) {
|
|
|
|
for (map = keymap; map->type; map++)
|
|
|
|
snd_jack_set_key(jack->jack, map->type, map->key);
|
|
|
|
}
|
|
|
|
|
2019-11-19 16:47:08 +08:00
|
|
|
state = snd_hda_jack_detect_mst(codec, nid, dev_id);
|
2015-04-27 21:20:59 +08:00
|
|
|
snd_jack_report(jack->jack, state ? jack->type : 0);
|
|
|
|
|
2011-10-28 06:03:22 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2019-11-19 16:47:08 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctl_mst);
|
2011-10-28 06:03:22 +08:00
|
|
|
|
2011-11-16 22:33:26 +08:00
|
|
|
static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
|
2013-04-11 17:30:30 +08:00
|
|
|
const struct auto_pin_cfg *cfg,
|
|
|
|
const char *base_name)
|
2011-10-28 06:03:22 +08:00
|
|
|
{
|
2011-10-28 07:16:55 +08:00
|
|
|
unsigned int def_conf, conn;
|
2013-06-28 17:56:49 +08:00
|
|
|
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
|
2015-04-27 21:20:59 +08:00
|
|
|
int err;
|
2012-06-04 15:33:51 +08:00
|
|
|
bool phantom_jack;
|
2011-10-28 07:16:55 +08:00
|
|
|
|
2019-11-19 16:47:08 +08:00
|
|
|
WARN_ON(codec->dp_mst);
|
|
|
|
|
2011-10-28 06:03:22 +08:00
|
|
|
if (!nid)
|
|
|
|
return 0;
|
2011-10-28 07:16:55 +08:00
|
|
|
def_conf = snd_hda_codec_get_pincfg(codec, nid);
|
|
|
|
conn = get_defcfg_connect(def_conf);
|
2012-06-04 15:33:51 +08:00
|
|
|
if (conn == AC_JACK_PORT_NONE)
|
2011-10-28 07:16:55 +08:00
|
|
|
return 0;
|
2012-06-04 15:33:51 +08:00
|
|
|
phantom_jack = (conn != AC_JACK_PORT_COMPLEX) ||
|
|
|
|
!is_jack_detectable(codec, nid);
|
2011-10-28 07:16:55 +08:00
|
|
|
|
2015-04-27 21:20:59 +08:00
|
|
|
if (base_name)
|
2013-04-11 17:30:30 +08:00
|
|
|
strlcpy(name, base_name, sizeof(name));
|
2015-04-27 21:20:59 +08:00
|
|
|
else
|
|
|
|
snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), NULL);
|
2012-06-04 15:33:51 +08:00
|
|
|
if (phantom_jack)
|
|
|
|
/* Example final name: "Internal Mic Phantom Jack" */
|
|
|
|
strncat(name, " Phantom", sizeof(name) - strlen(name) - 1);
|
2018-11-28 21:25:37 +08:00
|
|
|
err = snd_hda_jack_add_kctl(codec, nid, name, phantom_jack, 0, NULL);
|
2011-10-28 07:16:55 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2012-06-04 15:33:51 +08:00
|
|
|
|
|
|
|
if (!phantom_jack)
|
2019-11-19 16:47:08 +08:00
|
|
|
return snd_hda_jack_detect_enable(codec, nid, 0);
|
2012-06-04 15:33:51 +08:00
|
|
|
return 0;
|
2011-10-28 06:03:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg
|
2014-10-29 22:06:01 +08:00
|
|
|
* @codec: the HDA codec
|
|
|
|
* @cfg: pin config table to parse
|
2011-10-28 06:03:22 +08:00
|
|
|
*/
|
|
|
|
int snd_hda_jack_add_kctls(struct hda_codec *codec,
|
|
|
|
const struct auto_pin_cfg *cfg)
|
|
|
|
{
|
|
|
|
const hda_nid_t *p;
|
2012-07-17 22:48:27 +08:00
|
|
|
int i, err;
|
2011-10-28 06:03:22 +08:00
|
|
|
|
2013-04-11 17:30:30 +08:00
|
|
|
for (i = 0; i < cfg->num_inputs; i++) {
|
|
|
|
/* If we have headphone mics; make sure they get the right name
|
|
|
|
before grabbed by output pins */
|
|
|
|
if (cfg->inputs[i].is_headphone_mic) {
|
|
|
|
if (auto_cfg_hp_outs(cfg) == 1)
|
|
|
|
err = add_jack_kctl(codec, auto_cfg_hp_pins(cfg)[0],
|
|
|
|
cfg, "Headphone Mic");
|
|
|
|
else
|
|
|
|
err = add_jack_kctl(codec, cfg->inputs[i].pin,
|
|
|
|
cfg, "Headphone Mic");
|
|
|
|
} else
|
|
|
|
err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg,
|
|
|
|
NULL);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2011-10-28 06:03:22 +08:00
|
|
|
for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) {
|
2013-04-11 17:30:30 +08:00
|
|
|
err = add_jack_kctl(codec, *p, cfg, NULL);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) {
|
|
|
|
if (*p == *cfg->line_out_pins) /* might be duplicated */
|
|
|
|
break;
|
2013-04-11 17:30:30 +08:00
|
|
|
err = add_jack_kctl(codec, *p, cfg, NULL);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) {
|
|
|
|
if (*p == *cfg->line_out_pins) /* might be duplicated */
|
|
|
|
break;
|
2013-04-11 17:30:30 +08:00
|
|
|
err = add_jack_kctl(codec, *p, cfg, NULL);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) {
|
2013-04-11 17:30:30 +08:00
|
|
|
err = add_jack_kctl(codec, *p, cfg, NULL);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
}
|
2013-04-11 17:30:30 +08:00
|
|
|
err = add_jack_kctl(codec, cfg->dig_in_pin, cfg, NULL);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2013-04-11 17:30:30 +08:00
|
|
|
err = add_jack_kctl(codec, cfg->mono_out_pin, cfg, NULL);
|
2011-10-28 06:03:22 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
return 0;
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_add_kctls);
|
2012-09-25 17:30:59 +08:00
|
|
|
|
2018-11-28 21:17:58 +08:00
|
|
|
static void call_jack_callback(struct hda_codec *codec, unsigned int res,
|
2012-11-20 02:48:07 +08:00
|
|
|
struct hda_jack_tbl *jack)
|
|
|
|
{
|
2014-09-11 21:22:46 +08:00
|
|
|
struct hda_jack_callback *cb;
|
|
|
|
|
2018-11-28 21:17:58 +08:00
|
|
|
for (cb = jack->callback; cb; cb = cb->next) {
|
|
|
|
cb->jack = jack;
|
|
|
|
cb->unsol_res = res;
|
2014-09-11 21:22:46 +08:00
|
|
|
cb->func(codec, cb);
|
2018-11-28 21:17:58 +08:00
|
|
|
}
|
2012-11-20 02:48:07 +08:00
|
|
|
if (jack->gated_jack) {
|
|
|
|
struct hda_jack_tbl *gated =
|
2019-11-19 16:47:08 +08:00
|
|
|
snd_hda_jack_tbl_get_mst(codec, jack->gated_jack,
|
|
|
|
jack->dev_id);
|
2014-09-11 21:22:46 +08:00
|
|
|
if (gated) {
|
2018-11-28 21:17:58 +08:00
|
|
|
for (cb = gated->callback; cb; cb = cb->next) {
|
|
|
|
cb->jack = gated;
|
|
|
|
cb->unsol_res = res;
|
2014-09-11 21:22:46 +08:00
|
|
|
cb->func(codec, cb);
|
2018-11-28 21:17:58 +08:00
|
|
|
}
|
2014-09-11 21:22:46 +08:00
|
|
|
}
|
2012-11-20 02:48:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-29 23:03:58 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_unsol_event - Handle an unsolicited event
|
|
|
|
* @codec: the HDA codec
|
|
|
|
* @res: the unsolicited event data
|
|
|
|
*/
|
2012-09-25 17:30:59 +08:00
|
|
|
void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
|
|
|
|
{
|
|
|
|
struct hda_jack_tbl *event;
|
2019-06-12 01:09:07 +08:00
|
|
|
int tag = (res & AC_UNSOL_RES_TAG) >> AC_UNSOL_RES_TAG_SHIFT;
|
2012-09-25 17:30:59 +08:00
|
|
|
|
2019-11-19 16:47:08 +08:00
|
|
|
if (codec->dp_mst) {
|
|
|
|
int dev_entry =
|
|
|
|
(res & AC_UNSOL_RES_DE) >> AC_UNSOL_RES_DE_SHIFT;
|
|
|
|
|
|
|
|
event = snd_hda_jack_tbl_get_from_tag(codec, tag, dev_entry);
|
|
|
|
} else {
|
|
|
|
event = snd_hda_jack_tbl_get_from_tag(codec, tag, 0);
|
|
|
|
}
|
2012-09-25 17:30:59 +08:00
|
|
|
if (!event)
|
|
|
|
return;
|
|
|
|
event->jack_dirty = 1;
|
|
|
|
|
2018-11-28 21:17:58 +08:00
|
|
|
call_jack_callback(codec, res, event);
|
2012-09-25 17:30:59 +08:00
|
|
|
snd_hda_jack_report_sync(codec);
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_unsol_event);
|
2012-09-25 17:30:59 +08:00
|
|
|
|
2014-10-29 23:03:58 +08:00
|
|
|
/**
|
|
|
|
* snd_hda_jack_poll_all - Poll all jacks
|
|
|
|
* @codec: the HDA codec
|
|
|
|
*
|
|
|
|
* Poll all detectable jacks with dirty flag, update the status, call
|
|
|
|
* callbacks and call snd_hda_jack_report_sync() if any changes are found.
|
|
|
|
*/
|
2012-10-09 21:04:21 +08:00
|
|
|
void snd_hda_jack_poll_all(struct hda_codec *codec)
|
|
|
|
{
|
|
|
|
struct hda_jack_tbl *jack = codec->jacktbl.list;
|
|
|
|
int i, changes = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < codec->jacktbl.used; i++, jack++) {
|
|
|
|
unsigned int old_sense;
|
|
|
|
if (!jack->nid || !jack->jack_dirty || jack->phantom_jack)
|
|
|
|
continue;
|
|
|
|
old_sense = get_jack_plug_state(jack->pin_sense);
|
|
|
|
jack_detect_update(codec, jack);
|
|
|
|
if (old_sense == get_jack_plug_state(jack->pin_sense))
|
|
|
|
continue;
|
|
|
|
changes = 1;
|
2018-11-28 21:17:58 +08:00
|
|
|
call_jack_callback(codec, 0, jack);
|
2012-10-09 21:04:21 +08:00
|
|
|
}
|
|
|
|
if (changes)
|
|
|
|
snd_hda_jack_report_sync(codec);
|
|
|
|
}
|
2013-12-18 14:45:52 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_hda_jack_poll_all);
|
2012-10-09 21:04:21 +08:00
|
|
|
|