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); From patchwork Thu Apr 4 11:17:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 161781 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1465904jan; Thu, 4 Apr 2019 04:18:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwT9idmYFET8b01OXzQ3KkW6fumyNckkmkyqdeJ3gNDN98oxpz8nKMgBSYkQ1OPYFBq4S3j X-Received: by 2002:aa7:80c8:: with SMTP id a8mr5197036pfn.193.1554376680123; Thu, 04 Apr 2019 04:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554376680; cv=none; d=google.com; s=arc-20160816; b=0AIz5iUINfdHEfz2FuKmuMNn4ZGl5u7noz2wFNE3Pv6ZmyGtVdAhcrvnV4PeqMre6b 75fao2NKaRhAVFpJry3EatViqX+I3jKpMKqD6WOC1ghy0HjLtL3af6EeFg5thX7viO21 kyexbGcfxJZjWog3N9dfMt62v/JmQTR/Usf33FPv248k7GqDjUB4SQ8Iw5jmaot9ZkB0 /Un0tZFC0uTvjVqi4p4NGiVUVpI107ps2/a4b4hWYwyYqleQHcPj2NxPMU4F/fWxmPtn yxVKyR2qekuQK4bRb6qolU1y5yGPNn619R/Jpo/3AktKVxgazMdy4eFA8jyD/3oMtoK+ d59w== 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=njYuZs0QQDpdwULWDM30jmxjNG8Fc5VRgpPkmqI8/tg=; b=GQEhPloG8d3yIemPJ3GZ3gYccvWFu1OiC7WPsL1fi8lt2RObFuz70rr3+Ew6Fg4o7Z A2RGkQLqzfOqLrPdyLdfqYqxfnxAYAd/5Bb66HtZ8MpZQRctPA8ywKPmKvMTie4NgwJ/ h9i8klunMmxjV9kTrpPa5mjUhzSlsu2R+u4vHKl0rvAN3qckeWlxxEQbDmz5tZYBiWZB EYUtxZ/eNUyHzjHD9uz+mT6YryRsCIEtdpUyRSZaINf5PmZk1+Xzxqj+iGjR4lPGk2Mf ew4c/Dj1qRMzTPe4zg8vmC5C9NFzuAWg+2xXu5DFZlIu8KE7HglaX48tDAVD17H/kKBu ALHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="0S+5YM/0"; 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 g59si16847286plb.281.2019.04.04.04.17.59; Thu, 04 Apr 2019 04:18:00 -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="0S+5YM/0"; 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 S1729687AbfDDLR4 (ORCPT + 7 others); Thu, 4 Apr 2019 07:17:56 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37718 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729641AbfDDLRy (ORCPT ); Thu, 4 Apr 2019 07:17:54 -0400 Received: by mail-wr1-f66.google.com with SMTP id w10so3290151wrm.4 for ; Thu, 04 Apr 2019 04:17:53 -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=njYuZs0QQDpdwULWDM30jmxjNG8Fc5VRgpPkmqI8/tg=; b=0S+5YM/0pFsWqe0GLi2cBiX4o0bic1u2T7zVWJIgG1n5M6BB03QtaDEjJWEm7Vx2pR EcgDxDSrSSVf01WXzWAKTcGRAXamlJM4gIyRYY5INah/m9lF9zXv+NRVlQTfvev/5SEq Uu1zh2W9FXWMMAw2PDw1+qqkvMYxa14qEaj9oBtz23mNSCvOTRlbj1EtA879jt/isfwu TGpStKvevelZrysBcRYnvKBrcnw5B0w2PBv4xU0EmVsNGFBB+PmH2hGgXZl5X47PmZ8Z FT5fEpEXpu5GBk9s8d27wX1e6D0oFDsjKmUB85i36ZxkMRGpcPMuHBcqS/Wz1bBP9qH9 G/CA== 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=njYuZs0QQDpdwULWDM30jmxjNG8Fc5VRgpPkmqI8/tg=; b=EL96nUhkfQNEbech65qf7hWCeYa3S888v7Q6r2kOeVQNVtVuLHSvhnxJuZV25pE1Ag KCw0OfXbOkdncxAZuhTNZ6p4n0x6TbSTRkKX0Nw+FWJOfmbHtaG5OhNRsQG4V0xXhQ6G jYuvicWEtgyhmg/c1CWUTIQR7e0vryE+O2sXbvKctl+24Ul9Q2GeEdWiV9Qk9ES1BB4p pI80+PUixArAIpgBiw5KUIz302FqdK6HweyyEqkIw6rlX8MlJjaDev+VPqt+xCiNM1CB rsTGbfYnsyi1vzlfuJQz6ijSYKqqNHb7+WHr29dzoL/JlBHdVDz0FXXBqDqmexA5chQN Ogcg== X-Gm-Message-State: APjAAAVpP8R5xh/QQVUsgaUwV/S+mB9fERxj8PsjBx8KJ6NPagFxtdtn ay3AXW5luOPw5vPvKJfj6tcqFQ== X-Received: by 2002:adf:f7c2:: with SMTP id a2mr1681722wrq.242.1554376672697; Thu, 04 Apr 2019 04:17:52 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Apr 2019 04:17:51 -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 5/6] ASoC: meson: axg-tdm-formatter: rework quirks settings Date: Thu, 4 Apr 2019 13:17:32 +0200 Message-Id: <20190404111733.28705-6-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 tdmout requires a different signal skew offset than the axg. With this change, the skew offset is added as a parameter of the tdm formatters to prepare the addition of the g12a support. Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-tdm-formatter.c | 6 ++++-- sound/soc/meson/axg-tdm-formatter.h | 11 +++++++++-- sound/soc/meson/axg-tdmin.c | 16 +++++++++++----- sound/soc/meson/axg-tdmout.c | 16 +++++++++++----- 4 files changed, 35 insertions(+), 14 deletions(-) -- 2.20.1 diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c index 43e390f9358a..0c6cce5c5773 100644 --- a/sound/soc/meson/axg-tdm-formatter.c +++ b/sound/soc/meson/axg-tdm-formatter.c @@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks); static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) { struct axg_tdm_stream *ts = formatter->stream; - bool invert = formatter->drv->invert_sclk; + bool invert = formatter->drv->quirks->invert_sclk; int ret; /* Do nothing if the formatter is already enabled */ @@ -85,7 +85,9 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) return ret; /* Setup the stream parameter in the formatter */ - ret = formatter->drv->ops->prepare(formatter->map, formatter->stream); + ret = formatter->drv->ops->prepare(formatter->map, + formatter->drv->quirks, + formatter->stream); if (ret) return ret; diff --git a/sound/soc/meson/axg-tdm-formatter.h b/sound/soc/meson/axg-tdm-formatter.h index cf947caf3cb1..9ef98e955cb2 100644 --- a/sound/soc/meson/axg-tdm-formatter.h +++ b/sound/soc/meson/axg-tdm-formatter.h @@ -14,18 +14,25 @@ struct regmap; struct snd_soc_dapm_widget; struct snd_kcontrol; +struct axg_tdm_formatter_hw { + unsigned int skew_offset; + bool invert_sclk; +}; + struct axg_tdm_formatter_ops { struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w); void (*enable)(struct regmap *map); void (*disable)(struct regmap *map); - int (*prepare)(struct regmap *map, struct axg_tdm_stream *ts); + int (*prepare)(struct regmap *map, + const struct axg_tdm_formatter_hw *quirks, + struct axg_tdm_stream *ts); }; struct axg_tdm_formatter_driver { const struct snd_soc_component_driver *component_drv; const struct regmap_config *regmap_cfg; const struct axg_tdm_formatter_ops *ops; - bool invert_sclk; + const struct axg_tdm_formatter_hw *quirks; }; int axg_tdm_formatter_set_channel_masks(struct regmap *map, diff --git a/sound/soc/meson/axg-tdmin.c b/sound/soc/meson/axg-tdmin.c index bbac44c81688..a790f925a4ef 100644 --- a/sound/soc/meson/axg-tdmin.c +++ b/sound/soc/meson/axg-tdmin.c @@ -107,21 +107,22 @@ static void axg_tdmin_disable(struct regmap *map) regmap_update_bits(map, TDMIN_CTRL, TDMIN_CTRL_ENABLE, 0); } -static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts) +static int axg_tdmin_prepare(struct regmap *map, + const struct axg_tdm_formatter_hw *quirks, + struct axg_tdm_stream *ts) { - unsigned int val = 0; + unsigned int val, skew = quirks->skew_offset; /* Set stream skew */ switch (ts->iface->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_DSP_A: - val |= TDMIN_CTRL_IN_BIT_SKEW(3); + skew += 1; break; case SND_SOC_DAIFMT_LEFT_J: case SND_SOC_DAIFMT_RIGHT_J: case SND_SOC_DAIFMT_DSP_B: - val = TDMIN_CTRL_IN_BIT_SKEW(2); break; default: @@ -130,6 +131,8 @@ static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts) return -EINVAL; } + val = TDMIN_CTRL_IN_BIT_SKEW(skew); + /* Set stream format mode */ switch (ts->iface->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: @@ -204,7 +207,10 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = { .component_drv = &axg_tdmin_component_drv, .regmap_cfg = &axg_tdmin_regmap_cfg, .ops = &axg_tdmin_ops, - .invert_sclk = false, + .quirks = &(const struct axg_tdm_formatter_hw) { + .invert_sclk = false, + .skew_offset = 2, + }, }; static const struct of_device_id axg_tdmin_of_match[] = { diff --git a/sound/soc/meson/axg-tdmout.c b/sound/soc/meson/axg-tdmout.c index f73368ee1088..3984818e2a7c 100644 --- a/sound/soc/meson/axg-tdmout.c +++ b/sound/soc/meson/axg-tdmout.c @@ -124,21 +124,22 @@ static void axg_tdmout_disable(struct regmap *map) regmap_update_bits(map, TDMOUT_CTRL0, TDMOUT_CTRL0_ENABLE, 0); } -static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts) +static int axg_tdmout_prepare(struct regmap *map, + const struct axg_tdm_formatter_hw *quirks, + struct axg_tdm_stream *ts) { - unsigned int val = 0; + unsigned int val, skew = quirks->skew_offset; /* Set the stream skew */ switch (ts->iface->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_DSP_A: - val |= TDMOUT_CTRL0_INIT_BITNUM(1); break; case SND_SOC_DAIFMT_LEFT_J: case SND_SOC_DAIFMT_RIGHT_J: case SND_SOC_DAIFMT_DSP_B: - val |= TDMOUT_CTRL0_INIT_BITNUM(2); + skew += 1; break; default: @@ -147,6 +148,8 @@ static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts) return -EINVAL; } + val = TDMOUT_CTRL0_INIT_BITNUM(skew); + /* Set the slot width */ val |= TDMOUT_CTRL0_BITNUM(ts->iface->slot_width - 1); @@ -234,7 +237,10 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { .component_drv = &axg_tdmout_component_drv, .regmap_cfg = &axg_tdmout_regmap_cfg, .ops = &axg_tdmout_ops, - .invert_sclk = true, + .quirks = &(const struct axg_tdm_formatter_hw) { + .invert_sclk = true, + .skew_offset = 1, + }, }; static const struct of_device_id axg_tdmout_of_match[] = {