From: Sugar Zhang <sugar.zhang@rock-chips.com>
To: broonie@kernel.org, heiko@sntech.de
Cc: linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
alsa-devel@alsa-project.org,
Sugar Zhang <sugar.zhang@rock-chips.com>
Subject: [PATCH 13/15] ASoC: rockchip: i2s: Add support for frame inversion
Date: Mon, 23 Aug 2021 18:54:34 +0800 [thread overview]
Message-ID: <1629716076-21465-4-git-send-email-sugar.zhang@rock-chips.com> (raw)
In-Reply-To: <1629715710-21137-1-git-send-email-sugar.zhang@rock-chips.com>
This patch adds support for frame inversion.
Change-Id: Ic77122501224cec45200ae64416745a82fb67d76
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---
sound/soc/rockchip/rockchip_i2s.c | 20 +++++++++++++++++---
sound/soc/rockchip/rockchip_i2s.h | 10 ++++++----
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index a0f2778..6ccb62e 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -233,13 +233,27 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
regmap_update_bits(i2s->regmap, I2S_CKR, mask, val);
- mask = I2S_CKR_CKP_MASK;
+ mask = I2S_CKR_CKP_MASK | I2S_CKR_TLP_MASK | I2S_CKR_RLP_MASK;
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
- val = I2S_CKR_CKP_NEG;
+ val = I2S_CKR_CKP_NORMAL |
+ I2S_CKR_TLP_NORMAL |
+ I2S_CKR_RLP_NORMAL;
+ break;
+ case SND_SOC_DAIFMT_NB_IF:
+ val = I2S_CKR_CKP_NORMAL |
+ I2S_CKR_TLP_INVERTED |
+ I2S_CKR_RLP_INVERTED;
break;
case SND_SOC_DAIFMT_IB_NF:
- val = I2S_CKR_CKP_POS;
+ val = I2S_CKR_CKP_INVERTED |
+ I2S_CKR_TLP_NORMAL |
+ I2S_CKR_RLP_NORMAL;
+ break;
+ case SND_SOC_DAIFMT_IB_IF:
+ val = I2S_CKR_CKP_INVERTED |
+ I2S_CKR_TLP_INVERTED |
+ I2S_CKR_RLP_INVERTED;
break;
default:
ret = -EINVAL;
diff --git a/sound/soc/rockchip/rockchip_i2s.h b/sound/soc/rockchip/rockchip_i2s.h
index fcaae24..251851b 100644
--- a/sound/soc/rockchip/rockchip_i2s.h
+++ b/sound/soc/rockchip/rockchip_i2s.h
@@ -88,15 +88,17 @@
#define I2S_CKR_MSS_SLAVE (1 << I2S_CKR_MSS_SHIFT)
#define I2S_CKR_MSS_MASK (1 << I2S_CKR_MSS_SHIFT)
#define I2S_CKR_CKP_SHIFT 26
-#define I2S_CKR_CKP_NEG (0 << I2S_CKR_CKP_SHIFT)
-#define I2S_CKR_CKP_POS (1 << I2S_CKR_CKP_SHIFT)
+#define I2S_CKR_CKP_NORMAL (0 << I2S_CKR_CKP_SHIFT)
+#define I2S_CKR_CKP_INVERTED (1 << I2S_CKR_CKP_SHIFT)
#define I2S_CKR_CKP_MASK (1 << I2S_CKR_CKP_SHIFT)
#define I2S_CKR_RLP_SHIFT 25
#define I2S_CKR_RLP_NORMAL (0 << I2S_CKR_RLP_SHIFT)
-#define I2S_CKR_RLP_OPPSITE (1 << I2S_CKR_RLP_SHIFT)
+#define I2S_CKR_RLP_INVERTED (1 << I2S_CKR_RLP_SHIFT)
+#define I2S_CKR_RLP_MASK (1 << I2S_CKR_RLP_SHIFT)
#define I2S_CKR_TLP_SHIFT 24
#define I2S_CKR_TLP_NORMAL (0 << I2S_CKR_TLP_SHIFT)
-#define I2S_CKR_TLP_OPPSITE (1 << I2S_CKR_TLP_SHIFT)
+#define I2S_CKR_TLP_INVERTED (1 << I2S_CKR_TLP_SHIFT)
+#define I2S_CKR_TLP_MASK (1 << I2S_CKR_TLP_SHIFT)
#define I2S_CKR_MDIV_SHIFT 16
#define I2S_CKR_MDIV(x) ((x - 1) << I2S_CKR_MDIV_SHIFT)
#define I2S_CKR_MDIV_MASK (0xff << I2S_CKR_MDIV_SHIFT)
--
2.7.4
next prev parent reply other threads:[~2021-08-23 10:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 10:48 [PATCH v1 0/15] Patches to update for rockchip i2s Sugar Zhang
2021-08-23 10:53 ` [PATCH 05/15] ASoC: rockchip: i2s: Fix concurrency between tx/rx Sugar Zhang
2021-08-23 10:53 ` [PATCH 06/15] ASoC: rockchip: i2s: Reset the controller if soft reset failed Sugar Zhang
2021-08-23 10:53 ` [PATCH 07/15] ASoC: dt-bindings: rockchip: Document reset property for i2s Sugar Zhang
2021-08-23 10:53 ` [PATCH 08/15] ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B Sugar Zhang
2021-08-23 10:53 ` [PATCH 09/15] ASoC: rockchip: i2s: Add property to specify play/cap capability Sugar Zhang
2021-08-23 10:54 ` [PATCH 10/15] ASoC: dt-bindings: rockchip: i2s: Document property for playback/capture Sugar Zhang
2021-08-23 10:54 ` [PATCH 11/15] ASoC: rockchip: i2s: Add compatible for more SoCs Sugar Zhang
2021-08-23 10:54 ` [PATCH 12/15] ASoC: dt-bindings: rockchip: Add compatible strings " Sugar Zhang
2021-08-23 10:54 ` Sugar Zhang [this message]
2021-08-23 10:54 ` [PATCH 14/15] ASoC: rockchip: i2s: Add support for 'rockchip,clk-trcm' property Sugar Zhang
2021-08-23 11:47 ` [PATCH 14/15] ASoC: rockchip: i2s: Add support for 'rockchip, clk-trcm' property Nicolas Frattaroli
2021-08-24 1:41 ` sugar zhang
2021-08-23 10:55 ` [PATCH 15/15] ASoC: dt-bindings: rockchip: i2s: Document property 'clk-trcm' Sugar Zhang
2021-08-23 13:30 ` Rob Herring
2021-08-23 17:36 ` Rob Herring
2021-08-24 2:48 ` [PATCH 15/15] ASoC: dt-bindings: rockchip: i2s: Document property 'clk-trcm'【请注意,邮件由robherring2@gmail.com代发】 sugar zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1629716076-21465-4-git-send-email-sugar.zhang@rock-chips.com \
--to=sugar.zhang@rock-chips.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=linux-rockchip@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).