From patchwork Tue Nov 18 10:26:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 5327041 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE56FC11AD for ; Tue, 18 Nov 2014 10:26:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36EAC200F4 for ; Tue, 18 Nov 2014 10:26:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 98AE520165 for ; Tue, 18 Nov 2014 10:26:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 19595260470; Tue, 18 Nov 2014 11:26:28 +0100 (CET) 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,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id CE26B265074; Tue, 18 Nov 2014 11:26:17 +0100 (CET) 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 334852650B3; Tue, 18 Nov 2014 11:26:17 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id 23AF7260470 for ; Tue, 18 Nov 2014 11:26:07 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 18 Nov 2014 02:25:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,408,1413270000"; d="scan'208";a="633766892" Received: from vkoul-udesk3.iind.intel.com (HELO localhost.localdomain) ([10.223.84.65]) by fmsmga002.fm.intel.com with ESMTP; 18 Nov 2014 02:25:50 -0800 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Tue, 18 Nov 2014 15:56:50 +0530 Message-Id: <1416306410-25073-1-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.7.0.4 Cc: tiwai@suse.de, Vinod Koul , Rafal Redzimski Subject: [alsa-devel] [PATCH] ALSA: hda: separate stream tag for playback and capture 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 From: Rafal Redzimski According to hda specification stream tag must be unique throughout the input streams group, however an output stream might use a stream tag which is already in use by an input stream. Newer Intel HW has the capability to provides a total of more than 15 stream DMA engines which with the current implementation causes an overflow on STRM field (and the whole register) which results in usage of reserved value 0 in the STRM field which confuses HDA controller. So make stream_tag assignment separate for input and output streams Signed-off-by: Rafal Redzimski Signed-off-by: Vinod Koul --- sound/pci/hda/hda_controller.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 8337645..703ac6e 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -1921,11 +1921,17 @@ int azx_mixer_create(struct azx *chip) } EXPORT_SYMBOL_GPL(azx_mixer_create); +static bool is_input_stream(struct azx *chip, unsigned char index) +{ + return index < chip->playback_index_offset; +} /* initialize SD streams */ int azx_init_stream(struct azx *chip) { int i; + int in_stream_tag = 0; + int out_stream_tag = 0; /* initialize each stream (aka device) * assign the starting bdl address to each stream (device) @@ -1938,9 +1944,13 @@ int azx_init_stream(struct azx *chip) azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ azx_dev->sd_int_sta_mask = 1 << i; - /* stream tag: must be non-zero and unique */ azx_dev->index = i; - azx_dev->stream_tag = i + 1; + + /* stream tag must be unique throughout the stream direction + * group, valid values 1...15 + */ + azx_dev->stream_tag = is_input_stream(chip, i) ? + ++in_stream_tag : ++out_stream_tag; } return 0;