From f7d0c99b88f567a62a932b5d46aeda4f1d09bc17 Mon Sep 17 00:00:00 2001 From: Sumit Bhattacharya Date: Sat, 5 Nov 2011 02:19:44 +0530 Subject: ASoC: Tegra: Add AHUB APIs to configure AHUB CIF channels Bug 872652 Signed-off-by: Sumit Bhattacharya Change-Id: I0b777642681f5bf606a8faffb76142026902e538 Reviewed-on: http://git-master/r/62045 Reviewed-by: Scott Peterson Tested-by: Sumit Bhattacharya Rebase-Id: R5bac01349656e799fed56b368265da13d6a4b02a --- sound/soc/tegra/tegra30_ahub.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'sound/soc/tegra/tegra30_ahub.c') 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; -- cgit v1.2.3