summary refs log tree commit diff
path: root/sound/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-09 07:58:46 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-09 08:24:51 +0200
commit9efe2731db3a8944d26233bb47532011411810fb (patch)
tree9ce695d20786db896f61e3d0e914c9b752330152 /sound/hda
parent664c715573c2c116c2d8f5de7d59ce85a98a1751 (diff)
downloadlinux-9efe2731db3a8944d26233bb47532011411810fb.tar.gz
ALSA: hda - Always allow access for POWER_STATE verbs via regmap
The hdac regmap code checks whether the codec is powered on while
accessing, but there must be an exception -- the verbs to control the
power state.

Currently HD-audio driver doesn't access them via regmap, so this
patch doesn't fix any current behavior, but it's just for future.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/hdac_regmap.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c
index 64876fa357c9..51f1b5c8a91c 100644
--- a/sound/hda/hdac_regmap.c
+++ b/sound/hda/hdac_regmap.c
@@ -239,7 +239,7 @@ static int hda_reg_read(void *context, unsigned int reg, unsigned int *val)
 	int verb = get_verb(reg);
 	int err;
 
-	if (!codec_is_running(codec))
+	if (!codec_is_running(codec) && verb != AC_VERB_GET_POWER_STATE)
 		return -EAGAIN;
 	reg |= (codec->addr << 28);
 	if (is_stereo_amp_verb(reg))
@@ -265,16 +265,16 @@ static int hda_reg_write(void *context, unsigned int reg, unsigned int val)
 	unsigned int verb;
 	int i, bytes, err;
 
-	if (!codec_is_running(codec))
-		return codec->lazy_cache ? 0 : -EAGAIN;
-
 	reg &= ~0x00080000U; /* drop GET bit */
 	reg |= (codec->addr << 28);
+	verb = get_verb(reg);
+
+	if (!codec_is_running(codec) && verb != AC_VERB_SET_POWER_STATE)
+		return codec->lazy_cache ? 0 : -EAGAIN;
 
 	if (is_stereo_amp_verb(reg))
 		return hda_reg_write_stereo_amp(codec, reg, val);
 
-	verb = get_verb(reg);
 	if (verb == AC_VERB_SET_PROC_COEF)
 		return hda_reg_write_coef(codec, reg, val);