diff options
author | Mengdong Lin <mengdong.lin@intel.com> | 2013-11-29 01:48:45 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-29 08:47:46 -0500 |
commit | 7f132927435cf09d26ceb81cd0043b542ac7206d (patch) | |
tree | ef351beb51791a623c424b6830dde5485ea4b34b | |
parent | b5c6611fb4ef631cfb484a7cfe916154e52bc7d9 (diff) |
ALSA: hda - allow a codec to define its own depop delay time
This patch adds 'depop_delay' to struct hda_codec, to indicate a depop delay
time in ms when power-down, in function set_power_state() to D3.
Default value is -1, for a default delay time.
Machine fixup can set a suitable value according to the codec chip and HW audio
design.
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 7 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 472e5d04701e..5b7622034eee 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1471,6 +1471,7 @@ int snd_hda_codec_new(struct hda_bus *bus, | |||
1471 | INIT_LIST_HEAD(&codec->conn_list); | 1471 | INIT_LIST_HEAD(&codec->conn_list); |
1472 | 1472 | ||
1473 | INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); | 1473 | INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); |
1474 | codec->depop_delay = -1; | ||
1474 | 1475 | ||
1475 | #ifdef CONFIG_PM | 1476 | #ifdef CONFIG_PM |
1476 | spin_lock_init(&codec->power_lock); | 1477 | spin_lock_init(&codec->power_lock); |
@@ -3975,8 +3976,10 @@ static unsigned int hda_set_power_state(struct hda_codec *codec, | |||
3975 | 3976 | ||
3976 | /* this delay seems necessary to avoid click noise at power-down */ | 3977 | /* this delay seems necessary to avoid click noise at power-down */ |
3977 | if (power_state == AC_PWRST_D3) { | 3978 | if (power_state == AC_PWRST_D3) { |
3978 | /* transition time less than 10ms for power down */ | 3979 | if (codec->depop_delay < 0) |
3979 | msleep(codec->epss ? 10 : 100); | 3980 | msleep(codec->epss ? 10 : 100); |
3981 | else if (codec->depop_delay > 0) | ||
3982 | msleep(codec->depop_delay); | ||
3980 | flags = HDA_RW_NO_RESPONSE_FALLBACK; | 3983 | flags = HDA_RW_NO_RESPONSE_FALLBACK; |
3981 | } | 3984 | } |
3982 | 3985 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 01b248d3f7b2..3ab4834761a8 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -944,6 +944,8 @@ struct hda_codec { | |||
944 | struct snd_array jacks; | 944 | struct snd_array jacks; |
945 | #endif | 945 | #endif |
946 | 946 | ||
947 | int depop_delay; /* depop delay in ms, -1 for default delay time */ | ||
948 | |||
947 | /* fix-up list */ | 949 | /* fix-up list */ |
948 | int fixup_id; | 950 | int fixup_id; |
949 | const struct hda_fixup *fixup_list; | 951 | const struct hda_fixup *fixup_list; |