Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp123490yba; Thu, 11 Apr 2019 23:41:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOk8+EtMYcFJ2Xui/s03uMI1hj5Ks7v0MdNM9j0Ngn0/gvroI9oTHyoOwUIKq3DUXb7Mhr X-Received: by 2002:a63:cc0d:: with SMTP id x13mr16351421pgf.280.1555051279624; Thu, 11 Apr 2019 23:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555051279; cv=none; d=google.com; s=arc-20160816; b=RSbnUgS9cyKSOrXk/fQd1ZYNWfnxFIQvecQCIlGhMZmRrj4CNM5qW3F6O6W91ypvti 9/sGtEHyYWG8g+VseqOjY84fi73DMH+xudG+RZ3lTG6cakR5bQGvcrD363uanmvxwMBv jGs1ab9kpzEN8d+cTiQENmJL4TCNu0cUU1zdHJ2A8MBcltWrSKkLzrp+pgLdKyStBmLN 9O7V91vrI9hOVCN+tpccT2a4f1vQM9AW3z5+pS1EGRW0tEKKvCBg+IH8RGhDPlhkcugb aJ51GIMgPOQkV7b0omfqWdTR8PLAd00ML20uQpEzyPp8Evp2HUYAZTau4qZr54Dtz3xX GxiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=y+bMKdHi3SWeYs4dZvhMtk+AUKH/ZBVC2n8ty7LnNMw=; b=t8q+Gd2W57wD5Z+ez6OfFHZ7qPkUqNCui3iGJCDTENUhhPeqg6BwqrWuiJWOVUn8rZ BGEw0Z1DBiI2WR/uTfFi56GKhCVijeObuhZe+1z5jHfKSJwwgCvx0uiiXcSb5WDmCicf skiyDfUgawJS9ibJI7SK9r7EzJBIqROiyERhFuQK6YbXTzQEtbia+azD43AnouVjO1W7 DBCFLaLBSlbXUhLOoP+5MxnoD39pRL385x+/XPvTazrrtSA0m8ip7fhddpK+LBFfA+YQ YONSIA4c9E3uD8F+hzQCHj4F/k14BF64d/gA5Hjvju2om+hzX94/B5Sf0Ltrn9fgjErP TSJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="S/EzBrKj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h125si36796990pgc.290.2019.04.11.23.41.03; Thu, 11 Apr 2019 23:41:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="S/EzBrKj"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbfDLGk1 (ORCPT + 99 others); Fri, 12 Apr 2019 02:40:27 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36257 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfDLGk1 (ORCPT ); Fri, 12 Apr 2019 02:40:27 -0400 Received: by mail-pl1-f194.google.com with SMTP id ck15so4621010plb.3 for ; Thu, 11 Apr 2019 23:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=y+bMKdHi3SWeYs4dZvhMtk+AUKH/ZBVC2n8ty7LnNMw=; b=S/EzBrKjJJKgsluKYBFxQPiOpxxW782zUguX1a5Zvg0lojmCS9Tfce6kjL47U0FH8k zRO4WK5f7Bn/3J2Glth5uD5LRQemRVU5B19z9+s2U8GdF9xtmbp0WlF2KUBWVopieMkp 0t2yz1wMI6jyS/x1Ol+9doChihWKwI+PS9Tdl3sBGlsFXtA2GDjkmL1l9XHue6WF/LQX EMd04VChvZbzYs2hUr6KQYaZyZXLgNcoIUuZvgsmTokc/kpKNjSYXCzzRKKJEVIomSpM EOIfD1x65D9iyLpoRqu9bvMPxZ0q388GXgFFRyHnll5H2NAgJFuexZGHYy2aeNHZdPlI 9ALQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y+bMKdHi3SWeYs4dZvhMtk+AUKH/ZBVC2n8ty7LnNMw=; b=N0sgDf5Zm6inOMDFNxII2mstCF9wcemy2xtMkro7dYqSG+9y7yL1r2rS0yg1a0SiKZ Y8/b3qJwMsQmhkZ7nqIX9uB+E3kh+sVRVbhkce3t5PLIIFmB7oEYIR5l/eemWJlggC9C djVJIA1T1mnSltY6+iyPFrjxTgHxfNOkDhPjk5NCfjv35bii/xyqR8KNVQmzadgmVBx1 XhOucQSr5tvMzbdou86KJHMRRZzAwp9mc1iiKr96Gc39TnHXHfodQfSAUsIxvlR+Eksu umvusIKIlMjsHHAyJlBBekojJFVDmXTO4BkqUqUX7LSNOkwTHZ1DFu1qTL7SXjvGxtGO wUOw== X-Gm-Message-State: APjAAAW3iYXVgxp/wesELY6kj3IN9yPwoRhV+gCuIqLoqU2kAFEb98X3 jhCKDU3Aibley/BB6YN6MgW7llMaPc4= X-Received: by 2002:a17:902:b089:: with SMTP id p9mr30161989plr.185.1555051226410; Thu, 11 Apr 2019 23:40:26 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id h65sm100553081pfd.108.2019.04.11.23.40.23 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Apr 2019 23:40:25 -0700 (PDT) From: Baolin Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, baolin.wang@linaro.org, orsonzhai@gmail.com, zhang.lyra@gmail.com Subject: [PATCH] ASoC: sprd: Add reserved DMA memory support Date: Fri, 12 Apr 2019 14:40:17 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For Spreadtrum audio platform driver, it need allocate a larger DMA buffer dynamically to copy audio data between userspace and kernel space, but that will increase the risk of memory allocation failure especially the system is under heavy load situation. To make sure the audio can work in this scenario, we usually reserve one region of memory to be used as a shared pool of DMA buffers for the platform component. So add of_reserved_mem_device_init_by_idx() function to initialize the shared pool of DMA buffers to be used by the platform component. Signed-off-by: Baolin Wang --- sound/soc/sprd/sprd-pcm-dma.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c index 9be6d4b..d38ebbb 100644 --- a/sound/soc/sprd/sprd-pcm-dma.c +++ b/sound/soc/sprd/sprd-pcm-dma.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -530,8 +531,14 @@ static void sprd_pcm_free(struct snd_pcm *pcm) static int sprd_soc_platform_probe(struct platform_device *pdev) { + struct device_node *np = pdev->dev.of_node; int ret; + ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0); + if (ret) + dev_warn(&pdev->dev, + "no reserved DMA memory for audio platform device\n"); + ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component, NULL, 0); if (ret) -- 1.7.9.5