From patchwork Thu Apr 9 06:24:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 6183651 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 90FA29F2EC for ; Thu, 9 Apr 2015 06:24:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC0E4203C1 for ; Thu, 9 Apr 2015 06:24:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 28DB020114 for ; Thu, 9 Apr 2015 06:24:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1D2B6264FBA; Thu, 9 Apr 2015 08:24:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 8203726046B; Thu, 9 Apr 2015 08:24:30 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 29EB7260474; Thu, 9 Apr 2015 08:24:29 +0200 (CEST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 14E82260415 for ; Thu, 9 Apr 2015 08:24:22 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E2E66ABCA for ; Thu, 9 Apr 2015 06:24:21 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Thu, 9 Apr 2015 08:24:20 +0200 Message-Id: <1428560660-18109-1-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.3.5 Subject: [alsa-devel] [PATCH] ALSA: hda - Always allow access for POWER_STATE verbs X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- sound/hda/hdac_regmap.c | 10 +++++----- 1 file 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);