From patchwork Tue Aug 13 11:03:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vani.ganji@intel.com X-Patchwork-Id: 11093287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B264C14DB for ; Wed, 14 Aug 2019 06:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B61428750 for ; Wed, 14 Aug 2019 06:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FDAA28756; Wed, 14 Aug 2019 06:09:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E35A728750 for ; Wed, 14 Aug 2019 06:09:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5ADCA1665; Wed, 14 Aug 2019 08:08:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5ADCA1665 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1565762987; bh=VHpg7HBBQWkaj06nE/oV0Ysa6U5AAuslD39aJP9N8OY=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=aMHEjmhhuD474pM1i9Z/C2JtH9CEfxwb9sTTN10kMQWTRIe00Boc0ESTthBo6P9Df Uv3jCf8EAAkxshhHD6nGsUmZaGyQc9i4VDdYsyx0nulnBzvOCVcx1bwfVx/LzavKmQ BRUAZB0wnBOrpihD0PWQa9x/bDvOw1PHPzE+e3pc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7ED6FF803F4; Wed, 14 Aug 2019 08:08:02 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 81F72F8026A; Tue, 13 Aug 2019 13:02:46 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 64DE9F8015A for ; Tue, 13 Aug 2019 13:02:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 64DE9F8015A X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 04:02:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,381,1559545200"; d="scan'208";a="375562409" Received: from vganji-b85m-d3h.iind.intel.com ([10.223.163.76]) by fmsmga005.fm.intel.com with ESMTP; 13 Aug 2019 04:02:39 -0700 From: vani.ganji@intel.com To: alsa-devel@alsa-project.org Date: Tue, 13 Aug 2019 16:33:07 +0530 Message-Id: <20190813110307.5898-1-vani.ganji@intel.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 14 Aug 2019 08:07:59 +0200 Cc: pierre-louis.bossart@linux.intel.com, vani.ganji@intel.com Subject: [alsa-devel] [PATCH] ALSA: hda: Retry codec read on first time failure X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Vani Ganji Sometimes HDMI audio fails while fast switching between HDMI and Speaker due to codec Get Power state verb read failure. Verb is codec driver to access codec HW. Since issue scenario involves fast switching between HDMI and speaker, there might be chance to fail read from HW and same happened in the error scenario. Based on Display/Graphics architect suggestion, added a retry mechanism for failure on first attempt. Signed-off-by: Vani Ganji --- sound/hda/hdac_device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index b26cc93e7e10..225bd1bfe156 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -984,10 +984,17 @@ static unsigned int codec_read(struct hdac_device *hdac, hda_nid_t nid, { unsigned int cmd = snd_hdac_make_cmd(hdac, nid, verb, parm); unsigned int res; - - if (snd_hdac_exec_verb(hdac, cmd, flags, &res)) - return -1; - + unsigned int count; + + /* Retry verb once more if it fails first time */ + /* recommended to retry since it is HW related */ + for (count = 0; count <= 1; count++) { + if (snd_hdac_exec_verb(hdac, cmd, flags, &res)) + if (count == 1) + return -1; + } else + break; + } return res; }