mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
ASoC: tegra-alt: Fix build errors for kernel 3.18
- removed snd_soc_codec_set_cache_io function - use snd_soc_kcontrol_codec instead of snd_kcontrol_chip - use codec->component.val_bytes instead of codec->val_bytes - use devm_ioremap_resource instead of devm_request_and_ioremap - snd_soc_dapm_mux_update_power prototype is changed Change-Id: Ieb699a0e8a12b341c6823337ef2deb0d99292240 Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com>
This commit is contained in:
committed by
Sameer Pujar
parent
c8e1e7558e
commit
642d1a314c
@@ -2,7 +2,7 @@ config SND_SOC_TEGRA_ALT
|
||||
tristate "Alternative DAPM-based SoC audio support for the Tegra System-on-Chip"
|
||||
depends on ARCH_TEGRA
|
||||
select REGMAP_MMIO
|
||||
select SND_SOC_DMAENGINE_PCM
|
||||
select SND_DMAENGINE_PCM
|
||||
help
|
||||
Say Y or M here if you want support for SoC audio on Tegra, using the
|
||||
alternative driver that exposes to user-space the full routing capabilities
|
||||
|
||||
@@ -596,14 +596,8 @@ static const struct snd_soc_dapm_route tegra210_admaif_routes[] = {
|
||||
static int tegra210_admaif_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_admaif *admaif = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = admaif->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -689,7 +683,7 @@ static int tegra210_admaif_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
regs = devm_request_and_ioremap(&pdev->dev, res);
|
||||
regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (!regs) {
|
||||
dev_err(&pdev->dev, "request/iomap region failed\n");
|
||||
ret = -ENODEV;
|
||||
|
||||
@@ -165,7 +165,9 @@ static struct snd_compr_codec_caps adsp_compr_codec_caps[] = {
|
||||
.descriptor = {
|
||||
[0] = {
|
||||
.max_ch = 2,
|
||||
.sample_rates = SNDRV_PCM_RATE_8000_48000,
|
||||
.sample_rates = {
|
||||
[0] = SNDRV_PCM_RATE_8000_48000,
|
||||
},
|
||||
.bit_rate = {
|
||||
[0] = 32000,
|
||||
[1] = 64000,
|
||||
@@ -190,7 +192,9 @@ static struct snd_compr_codec_caps adsp_compr_codec_caps[] = {
|
||||
.descriptor = {
|
||||
[0] = {
|
||||
.max_ch = 2,
|
||||
.sample_rates = SNDRV_PCM_RATE_8000_48000,
|
||||
.sample_rates = {
|
||||
[0] = SNDRV_PCM_RATE_8000_48000,
|
||||
},
|
||||
.bit_rate = {
|
||||
[0] = 32000,
|
||||
[1] = 64000,
|
||||
@@ -1473,12 +1477,6 @@ static void tegra210_adsp_pcm_free(struct snd_pcm *pcm)
|
||||
}
|
||||
}
|
||||
|
||||
static int tegra210_adsp_pcm_probe(struct snd_soc_platform *platform)
|
||||
{
|
||||
platform->dapm.idle_bias_off = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ADSP-ADMAIF codec driver HW-params. Used for configuring ADMA */
|
||||
static int tegra210_adsp_admaif_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
@@ -1554,21 +1552,26 @@ static int tegra210_adsp_admaif_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
/* ADSP platform driver read/write call-back */
|
||||
static unsigned int tegra210_adsp_read(struct snd_soc_platform *platform,
|
||||
unsigned int reg)
|
||||
static int tegra210_adsp_read(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int *val)
|
||||
{
|
||||
struct snd_soc_platform *platform =
|
||||
snd_soc_component_to_platform(component);
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
|
||||
dev_vdbg(adsp->dev, "%s [0x%x] -> 0x%x\n", __func__, reg,
|
||||
tegra210_adsp_reg_read(adsp, reg));
|
||||
|
||||
return tegra210_adsp_reg_read(adsp, reg);
|
||||
*val = tegra210_adsp_reg_read(adsp, reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra210_adsp_write(struct snd_soc_platform *platform,
|
||||
static int tegra210_adsp_write(struct snd_soc_component *component,
|
||||
unsigned int reg,
|
||||
unsigned int val)
|
||||
{
|
||||
struct snd_soc_platform *platform =
|
||||
snd_soc_component_to_platform(component);
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
|
||||
dev_vdbg(adsp->dev, "%s [0x%x] -> 0x%x\n", __func__, reg, val);
|
||||
@@ -1583,7 +1586,8 @@ static int tegra210_adsp_mux_get(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||
struct snd_soc_platform *platform = widget->platform;
|
||||
struct snd_soc_platform *platform =
|
||||
snd_soc_dapm_to_platform(widget->dapm);
|
||||
struct soc_enum *e =
|
||||
(struct soc_enum *)kcontrol->private_value;
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
@@ -1599,13 +1603,14 @@ static int tegra210_adsp_mux_put(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_widget *w = wlist->widgets[0];
|
||||
struct snd_soc_platform *platform = w->platform;
|
||||
struct snd_soc_platform *platform = snd_soc_dapm_to_platform(w->dapm);
|
||||
uint32_t val = ucontrol->value.enumerated.item[0];
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
struct tegra210_adsp_app *app;
|
||||
uint32_t cur_val = 0;
|
||||
int ret = 0;
|
||||
struct snd_soc_dapm_update update;
|
||||
|
||||
if (!adsp->init_done)
|
||||
return -ENODEV;
|
||||
@@ -1639,7 +1644,8 @@ static int tegra210_adsp_mux_put(struct snd_kcontrol *kcontrol,
|
||||
TEGRA210_ADSP_WIDGET_SOURCE_MASK, val << e->shift_l);
|
||||
tegra210_adsp_update_connection(adsp);
|
||||
|
||||
snd_soc_dapm_mux_update_power(w, kcontrol, val, e);
|
||||
update.kcontrol = kcontrol;
|
||||
snd_soc_dapm_mux_update_power(w->dapm, kcontrol, val, e, &update);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1647,8 +1653,8 @@ static int tegra210_adsp_mux_put(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_adsp_init_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||
struct tegra210_adsp *adsp = snd_soc_component_get_drvdata(cmpnt);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = adsp->init_done;
|
||||
return 0;
|
||||
@@ -1657,8 +1663,8 @@ static int tegra210_adsp_init_get(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_adsp_init_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||
struct tegra210_adsp *adsp = snd_soc_component_get_drvdata(cmpnt);
|
||||
int init = ucontrol->value.enumerated.item[0];
|
||||
int ret = 0;
|
||||
|
||||
@@ -1682,7 +1688,7 @@ static int tegra210_adsp_init_put(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_adsp_widget_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol, int event)
|
||||
{
|
||||
struct snd_soc_platform *platform = w->platform;
|
||||
struct snd_soc_platform *platform = snd_soc_dapm_to_platform(w->dapm);
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
struct tegra210_adsp_app *app;
|
||||
|
||||
@@ -2208,8 +2214,8 @@ static int tegra210_adsp_set_param(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct tegra210_adsp *adsp = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||
struct tegra210_adsp *adsp = snd_soc_component_get_drvdata(cmpnt);
|
||||
struct tegra210_adsp_app *app = &adsp->apps[params->base];
|
||||
apm_msg_t apm_msg;
|
||||
|
||||
@@ -2312,6 +2318,12 @@ static const struct snd_kcontrol_new tegra210_adsp_controls[] = {
|
||||
|
||||
static const struct snd_soc_component_driver tegra210_adsp_component = {
|
||||
.name = "tegra210-adsp",
|
||||
.dapm_widgets = tegra210_adsp_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_adsp_widgets),
|
||||
.dapm_routes = tegra210_adsp_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(tegra210_adsp_routes),
|
||||
.controls = tegra210_adsp_controls,
|
||||
.num_controls = ARRAY_SIZE(tegra210_adsp_controls),
|
||||
};
|
||||
|
||||
static int tegra210_adsp_codec_probe(struct snd_soc_codec *codec)
|
||||
@@ -2324,20 +2336,20 @@ static struct snd_soc_codec_driver tegra210_adsp_codec = {
|
||||
.idle_bias_off = 1,
|
||||
};
|
||||
|
||||
static int tegra210_adsp_pcm_probe(struct snd_soc_platform *platform)
|
||||
{
|
||||
platform->component.dapm.idle_bias_off = 1;
|
||||
platform->component.read = tegra210_adsp_read;
|
||||
platform->component.write = tegra210_adsp_write;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver tegra210_adsp_platform = {
|
||||
.ops = &tegra210_adsp_pcm_ops,
|
||||
.compr_ops = &tegra210_adsp_compr_ops,
|
||||
.pcm_new = tegra210_adsp_pcm_new,
|
||||
.pcm_free = tegra210_adsp_pcm_free,
|
||||
.probe = tegra210_adsp_pcm_probe,
|
||||
.read = tegra210_adsp_read,
|
||||
.write = tegra210_adsp_write,
|
||||
.dapm_widgets = tegra210_adsp_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_adsp_widgets),
|
||||
.dapm_routes = tegra210_adsp_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(tegra210_adsp_routes),
|
||||
.controls = tegra210_adsp_controls,
|
||||
.num_controls = ARRAY_SIZE(tegra210_adsp_controls),
|
||||
};
|
||||
|
||||
static u64 tegra_dma_mask = DMA_BIT_MASK(32);
|
||||
|
||||
@@ -427,14 +427,8 @@ static int tegra210_adx_set_channel_map(struct snd_soc_dai *dai,
|
||||
static int tegra210_adx_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = adx->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -238,14 +238,8 @@ static int tegra210_afc_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_afc_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_afc *afc = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = afc->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 64, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -457,14 +457,8 @@ static int tegra210_amx_set_channel_map(struct snd_soc_dai *dai,
|
||||
static int tegra210_amx_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_amx *amx = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = amx->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -182,14 +182,8 @@ static int tegra210_dmic_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_dmic_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_dmic *dmic = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = dmic->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -522,14 +522,8 @@ static int tegra210_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_i2s_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_i2s *i2s = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = i2s->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 64, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -624,7 +618,7 @@ static struct snd_soc_dai_driver tegra210_i2s_dais[] = {
|
||||
static int tegra210_i2s_loopback_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_i2s *i2s = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = i2s->loopback;
|
||||
@@ -635,7 +629,7 @@ static int tegra210_i2s_loopback_get(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_i2s_loopback_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_i2s *i2s = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
i2s->loopback = ucontrol->value.integer.value[0];
|
||||
|
||||
@@ -167,14 +167,8 @@ static int tegra210_iqc_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_iqc_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_iqc *iqc = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = iqc->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 64, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ static int tegra210_mbdrc_get(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||
unsigned int val;
|
||||
@@ -175,7 +175,7 @@ static int tegra210_mbdrc_put(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||
unsigned int val;
|
||||
@@ -192,7 +192,7 @@ static int tegra210_mbdrc_put(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_mbdrc_get_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int val;
|
||||
@@ -206,13 +206,13 @@ static int tegra210_mbdrc_get_enum(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_mbdrc_put_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int val;
|
||||
unsigned int mask;
|
||||
|
||||
if (ucontrol->value.enumerated.item[0] > e->max - 1)
|
||||
if (ucontrol->value.enumerated.item[0] > e->items - 1)
|
||||
return -EINVAL;
|
||||
|
||||
val = ucontrol->value.enumerated.item[0] << e->shift_l;
|
||||
@@ -225,7 +225,7 @@ static int tegra210_mbdrc_band_params_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
u32 regs = params->soc.base;
|
||||
@@ -233,7 +233,8 @@ static int tegra210_mbdrc_band_params_get(struct snd_kcontrol *kcontrol,
|
||||
u32 shift = params->shift;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < params->soc.num_regs; i++, regs += codec->val_bytes) {
|
||||
for (i = 0; i < params->soc.num_regs; i++,
|
||||
regs += codec->component.val_bytes) {
|
||||
regmap_read(ope->mbdrc_regmap, regs, &data[i]);
|
||||
data[i] = ((data[i] & mask) >> shift);
|
||||
}
|
||||
@@ -245,7 +246,7 @@ static int tegra210_mbdrc_band_params_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
u32 regs = params->soc.base;
|
||||
@@ -253,7 +254,8 @@ static int tegra210_mbdrc_band_params_put(struct snd_kcontrol *kcontrol,
|
||||
u32 shift = params->shift;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < params->soc.num_regs; i++, regs += codec->val_bytes)
|
||||
for (i = 0; i < params->soc.num_regs; i++,
|
||||
regs += codec->component.val_bytes)
|
||||
regmap_update_bits(ope->mbdrc_regmap, regs, mask,
|
||||
data[i] << shift);
|
||||
|
||||
@@ -264,7 +266,7 @@ static int tegra210_mbdrc_threshold_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
u32 regs = params->soc.base;
|
||||
@@ -272,7 +274,7 @@ static int tegra210_mbdrc_threshold_get(struct snd_kcontrol *kcontrol,
|
||||
u32 val;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_regs; i += 4, regs += codec->val_bytes) {
|
||||
for (i = 0; i < num_regs; i += 4, regs += codec->component.val_bytes) {
|
||||
regmap_read(ope->mbdrc_regmap, regs, &val);
|
||||
|
||||
data[i] = (val & TEGRA210_MBDRC_THRESH_1ST_MASK) >>
|
||||
@@ -292,14 +294,14 @@ static int tegra210_mbdrc_threshold_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
u32 regs = params->soc.base;
|
||||
u32 num_regs = params->soc.num_regs;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_regs; i += 4, regs += codec->val_bytes) {
|
||||
for (i = 0; i < num_regs; i += 4, regs += codec->component.val_bytes) {
|
||||
data[i] = (((data[i] >> TEGRA210_MBDRC_THRESH_1ST_SHIFT) &
|
||||
TEGRA210_MBDRC_THRESH_1ST_MASK) |
|
||||
((data[i + 1] >> TEGRA210_MBDRC_THRESH_2ND_SHIFT) &
|
||||
@@ -319,10 +321,10 @@ static int tegra210_mbdrc_biquad_coeffs_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
|
||||
memset(data, 0, params->soc.num_regs * codec->val_bytes);
|
||||
memset(data, 0, params->soc.num_regs * codec->component.val_bytes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -330,10 +332,10 @@ static int tegra210_mbdrc_biquad_coeffs_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
u32 reg_ctrl = params->soc.base;
|
||||
u32 reg_data = reg_ctrl + codec->val_bytes;
|
||||
u32 reg_data = reg_ctrl + codec->component.val_bytes;
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
|
||||
tegra210_xbar_write_ahubram(ope->mbdrc_regmap, reg_ctrl, reg_data,
|
||||
|
||||
@@ -154,7 +154,7 @@ static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int ret, i;
|
||||
@@ -265,14 +265,8 @@ static int tegra210_mixer_out_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_mixer_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = mixer->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int ret, value, wait = 0xffff;
|
||||
@@ -251,14 +251,8 @@ static int tegra210_mvc_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_mvc_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = mvc->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 64, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -158,14 +158,8 @@ static int tegra210_ope_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_ope_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = ope->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ope->soc_data->peq_soc_data.codec_init(codec);
|
||||
ope->soc_data->mbdrc_soc_data.codec_init(codec);
|
||||
|
||||
@@ -73,7 +73,7 @@ static int tegra210_peq_get(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||
unsigned int val;
|
||||
@@ -92,7 +92,7 @@ static int tegra210_peq_put(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||
unsigned int val;
|
||||
@@ -110,10 +110,10 @@ static int tegra210_peq_ahub_ram_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
|
||||
memset(data, 0, params->soc.num_regs * codec->val_bytes);
|
||||
memset(data, 0, params->soc.num_regs * codec->component.val_bytes);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -121,10 +121,10 @@ static int tegra210_peq_ahub_ram_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
||||
u32 reg_ctrl = params->soc.base;
|
||||
u32 reg_data = reg_ctrl + codec->val_bytes;
|
||||
u32 reg_data = reg_ctrl + codec->component.val_bytes;
|
||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||
|
||||
tegra210_xbar_write_ahubram(ope->peq_regmap, reg_ctrl, reg_data,
|
||||
|
||||
@@ -227,7 +227,7 @@ static int tegra210_sfc_out_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_sfc_get_srate(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
/* get the sfc output rate */
|
||||
@@ -239,7 +239,7 @@ static int tegra210_sfc_get_srate(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_sfc_put_srate(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
/* update the sfc output rate */
|
||||
@@ -251,14 +251,8 @@ static int tegra210_sfc_put_srate(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_sfc_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = sfc->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -222,14 +222,8 @@ static int tegra210_spdif_hw_params(struct snd_pcm_substream *substream,
|
||||
static int tegra210_spdif_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct tegra210_spdif *spdif = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
codec->control_data = spdif->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -99,14 +99,7 @@ static int tegra210_xbar_suspend(struct device *dev)
|
||||
|
||||
static int tegra210_xbar_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
int ret;
|
||||
|
||||
codec->control_data = xbar->regmap;
|
||||
ret = snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -335,9 +328,7 @@ static const int tegra210_xbar_mux_values[] = {
|
||||
static int tegra210_xbar_get_value_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||
struct snd_soc_codec *codec = widget->codec;
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int reg_count, reg_val, val, bit_pos = 0, i;
|
||||
unsigned int reg[TEGRA210_XBAR_UPDATE_MAX_REG];
|
||||
@@ -353,12 +344,13 @@ static int tegra210_xbar_get_value_enum(struct snd_kcontrol *kcontrol,
|
||||
reg_val = snd_soc_read(codec, reg[i]);
|
||||
val = reg_val & xbar->soc_data->mask[i];
|
||||
if (val != 0) {
|
||||
bit_pos = ffs(val) + (8 * codec->val_bytes * i);
|
||||
bit_pos = ffs(val) +
|
||||
(8*codec->component.val_bytes * i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < e->max; i++) {
|
||||
for (i = 0; i < e->items; i++) {
|
||||
if (bit_pos == e->values[i]) {
|
||||
ucontrol->value.enumerated.item[0] = i;
|
||||
break;
|
||||
@@ -371,13 +363,13 @@ static int tegra210_xbar_get_value_enum(struct snd_kcontrol *kcontrol,
|
||||
static int tegra210_xbar_put_value_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_widget *widget = wlist->widgets[0];
|
||||
struct snd_soc_codec *codec = widget->codec;
|
||||
struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_dapm_kcontrol_dapm(kcontrol);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int *item = ucontrol->value.enumerated.item;
|
||||
unsigned int change = 0, reg_idx = 0, value, *mask, bit_pos = 0;
|
||||
unsigned int i, wi, reg_count, reg_val = 0, update_idx = 0;
|
||||
unsigned int i, reg_count, reg_val = 0, update_idx = 0;
|
||||
unsigned int reg[TEGRA210_XBAR_UPDATE_MAX_REG];
|
||||
struct snd_soc_dapm_update update[TEGRA210_XBAR_UPDATE_MAX_REG];
|
||||
|
||||
@@ -385,15 +377,15 @@ static int tegra210_xbar_put_value_enum(struct snd_kcontrol *kcontrol,
|
||||
reg_count = xbar->soc_data->reg_count;
|
||||
mask = (unsigned int *)xbar->soc_data->mask;
|
||||
|
||||
if (item[0] >= e->max || reg_count > TEGRA210_XBAR_UPDATE_MAX_REG)
|
||||
if (item[0] >= e->items || reg_count > TEGRA210_XBAR_UPDATE_MAX_REG)
|
||||
return -EINVAL;
|
||||
|
||||
value = e->values[item[0]];
|
||||
|
||||
if (value) {
|
||||
/* get the register index and value to set */
|
||||
reg_idx = (value - 1) / (8 * codec->val_bytes);
|
||||
bit_pos = (value - 1) % (8 * codec->val_bytes);
|
||||
reg_idx = (value - 1) / (8 * codec->component.val_bytes);
|
||||
bit_pos = (value - 1) % (8 * codec->component.val_bytes);
|
||||
reg_val = BIT(bit_pos);
|
||||
}
|
||||
|
||||
@@ -421,17 +413,10 @@ static int tegra210_xbar_put_value_enum(struct snd_kcontrol *kcontrol,
|
||||
|
||||
/* power the widgets */
|
||||
if (change) {
|
||||
for (wi = 0; wi < wlist->num_widgets; wi++) {
|
||||
widget = wlist->widgets[wi];
|
||||
widget->value = reg_val;
|
||||
for (i = 0; i < reg_count; i++) {
|
||||
update[i].kcontrol = kcontrol;
|
||||
update[i].widget = widget;
|
||||
widget->dapm->update = &update[i];
|
||||
snd_soc_dapm_mux_update_power(widget,
|
||||
kcontrol, item[0], e);
|
||||
widget->dapm->update = NULL;
|
||||
}
|
||||
for (i = 0; i < reg_count; i++) {
|
||||
update[i].kcontrol = kcontrol;
|
||||
snd_soc_dapm_mux_update_power(dapm,
|
||||
kcontrol, item[0], e, &update[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +427,7 @@ static int tegra210_xbar_put_value_enum(struct snd_kcontrol *kcontrol,
|
||||
|
||||
#define SOC_VALUE_ENUM_WIDE(xreg, shift, xmax, xtexts, xvalues) \
|
||||
{ .reg = xreg, .shift_l = shift, .shift_r = shift, \
|
||||
.max = xmax, .texts = xtexts, .values = xvalues, \
|
||||
.items = xmax, .texts = xtexts, .values = xvalues, \
|
||||
.mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0}
|
||||
|
||||
#define SOC_VALUE_ENUM_WIDE_DECL(name, xreg, shift, \
|
||||
@@ -514,7 +499,7 @@ MUX_ENUM_CTRL_DECL(adx2_tx, 0x59);
|
||||
#define WIDGETS(sname, ename) \
|
||||
SND_SOC_DAPM_AIF_IN(sname " RX", NULL, 0, SND_SOC_NOPM, 0, 0), \
|
||||
SND_SOC_DAPM_AIF_OUT(sname " TX", NULL, 0, SND_SOC_NOPM, 0, 0), \
|
||||
SND_SOC_DAPM_VALUE_MUX(sname " Mux", SND_SOC_NOPM, 0, 0, &ename##_control)
|
||||
SND_SOC_DAPM_MUX(sname " Mux", SND_SOC_NOPM, 0, 0, &ename##_control)
|
||||
|
||||
#define TX_WIDGETS(sname) \
|
||||
SND_SOC_DAPM_AIF_IN(sname " RX", NULL, 0, SND_SOC_NOPM, 0, 0), \
|
||||
@@ -818,6 +803,7 @@ static int tegra210_xbar_probe(struct platform_device *pdev)
|
||||
int ret, i;
|
||||
const struct of_device_id *match;
|
||||
struct tegra210_xbar_soc_data *soc_data;
|
||||
struct resource *res;
|
||||
struct clk *parent_clk;
|
||||
|
||||
match = of_match_device(tegra210_xbar_of_match, &pdev->dev);
|
||||
@@ -869,7 +855,7 @@ static int tegra210_xbar_probe(struct platform_device *pdev)
|
||||
goto err_clk_put;
|
||||
}
|
||||
|
||||
xbar->clk_ape = clk_get_sys(NULL, "ape");
|
||||
xbar->clk_ape = clk_get_sys(NULL, "xbar.ape");
|
||||
if (IS_ERR(xbar->clk_ape)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve ape clock\n");
|
||||
ret = PTR_ERR(xbar->clk_ape);
|
||||
@@ -902,7 +888,14 @@ static int tegra210_xbar_probe(struct platform_device *pdev)
|
||||
goto err_clk_put_ape;
|
||||
}
|
||||
|
||||
regs = devm_request_and_ioremap(&pdev->dev, pdev->resource);
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "No memory resource for admaif\n");
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (!regs) {
|
||||
dev_err(&pdev->dev, "request/iomap region failed\n");
|
||||
ret = -ENODEV;
|
||||
|
||||
Reference in New Issue
Block a user