aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/patch_sigmatel.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index c4a6ecb8e085..8f80796c366f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4961,29 +4961,19 @@ static int stac92xx_resume(struct hda_codec *codec)
4961 stac_issue_unsol_event(codec, 4961 stac_issue_unsol_event(codec,
4962 spec->autocfg.line_out_pins[0]); 4962 spec->autocfg.line_out_pins[0]);
4963 } 4963 }
4964 /* sync mute LED */
4965 if (spec->gpio_led)
4966 hda_call_check_power_status(codec, 0x01);
4967 return 0; 4964 return 0;
4968} 4965}
4969 4966
4967#ifdef CONFIG_SND_HDA_POWER_SAVE
4970/* 4968/*
4971 * using power check for controlling mute led of HP notebooks 4969 * For this feature CONFIG_SND_HDA_POWER_SAVE is needed
4972 * check for mute state only on Speakers (nid = 0x10) 4970 * as mute LED state is updated in check_power_status hook
4973 *
4974 * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise
4975 * the LED is NOT working properly !
4976 *
4977 * Changed name to reflect that it now works for any designated
4978 * model, not just HP HDX.
4979 */ 4971 */
4980 4972static int stac92xx_update_led_status(struct hda_codec *codec)
4981#ifdef CONFIG_SND_HDA_POWER_SAVE
4982static int stac92xx_hp_check_power_status(struct hda_codec *codec,
4983 hda_nid_t nid)
4984{ 4973{
4985 struct sigmatel_spec *spec = codec->spec; 4974 struct sigmatel_spec *spec = codec->spec;
4986 int i, muted = 1; 4975 int i, num_ext_dacs, muted = 1;
4976 hda_nid_t nid;
4987 4977
4988 for (i = 0; i < spec->multiout.num_dacs; i++) { 4978 for (i = 0; i < spec->multiout.num_dacs; i++) {
4989 nid = spec->multiout.dac_nids[i]; 4979 nid = spec->multiout.dac_nids[i];
@@ -4993,6 +4983,22 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec,
4993 break; 4983 break;
4994 } 4984 }
4995 } 4985 }
4986 if (muted && spec->multiout.hp_nid)
4987 if (!(snd_hda_codec_amp_read(codec,
4988 spec->multiout.hp_nid, 0, HDA_OUTPUT, 0) &
4989 HDA_AMP_MUTE)) {
4990 muted = 0; /* HP is not muted */
4991 }
4992 num_ext_dacs = ARRAY_SIZE(spec->multiout.extra_out_nid);
4993 for (i = 0; muted && i < num_ext_dacs; i++) {
4994 nid = spec->multiout.extra_out_nid[i];
4995 if (nid == 0)
4996 break;
4997 if (!(snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) &
4998 HDA_AMP_MUTE)) {
4999 muted = 0; /* extra output is not muted */
5000 }
5001 }
4996 if (muted) 5002 if (muted)
4997 spec->gpio_data &= ~spec->gpio_led; /* orange */ 5003 spec->gpio_data &= ~spec->gpio_led; /* orange */
4998 else 5004 else
@@ -5006,6 +5012,17 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec,
5006 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); 5012 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
5007 return 0; 5013 return 0;
5008} 5014}
5015
5016/*
5017 * use power check for controlling mute led of HP notebooks
5018 */
5019static int stac92xx_check_power_status(struct hda_codec *codec,
5020 hda_nid_t nid)
5021{
5022 stac92xx_update_led_status(codec);
5023
5024 return 0;
5025}
5009#endif 5026#endif
5010 5027
5011static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) 5028static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
@@ -5543,7 +5560,7 @@ again:
5543 spec->gpio_data |= spec->gpio_led; 5560 spec->gpio_data |= spec->gpio_led;
5544 /* register check_power_status callback. */ 5561 /* register check_power_status callback. */
5545 codec->patch_ops.check_power_status = 5562 codec->patch_ops.check_power_status =
5546 stac92xx_hp_check_power_status; 5563 stac92xx_check_power_status;
5547 } 5564 }
5548#endif 5565#endif
5549 5566
@@ -5871,7 +5888,7 @@ again:
5871 spec->gpio_data |= spec->gpio_led; 5888 spec->gpio_data |= spec->gpio_led;
5872 /* register check_power_status callback. */ 5889 /* register check_power_status callback. */
5873 codec->patch_ops.check_power_status = 5890 codec->patch_ops.check_power_status =
5874 stac92xx_hp_check_power_status; 5891 stac92xx_check_power_status;
5875 } 5892 }
5876#endif 5893#endif
5877 5894