diff options
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 85 |
1 files changed, 5 insertions, 80 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index bd7b123f6440..8fe5608c5f29 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -180,12 +180,6 @@ struct sigmatel_event { | |||
180 | int data; | 180 | int data; |
181 | }; | 181 | }; |
182 | 182 | ||
183 | struct sigmatel_jack { | ||
184 | hda_nid_t nid; | ||
185 | int type; | ||
186 | struct snd_jack *jack; | ||
187 | }; | ||
188 | |||
189 | struct sigmatel_mic_route { | 183 | struct sigmatel_mic_route { |
190 | hda_nid_t pin; | 184 | hda_nid_t pin; |
191 | signed char mux_idx; | 185 | signed char mux_idx; |
@@ -229,9 +223,6 @@ struct sigmatel_spec { | |||
229 | hda_nid_t *pwr_nids; | 223 | hda_nid_t *pwr_nids; |
230 | hda_nid_t *dac_list; | 224 | hda_nid_t *dac_list; |
231 | 225 | ||
232 | /* jack detection */ | ||
233 | struct snd_array jacks; | ||
234 | |||
235 | /* events */ | 226 | /* events */ |
236 | struct snd_array events; | 227 | struct snd_array events; |
237 | 228 | ||
@@ -4054,21 +4045,10 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, | |||
4054 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ | 4045 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
4055 | } | 4046 | } |
4056 | 4047 | ||
4057 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
4058 | static void stac92xx_free_jack_priv(struct snd_jack *jack) | ||
4059 | { | ||
4060 | struct sigmatel_jack *jacks = jack->private_data; | ||
4061 | jacks->nid = 0; | ||
4062 | jacks->jack = NULL; | ||
4063 | } | ||
4064 | #endif | ||
4065 | |||
4066 | static int stac92xx_add_jack(struct hda_codec *codec, | 4048 | static int stac92xx_add_jack(struct hda_codec *codec, |
4067 | hda_nid_t nid, int type) | 4049 | hda_nid_t nid, int type) |
4068 | { | 4050 | { |
4069 | #ifdef CONFIG_SND_HDA_INPUT_JACK | 4051 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
4070 | struct sigmatel_spec *spec = codec->spec; | ||
4071 | struct sigmatel_jack *jack; | ||
4072 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); | 4052 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
4073 | int connectivity = get_defcfg_connect(def_conf); | 4053 | int connectivity = get_defcfg_connect(def_conf); |
4074 | char name[32]; | 4054 | char name[32]; |
@@ -4077,26 +4057,15 @@ static int stac92xx_add_jack(struct hda_codec *codec, | |||
4077 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) | 4057 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) |
4078 | return 0; | 4058 | return 0; |
4079 | 4059 | ||
4080 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | ||
4081 | jack = snd_array_new(&spec->jacks); | ||
4082 | if (!jack) | ||
4083 | return -ENOMEM; | ||
4084 | jack->nid = nid; | ||
4085 | jack->type = type; | ||
4086 | |||
4087 | snprintf(name, sizeof(name), "%s at %s %s Jack", | 4060 | snprintf(name, sizeof(name), "%s at %s %s Jack", |
4088 | snd_hda_get_jack_type(def_conf), | 4061 | snd_hda_get_jack_type(def_conf), |
4089 | snd_hda_get_jack_connectivity(def_conf), | 4062 | snd_hda_get_jack_connectivity(def_conf), |
4090 | snd_hda_get_jack_location(def_conf)); | 4063 | snd_hda_get_jack_location(def_conf)); |
4091 | 4064 | ||
4092 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); | 4065 | err = snd_hda_input_jack_add(codec, nid, type, name); |
4093 | if (err < 0) { | 4066 | if (err < 0) |
4094 | jack->nid = 0; | ||
4095 | return err; | 4067 | return err; |
4096 | } | 4068 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ |
4097 | jack->jack->private_data = jack; | ||
4098 | jack->jack->private_free = stac92xx_free_jack_priv; | ||
4099 | #endif | ||
4100 | return 0; | 4069 | return 0; |
4101 | } | 4070 | } |
4102 | 4071 | ||
@@ -4399,23 +4368,6 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4399 | return 0; | 4368 | return 0; |
4400 | } | 4369 | } |
4401 | 4370 | ||
4402 | static void stac92xx_free_jacks(struct hda_codec *codec) | ||
4403 | { | ||
4404 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
4405 | /* free jack instances manually when clearing/reconfiguring */ | ||
4406 | struct sigmatel_spec *spec = codec->spec; | ||
4407 | if (!codec->bus->shutdown && spec->jacks.list) { | ||
4408 | struct sigmatel_jack *jacks = spec->jacks.list; | ||
4409 | int i; | ||
4410 | for (i = 0; i < spec->jacks.used; i++, jacks++) { | ||
4411 | if (jacks->jack) | ||
4412 | snd_device_free(codec->bus->card, jacks->jack); | ||
4413 | } | ||
4414 | } | ||
4415 | snd_array_free(&spec->jacks); | ||
4416 | #endif | ||
4417 | } | ||
4418 | |||
4419 | static void stac92xx_free_kctls(struct hda_codec *codec) | 4371 | static void stac92xx_free_kctls(struct hda_codec *codec) |
4420 | { | 4372 | { |
4421 | struct sigmatel_spec *spec = codec->spec; | 4373 | struct sigmatel_spec *spec = codec->spec; |
@@ -4449,7 +4401,7 @@ static void stac92xx_free(struct hda_codec *codec) | |||
4449 | return; | 4401 | return; |
4450 | 4402 | ||
4451 | stac92xx_shutup(codec); | 4403 | stac92xx_shutup(codec); |
4452 | stac92xx_free_jacks(codec); | 4404 | snd_hda_input_jack_free(codec); |
4453 | snd_array_free(&spec->events); | 4405 | snd_array_free(&spec->events); |
4454 | 4406 | ||
4455 | kfree(spec); | 4407 | kfree(spec); |
@@ -4667,33 +4619,6 @@ static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) | |||
4667 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); | 4619 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
4668 | } | 4620 | } |
4669 | 4621 | ||
4670 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) | ||
4671 | { | ||
4672 | struct sigmatel_spec *spec = codec->spec; | ||
4673 | struct sigmatel_jack *jacks = spec->jacks.list; | ||
4674 | |||
4675 | if (jacks) { | ||
4676 | int i; | ||
4677 | for (i = 0; i < spec->jacks.used; i++) { | ||
4678 | if (jacks->nid == nid) { | ||
4679 | unsigned int pin_ctl = | ||
4680 | snd_hda_codec_read(codec, nid, | ||
4681 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, | ||
4682 | 0x00); | ||
4683 | int type = jacks->type; | ||
4684 | if (type == (SND_JACK_LINEOUT | ||
4685 | | SND_JACK_HEADPHONE)) | ||
4686 | type = (pin_ctl & AC_PINCTL_HP_EN) | ||
4687 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; | ||
4688 | snd_jack_report(jacks->jack, | ||
4689 | get_pin_presence(codec, nid) | ||
4690 | ? type : 0); | ||
4691 | } | ||
4692 | jacks++; | ||
4693 | } | ||
4694 | } | ||
4695 | } | ||
4696 | |||
4697 | /* get the pin connection (fixed, none, etc) */ | 4622 | /* get the pin connection (fixed, none, etc) */ |
4698 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) | 4623 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
4699 | { | 4624 | { |
@@ -4782,7 +4707,7 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
4782 | case STAC_PWR_EVENT: | 4707 | case STAC_PWR_EVENT: |
4783 | if (spec->num_pwrs > 0) | 4708 | if (spec->num_pwrs > 0) |
4784 | stac92xx_pin_sense(codec, event->nid); | 4709 | stac92xx_pin_sense(codec, event->nid); |
4785 | stac92xx_report_jack(codec, event->nid); | 4710 | snd_hda_input_jack_report(codec, event->nid); |
4786 | 4711 | ||
4787 | switch (codec->subsystem_id) { | 4712 | switch (codec->subsystem_id) { |
4788 | case 0x103c308f: | 4713 | case 0x103c308f: |