aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2009-11-17 23:38:08 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-18 01:48:28 -0500
commit83d605fd63e704419ccb92d48b735c6890ce3d6a (patch)
treed05a3aecbcbdefe2b2b8a5e0b48abff37636961a
parent81bf31e2d0a6a9f5d83da0a757f8ca03db908162 (diff)
ALSA: hda - show EPSS capability in proc
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.h4
-rw-r--r--sound/pci/hda/hda_proc.c31
2 files changed, 35 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index be6c5f443cd..2d627613aea 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -286,6 +286,10 @@ enum {
286#define AC_PWRST_D1SUP (1<<1) 286#define AC_PWRST_D1SUP (1<<1)
287#define AC_PWRST_D2SUP (1<<2) 287#define AC_PWRST_D2SUP (1<<2)
288#define AC_PWRST_D3SUP (1<<3) 288#define AC_PWRST_D3SUP (1<<3)
289#define AC_PWRST_D3COLDSUP (1<<4)
290#define AC_PWRST_S3D3COLDSUP (1<<29)
291#define AC_PWRST_CLKSTOP (1<<30)
292#define AC_PWRST_EPSS (1U<<31)
289 293
290/* Power state values */ 294/* Power state values */
291#define AC_PWRST_SETTING (0xf<<0) 295#define AC_PWRST_SETTING (0xf<<0)
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index f465cff2804..09476fc1ab6 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -26,6 +26,21 @@
26#include "hda_codec.h" 26#include "hda_codec.h"
27#include "hda_local.h" 27#include "hda_local.h"
28 28
29static char *bits_names(unsigned int bits, char *names[], int size)
30{
31 int i, n;
32 static char buf[128];
33
34 for (i = 0, n = 0; i < size; i++) {
35 if (bits & (1U<<i) && names[i])
36 n += snprintf(buf + n, sizeof(buf) - n, " %s",
37 names[i]);
38 }
39 buf[n] = '\0';
40
41 return buf;
42}
43
29static const char *get_wid_type_name(unsigned int wid_value) 44static const char *get_wid_type_name(unsigned int wid_value)
30{ 45{
31 static char *names[16] = { 46 static char *names[16] = {
@@ -398,8 +413,24 @@ static const char *get_pwr_state(u32 state)
398static void print_power_state(struct snd_info_buffer *buffer, 413static void print_power_state(struct snd_info_buffer *buffer,
399 struct hda_codec *codec, hda_nid_t nid) 414 struct hda_codec *codec, hda_nid_t nid)
400{ 415{
416 static char *names[] = {
417 [ilog2(AC_PWRST_D0SUP)] = "D0",
418 [ilog2(AC_PWRST_D1SUP)] = "D1",
419 [ilog2(AC_PWRST_D2SUP)] = "D2",
420 [ilog2(AC_PWRST_D3SUP)] = "D3",
421 [ilog2(AC_PWRST_D3COLDSUP)] = "D3cold",
422 [ilog2(AC_PWRST_S3D3COLDSUP)] = "S3D3cold",
423 [ilog2(AC_PWRST_CLKSTOP)] = "CLKSTOP",
424 [ilog2(AC_PWRST_EPSS)] = "EPSS",
425 };
426
427 int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE);
401 int pwr = snd_hda_codec_read(codec, nid, 0, 428 int pwr = snd_hda_codec_read(codec, nid, 0,
402 AC_VERB_GET_POWER_STATE, 0); 429 AC_VERB_GET_POWER_STATE, 0);
430 if (sup)
431 snd_iprintf(buffer, " Power states: %s\n",
432 bits_names(sup, names, ARRAY_SIZE(names)));
433
403 snd_iprintf(buffer, " Power: setting=%s, actual=%s\n", 434 snd_iprintf(buffer, " Power: setting=%s, actual=%s\n",
404 get_pwr_state(pwr & AC_PWRST_SETTING), 435 get_pwr_state(pwr & AC_PWRST_SETTING),
405 get_pwr_state((pwr & AC_PWRST_ACTUAL) >> 436 get_pwr_state((pwr & AC_PWRST_ACTUAL) >>