2019-05-29 01:10:04 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2012-04-11 06:31:59 +08:00
|
|
|
/*
|
|
|
|
* tegra30_ahub.c - Tegra30 AHUB driver
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/of_platform.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/pm_runtime.h>
|
|
|
|
#include <linux/regmap.h>
|
2013-11-07 06:18:22 +08:00
|
|
|
#include <linux/reset.h>
|
2012-04-11 06:31:59 +08:00
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <sound/soc.h>
|
|
|
|
#include "tegra30_ahub.h"
|
|
|
|
|
|
|
|
#define DRV_NAME "tegra30-ahub"
|
|
|
|
|
|
|
|
static struct tegra30_ahub *ahub;
|
|
|
|
|
|
|
|
static inline void tegra30_apbif_write(u32 reg, u32 val)
|
|
|
|
{
|
|
|
|
regmap_write(ahub->regmap_apbif, reg, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 tegra30_apbif_read(u32 reg)
|
|
|
|
{
|
|
|
|
u32 val;
|
2017-02-26 02:59:17 +08:00
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
regmap_read(ahub->regmap_apbif, reg, &val);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void tegra30_audio_write(u32 reg, u32 val)
|
|
|
|
{
|
|
|
|
regmap_write(ahub->regmap_ahub, reg, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tegra30_ahub_runtime_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
regcache_cache_only(ahub->regmap_apbif, true);
|
|
|
|
regcache_cache_only(ahub->regmap_ahub, true);
|
|
|
|
|
2012-06-05 12:29:42 +08:00
|
|
|
clk_disable_unprepare(ahub->clk_apbif);
|
|
|
|
clk_disable_unprepare(ahub->clk_d_audio);
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* clk_apbif isn't required for an I2S<->I2S configuration where no PCM data
|
|
|
|
* is read from or sent to memory. However, that's not something the rest of
|
|
|
|
* the driver supports right now, so we'll just treat the two clocks as one
|
|
|
|
* for now.
|
|
|
|
*
|
|
|
|
* These functions should not be a plain ref-count. Instead, each active stream
|
|
|
|
* contributes some requirement to the minimum clock rate, so starting or
|
|
|
|
* stopping streams should dynamically adjust the clock as required. However,
|
|
|
|
* this is not yet implemented.
|
|
|
|
*/
|
|
|
|
static int tegra30_ahub_runtime_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2012-06-05 12:29:42 +08:00
|
|
|
ret = clk_prepare_enable(ahub->clk_d_audio);
|
2012-04-11 06:31:59 +08:00
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "clk_enable d_audio failed: %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2012-06-05 12:29:42 +08:00
|
|
|
ret = clk_prepare_enable(ahub->clk_apbif);
|
2012-04-11 06:31:59 +08:00
|
|
|
if (ret) {
|
|
|
|
dev_err(dev, "clk_enable apbif failed: %d\n", ret);
|
|
|
|
clk_disable(ahub->clk_d_audio);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
regcache_cache_only(ahub->regmap_apbif, false);
|
|
|
|
regcache_cache_only(ahub->regmap_ahub, false);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int tegra30_ahub_allocate_rx_fifo(enum tegra30_ahub_rxcif *rxcif,
|
2013-11-12 06:21:01 +08:00
|
|
|
char *dmachan, int dmachan_len,
|
|
|
|
dma_addr_t *fiforeg)
|
2012-04-11 06:31:59 +08:00
|
|
|
{
|
|
|
|
int channel;
|
|
|
|
u32 reg, val;
|
2013-10-12 05:43:17 +08:00
|
|
|
struct tegra30_ahub_cif_conf cif_conf;
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
channel = find_first_zero_bit(ahub->rx_usage,
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_COUNT);
|
|
|
|
if (channel >= TEGRA30_AHUB_CHANNEL_CTRL_COUNT)
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
__set_bit(channel, ahub->rx_usage);
|
|
|
|
|
|
|
|
*rxcif = TEGRA30_AHUB_RXCIF_APBIF_RX0 + channel;
|
2013-11-12 06:21:01 +08:00
|
|
|
snprintf(dmachan, dmachan_len, "rx%d", channel);
|
2012-04-11 06:31:59 +08:00
|
|
|
*fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_RXFIFO +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_RXFIFO_STRIDE);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CHANNEL_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
|
|
|
|
val = tegra30_apbif_read(reg);
|
|
|
|
val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_MASK |
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_MASK);
|
|
|
|
val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_RX_THRESHOLD_SHIFT) |
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_EN |
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_RX_PACK_16;
|
|
|
|
tegra30_apbif_write(reg, val);
|
|
|
|
|
2013-10-12 05:43:17 +08:00
|
|
|
cif_conf.threshold = 0;
|
|
|
|
cif_conf.audio_channels = 2;
|
|
|
|
cif_conf.client_channels = 2;
|
|
|
|
cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16;
|
|
|
|
cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
|
|
|
|
cif_conf.expand = 0;
|
|
|
|
cif_conf.stereo_conv = 0;
|
|
|
|
cif_conf.replicate = 0;
|
|
|
|
cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_RX;
|
|
|
|
cif_conf.truncate = 0;
|
|
|
|
cif_conf.mono_conv = 0;
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CIF_RX_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CIF_RX_CTRL_STRIDE);
|
2013-10-12 05:43:17 +08:00
|
|
|
ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf);
|
2012-04-11 06:31:59 +08:00
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_rx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_enable_rx_fifo(enum tegra30_ahub_rxcif rxcif)
|
|
|
|
{
|
|
|
|
int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
|
|
|
|
int reg, val;
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CHANNEL_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
|
|
|
|
val = tegra30_apbif_read(reg);
|
|
|
|
val |= TEGRA30_AHUB_CHANNEL_CTRL_RX_EN;
|
|
|
|
tegra30_apbif_write(reg, val);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_enable_rx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_disable_rx_fifo(enum tegra30_ahub_rxcif rxcif)
|
|
|
|
{
|
|
|
|
int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
|
|
|
|
int reg, val;
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CHANNEL_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
|
|
|
|
val = tegra30_apbif_read(reg);
|
|
|
|
val &= ~TEGRA30_AHUB_CHANNEL_CTRL_RX_EN;
|
|
|
|
tegra30_apbif_write(reg, val);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_disable_rx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_free_rx_fifo(enum tegra30_ahub_rxcif rxcif)
|
|
|
|
{
|
|
|
|
int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
|
|
|
|
|
|
|
|
__clear_bit(channel, ahub->rx_usage);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_free_rx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_allocate_tx_fifo(enum tegra30_ahub_txcif *txcif,
|
2013-11-12 06:21:01 +08:00
|
|
|
char *dmachan, int dmachan_len,
|
|
|
|
dma_addr_t *fiforeg)
|
2012-04-11 06:31:59 +08:00
|
|
|
{
|
|
|
|
int channel;
|
|
|
|
u32 reg, val;
|
2013-10-12 05:43:17 +08:00
|
|
|
struct tegra30_ahub_cif_conf cif_conf;
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
channel = find_first_zero_bit(ahub->tx_usage,
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_COUNT);
|
|
|
|
if (channel >= TEGRA30_AHUB_CHANNEL_CTRL_COUNT)
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
__set_bit(channel, ahub->tx_usage);
|
|
|
|
|
|
|
|
*txcif = TEGRA30_AHUB_TXCIF_APBIF_TX0 + channel;
|
2013-11-12 06:21:01 +08:00
|
|
|
snprintf(dmachan, dmachan_len, "tx%d", channel);
|
2012-04-11 06:31:59 +08:00
|
|
|
*fiforeg = ahub->apbif_addr + TEGRA30_AHUB_CHANNEL_TXFIFO +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_TXFIFO_STRIDE);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CHANNEL_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
|
|
|
|
val = tegra30_apbif_read(reg);
|
|
|
|
val &= ~(TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_MASK |
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_MASK);
|
|
|
|
val |= (7 << TEGRA30_AHUB_CHANNEL_CTRL_TX_THRESHOLD_SHIFT) |
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_EN |
|
|
|
|
TEGRA30_AHUB_CHANNEL_CTRL_TX_PACK_16;
|
|
|
|
tegra30_apbif_write(reg, val);
|
|
|
|
|
2013-10-12 05:43:17 +08:00
|
|
|
cif_conf.threshold = 0;
|
|
|
|
cif_conf.audio_channels = 2;
|
|
|
|
cif_conf.client_channels = 2;
|
|
|
|
cif_conf.audio_bits = TEGRA30_AUDIOCIF_BITS_16;
|
|
|
|
cif_conf.client_bits = TEGRA30_AUDIOCIF_BITS_16;
|
|
|
|
cif_conf.expand = 0;
|
|
|
|
cif_conf.stereo_conv = 0;
|
|
|
|
cif_conf.replicate = 0;
|
|
|
|
cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_TX;
|
|
|
|
cif_conf.truncate = 0;
|
|
|
|
cif_conf.mono_conv = 0;
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CIF_TX_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CIF_TX_CTRL_STRIDE);
|
2013-10-12 05:43:17 +08:00
|
|
|
ahub->soc_data->set_audio_cif(ahub->regmap_apbif, reg, &cif_conf);
|
2012-04-11 06:31:59 +08:00
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_allocate_tx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_enable_tx_fifo(enum tegra30_ahub_txcif txcif)
|
|
|
|
{
|
|
|
|
int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0;
|
|
|
|
int reg, val;
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CHANNEL_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
|
|
|
|
val = tegra30_apbif_read(reg);
|
|
|
|
val |= TEGRA30_AHUB_CHANNEL_CTRL_TX_EN;
|
|
|
|
tegra30_apbif_write(reg, val);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_enable_tx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_disable_tx_fifo(enum tegra30_ahub_txcif txcif)
|
|
|
|
{
|
|
|
|
int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0;
|
|
|
|
int reg, val;
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_CHANNEL_CTRL +
|
|
|
|
(channel * TEGRA30_AHUB_CHANNEL_CTRL_STRIDE);
|
|
|
|
val = tegra30_apbif_read(reg);
|
|
|
|
val &= ~TEGRA30_AHUB_CHANNEL_CTRL_TX_EN;
|
|
|
|
tegra30_apbif_write(reg, val);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_disable_tx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_free_tx_fifo(enum tegra30_ahub_txcif txcif)
|
|
|
|
{
|
|
|
|
int channel = txcif - TEGRA30_AHUB_TXCIF_APBIF_TX0;
|
|
|
|
|
|
|
|
__clear_bit(channel, ahub->tx_usage);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_free_tx_fifo);
|
|
|
|
|
|
|
|
int tegra30_ahub_set_rx_cif_source(enum tegra30_ahub_rxcif rxcif,
|
|
|
|
enum tegra30_ahub_txcif txcif)
|
|
|
|
{
|
|
|
|
int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
|
|
|
|
int reg;
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_AUDIO_RX +
|
|
|
|
(channel * TEGRA30_AHUB_AUDIO_RX_STRIDE);
|
|
|
|
tegra30_audio_write(reg, 1 << txcif);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_set_rx_cif_source);
|
|
|
|
|
|
|
|
int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif)
|
|
|
|
{
|
|
|
|
int channel = rxcif - TEGRA30_AHUB_RXCIF_APBIF_RX0;
|
|
|
|
int reg;
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_get_sync(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
reg = TEGRA30_AHUB_AUDIO_RX +
|
|
|
|
(channel * TEGRA30_AHUB_AUDIO_RX_STRIDE);
|
|
|
|
tegra30_audio_write(reg, 0);
|
|
|
|
|
2013-11-16 02:29:45 +08:00
|
|
|
pm_runtime_put(ahub->dev);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source);
|
|
|
|
|
2013-11-07 06:18:22 +08:00
|
|
|
#define MOD_LIST_MASK_TEGRA30 BIT(0)
|
|
|
|
#define MOD_LIST_MASK_TEGRA114 BIT(1)
|
2013-12-05 02:13:01 +08:00
|
|
|
#define MOD_LIST_MASK_TEGRA124 BIT(2)
|
2013-03-22 03:56:41 +08:00
|
|
|
|
2013-11-07 06:18:22 +08:00
|
|
|
#define MOD_LIST_MASK_TEGRA30_OR_LATER \
|
2013-12-05 02:13:01 +08:00
|
|
|
(MOD_LIST_MASK_TEGRA30 | MOD_LIST_MASK_TEGRA114 | \
|
|
|
|
MOD_LIST_MASK_TEGRA124)
|
|
|
|
#define MOD_LIST_MASK_TEGRA114_OR_LATER \
|
|
|
|
(MOD_LIST_MASK_TEGRA114 | MOD_LIST_MASK_TEGRA124)
|
2013-03-22 03:56:41 +08:00
|
|
|
|
|
|
|
static const struct {
|
2013-11-07 06:18:22 +08:00
|
|
|
const char *rst_name;
|
|
|
|
u32 mod_list_mask;
|
|
|
|
} configlink_mods[] = {
|
|
|
|
{ "i2s0", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "i2s1", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "i2s2", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "i2s3", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "i2s4", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "dam0", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "dam1", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "dam2", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
|
|
|
{ "spdif", MOD_LIST_MASK_TEGRA30_OR_LATER },
|
2013-12-05 02:13:01 +08:00
|
|
|
{ "amx", MOD_LIST_MASK_TEGRA114_OR_LATER },
|
|
|
|
{ "adx", MOD_LIST_MASK_TEGRA114_OR_LATER },
|
|
|
|
{ "amx1", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "adx1", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "afc0", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "afc1", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "afc2", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "afc3", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "afc4", MOD_LIST_MASK_TEGRA124 },
|
|
|
|
{ "afc5", MOD_LIST_MASK_TEGRA124 },
|
2012-04-11 06:31:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define LAST_REG(name) \
|
|
|
|
(TEGRA30_AHUB_##name + \
|
|
|
|
(TEGRA30_AHUB_##name##_STRIDE * TEGRA30_AHUB_##name##_COUNT) - 4)
|
|
|
|
|
|
|
|
#define REG_IN_ARRAY(reg, name) \
|
|
|
|
((reg >= TEGRA30_AHUB_##name) && \
|
|
|
|
(reg <= LAST_REG(name) && \
|
|
|
|
(!((reg - TEGRA30_AHUB_##name) % TEGRA30_AHUB_##name##_STRIDE))))
|
|
|
|
|
|
|
|
static bool tegra30_ahub_apbif_wr_rd_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
switch (reg) {
|
|
|
|
case TEGRA30_AHUB_CONFIG_LINK_CTRL:
|
|
|
|
case TEGRA30_AHUB_MISC_CTRL:
|
|
|
|
case TEGRA30_AHUB_APBDMA_LIVE_STATUS:
|
|
|
|
case TEGRA30_AHUB_I2S_LIVE_STATUS:
|
|
|
|
case TEGRA30_AHUB_SPDIF_LIVE_STATUS:
|
|
|
|
case TEGRA30_AHUB_I2S_INT_MASK:
|
|
|
|
case TEGRA30_AHUB_DAM_INT_MASK:
|
|
|
|
case TEGRA30_AHUB_SPDIF_INT_MASK:
|
|
|
|
case TEGRA30_AHUB_APBIF_INT_MASK:
|
|
|
|
case TEGRA30_AHUB_I2S_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_DAM_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_SPDIF_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_APBIF_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_I2S_INT_SOURCE:
|
|
|
|
case TEGRA30_AHUB_DAM_INT_SOURCE:
|
|
|
|
case TEGRA30_AHUB_SPDIF_INT_SOURCE:
|
|
|
|
case TEGRA30_AHUB_APBIF_INT_SOURCE:
|
|
|
|
case TEGRA30_AHUB_I2S_INT_SET:
|
|
|
|
case TEGRA30_AHUB_DAM_INT_SET:
|
|
|
|
case TEGRA30_AHUB_SPDIF_INT_SET:
|
|
|
|
case TEGRA30_AHUB_APBIF_INT_SET:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
2013-10-09 06:55:45 +08:00
|
|
|
}
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
if (REG_IN_ARRAY(reg, CHANNEL_CTRL) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_CLEAR) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_STATUS) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_TXFIFO) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_RXFIFO) ||
|
|
|
|
REG_IN_ARRAY(reg, CIF_TX_CTRL) ||
|
|
|
|
REG_IN_ARRAY(reg, CIF_RX_CTRL) ||
|
|
|
|
REG_IN_ARRAY(reg, DAM_LIVE_STATUS))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool tegra30_ahub_apbif_volatile_reg(struct device *dev,
|
|
|
|
unsigned int reg)
|
|
|
|
{
|
|
|
|
switch (reg) {
|
|
|
|
case TEGRA30_AHUB_CONFIG_LINK_CTRL:
|
|
|
|
case TEGRA30_AHUB_MISC_CTRL:
|
|
|
|
case TEGRA30_AHUB_APBDMA_LIVE_STATUS:
|
|
|
|
case TEGRA30_AHUB_I2S_LIVE_STATUS:
|
|
|
|
case TEGRA30_AHUB_SPDIF_LIVE_STATUS:
|
|
|
|
case TEGRA30_AHUB_I2S_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_DAM_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_SPDIF_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_APBIF_INT_STATUS:
|
|
|
|
case TEGRA30_AHUB_I2S_INT_SET:
|
|
|
|
case TEGRA30_AHUB_DAM_INT_SET:
|
|
|
|
case TEGRA30_AHUB_SPDIF_INT_SET:
|
|
|
|
case TEGRA30_AHUB_APBIF_INT_SET:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
break;
|
2013-10-09 06:55:45 +08:00
|
|
|
}
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
if (REG_IN_ARRAY(reg, CHANNEL_CLEAR) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_STATUS) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_TXFIFO) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_RXFIFO) ||
|
|
|
|
REG_IN_ARRAY(reg, DAM_LIVE_STATUS))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool tegra30_ahub_apbif_precious_reg(struct device *dev,
|
|
|
|
unsigned int reg)
|
|
|
|
{
|
|
|
|
if (REG_IN_ARRAY(reg, CHANNEL_TXFIFO) ||
|
|
|
|
REG_IN_ARRAY(reg, CHANNEL_RXFIFO))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct regmap_config tegra30_ahub_apbif_regmap_config = {
|
|
|
|
.name = "apbif",
|
|
|
|
.reg_bits = 32,
|
|
|
|
.val_bits = 32,
|
|
|
|
.reg_stride = 4,
|
|
|
|
.max_register = TEGRA30_AHUB_APBIF_INT_SET,
|
|
|
|
.writeable_reg = tegra30_ahub_apbif_wr_rd_reg,
|
|
|
|
.readable_reg = tegra30_ahub_apbif_wr_rd_reg,
|
|
|
|
.volatile_reg = tegra30_ahub_apbif_volatile_reg,
|
|
|
|
.precious_reg = tegra30_ahub_apbif_precious_reg,
|
2014-03-18 13:08:49 +08:00
|
|
|
.cache_type = REGCACHE_FLAT,
|
2012-04-11 06:31:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static bool tegra30_ahub_ahub_wr_rd_reg(struct device *dev, unsigned int reg)
|
|
|
|
{
|
|
|
|
if (REG_IN_ARRAY(reg, AUDIO_RX))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct regmap_config tegra30_ahub_ahub_regmap_config = {
|
|
|
|
.name = "ahub",
|
|
|
|
.reg_bits = 32,
|
|
|
|
.val_bits = 32,
|
|
|
|
.reg_stride = 4,
|
|
|
|
.max_register = LAST_REG(AUDIO_RX),
|
|
|
|
.writeable_reg = tegra30_ahub_ahub_wr_rd_reg,
|
|
|
|
.readable_reg = tegra30_ahub_ahub_wr_rd_reg,
|
2014-03-18 13:08:49 +08:00
|
|
|
.cache_type = REGCACHE_FLAT,
|
2012-04-11 06:31:59 +08:00
|
|
|
};
|
|
|
|
|
2013-03-22 03:56:41 +08:00
|
|
|
static struct tegra30_ahub_soc_data soc_data_tegra30 = {
|
2013-11-07 06:18:22 +08:00
|
|
|
.mod_list_mask = MOD_LIST_MASK_TEGRA30,
|
2013-10-12 05:43:17 +08:00
|
|
|
.set_audio_cif = tegra30_ahub_set_cif,
|
2013-03-22 03:56:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct tegra30_ahub_soc_data soc_data_tegra114 = {
|
2013-11-07 06:18:22 +08:00
|
|
|
.mod_list_mask = MOD_LIST_MASK_TEGRA114,
|
2013-10-12 05:43:17 +08:00
|
|
|
.set_audio_cif = tegra30_ahub_set_cif,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct tegra30_ahub_soc_data soc_data_tegra124 = {
|
2013-12-05 02:13:01 +08:00
|
|
|
.mod_list_mask = MOD_LIST_MASK_TEGRA124,
|
2013-10-12 05:43:17 +08:00
|
|
|
.set_audio_cif = tegra124_ahub_set_cif,
|
2013-03-22 03:56:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct of_device_id tegra30_ahub_of_match[] = {
|
2013-10-12 05:43:17 +08:00
|
|
|
{ .compatible = "nvidia,tegra124-ahub", .data = &soc_data_tegra124 },
|
2013-03-22 03:56:41 +08:00
|
|
|
{ .compatible = "nvidia,tegra114-ahub", .data = &soc_data_tegra114 },
|
|
|
|
{ .compatible = "nvidia,tegra30-ahub", .data = &soc_data_tegra30 },
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
2012-12-07 22:26:33 +08:00
|
|
|
static int tegra30_ahub_probe(struct platform_device *pdev)
|
2012-04-11 06:31:59 +08:00
|
|
|
{
|
2013-03-22 03:56:41 +08:00
|
|
|
const struct of_device_id *match;
|
|
|
|
const struct tegra30_ahub_soc_data *soc_data;
|
2013-11-07 06:18:22 +08:00
|
|
|
struct reset_control *rst;
|
2012-04-11 06:31:59 +08:00
|
|
|
int i;
|
2019-09-04 16:39:09 +08:00
|
|
|
struct resource *res0;
|
2012-04-11 06:31:59 +08:00
|
|
|
void __iomem *regs_apbif, *regs_ahub;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (ahub)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2013-03-22 03:56:41 +08:00
|
|
|
match = of_match_device(tegra30_ahub_of_match, &pdev->dev);
|
|
|
|
if (!match)
|
|
|
|
return -EINVAL;
|
|
|
|
soc_data = match->data;
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
/*
|
|
|
|
* The AHUB hosts a register bus: the "configlink". For this to
|
|
|
|
* operate correctly, all devices on this bus must be out of reset.
|
|
|
|
* Ensure that here.
|
|
|
|
*/
|
2013-11-07 06:18:22 +08:00
|
|
|
for (i = 0; i < ARRAY_SIZE(configlink_mods); i++) {
|
|
|
|
if (!(configlink_mods[i].mod_list_mask &
|
|
|
|
soc_data->mod_list_mask))
|
2013-03-22 03:56:41 +08:00
|
|
|
continue;
|
2013-11-07 06:18:22 +08:00
|
|
|
|
2017-07-19 23:26:44 +08:00
|
|
|
rst = reset_control_get_exclusive(&pdev->dev,
|
|
|
|
configlink_mods[i].rst_name);
|
2013-11-07 06:18:22 +08:00
|
|
|
if (IS_ERR(rst)) {
|
|
|
|
dev_err(&pdev->dev, "Can't get reset %s\n",
|
|
|
|
configlink_mods[i].rst_name);
|
|
|
|
ret = PTR_ERR(rst);
|
2015-08-03 19:57:34 +08:00
|
|
|
return ret;
|
2012-04-11 06:31:59 +08:00
|
|
|
}
|
2013-11-07 06:18:22 +08:00
|
|
|
|
|
|
|
ret = reset_control_deassert(rst);
|
|
|
|
reset_control_put(rst);
|
|
|
|
if (ret)
|
2015-08-03 19:57:34 +08:00
|
|
|
return ret;
|
2012-04-11 06:31:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub),
|
|
|
|
GFP_KERNEL);
|
2017-02-25 19:18:08 +08:00
|
|
|
if (!ahub)
|
2015-08-03 19:57:34 +08:00
|
|
|
return -ENOMEM;
|
2012-04-11 06:31:59 +08:00
|
|
|
dev_set_drvdata(&pdev->dev, ahub);
|
|
|
|
|
2013-10-12 05:43:17 +08:00
|
|
|
ahub->soc_data = soc_data;
|
2012-04-11 06:31:59 +08:00
|
|
|
ahub->dev = &pdev->dev;
|
|
|
|
|
2015-08-03 19:57:34 +08:00
|
|
|
ahub->clk_d_audio = devm_clk_get(&pdev->dev, "d_audio");
|
2012-04-11 06:31:59 +08:00
|
|
|
if (IS_ERR(ahub->clk_d_audio)) {
|
|
|
|
dev_err(&pdev->dev, "Can't retrieve ahub d_audio clock\n");
|
|
|
|
ret = PTR_ERR(ahub->clk_d_audio);
|
2015-08-03 19:57:34 +08:00
|
|
|
return ret;
|
2012-04-11 06:31:59 +08:00
|
|
|
}
|
|
|
|
|
2015-08-03 19:57:34 +08:00
|
|
|
ahub->clk_apbif = devm_clk_get(&pdev->dev, "apbif");
|
2012-04-11 06:31:59 +08:00
|
|
|
if (IS_ERR(ahub->clk_apbif)) {
|
|
|
|
dev_err(&pdev->dev, "Can't retrieve ahub apbif clock\n");
|
|
|
|
ret = PTR_ERR(ahub->clk_apbif);
|
2015-08-03 19:57:34 +08:00
|
|
|
return ret;
|
2012-04-11 06:31:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
2015-08-23 23:32:14 +08:00
|
|
|
regs_apbif = devm_ioremap_resource(&pdev->dev, res0);
|
|
|
|
if (IS_ERR(regs_apbif))
|
|
|
|
return PTR_ERR(regs_apbif);
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
ahub->apbif_addr = res0->start;
|
|
|
|
|
|
|
|
ahub->regmap_apbif = devm_regmap_init_mmio(&pdev->dev, regs_apbif,
|
|
|
|
&tegra30_ahub_apbif_regmap_config);
|
|
|
|
if (IS_ERR(ahub->regmap_apbif)) {
|
|
|
|
dev_err(&pdev->dev, "apbif regmap init failed\n");
|
|
|
|
ret = PTR_ERR(ahub->regmap_apbif);
|
2015-08-03 19:57:34 +08:00
|
|
|
return ret;
|
2012-04-11 06:31:59 +08:00
|
|
|
}
|
|
|
|
regcache_cache_only(ahub->regmap_apbif, true);
|
|
|
|
|
2019-09-04 16:39:09 +08:00
|
|
|
regs_ahub = devm_platform_ioremap_resource(pdev, 1);
|
2015-08-23 23:32:14 +08:00
|
|
|
if (IS_ERR(regs_ahub))
|
|
|
|
return PTR_ERR(regs_ahub);
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
ahub->regmap_ahub = devm_regmap_init_mmio(&pdev->dev, regs_ahub,
|
|
|
|
&tegra30_ahub_ahub_regmap_config);
|
|
|
|
if (IS_ERR(ahub->regmap_ahub)) {
|
|
|
|
dev_err(&pdev->dev, "ahub regmap init failed\n");
|
|
|
|
ret = PTR_ERR(ahub->regmap_ahub);
|
2015-08-03 19:57:34 +08:00
|
|
|
return ret;
|
2012-04-11 06:31:59 +08:00
|
|
|
}
|
|
|
|
regcache_cache_only(ahub->regmap_ahub, true);
|
|
|
|
|
|
|
|
pm_runtime_enable(&pdev->dev);
|
|
|
|
if (!pm_runtime_enabled(&pdev->dev)) {
|
|
|
|
ret = tegra30_ahub_runtime_resume(&pdev->dev);
|
|
|
|
if (ret)
|
|
|
|
goto err_pm_disable;
|
|
|
|
}
|
|
|
|
|
2013-01-11 16:01:25 +08:00
|
|
|
of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
|
2012-04-11 06:31:59 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_pm_disable:
|
|
|
|
pm_runtime_disable(&pdev->dev);
|
2015-08-03 19:57:34 +08:00
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-12-07 22:26:33 +08:00
|
|
|
static int tegra30_ahub_remove(struct platform_device *pdev)
|
2012-04-11 06:31:59 +08:00
|
|
|
{
|
|
|
|
if (!ahub)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
pm_runtime_disable(&pdev->dev);
|
|
|
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
|
|
|
tegra30_ahub_runtime_suspend(&pdev->dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-06-04 01:37:41 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
static int tegra30_ahub_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
regcache_mark_dirty(ahub->regmap_ahub);
|
|
|
|
regcache_mark_dirty(ahub->regmap_apbif);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int tegra30_ahub_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2013-06-05 02:58:14 +08:00
|
|
|
ret = pm_runtime_get_sync(dev);
|
2020-06-14 04:44:19 +08:00
|
|
|
if (ret < 0) {
|
|
|
|
pm_runtime_put(dev);
|
2013-06-05 02:58:14 +08:00
|
|
|
return ret;
|
2020-06-14 04:44:19 +08:00
|
|
|
}
|
2013-06-04 01:37:41 +08:00
|
|
|
ret = regcache_sync(ahub->regmap_ahub);
|
|
|
|
ret |= regcache_sync(ahub->regmap_apbif);
|
2013-06-05 02:58:14 +08:00
|
|
|
pm_runtime_put(dev);
|
2013-06-04 01:37:41 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-11-20 02:25:33 +08:00
|
|
|
static const struct dev_pm_ops tegra30_ahub_pm_ops = {
|
2012-04-11 06:31:59 +08:00
|
|
|
SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend,
|
|
|
|
tegra30_ahub_runtime_resume, NULL)
|
2013-06-04 01:37:41 +08:00
|
|
|
SET_SYSTEM_SLEEP_PM_OPS(tegra30_ahub_suspend, tegra30_ahub_resume)
|
2012-04-11 06:31:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_driver tegra30_ahub_driver = {
|
|
|
|
.probe = tegra30_ahub_probe,
|
2012-12-07 22:26:33 +08:00
|
|
|
.remove = tegra30_ahub_remove,
|
2012-04-11 06:31:59 +08:00
|
|
|
.driver = {
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.of_match_table = tegra30_ahub_of_match,
|
|
|
|
.pm = &tegra30_ahub_pm_ops,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
module_platform_driver(tegra30_ahub_driver);
|
|
|
|
|
2013-10-12 05:43:17 +08:00
|
|
|
void tegra30_ahub_set_cif(struct regmap *regmap, unsigned int reg,
|
|
|
|
struct tegra30_ahub_cif_conf *conf)
|
|
|
|
{
|
|
|
|
unsigned int value;
|
|
|
|
|
|
|
|
value = (conf->threshold <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT) |
|
|
|
|
((conf->audio_channels - 1) <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT) |
|
|
|
|
((conf->client_channels - 1) <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT) |
|
|
|
|
(conf->audio_bits <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT) |
|
|
|
|
(conf->client_bits <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT) |
|
|
|
|
(conf->expand <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT) |
|
|
|
|
(conf->stereo_conv <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT) |
|
|
|
|
(conf->replicate <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_REPLICATE_SHIFT) |
|
|
|
|
(conf->direction <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_DIRECTION_SHIFT) |
|
|
|
|
(conf->truncate <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_TRUNCATE_SHIFT) |
|
|
|
|
(conf->mono_conv <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_MONO_CONV_SHIFT);
|
|
|
|
|
|
|
|
regmap_write(regmap, reg, value);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra30_ahub_set_cif);
|
|
|
|
|
|
|
|
void tegra124_ahub_set_cif(struct regmap *regmap, unsigned int reg,
|
|
|
|
struct tegra30_ahub_cif_conf *conf)
|
|
|
|
{
|
|
|
|
unsigned int value;
|
|
|
|
|
|
|
|
value = (conf->threshold <<
|
|
|
|
TEGRA124_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT) |
|
|
|
|
((conf->audio_channels - 1) <<
|
|
|
|
TEGRA124_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT) |
|
|
|
|
((conf->client_channels - 1) <<
|
|
|
|
TEGRA124_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT) |
|
|
|
|
(conf->audio_bits <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_SHIFT) |
|
|
|
|
(conf->client_bits <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_SHIFT) |
|
|
|
|
(conf->expand <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_EXPAND_SHIFT) |
|
|
|
|
(conf->stereo_conv <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_STEREO_CONV_SHIFT) |
|
|
|
|
(conf->replicate <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_REPLICATE_SHIFT) |
|
|
|
|
(conf->direction <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_DIRECTION_SHIFT) |
|
|
|
|
(conf->truncate <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_TRUNCATE_SHIFT) |
|
|
|
|
(conf->mono_conv <<
|
|
|
|
TEGRA30_AUDIOCIF_CTRL_MONO_CONV_SHIFT);
|
|
|
|
|
|
|
|
regmap_write(regmap, reg, value);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(tegra124_ahub_set_cif);
|
|
|
|
|
2012-04-11 06:31:59 +08:00
|
|
|
MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
|
|
|
|
MODULE_DESCRIPTION("Tegra30 AHUB driver");
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
|
MODULE_ALIAS("platform:" DRV_NAME);
|
2012-06-08 07:58:31 +08:00
|
|
|
MODULE_DEVICE_TABLE(of, tegra30_ahub_of_match);
|