diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-12-06 07:19:25 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-12-06 07:19:25 -0500 |
commit | b5212878abdd9f9396705a5c84d622e78abc538c (patch) | |
tree | ce1ec72f5ee51a89b7b59c7a9a0a5c3a3c1318c2 /sound/pci | |
parent | cce4aa378a049f4275416ee6302dd24f37b289df (diff) | |
parent | f1a73746c6664442082e3d53e1804f46e1910436 (diff) |
Merge branch 'fix/hda-idt-fix' into fix/hda
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index d8d2f9dccd9b..ea1f157ca38b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -215,6 +215,7 @@ struct sigmatel_spec { | |||
215 | unsigned int gpio_mute; | 215 | unsigned int gpio_mute; |
216 | unsigned int gpio_led; | 216 | unsigned int gpio_led; |
217 | unsigned int gpio_led_polarity; | 217 | unsigned int gpio_led_polarity; |
218 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ | ||
218 | unsigned int vref_led; | 219 | unsigned int vref_led; |
219 | 220 | ||
220 | /* stream */ | 221 | /* stream */ |
@@ -4318,12 +4319,10 @@ static void stac_store_hints(struct hda_codec *codec) | |||
4318 | spec->eapd_switch = val; | 4319 | spec->eapd_switch = val; |
4319 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); | 4320 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); |
4320 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { | 4321 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { |
4321 | if (spec->gpio_led <= 8) { | 4322 | spec->gpio_mask |= spec->gpio_led; |
4322 | spec->gpio_mask |= spec->gpio_led; | 4323 | spec->gpio_dir |= spec->gpio_led; |
4323 | spec->gpio_dir |= spec->gpio_led; | 4324 | if (spec->gpio_led_polarity) |
4324 | if (spec->gpio_led_polarity) | 4325 | spec->gpio_data |= spec->gpio_led; |
4325 | spec->gpio_data |= spec->gpio_led; | ||
4326 | } | ||
4327 | } | 4326 | } |
4328 | } | 4327 | } |
4329 | 4328 | ||
@@ -4915,8 +4914,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
4915 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", | 4914 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", |
4916 | &spec->gpio_led_polarity, | 4915 | &spec->gpio_led_polarity, |
4917 | &spec->gpio_led) == 2) { | 4916 | &spec->gpio_led) == 2) { |
4918 | if (spec->gpio_led < 4) | 4917 | unsigned int max_gpio; |
4918 | max_gpio = snd_hda_param_read(codec, codec->afg, | ||
4919 | AC_PAR_GPIO_CAP); | ||
4920 | max_gpio &= AC_GPIO_IO_COUNT; | ||
4921 | if (spec->gpio_led < max_gpio) | ||
4919 | spec->gpio_led = 1 << spec->gpio_led; | 4922 | spec->gpio_led = 1 << spec->gpio_led; |
4923 | else | ||
4924 | spec->vref_mute_led_nid = spec->gpio_led; | ||
4920 | return 1; | 4925 | return 1; |
4921 | } | 4926 | } |
4922 | if (sscanf(dev->name, "HP_Mute_LED_%d", | 4927 | if (sscanf(dev->name, "HP_Mute_LED_%d", |
@@ -5045,15 +5050,12 @@ static int stac92xx_pre_resume(struct hda_codec *codec) | |||
5045 | struct sigmatel_spec *spec = codec->spec; | 5050 | struct sigmatel_spec *spec = codec->spec; |
5046 | 5051 | ||
5047 | /* sync mute LED */ | 5052 | /* sync mute LED */ |
5048 | if (spec->gpio_led) { | 5053 | if (spec->vref_mute_led_nid) |
5049 | if (spec->gpio_led <= 8) { | 5054 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
5050 | stac_gpio_set(codec, spec->gpio_mask, | 5055 | spec->vref_led); |
5051 | spec->gpio_dir, spec->gpio_data); | 5056 | else if (spec->gpio_led) |
5052 | } else { | 5057 | stac_gpio_set(codec, spec->gpio_mask, |
5053 | stac_vrefout_set(codec, | 5058 | spec->gpio_dir, spec->gpio_data); |
5054 | spec->gpio_led, spec->vref_led); | ||
5055 | } | ||
5056 | } | ||
5057 | return 0; | 5059 | return 0; |
5058 | } | 5060 | } |
5059 | 5061 | ||
@@ -5064,7 +5066,7 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
5064 | struct sigmatel_spec *spec = codec->spec; | 5066 | struct sigmatel_spec *spec = codec->spec; |
5065 | 5067 | ||
5066 | if (power_state == AC_PWRST_D3) { | 5068 | if (power_state == AC_PWRST_D3) { |
5067 | if (spec->gpio_led > 8) { | 5069 | if (spec->vref_mute_led_nid) { |
5068 | /* with vref-out pin used for mute led control | 5070 | /* with vref-out pin used for mute led control |
5069 | * codec AFG is prevented from D3 state | 5071 | * codec AFG is prevented from D3 state |
5070 | */ | 5072 | */ |
@@ -5117,7 +5119,7 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
5117 | } | 5119 | } |
5118 | } | 5120 | } |
5119 | /*polarity defines *not* muted state level*/ | 5121 | /*polarity defines *not* muted state level*/ |
5120 | if (spec->gpio_led <= 8) { | 5122 | if (!spec->vref_mute_led_nid) { |
5121 | if (muted) | 5123 | if (muted) |
5122 | spec->gpio_data &= ~spec->gpio_led; /* orange */ | 5124 | spec->gpio_data &= ~spec->gpio_led; /* orange */ |
5123 | else | 5125 | else |
@@ -5135,7 +5137,8 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
5135 | muted_lvl = spec->gpio_led_polarity ? | 5137 | muted_lvl = spec->gpio_led_polarity ? |
5136 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; | 5138 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; |
5137 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; | 5139 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; |
5138 | stac_vrefout_set(codec, spec->gpio_led, spec->vref_led); | 5140 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
5141 | spec->vref_led); | ||
5139 | } | 5142 | } |
5140 | return 0; | 5143 | return 0; |
5141 | } | 5144 | } |
@@ -5649,7 +5652,7 @@ again: | |||
5649 | 5652 | ||
5650 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5653 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5651 | if (spec->gpio_led) { | 5654 | if (spec->gpio_led) { |
5652 | if (spec->gpio_led <= 8) { | 5655 | if (!spec->vref_mute_led_nid) { |
5653 | spec->gpio_mask |= spec->gpio_led; | 5656 | spec->gpio_mask |= spec->gpio_led; |
5654 | spec->gpio_dir |= spec->gpio_led; | 5657 | spec->gpio_dir |= spec->gpio_led; |
5655 | spec->gpio_data |= spec->gpio_led; | 5658 | spec->gpio_data |= spec->gpio_led; |
@@ -5962,7 +5965,7 @@ again: | |||
5962 | 5965 | ||
5963 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5966 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5964 | if (spec->gpio_led) { | 5967 | if (spec->gpio_led) { |
5965 | if (spec->gpio_led <= 8) { | 5968 | if (!spec->vref_mute_led_nid) { |
5966 | spec->gpio_mask |= spec->gpio_led; | 5969 | spec->gpio_mask |= spec->gpio_led; |
5967 | spec->gpio_dir |= spec->gpio_led; | 5970 | spec->gpio_dir |= spec->gpio_led; |
5968 | spec->gpio_data |= spec->gpio_led; | 5971 | spec->gpio_data |= spec->gpio_led; |