From patchwork Mon Jan 11 15:17:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 59549 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2172957lbb; Mon, 11 Jan 2016 07:17:51 -0800 (PST) X-Received: by 10.66.230.201 with SMTP id ta9mr18098452pac.52.1452525471083; Mon, 11 Jan 2016 07:17:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si2931234pas.67.2016.01.11.07.17.50; Mon, 11 Jan 2016 07:17:51 -0800 (PST) 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; 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; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760660AbcAKPRr (ORCPT + 29 others); Mon, 11 Jan 2016 10:17:47 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:33840 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760647AbcAKPRp (ORCPT ); Mon, 11 Jan 2016 10:17:45 -0500 Received: by mail-wm0-f44.google.com with SMTP id u188so218591373wmu.1 for ; Mon, 11 Jan 2016 07:17:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=j4GeYpKI4qt/PINamjk+WFPiK0k4SsArmjaNjW7jnaA=; b=eeT06Keen0SNYkftcduFKlq3jWALAiIM8Q43wM78eLWNiRg1QpiztywV4pXvF+7Lwe 6KOsxIWG92UCGAwG/lb0rZzyO58a1gehEE0hD+Ei0E/MHeLHtSBuQSbmx7eWFJI8gbWb ioEWWP+FO2rKa1SEx6bgf0dkScFiIHQZH0U10= 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; bh=j4GeYpKI4qt/PINamjk+WFPiK0k4SsArmjaNjW7jnaA=; b=iYlWwuhtP1OsStliSXTbU2DF0ITshe8HcEbW8d8VQufVv88VRjpXxIM+QqWHLfQez5 4gMGcwa43PGDTw08NZz/G3vtRigSDWLt+3CaLcWQGIaRCGWLpGCS9+hM/SRx7ePhD9hv a/QjLxQl9aBYrovFluGWpJAvR8S1Rexo+vRxJEw3xpxOaj1O4B3Fg9jYgA3PQ3BaMrWX 8PaI86bATx+EQ7UXTr0PbbOaDwYfL/7VDsArPiWVxM7r2sk8tA4xqp9MwEqUwPl0qfzE AvmQBRjEXUhatt0YqnbEdsNne3UAYN7kiP8NXlzGixUnDcVwOMhKFrBMddF8jN3/Gn0V /+Pg== X-Gm-Message-State: ALoCoQkYY9/uiIVzKtVZPdCgXzxBomUrCihtSqCCVhcFCo5kV0Li5ES0bOvt1KzfUVeH0bwWZIgYjnRtiAab1Q4DXm52C3RRBA== X-Received: by 10.28.1.210 with SMTP id 201mr14630978wmb.90.1452525463762; Mon, 11 Jan 2016 07:17:43 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id e9sm2945477wja.25.2016.01.11.07.17.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 07:17:42 -0800 (PST) From: Srinivas Kandagatla To: Mark Brown , alsa-devel@alsaproject.org Cc: Patrick Lai , Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] ASoC: qcom: use correct device pointer in dma allocation Date: Mon, 11 Jan 2016 15:17:23 +0000 Message-Id: <1452525443-31521-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dev pointer in struct snd_soc_pcm_runtime does not have dma_ops set. In v4.4 kernel dma_ops would end up pointing to dummy_dma_ops in such cases. So attempting to use such device in allocating coherent memory on aarch64 would fail. According to commit 1dccb598df549d892b6450c261da54cdd7af44b4 ("arm64: simplify dma_get_ops") The current behavior of dma_get_ops is to fall back to the global dma_ops when a device has not set its own dma_ops, but only for DT based systems. So, this patch fixes the driver to use correct device pointer while allocating coherent memory, and also deletes un-necessary dma_mask setup on soc_runtime->dev. Without this patch lpass driver would fail with below log: ... [ 6.541542] ADV7533: lpass_platform_alloc_buffer: Could not allocate DMA buffer [ 6.541914] apq8016-lpass-cpu 7708000.lpass-cpu: ASoC: pcm constructor failed: -12 [ 6.548216] qcom-apq8016-sbc 7702000.sound: ASoC: can't create pcm ADV7533 :-12 [ 6.555581] qcom-apq8016-sbc 7702000.sound: ASoC: failed to instantiate card -12 [ 6.566072] qcom-apq8016-sbc: probe of 7702000.sound failed with error -12 ... Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/lpass-platform.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 1.9.1 diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index 79688aa..4aeb8e1 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -440,18 +440,18 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data) } static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream, - struct snd_soc_pcm_runtime *soc_runtime) + struct snd_soc_pcm_runtime *rt) { struct snd_dma_buffer *buf = &substream->dma_buffer; size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; buf->dev.type = SNDRV_DMA_TYPE_DEV; - buf->dev.dev = soc_runtime->dev; + buf->dev.dev = rt->platform->dev; buf->private_data = NULL; - buf->area = dma_alloc_coherent(soc_runtime->dev, size, &buf->addr, + buf->area = dma_alloc_coherent(rt->platform->dev, size, &buf->addr, GFP_KERNEL); if (!buf->area) { - dev_err(soc_runtime->dev, "%s: Could not allocate DMA buffer\n", + dev_err(rt->platform->dev, "%s: Could not allocate DMA buffer\n", __func__); return -ENOMEM; } @@ -461,12 +461,12 @@ static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream, } static void lpass_platform_free_buffer(struct snd_pcm_substream *substream, - struct snd_soc_pcm_runtime *soc_runtime) + struct snd_soc_pcm_runtime *rt) { struct snd_dma_buffer *buf = &substream->dma_buffer; if (buf->area) { - dma_free_coherent(soc_runtime->dev, buf->bytes, buf->area, + dma_free_coherent(rt->dev, buf->bytes, buf->area, buf->addr); } buf->area = NULL; @@ -499,9 +499,6 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) snd_soc_pcm_set_drvdata(soc_runtime, data); - soc_runtime->dev->coherent_dma_mask = DMA_BIT_MASK(32); - soc_runtime->dev->dma_mask = &soc_runtime->dev->coherent_dma_mask; - ret = lpass_platform_alloc_buffer(substream, soc_runtime); if (ret) return ret;