diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-09-21 03:57:06 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-09-21 04:00:03 -0400 |
commit | 9e5341b92d1d2dde11691b394721b45b36416bef (patch) | |
tree | 987a81df30cec229d2af12f87c4b572ded04095d | |
parent | 9396d3174b761685d6fefb1103e66b96a2e5db6d (diff) |
ALSA: hda - Introduce hda_call_check_power_status() helper
Replace the explicit ifdef check and call of check_power_status ops with
a new helper function, hda_call_check_power_status().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 5 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 12 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 11 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 12 |
4 files changed, 20 insertions, 20 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e15a75751f57..053f827d2c2c 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2228,10 +2228,7 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, | |||
2228 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, | 2228 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, |
2229 | HDA_AMP_MUTE, | 2229 | HDA_AMP_MUTE, |
2230 | *valp ? 0 : HDA_AMP_MUTE); | 2230 | *valp ? 0 : HDA_AMP_MUTE); |
2231 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2231 | hda_call_check_power_status(codec, nid); |
2232 | if (codec->patch_ops.check_power_status) | ||
2233 | codec->patch_ops.check_power_status(codec, nid); | ||
2234 | #endif | ||
2235 | snd_hda_power_down(codec); | 2232 | snd_hda_power_down(codec); |
2236 | return change; | 2233 | return change; |
2237 | } | 2234 | } |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 62c702240108..ebf8eb02e3c2 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -989,6 +989,18 @@ int snd_hda_suspend(struct hda_bus *bus); | |||
989 | int snd_hda_resume(struct hda_bus *bus); | 989 | int snd_hda_resume(struct hda_bus *bus); |
990 | #endif | 990 | #endif |
991 | 991 | ||
992 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
993 | static inline | ||
994 | int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid) | ||
995 | { | ||
996 | if (codec->patch_ops.check_power_status) | ||
997 | return codec->patch_ops.check_power_status(codec, nid); | ||
998 | return 0; | ||
999 | } | ||
1000 | #else | ||
1001 | #define hda_call_check_power_status(codec, nid) 0 | ||
1002 | #endif | ||
1003 | |||
992 | /* | 1004 | /* |
993 | * get widget information | 1005 | * get widget information |
994 | */ | 1006 | */ |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8689216fdcce..9bedca073e9a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -3729,10 +3729,7 @@ static int alc_init(struct hda_codec *codec) | |||
3729 | if (spec->init_hook) | 3729 | if (spec->init_hook) |
3730 | spec->init_hook(codec); | 3730 | spec->init_hook(codec); |
3731 | 3731 | ||
3732 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3732 | hda_call_check_power_status(codec, 0x01); |
3733 | if (codec->patch_ops.check_power_status) | ||
3734 | codec->patch_ops.check_power_status(codec, 0x01); | ||
3735 | #endif | ||
3736 | return 0; | 3733 | return 0; |
3737 | } | 3734 | } |
3738 | 3735 | ||
@@ -4128,8 +4125,7 @@ static int alc_resume(struct hda_codec *codec) | |||
4128 | codec->patch_ops.init(codec); | 4125 | codec->patch_ops.init(codec); |
4129 | snd_hda_codec_resume_amp(codec); | 4126 | snd_hda_codec_resume_amp(codec); |
4130 | snd_hda_codec_resume_cache(codec); | 4127 | snd_hda_codec_resume_cache(codec); |
4131 | if (codec->patch_ops.check_power_status) | 4128 | hda_call_check_power_status(codec, 0x01); |
4132 | codec->patch_ops.check_power_status(codec, 0x01); | ||
4133 | return 0; | 4129 | return 0; |
4134 | } | 4130 | } |
4135 | #endif | 4131 | #endif |
@@ -14703,8 +14699,7 @@ static int alc269_resume(struct hda_codec *codec) | |||
14703 | 14699 | ||
14704 | snd_hda_codec_resume_amp(codec); | 14700 | snd_hda_codec_resume_amp(codec); |
14705 | snd_hda_codec_resume_cache(codec); | 14701 | snd_hda_codec_resume_cache(codec); |
14706 | if (codec->patch_ops.check_power_status) | 14702 | hda_call_check_power_status(codec, 0x01); |
14707 | codec->patch_ops.check_power_status(codec, 0x01); | ||
14708 | return 0; | 14703 | return 0; |
14709 | } | 14704 | } |
14710 | #endif /* SND_HDA_NEEDS_RESUME */ | 14705 | #endif /* SND_HDA_NEEDS_RESUME */ |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6bfbc2fe46ed..a90327b0cc3e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4372,11 +4372,9 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4372 | stac_issue_unsol_event(codec, nid); | 4372 | stac_issue_unsol_event(codec, nid); |
4373 | } | 4373 | } |
4374 | 4374 | ||
4375 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4376 | /* sync mute LED */ | 4375 | /* sync mute LED */ |
4377 | if (spec->gpio_led && codec->patch_ops.check_power_status) | 4376 | if (spec->gpio_led) |
4378 | codec->patch_ops.check_power_status(codec, 0x01); | 4377 | hda_call_check_power_status(codec, 0x01); |
4379 | #endif | ||
4380 | if (spec->dac_list) | 4378 | if (spec->dac_list) |
4381 | stac92xx_power_down(codec); | 4379 | stac92xx_power_down(codec); |
4382 | return 0; | 4380 | return 0; |
@@ -4958,11 +4956,9 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
4958 | stac_issue_unsol_event(codec, | 4956 | stac_issue_unsol_event(codec, |
4959 | spec->autocfg.line_out_pins[0]); | 4957 | spec->autocfg.line_out_pins[0]); |
4960 | } | 4958 | } |
4961 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4962 | /* sync mute LED */ | 4959 | /* sync mute LED */ |
4963 | if (spec->gpio_led && codec->patch_ops.check_power_status) | 4960 | if (spec->gpio_led) |
4964 | codec->patch_ops.check_power_status(codec, 0x01); | 4961 | hda_call_check_power_status(codec, 0x01); |
4965 | #endif | ||
4966 | return 0; | 4962 | return 0; |
4967 | } | 4963 | } |
4968 | 4964 | ||