All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	"Wu Fengguang" <fengguang.wu@intel.com>,
	"Shane W" <shane-alsa@csy.ca>,
	"David Härdeman" <david@hardeman.nu>
Subject: [PATCH 10/10] hda - show EPSS capability in proc
Date: Wed, 18 Nov 2009 12:38:08 +0800	[thread overview]
Message-ID: <20091118043935.966835381@intel.com> (raw)
In-Reply-To: 20091118043758.141785140@intel.com

[-- Attachment #1: hda-power-epss.patch --]
[-- Type: text/plain, Size: 2366 bytes --]

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 sound/pci/hda/hda_codec.h |    4 ++++
 sound/pci/hda/hda_proc.c  |   31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

--- sound-2.6.orig/sound/pci/hda/hda_codec.h	2009-11-15 19:28:28.000000000 +0800
+++ sound-2.6/sound/pci/hda/hda_codec.h	2009-11-15 19:28:57.000000000 +0800
@@ -286,6 +286,10 @@ enum {
 #define AC_PWRST_D1SUP			(1<<1)
 #define AC_PWRST_D2SUP			(1<<2)
 #define AC_PWRST_D3SUP			(1<<3)
+#define AC_PWRST_D3COLDSUP		(1<<4)
+#define AC_PWRST_S3D3COLDSUP		(1<<29)
+#define AC_PWRST_CLKSTOP		(1<<30)
+#define AC_PWRST_EPSS			(1U<<31)
 
 /* Power state values */
 #define AC_PWRST_SETTING		(0xf<<0)
--- sound-2.6.orig/sound/pci/hda/hda_proc.c	2009-11-15 19:28:28.000000000 +0800
+++ sound-2.6/sound/pci/hda/hda_proc.c	2009-11-15 19:31:44.000000000 +0800
@@ -26,6 +26,21 @@
 #include "hda_codec.h"
 #include "hda_local.h"
 
+static char *bits_names(unsigned int bits, char *names[], int size)
+{
+       int i, n;
+       static char buf[128];
+
+       for (i = 0, n = 0; i < size; i++) {
+               if (bits & (1U<<i) && names[i])
+                       n += snprintf(buf + n, sizeof(buf) - n, " %s",
+                                                               names[i]);
+       }
+       buf[n] = '\0';
+
+       return buf;
+}
+
 static const char *get_wid_type_name(unsigned int wid_value)
 {
 	static char *names[16] = {
@@ -363,8 +378,24 @@ static const char *get_pwr_state(u32 sta
 static void print_power_state(struct snd_info_buffer *buffer,
 			      struct hda_codec *codec, hda_nid_t nid)
 {
+	static char *names[] = {
+		[ilog2(AC_PWRST_D0SUP)]		= "D0",
+		[ilog2(AC_PWRST_D1SUP)]		= "D1",
+		[ilog2(AC_PWRST_D2SUP)]		= "D2",
+		[ilog2(AC_PWRST_D3SUP)]		= "D3",
+		[ilog2(AC_PWRST_D3COLDSUP)]	= "D3cold",
+		[ilog2(AC_PWRST_S3D3COLDSUP)]	= "S3D3cold",
+		[ilog2(AC_PWRST_CLKSTOP)]	= "CLKSTOP",
+		[ilog2(AC_PWRST_EPSS)]		= "EPSS",
+	};
+
+	int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE);
 	int pwr = snd_hda_codec_read(codec, nid, 0,
 				     AC_VERB_GET_POWER_STATE, 0);
+	if (sup)
+		snd_iprintf(buffer, "  Power states: %s\n",
+			    bits_names(sup, names, ARRAY_SIZE(names)));
+
 	snd_iprintf(buffer, "  Power: setting=%s, actual=%s\n",
 		    get_pwr_state(pwr & AC_PWRST_SETTING),
 		    get_pwr_state((pwr & AC_PWRST_ACTUAL) >>

  parent reply	other threads:[~2009-11-18  4:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18  4:37 [PATCH 00/10] Intel HDMI fixes v2 Wu Fengguang
2009-11-18  4:37 ` [PATCH 01/10] intelhdmi - fix audio infoframe fill size Wu Fengguang
2009-11-18  4:38 ` [PATCH 02/10] intelhdmi - fix channel mapping slot mask Wu Fengguang
2009-11-18  4:38 ` [PATCH 03/10] intelhdmi - export monitor-presence and ELD-valid status Wu Fengguang
2009-11-18  4:38 ` [PATCH 04/10] hda - introduce snd_hda_jack_detect() and snd_hda_pin_sense() Wu Fengguang
2009-11-18  4:38 ` [PATCH 05/10] intelhdmi - probe for monitor/eld presence at module init time Wu Fengguang
2009-11-18  9:04   ` Takashi Iwai
2009-11-18  9:16     ` Wu Fengguang
2009-11-18  4:38 ` [PATCH 06/10] intelhdmi - separate out infoframe checksum routine Wu Fengguang
2009-11-18  4:38 ` [PATCH 07/10] intelhdmi - sticky infoframe Wu Fengguang
2009-11-18  4:38 ` [PATCH 08/10] intelhdmi - sticky stream id and format Wu Fengguang
2009-11-18  4:38 ` [PATCH 09/10] intelhdmi - sticky channel count Wu Fengguang
2009-11-18  4:38 ` Wu Fengguang [this message]
2009-11-18  4:58 ` [PATCH 00/10] Intel HDMI fixes v2 Wu Fengguang
2009-11-18  7:04   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091118043935.966835381@intel.com \
    --to=fengguang.wu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=david@hardeman.nu \
    --cc=shane-alsa@csy.ca \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.