Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83d605fd authored by Wu Fengguang's avatar Wu Fengguang Committed by Takashi Iwai
Browse files

ALSA: hda - show EPSS capability in proc

parent 81bf31e2
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -286,6 +286,10 @@ enum {
#define AC_PWRST_D1SUP			(1<<1)
#define AC_PWRST_D1SUP			(1<<1)
#define AC_PWRST_D2SUP			(1<<2)
#define AC_PWRST_D2SUP			(1<<2)
#define AC_PWRST_D3SUP			(1<<3)
#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 */
/* Power state values */
#define AC_PWRST_SETTING		(0xf<<0)
#define AC_PWRST_SETTING		(0xf<<0)
+31 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,21 @@
#include "hda_codec.h"
#include "hda_codec.h"
#include "hda_local.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 const char *get_wid_type_name(unsigned int wid_value)
{
{
	static char *names[16] = {
	static char *names[16] = {
@@ -398,8 +413,24 @@ static const char *get_pwr_state(u32 state)
static void print_power_state(struct snd_info_buffer *buffer,
static void print_power_state(struct snd_info_buffer *buffer,
			      struct hda_codec *codec, hda_nid_t nid)
			      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,
	int pwr = snd_hda_codec_read(codec, nid, 0,
				     AC_VERB_GET_POWER_STATE, 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",
	snd_iprintf(buffer, "  Power: setting=%s, actual=%s\n",
		    get_pwr_state(pwr & AC_PWRST_SETTING),
		    get_pwr_state(pwr & AC_PWRST_SETTING),
		    get_pwr_state((pwr & AC_PWRST_ACTUAL) >>
		    get_pwr_state((pwr & AC_PWRST_ACTUAL) >>