aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-02-08 09:16:08 -0500
committerTakashi Iwai <tiwai@suse.de>2010-02-08 09:19:51 -0500
commitc21bd0254371c207636e84c9e033d13a6fe48d43 (patch)
tree6e396abcc81775ad9aa5f0ef19b5c69af5795e82 /sound/pci
parent07f804495cb08c8fdf16eee8f7d90edce4a3c9c5 (diff)
ALSA: hda - Merge HP mute-LED status callback on both IDT 92HD7x and 8x codecs
Merge the mute-LED status callback function for both IDT 92HD7x and 8x codecs to one function. Also it's changed to check all DACs, and called in the initialization to sync with the current status. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_sigmatel.c57
1 files changed, 27 insertions, 30 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 39961879c414..ea254235470d 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4363,6 +4363,12 @@ static int stac92xx_init(struct hda_codec *codec)
4363 if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) 4363 if (enable_pin_detect(codec, nid, STAC_PWR_EVENT))
4364 stac_issue_unsol_event(codec, nid); 4364 stac_issue_unsol_event(codec, nid);
4365 } 4365 }
4366
4367#ifdef CONFIG_SND_HDA_POWER_SAVE
4368 /* sync mute LED */
4369 if (spec->gpio_led && codec->patch_ops.check_power_status)
4370 codec->patch_ops.check_power_status(codec, 0x01);
4371#endif
4366 if (spec->dac_list) 4372 if (spec->dac_list)
4367 stac92xx_power_down(codec); 4373 stac92xx_power_down(codec);
4368 return 0; 4374 return 0;
@@ -4909,6 +4915,11 @@ static int stac92xx_resume(struct hda_codec *codec)
4909 stac_issue_unsol_event(codec, 4915 stac_issue_unsol_event(codec,
4910 spec->autocfg.line_out_pins[0]); 4916 spec->autocfg.line_out_pins[0]);
4911 } 4917 }
4918#ifdef CONFIG_SND_HDA_POWER_SAVE
4919 /* sync mute LED */
4920 if (spec->gpio_led && codec->patch_ops.check_power_status)
4921 codec->patch_ops.check_power_status(codec, 0x01);
4922#endif
4912 return 0; 4923 return 0;
4913} 4924}
4914 4925
@@ -4928,43 +4939,29 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec,
4928 hda_nid_t nid) 4939 hda_nid_t nid)
4929{ 4940{
4930 struct sigmatel_spec *spec = codec->spec; 4941 struct sigmatel_spec *spec = codec->spec;
4942 int i, muted = 1;
4931 4943
4932 if (nid == 0x10) { 4944 for (i = 0; i < spec->multiout.num_dacs; i++) {
4933 if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & 4945 nid = spec->multiout.dac_nids[i];
4934 HDA_AMP_MUTE) 4946 if (!(snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
4935 spec->gpio_data &= ~spec->gpio_led; /* orange */ 4947 HDA_AMP_MUTE)) {
4936 else 4948 muted = 0; /* something heard */
4937 spec->gpio_data |= spec->gpio_led; /* white */ 4949 break;
4938
4939 if (!spec->gpio_led_polarity) {
4940 /* LED state is inverted on these systems */
4941 spec->gpio_data ^= spec->gpio_led;
4942 } 4950 }
4943
4944 stac_gpio_set(codec, spec->gpio_mask,
4945 spec->gpio_dir,
4946 spec->gpio_data);
4947 } 4951 }
4952 if (muted)
4953 spec->gpio_data &= ~spec->gpio_led; /* orange */
4954 else
4955 spec->gpio_data |= spec->gpio_led; /* white */
4948 4956
4949 return 0; 4957 if (!spec->gpio_led_polarity) {
4950} 4958 /* LED state is inverted on these systems */
4951 4959 spec->gpio_data ^= spec->gpio_led;
4952static int idt92hd83xxx_hp_check_power_status(struct hda_codec *codec, 4960 }
4953 hda_nid_t nid)
4954{
4955 struct sigmatel_spec *spec = codec->spec;
4956 4961
4957 if (nid != 0x13)
4958 return 0;
4959 if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & HDA_AMP_MUTE)
4960 spec->gpio_data |= spec->gpio_led; /* mute LED on */
4961 else
4962 spec->gpio_data &= ~spec->gpio_led; /* mute LED off */
4963 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); 4962 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
4964
4965 return 0; 4963 return 0;
4966} 4964}
4967
4968#endif 4965#endif
4969 4966
4970static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) 4967static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
@@ -5361,7 +5358,7 @@ again:
5361 spec->gpio_data |= spec->gpio_led; 5358 spec->gpio_data |= spec->gpio_led;
5362 /* register check_power_status callback. */ 5359 /* register check_power_status callback. */
5363 codec->patch_ops.check_power_status = 5360 codec->patch_ops.check_power_status =
5364 idt92hd83xxx_hp_check_power_status; 5361 stac92xx_hp_check_power_status;
5365 } 5362 }
5366#endif 5363#endif
5367 5364