* [PATCH 1/2] ALSA: hda - check supported power states
@ 2012-06-06 14:02 Wang Xingchao
2012-06-06 14:02 ` [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported Wang Xingchao
2012-06-07 9:42 ` [PATCH 1/2] ALSA: hda - check supported power states Takashi Iwai
0 siblings, 2 replies; 5+ messages in thread
From: Wang Xingchao @ 2012-06-06 14:02 UTC (permalink / raw)
To: tiwai, alsa-devel; +Cc: wangxingchao2011, Wang Xingchao
Add function to check whether power states supported by specific
codec node.
Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
---
sound/pci/hda/hda_codec.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 41ca803..b89c8ec 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3505,6 +3505,22 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all);
/*
+ * supported power states check
+ */
+static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg,
+ unsigned int power_state)
+{
+ int sup = snd_hda_param_read(codec, fg, AC_PAR_POWER_STATE);
+
+ if (sup < 0)
+ return false;
+ if (sup & power_state)
+ return true;
+ else
+ return false;
+}
+
+/*
* set power state of the codec
*/
static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported
2012-06-06 14:02 [PATCH 1/2] ALSA: hda - check supported power states Wang Xingchao
@ 2012-06-06 14:02 ` Wang Xingchao
2012-06-07 7:15 ` David Henningsson
2012-06-07 9:42 ` [PATCH 1/2] ALSA: hda - check supported power states Takashi Iwai
1 sibling, 1 reply; 5+ messages in thread
From: Wang Xingchao @ 2012-06-06 14:02 UTC (permalink / raw)
To: tiwai, alsa-devel; +Cc: wangxingchao2011, Wang Xingchao
if EPSS supported, transition from D3 state to D0 state in less
than 10ms
Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
---
sound/pci/hda/hda_codec.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index b89c8ec..5298ba1 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3526,14 +3526,18 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg
static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
unsigned int power_state)
{
+ bool epss;
if (codec->patch_ops.set_power_state) {
codec->patch_ops.set_power_state(codec, fg, power_state);
return;
}
+ epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS);
/* this delay seems necessary to avoid click noise at power-down */
- if (power_state == AC_PWRST_D3)
+ if ((power_state == AC_PWRST_D3) && !epss)
msleep(100);
+ else
+ msleep(10);
snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
power_state);
snd_hda_codec_set_power_to_all(codec, fg, power_state, true);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported
2012-06-06 14:02 ` [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported Wang Xingchao
@ 2012-06-07 7:15 ` David Henningsson
2012-06-07 7:26 ` Wang Xingchao
0 siblings, 1 reply; 5+ messages in thread
From: David Henningsson @ 2012-06-07 7:15 UTC (permalink / raw)
To: Wang Xingchao; +Cc: tiwai, alsa-devel, wangxingchao2011
On 06/06/2012 04:02 PM, Wang Xingchao wrote:
> if EPSS supported, transition from D3 state to D0 state in less
> than 10ms
>
> Signed-off-by: Wang Xingchao<xingchao.wang@intel.com>
> ---
> sound/pci/hda/hda_codec.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index b89c8ec..5298ba1 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -3526,14 +3526,18 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg
> static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
> unsigned int power_state)
> {
> + bool epss;
> if (codec->patch_ops.set_power_state) {
> codec->patch_ops.set_power_state(codec, fg, power_state);
> return;
> }
>
> + epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS);
> /* this delay seems necessary to avoid click noise at power-down */
> - if (power_state == AC_PWRST_D3)
> + if ((power_state == AC_PWRST_D3)&& !epss)
> msleep(100);
> + else
> + msleep(10);
Hi Wang,
You seem to have increased the delay from 0 to 10 ms on all cases when
power_state != AC_PWRST_D3, is this intentional?
Or did you mean to write like this:
if (power_state == AC_PWRST_D3) {
bool epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS);
msleep(epss ? 10 : 100);
}
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported
2012-06-07 7:15 ` David Henningsson
@ 2012-06-07 7:26 ` Wang Xingchao
0 siblings, 0 replies; 5+ messages in thread
From: Wang Xingchao @ 2012-06-07 7:26 UTC (permalink / raw)
To: David Henningsson; +Cc: tiwai, alsa-devel, Wang Xingchao
Hi David,
2012/6/7 David Henningsson <david.henningsson@canonical.com>:
> On 06/06/2012 04:02 PM, Wang Xingchao wrote:
>>
>> if EPSS supported, transition from D3 state to D0 state in less
>> than 10ms
>>
>> Signed-off-by: Wang Xingchao<xingchao.wang@intel.com>
>> ---
>> sound/pci/hda/hda_codec.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
>> index b89c8ec..5298ba1 100644
>> --- a/sound/pci/hda/hda_codec.c
>> +++ b/sound/pci/hda/hda_codec.c
>> @@ -3526,14 +3526,18 @@ static bool snd_hda_codec_get_supported_ps(struct
>> hda_codec *codec, hda_nid_t fg
>> static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
>> unsigned int power_state)
>> {
>> + bool epss;
>> if (codec->patch_ops.set_power_state) {
>> codec->patch_ops.set_power_state(codec, fg, power_state);
>> return;
>> }
>>
>> + epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS);
>> /* this delay seems necessary to avoid click noise at power-down */
>> - if (power_state == AC_PWRST_D3)
>> + if ((power_state == AC_PWRST_D3)&& !epss)
>>
>> msleep(100);
>> + else
>> + msleep(10);
>
>
> Hi Wang,
>
> You seem to have increased the delay from 0 to 10 ms on all cases when
> power_state != AC_PWRST_D3, is this intentional?
Thanks for clarification, it's a mistake here. Only transition from D0
to D3 need the delay to avoid click noise, there's no limitation
during power up.
i will update the patch based on your suggestion.
thanks
--xingchao
>
> Or did you mean to write like this:
>
> if (power_state == AC_PWRST_D3) {
> bool epss = snd_hda_codec_get_supported_ps(codec, fg,
> AC_PWRST_EPSS);
> msleep(epss ? 10 : 100);
> }
>
>
> --
> David Henningsson, Canonical Ltd.
> https://launchpad.net/~diwic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ALSA: hda - check supported power states
2012-06-06 14:02 [PATCH 1/2] ALSA: hda - check supported power states Wang Xingchao
2012-06-06 14:02 ` [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported Wang Xingchao
@ 2012-06-07 9:42 ` Takashi Iwai
1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2012-06-07 9:42 UTC (permalink / raw)
To: Wang Xingchao; +Cc: alsa-devel, wangxingchao2011
At Wed, 6 Jun 2012 22:02:48 +0800,
Wang Xingchao wrote:
>
> Add function to check whether power states supported by specific
> codec node.
>
> Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
Applied together with v2 patch. Thanks.
Takashi
> ---
> sound/pci/hda/hda_codec.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 41ca803..b89c8ec 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -3505,6 +3505,22 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
> EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all);
>
> /*
> + * supported power states check
> + */
> +static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg,
> + unsigned int power_state)
> +{
> + int sup = snd_hda_param_read(codec, fg, AC_PAR_POWER_STATE);
> +
> + if (sup < 0)
> + return false;
> + if (sup & power_state)
> + return true;
> + else
> + return false;
> +}
> +
> +/*
> * set power state of the codec
> */
> static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
> --
> 1.7.9.5
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-07 9:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 14:02 [PATCH 1/2] ALSA: hda - check supported power states Wang Xingchao
2012-06-06 14:02 ` [PATCH 2/2] ALSA: hda - reduce msleep time if EPSS power states supported Wang Xingchao
2012-06-07 7:15 ` David Henningsson
2012-06-07 7:26 ` Wang Xingchao
2012-06-07 9:42 ` [PATCH 1/2] ALSA: hda - check supported power states Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.