From patchwork Fri Feb 28 23:41:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3745251 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 E810ABF13A for ; Fri, 28 Feb 2014 23:44:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0BEC20263 for ; Fri, 28 Feb 2014 23:44:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id AB4162024D for ; Fri, 28 Feb 2014 23:44:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C757A265CFA; Sat, 1 Mar 2014 00:44:33 +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, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 26B7A265A08; Sat, 1 Mar 2014 00:43:04 +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 C631F265A10; Sat, 1 Mar 2014 00:43:02 +0100 (CET) Received: from mail-oa0-f73.google.com (mail-oa0-f73.google.com [209.85.219.73]) by alsa0.perex.cz (Postfix) with ESMTP id 3926F26598A for ; Sat, 1 Mar 2014 00:42:52 +0100 (CET) Received: by mail-oa0-f73.google.com with SMTP id n16so60830oag.2 for ; Fri, 28 Feb 2014 15:42:51 -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=Oc7HzC42RveC8iZfdoIBrh9sagcP1RNSkwmqJIuct60=; b=QXDiou2mGVH3obSjVfyi/d7JfiAMvIdvp3GgkIiDXGdMnKOmkcjUPmSNzfUhl6pINU JN85SRjYwT7mUsvtAyyfWSkiDe8Sbx3BpYQxup/gaUYL8LkKXHOBndYYyEofwDgeW5H5 RTbyB0zpkwylwcr4Oo/6pSwzzwAsAt59YYWiqEy5+6AGm0ia1UPtfpWubMm4bS86LGRC uNU6DnGC0g6X6t0gnL4YJ8Hk7EKiXuYR7QNRGocgc61wwUZnHhTPqndAgwvflBeP8Sqx 6OSY0Iv9vTpJlYgYC7Yc7mYir++qiDCPNlXNZi2wfU66n18LenxGzV3Omk9UMo3Y5WD2 bBxQ== X-Gm-Message-State: ALoCoQkvnsifj/iH/wAqneseoesfJQI3rAA2r1VUeSyHWEcov34PR3Wr4ilXh+wG5U3XzBiTuGIi+NSwal8U75KgRL6BMzz2j5FTaHVRzC6t/CUPbPMJhD1P2KVEQN9wZMO8MdBffgNOtcvDQrhfriNLG63ujVSOosY8BzYSi8ClY6Mrm33ObbiqDjniTbFGISXYzlumh0SyQqaXqy4eWrEEZHLlhUP7uxFI5c9KNAV7voMHcEM6IM4= X-Received: by 10.182.104.200 with SMTP id gg8mr8002368obb.45.1393630970891; Fri, 28 Feb 2014 15:42:50 -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 u30si545512yhk.1.2014.02.28.15.42.50 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Feb 2014 15:42:50 -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 B55DE5A428B; Fri, 28 Feb 2014 15:42:50 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id 57EE5180D8D; Fri, 28 Feb 2014 15:42:50 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Fri, 28 Feb 2014 15:41:14 -0800 Message-Id: <1393630893-29010-4-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393630893-29010-1-git-send-email-dgreid@chromium.org> References: <1393630893-29010-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFCv2 03/22] 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 | 12 ++++++++---- sound/pci/hda/hda_priv.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 45718fb..9fcd1d1 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1147,7 +1147,7 @@ static int azx_setup_periods(struct azx *chip, { u32 *bdl; int i, ofs, periods, period_bytes; - int pos_adj; + int pos_adj = 0; /* reset BDL address */ azx_sd_writel(chip, azx_dev, SD_BDLPL, 0); @@ -1160,7 +1160,9 @@ 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]; + + if (chip->bdl_pos_adj) + 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; @@ -1173,7 +1175,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]); + pos_adj); pos_adj = 0; } else { ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), @@ -1184,6 +1186,7 @@ static int azx_setup_periods(struct azx *chip, } } else pos_adj = 0; + for (i = 0; i < periods; i++) { if (i == periods - 1 && pos_adj) ofs = setup_bdle(chip, snd_pcm_get_dma_buf(substream), @@ -2143,7 +2146,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 */ } @@ -3207,6 +3210,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 6d082d6..17afe90 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h @@ -357,6 +357,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;