aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-10-27 16:12:46 -0400
committerTakashi Iwai <tiwai@suse.de>2011-11-16 05:11:15 -0500
commit1835a0f9a2121ce3198dab67507d4d3e960cc09e (patch)
tree5cbd9f34a3cb5d4906042c9fed5ab5fe2813123e /sound/pci/hda/patch_conexant.c
parent04f5ade6afc4326dc6cd10d235500972fba548eb (diff)
ALSA: hda - Cache the jack-detection value
Introduce a table containing the pins and their jack-detection states for avoiding the unnecessary verbs to check the pin status at each time. When the unsol event is enabled via snd_hda_jack_detect_enable(), it automatically adds the given NID to the table. Then the driver supposes that the codec driver will set the dirty flag appropariately when an unsolicited event is invoked for that pin. The behavior for reading other pins that aren't registered in the table doesn't change. Only the pins assigned to the table are cached, so far. In near futre, this table can be extended to use the central place for the unsolicited events of all pins, etc, and eventually include the jack-detect kcontrols that replace the current input-jack stuff. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 0de21193a2b0..220e567ccfff 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -31,6 +31,7 @@
31#include "hda_codec.h" 31#include "hda_codec.h"
32#include "hda_local.h" 32#include "hda_local.h"
33#include "hda_beep.h" 33#include "hda_beep.h"
34#include "hda_jack.h"
34 35
35#define CXT_PIN_DIR_IN 0x00 36#define CXT_PIN_DIR_IN 0x00
36#define CXT_PIN_DIR_OUT 0x01 37#define CXT_PIN_DIR_OUT 0x01
@@ -3756,6 +3757,7 @@ static void cx_auto_automic(struct hda_codec *codec)
3756static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) 3757static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
3757{ 3758{
3758 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; 3759 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20;
3760 snd_hda_jack_set_dirty(codec, nid);
3759 switch (res >> 26) { 3761 switch (res >> 26) {
3760 case CONEXANT_HP_EVENT: 3762 case CONEXANT_HP_EVENT:
3761 cx_auto_hp_automute(codec); 3763 cx_auto_hp_automute(codec);
@@ -3983,9 +3985,7 @@ static void enable_unsol_pins(struct hda_codec *codec, int num_pins,
3983{ 3985{
3984 int i; 3986 int i;
3985 for (i = 0; i < num_pins; i++) 3987 for (i = 0; i < num_pins; i++)
3986 snd_hda_codec_write(codec, pins[i], 0, 3988 snd_hda_jack_detect_enable(codec, pins[i], tag);
3987 AC_VERB_SET_UNSOLICITED_ENABLE,
3988 AC_USRSP_EN | tag);
3989} 3989}
3990 3990
3991static void cx_auto_init_output(struct hda_codec *codec) 3991static void cx_auto_init_output(struct hda_codec *codec)
@@ -4060,16 +4060,14 @@ static void cx_auto_init_input(struct hda_codec *codec)
4060 4060
4061 if (spec->auto_mic) { 4061 if (spec->auto_mic) {
4062 if (spec->auto_mic_ext >= 0) { 4062 if (spec->auto_mic_ext >= 0) {
4063 snd_hda_codec_write(codec, 4063 snd_hda_jack_detect_enable(codec,
4064 cfg->inputs[spec->auto_mic_ext].pin, 0, 4064 cfg->inputs[spec->auto_mic_ext].pin,
4065 AC_VERB_SET_UNSOLICITED_ENABLE, 4065 CONEXANT_MIC_EVENT);
4066 AC_USRSP_EN | CONEXANT_MIC_EVENT);
4067 } 4066 }
4068 if (spec->auto_mic_dock >= 0) { 4067 if (spec->auto_mic_dock >= 0) {
4069 snd_hda_codec_write(codec, 4068 snd_hda_jack_detect_enable(codec,
4070 cfg->inputs[spec->auto_mic_dock].pin, 0, 4069 cfg->inputs[spec->auto_mic_dock].pin,
4071 AC_VERB_SET_UNSOLICITED_ENABLE, 4070 CONEXANT_MIC_EVENT);
4072 AC_USRSP_EN | CONEXANT_MIC_EVENT);
4073 } 4071 }
4074 cx_auto_automic(codec); 4072 cx_auto_automic(codec);
4075 } else { 4073 } else {