From patchwork Fri Feb 28 06:35:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3738911 X-Patchwork-Delegate: tiwai@suse.de 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 3C29FBF13A for ; Fri, 28 Feb 2014 06:42:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5770620266 for ; Fri, 28 Feb 2014 06:41:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1501220148 for ; Fri, 28 Feb 2014 06:41:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 35C33265A27; Fri, 28 Feb 2014 07:41:57 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 36C0F26509D; Fri, 28 Feb 2014 07:38:10 +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 D174426524F; Fri, 28 Feb 2014 07:38:06 +0100 (CET) Received: from mail-ig0-f201.google.com (mail-ig0-f201.google.com [209.85.213.201]) by alsa0.perex.cz (Postfix) with ESMTP id 7E3542650A4 for ; Fri, 28 Feb 2014 07:37:13 +0100 (CET) Received: by mail-ig0-f201.google.com with SMTP id l13so102638iga.0 for ; Thu, 27 Feb 2014 22:37:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FwetRXT2dgO2QST0NaGKMEfk0j66iRS1DPoXFTVKm0E=; b=ENTn3Fevu3ytoQaXtLz+flqD3gfJ8+tQrvFPDzqMYqrLVSRKSLalXj3HdT0epRIvLp WRau00QSiyHpOk2Vmfp2e2MD6+CYeeIrmIlNV+Hz1nJEHPU5F3PfXcj3CRlguUxZNSgh +ovik1nk7vZOJ4eb/Bsi7rG0osPCGLzM8eKgfk5cHH/45UOMgNyT52bfe2X+uCxEu22f 4L1pFVQGrCn/9BxkMX77/zr8ei9sgTEoLklOKwFbLl68shLr8VNtBJ/7Ub1xqDnYzhbE yGtSfeCaokws8tWUTem2JlIbx2r3wzhAcODWlG3yDm+2DxizlPc+cW2G+ve/IZaE5OJ6 NSsQ== X-Gm-Message-State: ALoCoQksfBEalGvJysCEkxoCZR6rHMUsk/Km34FPqlRBTq+knvVGzUITvoy+09cxxkVJv8gAaeDRVqspK19NyCaBuoS+KjWtznx0ZZXHT/aFl+RiFe/Pz3/VudYKBXdpNktkik6D84+aXdUUUizmgxX7lrqK40hbjsCT6JfhGN40wL4kv6R/vPIRYPjd8N+q3HAd33uiT5q5LyBE4sIH+1+C7+lmgWOSQxYa+rc4zKxD7F6PcbR1h40= X-Received: by 10.182.251.230 with SMTP id zn6mr6021758obc.14.1393569432125; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id k45si113832yhn.4.2014.02.27.22.37.12 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id F07075A42C0; Thu, 27 Feb 2014 22:37:11 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id 9CBAB18113D; Thu, 27 Feb 2014 22:37:11 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Thu, 27 Feb 2014 22:35:46 -0800 Message-Id: <1393569362-27285-4-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393569362-27285-1-git-send-email-dgreid@chromium.org> References: <1393569362-27285-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFC 03/19] ALSA: hda - Keep pointer to bdl_pos_fix in chip struct 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 This will allow for a platform hda driver to use it as well. It removes the dependency on the module param from hda_intel, which will allow for azx_setup_periods to be shared. Signed-off-by: Dylan Reid --- sound/pci/hda/hda_intel.c | 7 ++++--- sound/pci/hda/hda_priv.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index e0ee3d4..8eec5cb 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1179,7 +1179,7 @@ static int azx_setup_periods(struct azx *chip, bdl = (u32 *)azx_dev->bdl.area; ofs = 0; azx_dev->frags = 0; - pos_adj = bdl_pos_adj[chip->dev_index]; + pos_adj = chip->bdl_pos_adj[chip->dev_index]; if (!azx_dev->no_period_wakeup && pos_adj > 0) { struct snd_pcm_runtime *runtime = substream->runtime; int pos_align = pos_adj; @@ -1192,7 +1192,7 @@ static int azx_setup_periods(struct azx *chip, pos_adj = frames_to_bytes(runtime, pos_adj); if (pos_adj >= period_bytes) { dev_warn(chip->card->dev,"Too big adjustment %d\n", - bdl_pos_adj[chip->dev_index]); + chip->bdl_pos_adj[chip->dev_index]); pos_adj = 0; } else { ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), @@ -2162,7 +2162,7 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) if (wallclk < (azx_dev->period_wallclk * 5) / 4 && pos % azx_dev->period_bytes > azx_dev->period_bytes / 2) /* NG - it's below the first next period boundary */ - return bdl_pos_adj[chip->dev_index] ? 0 : -1; + return chip->bdl_pos_adj[chip->dev_index] ? 0 : -1; azx_dev->start_wallclk += wallclk; return 1; /* OK, it's fine */ } @@ -3226,6 +3226,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, break; } } + chip->bdl_pos_adj = bdl_pos_adj; err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); if (err < 0) { diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 5a21985..0e3bba1 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h @@ -356,6 +356,7 @@ struct azx { /* flags */ int position_fix[2]; /* for both playback/capture streams */ + const int *bdl_pos_adj; int poll_count; unsigned int running:1; unsigned int initialized:1;