summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSumit Bhattacharya <sumitb@nvidia.com>2011-11-05 02:19:44 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:49:43 -0800
commitf7d0c99b88f567a62a932b5d46aeda4f1d09bc17 (patch)
treea481c4ea8956d7cfedb685816858623fbbb71812 /sound
parentda2332f57ed58830d81cb4a5a3406a16e2e97d32 (diff)
ASoC: Tegra: Add AHUB APIs to configure AHUB CIF channels
Bug 872652 Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com> Change-Id: I0b777642681f5bf606a8faffb76142026902e538 Reviewed-on: http://git-master/r/62045 Reviewed-by: Scott Peterson <speterson@nvidia.com> Tested-by: Sumit Bhattacharya <sumitb@nvidia.com> Rebase-Id: R5bac01349656e799fed56b368265da13d6a4b02a
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra30_ahub.c47
-rw-r--r--sound/soc/tegra/tegra30_ahub.h6
2 files changed, 53 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 10e95edb4cab..8ee96bca2aff 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -397,6 +397,53 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif)
return 0;
}
+int tegra30_ahub_set_rx_cif_channels(enum tegra30_ahub_rxcif rxcif,
+ unsigned int audio_ch,
+ unsigned int client_ch)
+{
+ int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
+ unsigned int reg, val;
+
+ tegra30_ahub_enable_clocks();
+
+ reg = TEGRA30_AHUB_CIF_RX_CTRL +
+ (channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE);
+ val = tegra30_apbif_read(reg);
+ val &= ~(TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK |
+ TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK);
+ val |= ((audio_ch - 1) << TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT) |
+ ((client_ch - 1) << TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT);
+ tegra30_apbif_write(reg, val);
+
+ tegra30_ahub_disable_clocks();
+
+ return 0;
+}
+
+int tegra30_ahub_set_tx_cif_channels(enum tegra30_ahub_txcif txcif,
+ unsigned int audio_ch,
+ unsigned int client_ch)
+{
+ int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0;
+ unsigned int reg, val;
+
+ tegra30_ahub_enable_clocks();
+
+ reg = TEGRA30_AHUB_CIF_TX_CTRL +
+ (channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE);
+ val = tegra30_apbif_read(reg);
+ val &= ~(TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_MASK |
+ TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_MASK);
+ val |= ((audio_ch - 1) << TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT) |
+ ((client_ch - 1) << TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT);
+
+ tegra30_apbif_write(reg, val);
+
+ tegra30_ahub_disable_clocks();
+
+ return 0;
+}
+
static int __devinit tegra30_ahub_probe(struct platform_device *pdev)
{
struct resource *res0, *res1, *region;
diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h
index cac80aa93e16..84c2cdfd69a8 100644
--- a/sound/soc/tegra/tegra30_ahub.h
+++ b/sound/soc/tegra/tegra30_ahub.h
@@ -460,6 +460,9 @@ extern void tegra30_ahub_disable_clocks(void);
extern int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
unsigned long *fiforeg,
unsigned long *reqsel);
+extern int tegra30_ahub_set_rx_cif_channels(enum tegra30_ahub_rxcif rxcif,
+ unsigned int audio_ch,
+ unsigned int client_ch);
extern int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
extern int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif);
extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
@@ -467,6 +470,9 @@ extern int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif);
extern int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
unsigned long *fiforeg,
unsigned long *reqsel);
+extern int tegra30_ahub_set_tx_cif_channels(enum tegra30_ahub_txcif txcif,
+ unsigned int audio_ch,
+ unsigned int client_ch);
extern int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif);
extern int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif);
extern int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif);