From patchwork Thu Apr 4 11:17:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 161784 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1466249jan; Thu, 4 Apr 2019 04:18:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTZTZPVfRM09nXjQAaqN60gVLN3ELgLmgyH0CuZWBXiayNH83bJq0yPtCM4EyYxHK5sw5H X-Received: by 2002:a62:2587:: with SMTP id l129mr5267771pfl.151.1554376700895; Thu, 04 Apr 2019 04:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554376700; cv=none; d=google.com; s=arc-20160816; b=rvrLqrxcwC0WsQWYSJ41OxqILMuNuud4bZg7Rq/jvUKLL3KZ/yi7/N7diac6z0Lh9M 2OIKEK0/UnIGw6p2Su4J9otnRa2DjT0+5uHhjpK59EhjZPZqGeqgEsQDx6UiS2daAPlY AZGBcdx2TkBvGb31+R8xzxucJSZQc+W+LULZvpfhSsZ7OO3FmgWJQZWJthI/OUdBDtDY 2hz/m5qIwvaqGShwtMOSkciINOO5JtQOq9BZCZe9hKekOfsAB45H1g4w0Gz9ISShZzy+ iqIaYBQBsx8Obbaa7+MWqBeReEoFC/AQ3cChRVLtQQ+Z7MkjPDwdjxujR8UXT89paQeo /qiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+G25AdD9UpKYT+FRpEdmoxxTPv+X6Dc3Bb+5yQ5rUQI=; b=bVfwW8wyU7MHKRX0nAow1JvUc67URZSFM0XlQDXpzPCfVQba3hJZNovy/fZdMpE3AW fesuiZmeGJtG5YzE9/PZ7jCohuPmtb38g5HdYk+hL27QLgMQtYETIQGF+PmP3+vTi6bJ WuvrM9zLDUpLzU0YJnXJUdGEFuaAN6BcBf+UYUMESRLE6JDmikXSIQ0w8D/HucT8NNj5 Vkkvp51cnKgU0n+XqCeoBtFr8yH9tj/solxCawA5KkEVhpUZSElnRIJn/FXxaWoDBxH8 CBT9ESih37vY+Dhm2Z0BDZGH6/j3YmRrBTsAuitDO1rj4Qvx1cFtR3aPtwd8bNvACiNf OGQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=E5iEIKYS; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l17si15719069pff.202.2019.04.04.04.18.20; Thu, 04 Apr 2019 04:18:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=E5iEIKYS; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729545AbfDDLRu (ORCPT + 7 others); Thu, 4 Apr 2019 07:17:50 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35287 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729469AbfDDLRu (ORCPT ); Thu, 4 Apr 2019 07:17:50 -0400 Received: by mail-wr1-f68.google.com with SMTP id w1so3305382wrp.2 for ; Thu, 04 Apr 2019 04:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+G25AdD9UpKYT+FRpEdmoxxTPv+X6Dc3Bb+5yQ5rUQI=; b=E5iEIKYSXouaY/d+tsB/s0MRtE3XExjw7NpnCw76gtdhv1qmhIx+POHVv7gQ4/CO9K zkteUnOKOplbTxRFZr/Pr43f+83IiBuNFxTA5KNQs0IzfH67OZo3X2QWadDDXqpHUmGo 9jieA7004kk3qvwU++oh4lH5pfpCwHFDRCV3k6K5Krl0SPNSCaNHrbopj31kGmRNsdD9 iONculrcr5Uxhyo4vzvSnBHMFdj19/Dm/+0xWqyegC4+CQfeu9UBlu9xT2N9cv0/ynG0 YQj8iBCDcpiYCqLkRzZ+V0SrSOlpna2m34xMf+tCo6krou8+rlljMzb1OoQnU4UBLKTc Go7A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+G25AdD9UpKYT+FRpEdmoxxTPv+X6Dc3Bb+5yQ5rUQI=; b=T0+204+5l39rwWDiDWBhC6AUmm8vvVDzP4REc1rbqTZoGJ5GllTWrl/4dfbLSoi6sm lVpSTp4xeg8m+qxnEuIw8HIViIYpYpvPHawb2Elnth3DFgBsgxYudaikWTLsX/vJ1fQz yzVeWA9+cAZyhJKSXlQRpptu36/HYSDbpUMtFuSrz3O8Ewpz+9/ywQ8a5XcKPHfT8cf+ V0DmGdtv/zNy9xP98L4w2T3RvP3O9P5rjU836p22Irdgb6n5VQ4FMFy6qpw1pcm01MKA kxmtCkYnRwd0ThQy0aBpMl/JyWRyQJkRr2rS0xG55hCPXTZ6doZekYGg0eQLXt+hQqot /76Q== X-Gm-Message-State: APjAAAUjAMFL/X6sokYb8nfGUXVHq0QzHYY/Z+4bnqdZ4koRclyto8Lm c8OYzSjACUayP7o3IuCDwEfGhN1HOR4= X-Received: by 2002:a5d:63c5:: with SMTP id c5mr3875543wrw.82.1554376667826; Thu, 04 Apr 2019 04:17:47 -0700 (PDT) Received: from boomer.local ([2a01:e34:eeb6:4690:106b:bae3:31ed:7561]) by smtp.googlemail.com with ESMTPSA id z23sm9024771wma.0.2019.04.04.04.17.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 04:17:47 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , Kevin Hilman , Maxime Jourdan , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 2/6] ASoC: meson: axg-fifo: add g12a support Date: Thu, 4 Apr 2019 13:17:29 +0200 Message-Id: <20190404111733.28705-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190404111733.28705-1-jbrunet@baylibre.com> References: <20190404111733.28705-1-jbrunet@baylibre.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The g12a fifos gained the ability to set the initial address of the pointer within the buffer, instead of defaulting to the buffer start address. It is not very useful to us (yet) but we need to put a copy the buffer start address in the related register for the fifo to work properly on the g12a SoC family Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-fifo.c | 34 +++++++++++++++++++++++++++++++--- sound/soc/meson/axg-fifo.h | 2 ++ 2 files changed, 33 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index 75e5e480fda2..01c1c7db2510 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c @@ -19,7 +19,7 @@ * This file implements the platform operations common to the playback and * capture frontend DAI. The logic behind this two types of fifo is very * similar but some difference exist. - * These differences the respective DAI drivers + * These differences are handled in the respective DAI drivers */ static struct snd_pcm_hardware axg_fifo_hw = { @@ -133,6 +133,23 @@ static int axg_fifo_pcm_hw_params(struct snd_pcm_substream *ss, return 0; } +static int g12a_fifo_pcm_hw_params(struct snd_pcm_substream *ss, + struct snd_pcm_hw_params *params) +{ + struct axg_fifo *fifo = axg_fifo_data(ss); + struct snd_pcm_runtime *runtime = ss->runtime; + int ret; + + ret = axg_fifo_pcm_hw_params(ss, params); + if (ret) + return ret; + + /* Set the initial memory address of the DMA */ + regmap_write(fifo->map, FIFO_INIT_ADDR, runtime->dma_addr); + + return 0; +} + static int axg_fifo_pcm_hw_free(struct snd_pcm_substream *ss) { struct axg_fifo *fifo = axg_fifo_data(ss); @@ -262,6 +279,17 @@ const struct snd_pcm_ops axg_fifo_pcm_ops = { }; EXPORT_SYMBOL_GPL(axg_fifo_pcm_ops); +const struct snd_pcm_ops g12a_fifo_pcm_ops = { + .open = axg_fifo_pcm_open, + .close = axg_fifo_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = g12a_fifo_pcm_hw_params, + .hw_free = axg_fifo_pcm_hw_free, + .pointer = axg_fifo_pcm_pointer, + .trigger = axg_fifo_pcm_trigger, +}; +EXPORT_SYMBOL_GPL(g12a_fifo_pcm_ops); + int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type) { struct snd_card *card = rtd->card->snd_card; @@ -278,7 +306,7 @@ static const struct regmap_config axg_fifo_regmap_cfg = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, - .max_register = FIFO_STATUS2, + .max_register = FIFO_INIT_ADDR, }; int axg_fifo_probe(struct platform_device *pdev) @@ -339,6 +367,6 @@ int axg_fifo_probe(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(axg_fifo_probe); -MODULE_DESCRIPTION("Amlogic AXG fifo driver"); +MODULE_DESCRIPTION("Amlogic AXG/G12A fifo driver"); MODULE_AUTHOR("Jerome Brunet "); MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/meson/axg-fifo.h b/sound/soc/meson/axg-fifo.h index d9f516cfbeda..5caf81241dfe 100644 --- a/sound/soc/meson/axg-fifo.h +++ b/sound/soc/meson/axg-fifo.h @@ -60,6 +60,7 @@ struct snd_soc_pcm_runtime; #define FIFO_STATUS1 0x14 #define STATUS1_INT_STS(x) ((x) << 0) #define FIFO_STATUS2 0x18 +#define FIFO_INIT_ADDR 0x24 struct axg_fifo { struct regmap *map; @@ -74,6 +75,7 @@ struct axg_fifo_match_data { }; extern const struct snd_pcm_ops axg_fifo_pcm_ops; +extern const struct snd_pcm_ops g12a_fifo_pcm_ops; int axg_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd, unsigned int type); int axg_fifo_probe(struct platform_device *pdev);