public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Sameer Pujar <spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	perex-/Fr2/VpizcU@public.gmane.org,
	tiwai-IBi9RG/b67k@public.gmane.org,
	kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sharadg-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	mkumard-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	viswanathl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	rlokhande-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	dramesh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	atalambedu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	nwartikar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
	nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	Sameer Pujar <spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH v5 02/11] ASoC: tegra: Add support for CIF programming
Date: Sun, 19 Jul 2020 10:31:21 +0530	[thread overview]
Message-ID: <1595134890-16470-3-git-send-email-spujar@nvidia.com> (raw)
In-Reply-To: <1595134890-16470-1-git-send-email-spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Audio Client Interface (CIF) is a proprietary interface employed to route
audio samples through Audio Hub (AHUB) components by inter connecting the
various modules.

This patch exports an inline function tegra_set_cif() which can be used,
for now, to program CIF on Tegra210 and later Tegra generations. Later it
can be extended to include helpers for legacy chips as well.

Signed-off-by: Sameer Pujar <spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Reviewed-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 sound/soc/tegra/tegra_cif.h | 65 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 sound/soc/tegra/tegra_cif.h

diff --git a/sound/soc/tegra/tegra_cif.h b/sound/soc/tegra/tegra_cif.h
new file mode 100644
index 0000000..7cca806
--- /dev/null
+++ b/sound/soc/tegra/tegra_cif.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * tegra_cif.h - TEGRA Audio CIF Programming
+ *
+ * Copyright (c) 2020 NVIDIA CORPORATION.  All rights reserved.
+ *
+ */
+
+#ifndef __TEGRA_CIF_H__
+#define __TEGRA_CIF_H__
+
+#include <linux/regmap.h>
+
+#define TEGRA_ACIF_CTRL_FIFO_TH_SHIFT		24
+#define TEGRA_ACIF_CTRL_AUDIO_CH_SHIFT		20
+#define TEGRA_ACIF_CTRL_CLIENT_CH_SHIFT		16
+#define TEGRA_ACIF_CTRL_AUDIO_BITS_SHIFT	12
+#define TEGRA_ACIF_CTRL_CLIENT_BITS_SHIFT	8
+#define TEGRA_ACIF_CTRL_EXPAND_SHIFT		6
+#define TEGRA_ACIF_CTRL_STEREO_CONV_SHIFT	4
+#define TEGRA_ACIF_CTRL_REPLICATE_SHIFT		3
+#define TEGRA_ACIF_CTRL_TRUNCATE_SHIFT		1
+#define TEGRA_ACIF_CTRL_MONO_CONV_SHIFT		0
+
+/* AUDIO/CLIENT_BITS values */
+#define TEGRA_ACIF_BITS_8			1
+#define TEGRA_ACIF_BITS_16			3
+#define TEGRA_ACIF_BITS_24			5
+#define TEGRA_ACIF_BITS_32			7
+
+#define TEGRA_ACIF_UPDATE_MASK			0x3ffffffb
+
+struct tegra_cif_conf {
+	unsigned int threshold;
+	unsigned int audio_ch;
+	unsigned int client_ch;
+	unsigned int audio_bits;
+	unsigned int client_bits;
+	unsigned int expand;
+	unsigned int stereo_conv;
+	unsigned int replicate;
+	unsigned int truncate;
+	unsigned int mono_conv;
+};
+
+static inline void tegra_set_cif(struct regmap *regmap, unsigned int reg,
+				 struct tegra_cif_conf *conf)
+{
+	unsigned int value;
+
+	value = (conf->threshold << TEGRA_ACIF_CTRL_FIFO_TH_SHIFT) |
+		((conf->audio_ch - 1) << TEGRA_ACIF_CTRL_AUDIO_CH_SHIFT) |
+		((conf->client_ch - 1) << TEGRA_ACIF_CTRL_CLIENT_CH_SHIFT) |
+		(conf->audio_bits << TEGRA_ACIF_CTRL_AUDIO_BITS_SHIFT) |
+		(conf->client_bits << TEGRA_ACIF_CTRL_CLIENT_BITS_SHIFT) |
+		(conf->expand << TEGRA_ACIF_CTRL_EXPAND_SHIFT) |
+		(conf->stereo_conv << TEGRA_ACIF_CTRL_STEREO_CONV_SHIFT) |
+		(conf->replicate << TEGRA_ACIF_CTRL_REPLICATE_SHIFT) |
+		(conf->truncate << TEGRA_ACIF_CTRL_TRUNCATE_SHIFT) |
+		(conf->mono_conv << TEGRA_ACIF_CTRL_MONO_CONV_SHIFT);
+
+	regmap_update_bits(regmap, reg, TEGRA_ACIF_UPDATE_MASK, value);
+}
+
+#endif
-- 
2.7.4

  parent reply	other threads:[~2020-07-19  5:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19  5:01 [PATCH v5 00/11] Add ASoC AHUB components for Tegra210 and later Sameer Pujar
     [not found] ` <1595134890-16470-1-git-send-email-spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-19  5:01   ` [PATCH v5 01/11] ASoC: dt-bindings: tegra: Add DT bindings for Tegra210 Sameer Pujar
     [not found]     ` <1595134890-16470-2-git-send-email-spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-20 12:34       ` Mark Brown
2020-07-20 14:20       ` Rob Herring
2020-07-19  5:01   ` Sameer Pujar [this message]
2020-07-19  5:01   ` [PATCH v5 04/11] ASoC: tegra: Add Tegra210 based I2S driver Sameer Pujar
2020-07-19  5:01   ` [PATCH v5 05/11] ASoC: tegra: Add Tegra210 based AHUB driver Sameer Pujar
2020-07-19  5:01   ` [PATCH v5 06/11] ASoC: tegra: Add Tegra186 based DSPK driver Sameer Pujar
2020-07-19  5:01   ` [PATCH v5 07/11] ASoC: tegra: Add Tegra210 based ADMAIF driver Sameer Pujar
2020-07-19  5:01   ` [PATCH v5 08/11] arm64: defconfig: Build AHUB component drivers Sameer Pujar
2020-08-06 18:23     ` Jon Hunter
2020-07-19  5:01   ` [PATCH v5 09/11] arm64: defconfig: Build ADMA and ACONNECT driver Sameer Pujar
2020-08-06 18:24     ` Jon Hunter
2020-07-19  5:01   ` [PATCH v5 10/11] arm64: tegra: Enable ACONNECT, ADMA and AGIC on Jetson Nano Sameer Pujar
2020-08-07 10:35     ` Jon Hunter
2020-07-19  5:01   ` [PATCH v5 11/11] arm64: tegra: Add DT binding for AHUB components Sameer Pujar
2020-08-07 10:52     ` Jon Hunter
2020-07-20 14:38   ` [PATCH v5 00/11] Add ASoC AHUB components for Tegra210 and later Mark Brown
     [not found]     ` <159525589435.6792.708136378511410418.b4-ty-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-07-21 11:52       ` Sameer Pujar
     [not found]         ` <72d45476-7050-187b-19d6-2ddb9b0ba97a-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-21 22:41           ` Mark Brown
2020-07-22  0:56   ` Mark Brown
2020-07-19  5:01 ` [PATCH v5 03/11] ASoC: tegra: Add Tegra210 based DMIC driver Sameer Pujar

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=1595134890-16470-3-git-send-email-spujar@nvidia.com \
    --to=spujar-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=atalambedu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=dramesh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mkumard-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=nwartikar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=perex-/Fr2/VpizcU@public.gmane.org \
    --cc=rlokhande-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sharadg-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tiwai-IBi9RG/b67k@public.gmane.org \
    --cc=viswanathl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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