From patchwork Fri Feb 28 23:41:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3745401 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 39E30BF13A for ; Fri, 28 Feb 2014 23:47:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F605202A7 for ; Fri, 28 Feb 2014 23:47:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 02062201BA for ; Fri, 28 Feb 2014 23:47:11 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07D77265DAB; Sat, 1 Mar 2014 00:47:10 +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 0E4F8265A5A; Sat, 1 Mar 2014 00:43:11 +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 4EBA5265A32; Sat, 1 Mar 2014 00:43:09 +0100 (CET) Received: from mail-qa0-f73.google.com (mail-qa0-f73.google.com [209.85.216.73]) by alsa0.perex.cz (Postfix) with ESMTP id 9AD2B2659B4 for ; Sat, 1 Mar 2014 00:42:52 +0100 (CET) Received: by mail-qa0-f73.google.com with SMTP id f11so228198qae.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=YIG+Y9ZN8jnXlP1SF1e5GCEPCY3EQ+TA/rbX/YSjLnc=; b=XfsmyoWOxCXwIyjwJFTbIlSZwK0Gm2OgPWDNxYUX3KyzlQ5njib+VmGBjDs+ZRPAvo IXwZmTYLNtDwGlbrzESIyhZHgXKhezLPPVgIh7MOH4bI3/4bkdaYRI5G3Qvtl5Go4wwp n39RgBPWt4t7czr14n20GAO9fJYCsDWXn75SCcvSm6wwf0weDTQaDVMkFFgN2F4GrhcU 2xrRs8vtmQnBivGyrdW3D07Rxsz7o7nKfMz1O372Voi3IEiw64kxfyerdaIpWMicgt1T xuVK4F7GZTjGSbRmXLHBrX3wZeO+KaKkWp7c2xvQDDEYCk15gSANNoMXpu83D8QjFbCY z5YA== X-Gm-Message-State: ALoCoQlQONWZOmiYx0IKuN/iLJ6ozkuQSLcEDMmDcQRQ0RBtV/JpWsKQ+bgCFG6KlhCehkWhwtiAU1LYjiTRUkX5bickgZsrgwuPqDPD0Nw2q4XJHCi17JKisgQunDjlmKt2a8kLrVE7B5AyQAL3OI7dT2CcE+RYiMQNe1cUUydlAFTGsiyzSzzXtMyku5WlkOafrlCQ+MalhflajH67awNlJvgtEZz3uZhLtXKhP/6crdoVRjfcCew= X-Received: by 10.236.145.34 with SMTP id o22mr2328623yhj.22.1393630971488; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id x29si545910yha.0.2014.02.28.15.42.51 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 5509331C1D8; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id 063CC1806B1; 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:21 -0800 Message-Id: <1393630893-29010-11-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 10/22] ALSA: hda - Add pcm_mmap_prepare op. 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 Adding this op allows the X86 specific mmap operation to help in hda_intel without needing a CONFIG_X86 in future non-PCI hda drivers. Signed-off-by: Dylan Reid --- sound/pci/hda/hda_intel.c | 20 ++++++++++++++------ sound/pci/hda/hda_priv.h | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index fa3a04c..aa8b765 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2190,19 +2190,15 @@ static void azx_clear_irq_pending(struct azx *chip) spin_unlock_irq(&chip->reg_lock); } -#ifdef CONFIG_X86 static int azx_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *area) { struct azx_pcm *apcm = snd_pcm_substream_chip(substream); struct azx *chip = apcm->chip; - if (!azx_snoop(chip)) - area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); + if (chip->ops->pcm_mmap_prepare) + chip->ops->pcm_mmap_prepare(substream, area); return snd_pcm_lib_default_mmap(substream, area); } -#else -#define azx_pcm_mmap NULL -#endif static struct snd_pcm_ops azx_pcm_ops = { .open = azx_pcm_open, @@ -3508,6 +3504,17 @@ static int substream_free_pages(struct azx *chip, return snd_pcm_lib_free_pages(substream); } +static void pcm_mmap_prepare(struct snd_pcm_substream *substream, + struct vm_area_struct *area) +{ +#ifdef CONFIG_X86 + struct azx_pcm *apcm = snd_pcm_substream_chip(substream); + struct azx *chip = apcm->chip; + if (!azx_snoop(chip)) + area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); +#endif +} + static const struct hda_controller_ops pci_hda_ops = { .writel = pci_azx_writel, .readl = pci_azx_readl, @@ -3520,6 +3527,7 @@ static const struct hda_controller_ops pci_hda_ops = { .dma_free_pages = dma_free_pages, .substream_alloc_pages = substream_alloc_pages, .substream_free_pages = substream_free_pages, + .pcm_mmap_prepare = pcm_mmap_prepare, }; static int azx_probe(struct pci_dev *pci, diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 10bcec1..edbe2eb 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h @@ -309,6 +309,8 @@ struct hda_controller_ops { size_t size); int (*substream_free_pages)(struct azx *chip, struct snd_pcm_substream *substream); + void (*pcm_mmap_prepare)(struct snd_pcm_substream *substream, + struct vm_area_struct *area); }; struct azx_pcm {