mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
ASoC: tegra: move remaining AHUB devices to component
Following AHUB modules are considered as part of this series. This updates all drivers to use component structure. Initially AHUB, I2S, DMIC, DSPK and ADMAIF drivers were updated. FPGA code is removed from the related drivers. This can be cherry-picked if it is really required. Bug 2845498 Change-Id: Ia3f60257c225d281d86ad83325fb517969259cb4 Signed-off-by: Sameer Pujar <spujar@nvidia.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra186_arad_alt.c - Tegra186 ARAD driver
|
* tegra186_arad.c - Tegra186 ARAD driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -31,8 +31,9 @@
|
|||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/tegra186_ahc.h>
|
#include <linux/tegra186_ahc.h>
|
||||||
|
|
||||||
#include "tegra186_asrc_alt.h"
|
#include "tegra186_asrc.h"
|
||||||
#include "tegra186_arad_alt.h"
|
#include "tegra186_arad.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra186-arad"
|
#define DRV_NAME "tegra186-arad"
|
||||||
|
|
||||||
@@ -173,8 +174,8 @@ static int tegra186_arad_mux_get(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_enum *arad_private =
|
struct soc_enum *arad_private =
|
||||||
(struct soc_enum *)kcontrol->private_value;
|
(struct soc_enum *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int val, loop = 0;
|
unsigned int val, loop = 0;
|
||||||
|
|
||||||
regmap_read(arad->regmap, arad_private->reg, &val);
|
regmap_read(arad->regmap, arad_private->reg, &val);
|
||||||
@@ -198,8 +199,8 @@ static int tegra186_arad_mux_put(struct snd_kcontrol *kcontrol,
|
|||||||
|
|
||||||
struct soc_enum *arad_private =
|
struct soc_enum *arad_private =
|
||||||
(struct soc_enum *)kcontrol->private_value;
|
(struct soc_enum *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int val = ucontrol->value.integer.value[0];
|
unsigned int val = ucontrol->value.integer.value[0];
|
||||||
if (!val)
|
if (!val)
|
||||||
regmap_write(arad->regmap, arad_private->reg, 0);
|
regmap_write(arad->regmap, arad_private->reg, 0);
|
||||||
@@ -229,8 +230,8 @@ static int tegra186_arad_get_ratio_int(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *arad_private =
|
struct soc_mixer_control *arad_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
regmap_read(arad->regmap, arad_private->reg, &val);
|
regmap_read(arad->regmap, arad_private->reg, &val);
|
||||||
@@ -244,8 +245,8 @@ static int tegra186_arad_get_ratio_frac(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *arad_private =
|
struct soc_mixer_control *arad_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
regmap_read(arad->regmap, arad_private->reg, &val);
|
regmap_read(arad->regmap, arad_private->reg, &val);
|
||||||
@@ -259,8 +260,8 @@ static int tegra186_arad_get_enable_lane(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *arad_private =
|
struct soc_mixer_control *arad_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int enable;
|
unsigned int enable;
|
||||||
|
|
||||||
regmap_read(arad->regmap, arad_private->reg, &enable);
|
regmap_read(arad->regmap, arad_private->reg, &enable);
|
||||||
@@ -275,9 +276,9 @@ static int tegra186_arad_put_enable_lane(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *arad_private =
|
struct soc_mixer_control *arad_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct device *dev = codec->dev;
|
struct device *dev = cmpnt->dev;
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int enable = 0, lane_id = arad_private->shift, state;
|
unsigned int enable = 0, lane_id = arad_private->shift, state;
|
||||||
int dcnt = 10;
|
int dcnt = 10;
|
||||||
|
|
||||||
@@ -323,8 +324,8 @@ static int tegra186_arad_put_enable_lane(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra186_arad_tx_stop(struct snd_soc_dapm_widget *w,
|
static int tegra186_arad_tx_stop(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
|
||||||
struct device *dev = codec->dev;
|
struct device *dev = cmpnt->dev;
|
||||||
struct tegra186_arad *arad = dev_get_drvdata(dev);
|
struct tegra186_arad *arad = dev_get_drvdata(dev);
|
||||||
|
|
||||||
regmap_write(arad->regmap, TEGRA186_ARAD_LANE_ENABLE, 0);
|
regmap_write(arad->regmap, TEGRA186_ARAD_LANE_ENABLE, 0);
|
||||||
@@ -359,8 +360,8 @@ static int tegra186_arad_get_prescalar(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *arad_private =
|
struct soc_mixer_control *arad_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int reg = arad_private->reg;
|
unsigned int reg = arad_private->reg;
|
||||||
unsigned int val = 0;
|
unsigned int val = 0;
|
||||||
|
|
||||||
@@ -375,8 +376,8 @@ static int tegra186_arad_put_prescalar(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *arad_private =
|
struct soc_mixer_control *arad_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_arad *arad = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_arad *arad = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int reg = arad_private->reg;
|
unsigned int reg = arad_private->reg;
|
||||||
|
|
||||||
regmap_write(arad->regmap, reg, ucontrol->value.integer.value[0]);
|
regmap_write(arad->regmap, reg, ucontrol->value.integer.value[0]);
|
||||||
@@ -537,16 +538,13 @@ void tegra186_arad_send_ratio(void)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(tegra186_arad_send_ratio);
|
EXPORT_SYMBOL(tegra186_arad_send_ratio);
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra186_arad_codec = {
|
static struct snd_soc_component_driver tegra186_arad_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra186_arad_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra186_arad_widgets),
|
||||||
.dapm_widgets = tegra186_arad_widgets,
|
.dapm_routes = tegra186_arad_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra186_arad_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra186_arad_routes),
|
||||||
.dapm_routes = tegra186_arad_routes,
|
.controls = tegra186_arad_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra186_arad_routes),
|
.num_controls = ARRAY_SIZE(tegra186_arad_controls),
|
||||||
.controls = tegra186_arad_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra186_arad_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra186_arad_wr_reg(struct device *dev, unsigned int reg)
|
static bool tegra186_arad_wr_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -774,7 +772,7 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
|
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra186_arad_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra186_arad_cmpnt,
|
||||||
tegra186_arad_dais,
|
tegra186_arad_dais,
|
||||||
ARRAY_SIZE(tegra186_arad_dais));
|
ARRAY_SIZE(tegra186_arad_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -798,7 +796,7 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra186_arad_platform_remove(struct platform_device *pdev)
|
static int tegra186_arad_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra186_arad_alt.h - Definitions for Tegra186 ARAD driver
|
* tegra186_arad.h - Definitions for Tegra186 ARAD driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra186_asrc_alt.c - Tegra186 ASRC driver
|
* tegra186_asrc.c - Tegra186 ASRC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -31,9 +31,10 @@
|
|||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/tegra186_ahc.h>
|
#include <linux/tegra186_ahc.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra186_asrc_alt.h"
|
#include "tegra186_asrc.h"
|
||||||
#include "tegra186_arad_alt.h"
|
#include "tegra186_arad.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra186-asrc"
|
#define DRV_NAME "tegra186-asrc"
|
||||||
#define ASRC_ARAM_START_ADDR 0x3F800000
|
#define ASRC_ARAM_START_ADDR 0x3F800000
|
||||||
@@ -226,28 +227,28 @@ static int tegra186_asrc_set_audio_cif(struct tegra186_asrc *asrc,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
tegra210_xbar_set_cif(asrc->regmap, reg, &cif_conf);
|
tegra_set_cif(asrc->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -342,8 +343,8 @@ static int tegra186_asrc_get_ratio_source(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_enum *asrc_private =
|
struct soc_enum *asrc_private =
|
||||||
(struct soc_enum *)kcontrol->private_value;
|
(struct soc_enum *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
/* get the source of a lane in asrc */
|
/* get the source of a lane in asrc */
|
||||||
@@ -357,8 +358,8 @@ static int tegra186_asrc_put_ratio_source(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_enum *asrc_private =
|
struct soc_enum *asrc_private =
|
||||||
(struct soc_enum *)kcontrol->private_value;
|
(struct soc_enum *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
/* update the source of the lane */
|
/* update the source of the lane */
|
||||||
@@ -375,8 +376,8 @@ static int tegra186_asrc_get_enable_stream(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int enable;
|
unsigned int enable;
|
||||||
|
|
||||||
regmap_read(asrc->regmap, asrc_private->reg, &enable);
|
regmap_read(asrc->regmap, asrc_private->reg, &enable);
|
||||||
@@ -390,8 +391,8 @@ static int tegra186_asrc_put_enable_stream(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int enable = 0;
|
unsigned int enable = 0;
|
||||||
|
|
||||||
enable = ucontrol->value.integer.value[0];
|
enable = ucontrol->value.integer.value[0];
|
||||||
@@ -405,8 +406,8 @@ static int tegra186_asrc_get_ratio_int(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
regmap_read(asrc->regmap,
|
regmap_read(asrc->regmap,
|
||||||
@@ -422,8 +423,8 @@ static int tegra186_asrc_put_ratio_int(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
asrc->lane[id].int_part = ucontrol->value.integer.value[0];
|
asrc->lane[id].int_part = ucontrol->value.integer.value[0];
|
||||||
@@ -440,8 +441,8 @@ static int tegra186_asrc_get_ratio_frac(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mreg_control *asrc_private =
|
struct soc_mreg_control *asrc_private =
|
||||||
(struct soc_mreg_control *)kcontrol->private_value;
|
(struct soc_mreg_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->regbase / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->regbase / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
regmap_read(asrc->regmap,
|
regmap_read(asrc->regmap,
|
||||||
@@ -457,8 +458,8 @@ static int tegra186_asrc_put_ratio_frac(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mreg_control *asrc_private =
|
struct soc_mreg_control *asrc_private =
|
||||||
(struct soc_mreg_control *)kcontrol->private_value;
|
(struct soc_mreg_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->regbase / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->regbase / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
asrc->lane[id].frac_part = ucontrol->value.integer.value[0];
|
asrc->lane[id].frac_part = ucontrol->value.integer.value[0];
|
||||||
@@ -475,8 +476,8 @@ static int tegra186_asrc_get_hwcomp_disable(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = asrc->lane[id].hwcomp_disable;
|
ucontrol->value.integer.value[0] = asrc->lane[id].hwcomp_disable;
|
||||||
@@ -489,8 +490,8 @@ static int tegra186_asrc_put_hwcomp_disable(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
asrc->lane[id].hwcomp_disable = ucontrol->value.integer.value[0];
|
asrc->lane[id].hwcomp_disable = ucontrol->value.integer.value[0];
|
||||||
@@ -503,8 +504,8 @@ static int tegra186_asrc_get_input_threshold(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = (asrc->lane[id].input_thresh & 0x3);
|
ucontrol->value.integer.value[0] = (asrc->lane[id].input_thresh & 0x3);
|
||||||
@@ -517,8 +518,8 @@ static int tegra186_asrc_put_input_threshold(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
asrc->lane[id].input_thresh = (asrc->lane[id].input_thresh & ~(0x3))
|
asrc->lane[id].input_thresh = (asrc->lane[id].input_thresh & ~(0x3))
|
||||||
@@ -531,8 +532,8 @@ static int tegra186_asrc_get_output_threshold(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = (asrc->lane[id].output_thresh & 0x3);
|
ucontrol->value.integer.value[0] = (asrc->lane[id].output_thresh & 0x3);
|
||||||
@@ -545,8 +546,8 @@ static int tegra186_asrc_put_output_threshold(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *asrc_private =
|
struct soc_mixer_control *asrc_private =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra186_asrc *asrc = snd_soc_codec_get_drvdata(codec);
|
struct tegra186_asrc *asrc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
unsigned int id = asrc_private->reg / TEGRA186_ASRC_STREAM_STRIDE;
|
||||||
|
|
||||||
asrc->lane[id].output_thresh = (asrc->lane[id].output_thresh & ~(0x3))
|
asrc->lane[id].output_thresh = (asrc->lane[id].output_thresh & ~(0x3))
|
||||||
@@ -557,8 +558,8 @@ static int tegra186_asrc_put_output_threshold(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra186_asrc_req_arad_ratio(struct snd_soc_dapm_widget *w,
|
static int tegra186_asrc_req_arad_ratio(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
|
||||||
struct device *dev = codec->dev;
|
struct device *dev = cmpnt->dev;
|
||||||
struct tegra186_asrc *asrc = dev_get_drvdata(dev);
|
struct tegra186_asrc *asrc = dev_get_drvdata(dev);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
unsigned int lane_id = 0;
|
unsigned int lane_id = 0;
|
||||||
@@ -873,16 +874,13 @@ static const struct snd_kcontrol_new tegra186_asrc_controls[] = {
|
|||||||
tegra186_asrc_get_output_threshold, tegra186_asrc_put_output_threshold),
|
tegra186_asrc_get_output_threshold, tegra186_asrc_put_output_threshold),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra186_asrc_codec = {
|
static struct snd_soc_component_driver tegra186_asrc_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra186_asrc_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra186_asrc_widgets),
|
||||||
.dapm_widgets = tegra186_asrc_widgets,
|
.dapm_routes = tegra186_asrc_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra186_asrc_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra186_asrc_routes),
|
||||||
.dapm_routes = tegra186_asrc_routes,
|
.controls = tegra186_asrc_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra186_asrc_routes),
|
.num_controls = ARRAY_SIZE(tegra186_asrc_controls),
|
||||||
.controls = tegra186_asrc_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra186_asrc_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra186_asrc_wr_reg(struct device *dev, unsigned int reg)
|
static bool tegra186_asrc_wr_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -1132,7 +1130,7 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra186_asrc_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra186_asrc_cmpnt,
|
||||||
tegra186_asrc_dais,
|
tegra186_asrc_dais,
|
||||||
ARRAY_SIZE(tegra186_asrc_dais));
|
ARRAY_SIZE(tegra186_asrc_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -1146,7 +1144,7 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra186_asrc_platform_remove(struct platform_device *pdev)
|
static int tegra186_asrc_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra186_asrc_alt.h - Definitions for Tegra186 ASRC driver
|
* tegra186_asrc.h - Definitions for Tegra186 ASRC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -156,7 +156,7 @@ enum asrc_task_event {
|
|||||||
STREAM_ENABLE,
|
STREAM_ENABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tegra210_xbar_cif_conf;
|
struct tegra_cif_conf;
|
||||||
|
|
||||||
struct tegra186_asrc_lane {
|
struct tegra186_asrc_lane {
|
||||||
unsigned int int_part;
|
unsigned int int_part;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_adx_alt.c - Tegra210 ADX driver
|
* tegra210_adx.c - Tegra210 ADX driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -24,15 +24,15 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <soc/tegra/chip-id.h>
|
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_adx_alt.h"
|
#include "tegra210_adx.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-adx"
|
#define DRV_NAME "tegra210-adx"
|
||||||
|
|
||||||
@@ -157,8 +157,8 @@ static void tegra210_adx_update_map_ram(struct tegra210_adx *adx)
|
|||||||
static int tegra210_adx_stop(struct snd_soc_dapm_widget *w,
|
static int tegra210_adx_stop(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
|
||||||
struct device *dev = codec->dev;
|
struct device *dev = cmpnt->dev;
|
||||||
struct tegra210_adx *adx = dev_get_drvdata(dev);
|
struct tegra210_adx *adx = dev_get_drvdata(dev);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -245,34 +245,34 @@ static int tegra210_adx_set_audio_cif(struct snd_soc_dai *dai,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai);
|
struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai);
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
int audio_bits;
|
int audio_bits;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
if (channels < 1 || channels > 16)
|
if (channels < 1 || channels > 16)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case SNDRV_PCM_FORMAT_S8:
|
case SNDRV_PCM_FORMAT_S8:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_8;
|
audio_bits = TEGRA_ACIF_BITS_8;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(adx->regmap, reg, &cif_conf);
|
tegra_set_cif(adx->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -325,12 +325,6 @@ static int tegra210_adx_in_hw_params(struct snd_pcm_substream *substream,
|
|||||||
struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai);
|
struct tegra210_adx *adx = snd_soc_dai_get_drvdata(dai);
|
||||||
int channels;
|
int channels;
|
||||||
|
|
||||||
if (tegra_platform_is_unit_fpga() || tegra_platform_is_fpga()) {
|
|
||||||
/* update the map ram */
|
|
||||||
tegra210_adx_update_map_ram(adx);
|
|
||||||
tegra210_adx_set_in_byte_mask(adx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adx->input_channels > 0)
|
if (adx->input_channels > 0)
|
||||||
channels = adx->input_channels;
|
channels = adx->input_channels;
|
||||||
else
|
else
|
||||||
@@ -390,8 +384,8 @@ static int tegra210_adx_set_channel_map(struct snd_soc_dai *dai,
|
|||||||
static int tegra210_adx_get_byte_map(struct snd_kcontrol *kcontrol,
|
static int tegra210_adx_get_byte_map(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
struct soc_mixer_control *mc;
|
struct soc_mixer_control *mc;
|
||||||
unsigned char *bytes_map = (unsigned char *)&adx->map;
|
unsigned char *bytes_map = (unsigned char *)&adx->map;
|
||||||
int enabled;
|
int enabled;
|
||||||
@@ -410,8 +404,8 @@ static int tegra210_adx_get_byte_map(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_adx_put_byte_map(struct snd_kcontrol *kcontrol,
|
static int tegra210_adx_put_byte_map(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
struct soc_mixer_control *mc;
|
struct soc_mixer_control *mc;
|
||||||
unsigned char *bytes_map = (unsigned char *)&adx->map;
|
unsigned char *bytes_map = (unsigned char *)&adx->map;
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
@@ -434,8 +428,8 @@ static int tegra210_adx_put_byte_map(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_adx_get_in_channels(struct snd_kcontrol *kcontrol,
|
static int tegra210_adx_get_in_channels(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = adx->input_channels;
|
ucontrol->value.integer.value[0] = adx->input_channels;
|
||||||
|
|
||||||
@@ -445,8 +439,8 @@ static int tegra210_adx_get_in_channels(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_adx_put_in_channels(struct snd_kcontrol *kcontrol,
|
static int tegra210_adx_put_in_channels(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
if (value < 0 || value > 16)
|
if (value < 0 || value > 16)
|
||||||
@@ -460,8 +454,8 @@ static int tegra210_adx_put_in_channels(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_adx_get_out_channels(struct snd_kcontrol *kcontrol,
|
static int tegra210_adx_get_out_channels(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
struct soc_mixer_control *mc;
|
struct soc_mixer_control *mc;
|
||||||
|
|
||||||
mc = (struct soc_mixer_control *)kcontrol->private_value;
|
mc = (struct soc_mixer_control *)kcontrol->private_value;
|
||||||
@@ -474,8 +468,8 @@ static int tegra210_adx_get_out_channels(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_adx_put_out_channels(struct snd_kcontrol *kcontrol,
|
static int tegra210_adx_put_out_channels(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_adx *adx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_adx *adx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
struct soc_mixer_control *mc;
|
struct soc_mixer_control *mc;
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
@@ -643,16 +637,13 @@ static struct snd_kcontrol_new tegra210_adx_controls[] = {
|
|||||||
TEGRA210_ADX_INPUT_CHANNELS_CTRL(1),
|
TEGRA210_ADX_INPUT_CHANNELS_CTRL(1),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_adx_codec = {
|
static struct snd_soc_component_driver tegra210_adx_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_adx_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_adx_widgets),
|
||||||
.dapm_widgets = tegra210_adx_widgets,
|
.dapm_routes = tegra210_adx_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_adx_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_adx_routes),
|
||||||
.dapm_routes = tegra210_adx_routes,
|
.controls = tegra210_adx_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_adx_routes),
|
.num_controls = ARRAY_SIZE(tegra210_adx_controls),
|
||||||
.controls = tegra210_adx_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_adx_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_adx_wr_reg(struct device *dev,
|
static bool tegra210_adx_wr_reg(struct device *dev,
|
||||||
@@ -795,7 +786,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
|
|||||||
regcache_cache_only(adx->regmap, true);
|
regcache_cache_only(adx->regmap, true);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_adx_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_adx_cmpnt,
|
||||||
tegra210_adx_dais,
|
tegra210_adx_dais,
|
||||||
ARRAY_SIZE(tegra210_adx_dais));
|
ARRAY_SIZE(tegra210_adx_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -809,7 +800,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_adx_platform_remove(struct platform_device *pdev)
|
static int tegra210_adx_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_adx_alt.h - Definitions for Tegra210 ADX driver
|
* tegra210_adx.h - Definitions for Tegra210 ADX driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -54,19 +54,19 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Fields in TEGRA210_ADX_AXBAR_RX_CIF_CTRL */
|
/* Fields in TEGRA210_ADX_AXBAR_RX_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_ADX_AXBAR_TX1_CIF_CTRL */
|
/* Fields in TEGRA210_ADX_AXBAR_TX1_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_ADX_AXBAR_TX2_CIF_CTRL */
|
/* Fields in TEGRA210_ADX_AXBAR_TX2_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_ADX_AXBAR_TX3_CIF_CTRL */
|
/* Fields in TEGRA210_ADX_AXBAR_TX3_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_ADX_AXBAR_TX_CIF_CTRL */
|
/* Fields in TEGRA210_ADX_AXBAR_TX_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_ADX_ENABLE */
|
/* Fields in TEGRA210_ADX_ENABLE */
|
||||||
#define TEGRA210_ADX_ENABLE_SHIFT 0
|
#define TEGRA210_ADX_ENABLE_SHIFT 0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_afc_alt.c - Tegra210 AFC driver
|
* tegra210_afc.c - Tegra210 AFC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -29,8 +29,9 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_afc_alt.h"
|
#include "tegra210_afc.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-afc"
|
#define DRV_NAME "tegra210-afc"
|
||||||
|
|
||||||
@@ -86,8 +87,8 @@ static int tegra210_afc_runtime_resume(struct device *dev)
|
|||||||
static int tegra210_afc_controls_get(struct snd_kcontrol *kctl,
|
static int tegra210_afc_controls_get(struct snd_kcontrol *kctl,
|
||||||
struct snd_ctl_elem_value *uctl)
|
struct snd_ctl_elem_value *uctl)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kctl);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kctl);
|
||||||
struct tegra210_afc *afc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_afc *afc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
if (strstr(kctl->id.name, "ppm diff"))
|
if (strstr(kctl->id.name, "ppm diff"))
|
||||||
uctl->value.integer.value[0] = afc->ppm_diff;
|
uctl->value.integer.value[0] = afc->ppm_diff;
|
||||||
@@ -106,8 +107,8 @@ static int tegra210_afc_controls_get(struct snd_kcontrol *kctl,
|
|||||||
static int tegra210_afc_controls_put(struct snd_kcontrol *kctl,
|
static int tegra210_afc_controls_put(struct snd_kcontrol *kctl,
|
||||||
struct snd_ctl_elem_value *uctl)
|
struct snd_ctl_elem_value *uctl)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kctl);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kctl);
|
||||||
struct tegra210_afc *afc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_afc *afc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int value = uctl->value.integer.value[0];
|
int value = uctl->value.integer.value[0];
|
||||||
|
|
||||||
if (strstr(kctl->id.name, "ppm diff")) {
|
if (strstr(kctl->id.name, "ppm diff")) {
|
||||||
@@ -296,9 +297,9 @@ static int tegra210_afc_set_audio_cif(struct tegra210_afc *afc,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
if (channels < 2)
|
if (channels < 2)
|
||||||
@@ -306,21 +307,21 @@ static int tegra210_afc_set_audio_cif(struct tegra210_afc *afc,
|
|||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(afc->regmap, reg, &cif_conf);
|
tegra_set_cif(afc->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -400,26 +401,20 @@ static const struct snd_soc_dapm_route tegra210_afc_routes[] = {
|
|||||||
{ "AFC Transmit", NULL, "AFC TX" },
|
{ "AFC Transmit", NULL, "AFC TX" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct snd_soc_codec_driver tegra210_afc_codec = {
|
static const struct snd_soc_component_driver tegra210_afc_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_afc_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_afc_widgets),
|
||||||
.dapm_widgets = tegra210_afc_widgets,
|
.dapm_routes = tegra210_afc_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_afc_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_afc_routes),
|
||||||
.dapm_routes = tegra210_afc_routes,
|
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_afc_routes),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct snd_soc_codec_driver tegra186_afc_codec = {
|
static const struct snd_soc_component_driver tegra186_afc_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_afc_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_afc_widgets),
|
||||||
.dapm_widgets = tegra210_afc_widgets,
|
.dapm_routes = tegra210_afc_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_afc_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_afc_routes),
|
||||||
.dapm_routes = tegra210_afc_routes,
|
.controls = tegra186_afc_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_afc_routes),
|
.num_controls = ARRAY_SIZE(tegra186_afc_controls),
|
||||||
.controls = tegra186_afc_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra186_afc_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_afc_wr_rd_reg(struct device *dev, unsigned int reg)
|
static bool tegra210_afc_wr_rd_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -486,13 +481,13 @@ static const struct regmap_config tegra210_afc_regmap_config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct tegra210_afc_soc_data soc_data_tegra210 = {
|
static const struct tegra210_afc_soc_data soc_data_tegra210 = {
|
||||||
.afc_codec = &tegra210_afc_codec,
|
.afc_cmpnt = &tegra210_afc_cmpnt,
|
||||||
.num_i2s = 5,
|
.num_i2s = 5,
|
||||||
.flag_module_select = false,
|
.flag_module_select = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct tegra210_afc_soc_data soc_data_tegra186 = {
|
static const struct tegra210_afc_soc_data soc_data_tegra186 = {
|
||||||
.afc_codec = &tegra186_afc_codec,
|
.afc_cmpnt = &tegra186_afc_cmpnt,
|
||||||
.num_i2s = 6,
|
.num_i2s = 6,
|
||||||
.flag_module_select = true,
|
.flag_module_select = true,
|
||||||
};
|
};
|
||||||
@@ -544,7 +539,7 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev)
|
|||||||
regmap_write(afc->regmap, TEGRA210_AFC_CG, 0);
|
regmap_write(afc->regmap, TEGRA210_AFC_CG, 0);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, afc->soc_data->afc_codec,
|
ret = snd_soc_register_component(&pdev->dev, afc->soc_data->afc_cmpnt,
|
||||||
tegra210_afc_dais,
|
tegra210_afc_dais,
|
||||||
ARRAY_SIZE(tegra210_afc_dais));
|
ARRAY_SIZE(tegra210_afc_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -558,7 +553,7 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_afc_platform_remove(struct platform_device *pdev)
|
static int tegra210_afc_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_afc_alt.h - Definitions for Tegra210 AFC driver
|
* tegra210_afc.h - Definitions for Tegra210 AFC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
struct tegra210_afc_soc_data {
|
struct tegra210_afc_soc_data {
|
||||||
unsigned int num_i2s;
|
unsigned int num_i2s;
|
||||||
bool flag_module_select;
|
bool flag_module_select;
|
||||||
const struct snd_soc_codec_driver *afc_codec;
|
const struct snd_soc_component_driver *afc_cmpnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum tegra210_afc_threshold_type {
|
enum tegra210_afc_threshold_type {
|
||||||
|
|||||||
@@ -96,6 +96,48 @@ static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tegra210_ahub_write_ram(struct regmap *regmap, unsigned int reg_ctrl,
|
||||||
|
unsigned int reg_data, unsigned int ram_offset,
|
||||||
|
unsigned int *data, size_t size)
|
||||||
|
{
|
||||||
|
unsigned int val = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
val = ram_offset & TEGRA210_AHUBRAMCTL_CTRL_RAM_ADDR_MASK;
|
||||||
|
val |= TEGRA210_AHUBRAMCTL_CTRL_ADDR_INIT_EN;
|
||||||
|
val |= TEGRA210_AHUBRAMCTL_CTRL_SEQ_ACCESS_EN;
|
||||||
|
val |= TEGRA210_AHUBRAMCTL_CTRL_RW_WRITE;
|
||||||
|
|
||||||
|
regmap_write(regmap, reg_ctrl, val);
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
regmap_write(regmap, reg_data, data[i]);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(tegra210_ahub_write_ram);
|
||||||
|
|
||||||
|
void tegra210_ahub_read_ram(struct regmap *regmap, unsigned int reg_ctrl,
|
||||||
|
unsigned int reg_data, unsigned int ram_offset,
|
||||||
|
unsigned int *data, size_t size)
|
||||||
|
{
|
||||||
|
unsigned int val = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
val = ram_offset & TEGRA210_AHUBRAMCTL_CTRL_RAM_ADDR_MASK;
|
||||||
|
val |= TEGRA210_AHUBRAMCTL_CTRL_ADDR_INIT_EN;
|
||||||
|
val |= TEGRA210_AHUBRAMCTL_CTRL_SEQ_ACCESS_EN;
|
||||||
|
val |= TEGRA210_AHUBRAMCTL_CTRL_RW_READ;
|
||||||
|
|
||||||
|
regmap_write(regmap, reg_ctrl, val);
|
||||||
|
/* Since all ahub non-io modules work under same ahub clock it is not
|
||||||
|
necessary to check ahub read busy bit after every read */
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
regmap_read(regmap, reg_data, &data[i]);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(tegra210_ahub_read_ram);
|
||||||
|
|
||||||
static struct snd_soc_dai_driver tegra210_ahub_dais[] = {
|
static struct snd_soc_dai_driver tegra210_ahub_dais[] = {
|
||||||
DAI(ADMAIF1),
|
DAI(ADMAIF1),
|
||||||
DAI(ADMAIF2),
|
DAI(ADMAIF2),
|
||||||
|
|||||||
@@ -28,6 +28,13 @@
|
|||||||
#define TEGRA186_XBAR_REG_MASK_3 0x3f0f00ff
|
#define TEGRA186_XBAR_REG_MASK_3 0x3f0f00ff
|
||||||
#define TEGRA186_XBAR_UPDATE_MAX_REG 4
|
#define TEGRA186_XBAR_UPDATE_MAX_REG 4
|
||||||
|
|
||||||
|
/* Fields in *AHUBRAMCTL_CTRL; used by different AHUB modules */
|
||||||
|
#define TEGRA210_AHUBRAMCTL_CTRL_RW_READ 0
|
||||||
|
#define TEGRA210_AHUBRAMCTL_CTRL_RW_WRITE (1 << 14)
|
||||||
|
#define TEGRA210_AHUBRAMCTL_CTRL_ADDR_INIT_EN (1 << 13)
|
||||||
|
#define TEGRA210_AHUBRAMCTL_CTRL_SEQ_ACCESS_EN (1 << 12)
|
||||||
|
#define TEGRA210_AHUBRAMCTL_CTRL_RAM_ADDR_MASK 0x1ff
|
||||||
|
|
||||||
#define TEGRA_XBAR_UPDATE_MAX_REG (TEGRA186_XBAR_UPDATE_MAX_REG)
|
#define TEGRA_XBAR_UPDATE_MAX_REG (TEGRA186_XBAR_UPDATE_MAX_REG)
|
||||||
|
|
||||||
#define TEGRA186_MAX_REGISTER_ADDR (TEGRA186_XBAR_PART3_RX + \
|
#define TEGRA186_MAX_REGISTER_ADDR (TEGRA186_XBAR_PART3_RX + \
|
||||||
@@ -125,4 +132,11 @@ struct tegra_ahub {
|
|||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void tegra210_ahub_write_ram(struct regmap *regmap, unsigned int reg_ctrl,
|
||||||
|
unsigned int reg_data, unsigned int ram_offset,
|
||||||
|
unsigned int *data, size_t size);
|
||||||
|
void tegra210_ahub_read_ram(struct regmap *regmap, unsigned int reg_ctrl,
|
||||||
|
unsigned int reg_data, unsigned int ram_offset,
|
||||||
|
unsigned int *data, size_t size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_amx_alt.c - Tegra210 AMX driver
|
* tegra210_amx.c - Tegra210 AMX driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -24,15 +24,15 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <soc/tegra/chip-id.h>
|
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_amx_alt.h"
|
#include "tegra210_amx.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-amx"
|
#define DRV_NAME "tegra210-amx"
|
||||||
|
|
||||||
@@ -181,8 +181,8 @@ static void tegra210_amx_update_map_ram(struct tegra210_amx *amx)
|
|||||||
static int tegra210_amx_stop(struct snd_soc_dapm_widget *w,
|
static int tegra210_amx_stop(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
|
struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
|
||||||
struct device *dev = codec->dev;
|
struct device *dev = cmpnt->dev;
|
||||||
struct tegra210_amx *amx = dev_get_drvdata(dev);
|
struct tegra210_amx *amx = dev_get_drvdata(dev);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -271,9 +271,9 @@ static int tegra210_amx_set_audio_cif(struct snd_soc_dai *dai,
|
|||||||
{
|
{
|
||||||
struct tegra210_amx *amx = snd_soc_dai_get_drvdata(dai);
|
struct tegra210_amx *amx = snd_soc_dai_get_drvdata(dai);
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
|
|
||||||
@@ -290,24 +290,24 @@ static int tegra210_amx_set_audio_cif(struct snd_soc_dai *dai,
|
|||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S8:
|
case SNDRV_PCM_FORMAT_S8:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_8;
|
audio_bits = TEGRA_ACIF_BITS_8;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(amx->regmap, reg, &cif_conf);
|
tegra_set_cif(amx->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -373,20 +373,8 @@ static int tegra210_amx_out_hw_params(struct snd_pcm_substream *substream,
|
|||||||
struct snd_pcm_hw_params *params,
|
struct snd_pcm_hw_params *params,
|
||||||
struct snd_soc_dai *dai)
|
struct snd_soc_dai *dai)
|
||||||
{
|
{
|
||||||
int ret;
|
return tegra210_amx_set_audio_cif(dai, params,
|
||||||
if (tegra_platform_is_unit_fpga() || tegra_platform_is_fpga()) {
|
TEGRA210_AMX_AXBAR_TX_CIF_CTRL);
|
||||||
/* update map ram */
|
|
||||||
struct tegra210_amx *amx = snd_soc_dai_get_drvdata(dai);
|
|
||||||
tegra210_amx_set_master_stream(amx, 0,
|
|
||||||
TEGRA210_AMX_WAIT_ON_ANY);
|
|
||||||
tegra210_amx_update_map_ram(amx);
|
|
||||||
tegra210_amx_set_out_byte_mask(amx);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = tegra210_amx_set_audio_cif(dai, params,
|
|
||||||
TEGRA210_AMX_AXBAR_TX_CIF_CTRL);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra210_amx_set_channel_map(struct snd_soc_dai *dai,
|
static int tegra210_amx_set_channel_map(struct snd_soc_dai *dai,
|
||||||
@@ -439,10 +427,10 @@ static int tegra210_amx_set_channel_map(struct snd_soc_dai *dai,
|
|||||||
static int tegra210_amx_get_byte_map(struct snd_kcontrol *kcontrol,
|
static int tegra210_amx_get_byte_map(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct tegra210_amx *amx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_amx *amx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned char *bytes_map = (unsigned char *)&amx->map;
|
unsigned char *bytes_map = (unsigned char *)&amx->map;
|
||||||
int reg = mc->reg;
|
int reg = mc->reg;
|
||||||
int enabled;
|
int enabled;
|
||||||
@@ -465,8 +453,8 @@ static int tegra210_amx_put_byte_map(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_amx *amx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_amx *amx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned char *bytes_map = (unsigned char *)&amx->map;
|
unsigned char *bytes_map = (unsigned char *)&amx->map;
|
||||||
int reg = mc->reg;
|
int reg = mc->reg;
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
@@ -493,10 +481,10 @@ static int tegra210_amx_put_byte_map(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_amx_get_channels(struct snd_kcontrol *kcontrol,
|
static int tegra210_amx_get_channels(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct tegra210_amx *amx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_amx *amx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int reg = mc->reg;
|
int reg = mc->reg;
|
||||||
char buf[50];
|
char buf[50];
|
||||||
|
|
||||||
@@ -512,10 +500,10 @@ static int tegra210_amx_get_channels(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_amx_put_channels(struct snd_kcontrol *kcontrol,
|
static int tegra210_amx_put_channels(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct tegra210_amx *amx = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_amx *amx = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int reg = mc->reg;
|
int reg = mc->reg;
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
char buf[50];
|
char buf[50];
|
||||||
@@ -688,16 +676,13 @@ static struct snd_kcontrol_new tegra210_amx_controls[] = {
|
|||||||
TEGRA210_AMX_INPUT_CHANNELS_CTRL(4),
|
TEGRA210_AMX_INPUT_CHANNELS_CTRL(4),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_amx_codec = {
|
static struct snd_soc_component_driver tegra210_amx_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_amx_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_amx_widgets),
|
||||||
.dapm_widgets = tegra210_amx_widgets,
|
.dapm_routes = tegra210_amx_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_amx_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_amx_routes),
|
||||||
.dapm_routes = tegra210_amx_routes,
|
.controls = tegra210_amx_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_amx_routes),
|
.num_controls = ARRAY_SIZE(tegra210_amx_controls),
|
||||||
.controls = tegra210_amx_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_amx_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_amx_wr_reg(struct device *dev,
|
static bool tegra210_amx_wr_reg(struct device *dev,
|
||||||
@@ -878,7 +863,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
|||||||
regcache_cache_only(amx->regmap, true);
|
regcache_cache_only(amx->regmap, true);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_amx_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_amx_cmpnt,
|
||||||
tegra210_amx_dais,
|
tegra210_amx_dais,
|
||||||
ARRAY_SIZE(tegra210_amx_dais));
|
ARRAY_SIZE(tegra210_amx_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -892,7 +877,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_amx_platform_remove(struct platform_device *pdev)
|
static int tegra210_amx_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_amx_alt.h - Definitions for Tegra210 AMX driver
|
* tegra210_amx.h - Definitions for Tegra210 AMX driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -56,19 +56,19 @@
|
|||||||
#define TEGRA194_AMX_RX4_LAST_FRAME_PERIOD 0xdc
|
#define TEGRA194_AMX_RX4_LAST_FRAME_PERIOD 0xdc
|
||||||
|
|
||||||
/* Fields in TEGRA210_AMX_AXBAR_RX1_CIF_CTRL */
|
/* Fields in TEGRA210_AMX_AXBAR_RX1_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_AMX_AXBAR_RX2_CIF_CTRL */
|
/* Fields in TEGRA210_AMX_AXBAR_RX2_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_AMX_AXBAR_RX3_CIF_CTRL */
|
/* Fields in TEGRA210_AMX_AXBAR_RX3_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_AMX_AXBAR_RX4_CIF_CTRL */
|
/* Fields in TEGRA210_AMX_AXBAR_RX4_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_AMX_AXBAR_TX_CIF_CTRL */
|
/* Fields in TEGRA210_AMX_AXBAR_TX_CIF_CTRL */
|
||||||
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_xbar_alt.h */
|
/* Uses field from TEGRA210_AUDIOCIF_CTRL_* in tegra210_ahub.h */
|
||||||
|
|
||||||
/* Fields in TEGRA210_AMX_ENABLE */
|
/* Fields in TEGRA210_AMX_ENABLE */
|
||||||
#define TEGRA210_AMX_ENABLE_SHIFT 0
|
#define TEGRA210_AMX_ENABLE_SHIFT 0
|
||||||
|
|||||||
@@ -28,10 +28,10 @@
|
|||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/tegra-soc.h>
|
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_iqc_alt.h"
|
#include "tegra210_iqc.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-iqc"
|
#define DRV_NAME "tegra210-iqc"
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ static int tegra210_iqc_set_audio_cif(struct tegra210_iqc *iqc,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
if (channels < 2)
|
if (channels < 2)
|
||||||
@@ -88,22 +88,22 @@ static int tegra210_iqc_set_audio_cif(struct tegra210_iqc *iqc,
|
|||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(iqc->regmap, reg, &cif_conf);
|
tegra_set_cif(iqc->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -201,16 +201,13 @@ static const struct snd_soc_dapm_route tegra210_iqc_routes[] = {
|
|||||||
{ "CIF2 Transmit", NULL, "IQC TX2" },
|
{ "CIF2 Transmit", NULL, "IQC TX2" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_iqc_codec = {
|
static struct snd_soc_component_driver tegra210_iqc_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_iqc_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_iqc_widgets),
|
||||||
.dapm_widgets = tegra210_iqc_widgets,
|
.dapm_routes = tegra210_iqc_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_iqc_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_iqc_routes),
|
||||||
.dapm_routes = tegra210_iqc_routes,
|
.controls = tegra210_iqc_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_iqc_routes),
|
.num_controls = ARRAY_SIZE(tegra210_iqc_controls),
|
||||||
.controls = tegra210_iqc_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_iqc_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_iqc_wr_reg(struct device *dev, unsigned int reg)
|
static bool tegra210_iqc_wr_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -306,12 +303,10 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
dev_set_drvdata(&pdev->dev, iqc);
|
dev_set_drvdata(&pdev->dev, iqc);
|
||||||
|
|
||||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
iqc->clk_iqc = devm_clk_get(&pdev->dev, NULL);
|
||||||
iqc->clk_iqc = devm_clk_get(&pdev->dev, NULL);
|
if (IS_ERR(iqc->clk_iqc)) {
|
||||||
if (IS_ERR(iqc->clk_iqc)) {
|
dev_err(&pdev->dev, "Can't retrieve iqc clock\n");
|
||||||
dev_err(&pdev->dev, "Can't retrieve iqc clock\n");
|
return PTR_ERR(iqc->clk_iqc);
|
||||||
return PTR_ERR(iqc->clk_iqc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
@@ -343,7 +338,7 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_iqc_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_iqc_cmpnt,
|
||||||
tegra210_iqc_dais,
|
tegra210_iqc_dais,
|
||||||
ARRAY_SIZE(tegra210_iqc_dais));
|
ARRAY_SIZE(tegra210_iqc_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -357,9 +352,7 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_iqc_platform_remove(struct platform_device *pdev)
|
static int tegra210_iqc_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct tegra210_iqc *iqc = dev_get_drvdata(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_iqc_alt.h - Definitions for Tegra210 IQC driver
|
* tegra210_iqc.h - Definitions for Tegra210 IQC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_mbdrc_alt.c - Tegra210 MBDRC driver
|
* tegra210_mbdrc.c - Tegra210 MBDRC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_ope_alt.h"
|
#include "tegra210_ope.h"
|
||||||
#include "tegra210_mbdrc_alt.h"
|
#include "tegra210_mbdrc.h"
|
||||||
|
|
||||||
#define MBDRC_FILTER_REG(reg, id) \
|
#define MBDRC_FILTER_REG(reg, id) \
|
||||||
(reg + (id * TEGRA210_MBDRC_FILTER_PARAM_STRIDE))
|
(reg + (id * TEGRA210_MBDRC_FILTER_PARAM_STRIDE))
|
||||||
@@ -155,8 +155,8 @@ static int tegra210_mbdrc_get(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
@@ -174,8 +174,8 @@ static int tegra210_mbdrc_put(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
@@ -191,8 +191,8 @@ static int tegra210_mbdrc_put(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mbdrc_get_enum(struct snd_kcontrol *kcontrol,
|
static int tegra210_mbdrc_get_enum(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
@@ -205,8 +205,8 @@ static int tegra210_mbdrc_get_enum(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mbdrc_put_enum(struct snd_kcontrol *kcontrol,
|
static int tegra210_mbdrc_put_enum(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
@@ -224,8 +224,8 @@ static int tegra210_mbdrc_band_params_get(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||||
u32 regs = params->soc.base;
|
u32 regs = params->soc.base;
|
||||||
u32 mask = params->soc.mask;
|
u32 mask = params->soc.mask;
|
||||||
@@ -233,7 +233,7 @@ static int tegra210_mbdrc_band_params_get(struct snd_kcontrol *kcontrol,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < params->soc.num_regs; i++,
|
for (i = 0; i < params->soc.num_regs; i++,
|
||||||
regs += codec->component.val_bytes) {
|
regs += cmpnt->val_bytes) {
|
||||||
regmap_read(ope->mbdrc_regmap, regs, &data[i]);
|
regmap_read(ope->mbdrc_regmap, regs, &data[i]);
|
||||||
data[i] = ((data[i] & mask) >> shift);
|
data[i] = ((data[i] & mask) >> shift);
|
||||||
}
|
}
|
||||||
@@ -245,8 +245,8 @@ static int tegra210_mbdrc_band_params_put(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||||
u32 regs = params->soc.base;
|
u32 regs = params->soc.base;
|
||||||
u32 mask = params->soc.mask;
|
u32 mask = params->soc.mask;
|
||||||
@@ -254,7 +254,7 @@ static int tegra210_mbdrc_band_params_put(struct snd_kcontrol *kcontrol,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < params->soc.num_regs; i++,
|
for (i = 0; i < params->soc.num_regs; i++,
|
||||||
regs += codec->component.val_bytes)
|
regs += cmpnt->val_bytes)
|
||||||
regmap_update_bits(ope->mbdrc_regmap, regs, mask,
|
regmap_update_bits(ope->mbdrc_regmap, regs, mask,
|
||||||
data[i] << shift);
|
data[i] << shift);
|
||||||
|
|
||||||
@@ -265,15 +265,15 @@ static int tegra210_mbdrc_threshold_get(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||||
u32 regs = params->soc.base;
|
u32 regs = params->soc.base;
|
||||||
u32 num_regs = params->soc.num_regs;
|
u32 num_regs = params->soc.num_regs;
|
||||||
u32 val;
|
u32 val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num_regs; i += 4, regs += codec->component.val_bytes) {
|
for (i = 0; i < num_regs; i += 4, regs += cmpnt->val_bytes) {
|
||||||
regmap_read(ope->mbdrc_regmap, regs, &val);
|
regmap_read(ope->mbdrc_regmap, regs, &val);
|
||||||
|
|
||||||
data[i] = (val & TEGRA210_MBDRC_THRESH_1ST_MASK) >>
|
data[i] = (val & TEGRA210_MBDRC_THRESH_1ST_MASK) >>
|
||||||
@@ -293,14 +293,14 @@ static int tegra210_mbdrc_threshold_put(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||||
u32 regs = params->soc.base;
|
u32 regs = params->soc.base;
|
||||||
u32 num_regs = params->soc.num_regs;
|
u32 num_regs = params->soc.num_regs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num_regs; i += 4, regs += codec->component.val_bytes) {
|
for (i = 0; i < num_regs; i += 4, regs += cmpnt->val_bytes) {
|
||||||
data[i] = (((data[i] >> TEGRA210_MBDRC_THRESH_1ST_SHIFT) &
|
data[i] = (((data[i] >> TEGRA210_MBDRC_THRESH_1ST_SHIFT) &
|
||||||
TEGRA210_MBDRC_THRESH_1ST_MASK) |
|
TEGRA210_MBDRC_THRESH_1ST_MASK) |
|
||||||
((data[i + 1] >> TEGRA210_MBDRC_THRESH_2ND_SHIFT) &
|
((data[i + 1] >> TEGRA210_MBDRC_THRESH_2ND_SHIFT) &
|
||||||
@@ -320,10 +320,10 @@ static int tegra210_mbdrc_biquad_coeffs_get(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||||
|
|
||||||
memset(data, 0, params->soc.num_regs * codec->component.val_bytes);
|
memset(data, 0, params->soc.num_regs * cmpnt->val_bytes);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,13 +331,13 @@ static int tegra210_mbdrc_biquad_coeffs_put(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 reg_ctrl = params->soc.base;
|
u32 reg_ctrl = params->soc.base;
|
||||||
u32 reg_data = reg_ctrl + codec->component.val_bytes;
|
u32 reg_data = reg_ctrl + cmpnt->val_bytes;
|
||||||
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
u32 *data = (u32 *)ucontrol->value.bytes.data;
|
||||||
|
|
||||||
tegra210_xbar_write_ahubram(ope->mbdrc_regmap, reg_ctrl, reg_data,
|
tegra210_ahub_write_ram(ope->mbdrc_regmap, reg_ctrl, reg_data,
|
||||||
params->shift, data, params->soc.num_regs);
|
params->shift, data, params->soc.num_regs);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -650,9 +650,9 @@ static const struct regmap_config tegra210_mbdrc_regmap_config = {
|
|||||||
.cache_type = REGCACHE_FLAT,
|
.cache_type = REGCACHE_FLAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
int tegra210_mbdrc_hw_params(struct snd_soc_codec *codec)
|
int tegra210_mbdrc_hw_params(struct snd_soc_component *cmpnt)
|
||||||
{
|
{
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
const struct tegra210_mbdrc_config *conf = &mbdrc_init_config;
|
const struct tegra210_mbdrc_config *conf = &mbdrc_init_config;
|
||||||
u32 val = 0;
|
u32 val = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -666,7 +666,7 @@ int tegra210_mbdrc_hw_params(struct snd_soc_codec *codec)
|
|||||||
&conf->band_params[i];
|
&conf->band_params[i];
|
||||||
u32 reg_off = i * TEGRA210_MBDRC_FILTER_PARAM_STRIDE;
|
u32 reg_off = i * TEGRA210_MBDRC_FILTER_PARAM_STRIDE;
|
||||||
|
|
||||||
tegra210_xbar_write_ahubram(ope->mbdrc_regmap,
|
tegra210_ahub_write_ram(ope->mbdrc_regmap,
|
||||||
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
||||||
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_DATA, 0,
|
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_DATA, 0,
|
||||||
(u32 *)¶ms->biquad_params[0],
|
(u32 *)¶ms->biquad_params[0],
|
||||||
@@ -676,14 +676,14 @@ int tegra210_mbdrc_hw_params(struct snd_soc_codec *codec)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tegra210_mbdrc_hw_params);
|
EXPORT_SYMBOL_GPL(tegra210_mbdrc_hw_params);
|
||||||
|
|
||||||
int tegra210_mbdrc_codec_init(struct snd_soc_codec *codec)
|
int tegra210_mbdrc_codec_init(struct snd_soc_component *cmpnt)
|
||||||
{
|
{
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
const struct tegra210_mbdrc_config *conf = &mbdrc_init_config;
|
const struct tegra210_mbdrc_config *conf = &mbdrc_init_config;
|
||||||
u32 val;
|
u32 val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
pm_runtime_get_sync(codec->dev);
|
pm_runtime_get_sync(cmpnt->dev);
|
||||||
/* Initialize MBDRC registers and ahub-ram with default params */
|
/* Initialize MBDRC registers and ahub-ram with default params */
|
||||||
regmap_update_bits(ope->mbdrc_regmap, TEGRA210_MBDRC_CONFIG,
|
regmap_update_bits(ope->mbdrc_regmap, TEGRA210_MBDRC_CONFIG,
|
||||||
TEGRA210_MBDRC_CONFIG_MBDRC_MODE_MASK,
|
TEGRA210_MBDRC_CONFIG_MBDRC_MODE_MASK,
|
||||||
@@ -819,16 +819,17 @@ int tegra210_mbdrc_codec_init(struct snd_soc_codec *codec)
|
|||||||
params->fast_release_tc <<
|
params->fast_release_tc <<
|
||||||
TEGRA210_MBDRC_FAST_RELEASE_SHIFT);
|
TEGRA210_MBDRC_FAST_RELEASE_SHIFT);
|
||||||
|
|
||||||
tegra210_xbar_write_ahubram(ope->mbdrc_regmap,
|
tegra210_ahub_write_ram(ope->mbdrc_regmap,
|
||||||
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
||||||
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_DATA, 0,
|
reg_off + TEGRA210_MBDRC_AHUBRAMCTL_CONFIG_RAM_DATA, 0,
|
||||||
(u32 *)¶ms->biquad_params[0],
|
(u32 *)¶ms->biquad_params[0],
|
||||||
TEGRA210_MBDRC_MAX_BIQUAD_STAGES * 5);
|
TEGRA210_MBDRC_MAX_BIQUAD_STAGES * 5);
|
||||||
}
|
}
|
||||||
pm_runtime_put_sync(codec->dev);
|
pm_runtime_put_sync(cmpnt->dev);
|
||||||
|
|
||||||
snd_soc_add_codec_controls(codec, tegra210_mbdrc_controls,
|
snd_soc_add_component_controls(cmpnt, tegra210_mbdrc_controls,
|
||||||
ARRAY_SIZE(tegra210_mbdrc_controls));
|
ARRAY_SIZE(tegra210_mbdrc_controls));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tegra210_mbdrc_codec_init);
|
EXPORT_SYMBOL_GPL(tegra210_mbdrc_codec_init);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_mbdrc_alt.h - Definitions for Tegra210 MBDRC driver
|
* tegra210_mbdrc.h - Definitions for Tegra210 MBDRC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2017 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2017 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_mixer_alt.c - Tegra210 MIXER driver
|
* tegra210_mixer.c - Tegra210 MIXER driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -30,8 +30,9 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_mixer_alt.h"
|
#include "tegra210_mixer.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210_mixer"
|
#define DRV_NAME "tegra210_mixer"
|
||||||
|
|
||||||
@@ -129,8 +130,8 @@ static int tegra210_mixer_put_format(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
if (strstr(kcontrol->id.name, "Channels")) {
|
if (strstr(kcontrol->id.name, "Channels")) {
|
||||||
@@ -148,8 +149,8 @@ static int tegra210_mixer_get_format(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
if (strstr(kcontrol->id.name, "Channels"))
|
if (strstr(kcontrol->id.name, "Channels"))
|
||||||
ucontrol->value.integer.value[0] =
|
ucontrol->value.integer.value[0] =
|
||||||
@@ -162,8 +163,8 @@ static int tegra210_mixer_get_gain(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int reg = mc->reg;
|
unsigned int reg = mc->reg;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -179,12 +180,12 @@ static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mixer *mixer = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int reg = mc->reg;
|
unsigned int reg = mc->reg;
|
||||||
unsigned int ret, i;
|
unsigned int ret, i;
|
||||||
|
|
||||||
pm_runtime_get_sync(codec->dev);
|
pm_runtime_get_sync(cmpnt->dev);
|
||||||
/* write default gain config poly coefficients */
|
/* write default gain config poly coefficients */
|
||||||
for (i = 0; i < 10; i++)
|
for (i = 0; i < 10; i++)
|
||||||
tegra210_mixer_write_ram(mixer, reg + i, mixer->gain_coeff[i]);
|
tegra210_mixer_write_ram(mixer, reg + i, mixer->gain_coeff[i]);
|
||||||
@@ -204,7 +205,7 @@ static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol,
|
|||||||
ucontrol->value.integer.value[0]);
|
ucontrol->value.integer.value[0]);
|
||||||
ret |= tegra210_mixer_write_ram(mixer, reg + 0x0f,
|
ret |= tegra210_mixer_write_ram(mixer, reg + 0x0f,
|
||||||
ucontrol->value.integer.value[0]);
|
ucontrol->value.integer.value[0]);
|
||||||
pm_runtime_put(codec->dev);
|
pm_runtime_put(cmpnt->dev);
|
||||||
|
|
||||||
/* save gain */
|
/* save gain */
|
||||||
i = (reg - TEGRA210_MIXER_AHUBRAMCTL_GAIN_CONFIG_RAM_ADDR_0) /
|
i = (reg - TEGRA210_MIXER_AHUBRAMCTL_GAIN_CONFIG_RAM_ADDR_0) /
|
||||||
@@ -220,9 +221,9 @@ static int tegra210_mixer_set_audio_cif(struct tegra210_mixer *mixer,
|
|||||||
unsigned int id)
|
unsigned int id)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
|
|
||||||
@@ -231,21 +232,21 @@ static int tegra210_mixer_set_audio_cif(struct tegra210_mixer *mixer,
|
|||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(mixer->regmap, reg, &cif_conf);
|
tegra_set_cif(mixer->regmap, reg, &cif_conf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,16 +518,13 @@ static const struct snd_soc_dapm_route tegra210_mixer_routes[] = {
|
|||||||
{ "TX5 Transmit", NULL, "TX5" },
|
{ "TX5 Transmit", NULL, "TX5" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_mixer_codec = {
|
static struct snd_soc_component_driver tegra210_mixer_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_mixer_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_mixer_widgets),
|
||||||
.dapm_widgets = tegra210_mixer_widgets,
|
.dapm_routes = tegra210_mixer_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_mixer_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_mixer_routes),
|
||||||
.dapm_routes = tegra210_mixer_routes,
|
.controls = tegra210_mixer_gain_ctls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_mixer_routes),
|
.num_controls = ARRAY_SIZE(tegra210_mixer_gain_ctls),
|
||||||
.controls = tegra210_mixer_gain_ctls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_mixer_gain_ctls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_mixer_wr_reg(struct device *dev,
|
static bool tegra210_mixer_wr_reg(struct device *dev,
|
||||||
@@ -722,7 +720,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
|
|||||||
regcache_cache_only(mixer->regmap, true);
|
regcache_cache_only(mixer->regmap, true);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_mixer_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_mixer_cmpnt,
|
||||||
tegra210_mixer_dais,
|
tegra210_mixer_dais,
|
||||||
ARRAY_SIZE(tegra210_mixer_dais));
|
ARRAY_SIZE(tegra210_mixer_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -736,7 +734,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_mixer_platform_remove(struct platform_device *pdev)
|
static int tegra210_mixer_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_mixer_alt.h - Definitions for Tegra210 MIXER driver
|
* tegra210_mixer.h - Definitions for Tegra210 MIXER driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_mvc_alt.c - Tegra210 MVC driver
|
* tegra210_mvc.c - Tegra210 MVC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -29,8 +29,9 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_mvc_alt.h"
|
#include "tegra210_mvc.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-mvc"
|
#define DRV_NAME "tegra210-mvc"
|
||||||
|
|
||||||
@@ -104,8 +105,8 @@ static int tegra210_mvc_get_vol(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int reg = mc->reg;
|
unsigned int reg = mc->reg;
|
||||||
|
|
||||||
if (reg == TEGRA210_MVC_TARGET_VOL) {
|
if (reg == TEGRA210_MVC_TARGET_VOL) {
|
||||||
@@ -133,14 +134,14 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int reg = mc->reg;
|
unsigned int reg = mc->reg;
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
s32 val;
|
s32 val;
|
||||||
|
|
||||||
pm_runtime_get_sync(codec->dev);
|
pm_runtime_get_sync(cmpnt->dev);
|
||||||
|
|
||||||
/* check if VOLUME_SWITCH is triggered */
|
/* check if VOLUME_SWITCH is triggered */
|
||||||
ret = regmap_read_poll_timeout(mvc->regmap, TEGRA210_MVC_SWITCH,
|
ret = regmap_read_poll_timeout(mvc->regmap, TEGRA210_MVC_SWITCH,
|
||||||
@@ -175,7 +176,7 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol,
|
|||||||
TEGRA210_MVC_VOLUME_SWITCH_TRIGGER);
|
TEGRA210_MVC_VOLUME_SWITCH_TRIGGER);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
pm_runtime_put(codec->dev);
|
pm_runtime_put(cmpnt->dev);
|
||||||
|
|
||||||
if (reg == TEGRA210_MVC_TARGET_VOL)
|
if (reg == TEGRA210_MVC_TARGET_VOL)
|
||||||
ret |= regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL,
|
ret |= regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL,
|
||||||
@@ -187,8 +188,8 @@ end:
|
|||||||
static int tegra210_mvc_get_curve_type(struct snd_kcontrol *kcontrol,
|
static int tegra210_mvc_get_curve_type(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = mvc->curve_type;
|
ucontrol->value.integer.value[0] = mvc->curve_type;
|
||||||
|
|
||||||
@@ -198,8 +199,8 @@ static int tegra210_mvc_get_curve_type(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mvc_put_curve_type(struct snd_kcontrol *kcontrol,
|
static int tegra210_mvc_put_curve_type(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
mvc->curve_type = ucontrol->value.integer.value[0];
|
mvc->curve_type = ucontrol->value.integer.value[0];
|
||||||
/* change volume to default init for new curve type */
|
/* change volume to default init for new curve type */
|
||||||
@@ -214,8 +215,8 @@ static int tegra210_mvc_put_curve_type(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mvc_get_audio_bits(struct snd_kcontrol *kcontrol,
|
static int tegra210_mvc_get_audio_bits(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
if (mvc->audio_bits > 0)
|
if (mvc->audio_bits > 0)
|
||||||
ucontrol->value.integer.value[0] = (mvc->audio_bits + 1) * 4;
|
ucontrol->value.integer.value[0] = (mvc->audio_bits + 1) * 4;
|
||||||
@@ -228,8 +229,8 @@ static int tegra210_mvc_get_audio_bits(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mvc_put_audio_bits(struct snd_kcontrol *kcontrol,
|
static int tegra210_mvc_put_audio_bits(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
val = ucontrol->value.integer.value[0];
|
val = ucontrol->value.integer.value[0];
|
||||||
@@ -245,8 +246,8 @@ static int tegra210_mvc_put_audio_bits(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mvc_get_format(struct snd_kcontrol *kcontrol,
|
static int tegra210_mvc_get_format(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
/* get the format control flag */
|
/* get the format control flag */
|
||||||
if (strstr(kcontrol->id.name, "input bit format"))
|
if (strstr(kcontrol->id.name, "input bit format"))
|
||||||
@@ -260,8 +261,8 @@ static int tegra210_mvc_get_format(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_mvc_put_format(struct snd_kcontrol *kcontrol,
|
static int tegra210_mvc_put_format(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_mvc *mvc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int value = ucontrol->value.integer.value[0];
|
unsigned int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
/* set the format control flag */
|
/* set the format control flag */
|
||||||
@@ -275,8 +276,8 @@ static int tegra210_mvc_put_format(struct snd_kcontrol *kcontrol,
|
|||||||
|
|
||||||
static const int tegra210_mvc_fmt_values[] = {
|
static const int tegra210_mvc_fmt_values[] = {
|
||||||
0,
|
0,
|
||||||
TEGRA210_AUDIOCIF_BITS_16,
|
TEGRA_ACIF_BITS_16,
|
||||||
TEGRA210_AUDIOCIF_BITS_32,
|
TEGRA_ACIF_BITS_32,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc,
|
static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc,
|
||||||
@@ -284,9 +285,9 @@ static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
if (mvc->cif_channels > 0)
|
if (mvc->cif_channels > 0)
|
||||||
@@ -297,10 +298,10 @@ static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc,
|
|||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -309,8 +310,8 @@ static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc,
|
|||||||
if (mvc->audio_bits > 0)
|
if (mvc->audio_bits > 0)
|
||||||
audio_bits = mvc->audio_bits;
|
audio_bits = mvc->audio_bits;
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
@@ -318,7 +319,7 @@ static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc,
|
|||||||
if (mvc->format_in && (reg == TEGRA210_MVC_AXBAR_RX_CIF_CTRL))
|
if (mvc->format_in && (reg == TEGRA210_MVC_AXBAR_RX_CIF_CTRL))
|
||||||
cif_conf.audio_bits = tegra210_mvc_fmt_values[mvc->format_in];
|
cif_conf.audio_bits = tegra210_mvc_fmt_values[mvc->format_in];
|
||||||
|
|
||||||
tegra210_xbar_set_cif(mvc->regmap, reg, &cif_conf);
|
tegra_set_cif(mvc->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -480,16 +481,13 @@ static const struct snd_soc_dapm_route tegra210_mvc_routes[] = {
|
|||||||
{ "MVC Transmit", NULL, "MVC TX" },
|
{ "MVC Transmit", NULL, "MVC TX" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_mvc_codec = {
|
static struct snd_soc_component_driver tegra210_mvc_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_mvc_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_mvc_widgets),
|
||||||
.dapm_widgets = tegra210_mvc_widgets,
|
.dapm_routes = tegra210_mvc_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_mvc_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_mvc_routes),
|
||||||
.dapm_routes = tegra210_mvc_routes,
|
.controls = tegra210_mvc_vol_ctrl,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_mvc_routes),
|
.num_controls = ARRAY_SIZE(tegra210_mvc_vol_ctrl),
|
||||||
.controls = tegra210_mvc_vol_ctrl,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_mvc_vol_ctrl),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_mvc_wr_rd_reg(struct device *dev, unsigned int reg)
|
static bool tegra210_mvc_wr_rd_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -628,7 +626,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
|
|||||||
regcache_cache_only(mvc->regmap, true);
|
regcache_cache_only(mvc->regmap, true);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_mvc_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_mvc_cmpnt,
|
||||||
tegra210_mvc_dais,
|
tegra210_mvc_dais,
|
||||||
ARRAY_SIZE(tegra210_mvc_dais));
|
ARRAY_SIZE(tegra210_mvc_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -642,7 +640,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_mvc_platform_remove(struct platform_device *pdev)
|
static int tegra210_mvc_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_mvc_alt.h - Definitions for Tegra210 MVC driver
|
* tegra210_mvc.h - Definitions for Tegra210 MVC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_ope_alt.c - Tegra210 OPE driver
|
* tegra210_ope.c - Tegra210 OPE driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -30,8 +30,9 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_ope_alt.h"
|
#include "tegra210_ope.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-ope"
|
#define DRV_NAME "tegra210-ope"
|
||||||
|
|
||||||
@@ -79,9 +80,9 @@ static int tegra210_ope_set_audio_cif(struct tegra210_ope *ope,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
if (channels < 2)
|
if (channels < 2)
|
||||||
@@ -89,21 +90,21 @@ static int tegra210_ope_set_audio_cif(struct tegra210_ope *ope,
|
|||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
cif_conf.client_bits = audio_bits;
|
cif_conf.client_bits = audio_bits;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(ope->regmap, reg, &cif_conf);
|
tegra_set_cif(ope->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -131,26 +132,19 @@ static int tegra210_ope_hw_params(struct snd_pcm_substream *substream,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
tegra210_mbdrc_hw_params(dai->codec);
|
tegra210_mbdrc_hw_params(dai->component);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tegra210_ope_codec_probe(struct snd_soc_codec *codec)
|
static int tegra210_ope_codec_probe(struct snd_soc_component *cmpnt)
|
||||||
{
|
{
|
||||||
tegra210_peq_codec_init(codec);
|
tegra210_peq_codec_init(cmpnt);
|
||||||
tegra210_mbdrc_codec_init(codec);
|
tegra210_mbdrc_codec_init(cmpnt);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct regmap *tegra210_ope_init_regmap(struct device *dev)
|
|
||||||
{
|
|
||||||
struct tegra210_ope *ope = dev_get_drvdata(dev);
|
|
||||||
|
|
||||||
return ope->regmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct snd_soc_dai_ops tegra210_ope_dai_ops = {
|
static struct snd_soc_dai_ops tegra210_ope_dai_ops = {
|
||||||
.hw_params = tegra210_ope_hw_params,
|
.hw_params = tegra210_ope_hw_params,
|
||||||
};
|
};
|
||||||
@@ -201,18 +195,14 @@ static const struct snd_kcontrol_new tegra210_ope_controls[] = {
|
|||||||
TEGRA210_OPE_DIRECTION_SHIFT, 1, 0),
|
TEGRA210_OPE_DIRECTION_SHIFT, 1, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_ope_codec = {
|
static struct snd_soc_component_driver tegra210_ope_cmpnt = {
|
||||||
.probe = tegra210_ope_codec_probe,
|
.probe = tegra210_ope_codec_probe,
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_ope_widgets,
|
||||||
.get_regmap = tegra210_ope_init_regmap,
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_ope_widgets),
|
||||||
.component_driver = {
|
.dapm_routes = tegra210_ope_routes,
|
||||||
.dapm_widgets = tegra210_ope_widgets,
|
.num_dapm_routes = ARRAY_SIZE(tegra210_ope_routes),
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_ope_widgets),
|
.controls = tegra210_ope_controls,
|
||||||
.dapm_routes = tegra210_ope_routes,
|
.num_controls = ARRAY_SIZE(tegra210_ope_controls),
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_ope_routes),
|
|
||||||
.controls = tegra210_ope_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_ope_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_ope_wr_reg(struct device *dev, unsigned int reg)
|
static bool tegra210_ope_wr_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -354,7 +344,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev)
|
|||||||
regcache_cache_only(ope->mbdrc_regmap, true);
|
regcache_cache_only(ope->mbdrc_regmap, true);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_ope_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_ope_cmpnt,
|
||||||
tegra210_ope_dais,
|
tegra210_ope_dais,
|
||||||
ARRAY_SIZE(tegra210_ope_dais));
|
ARRAY_SIZE(tegra210_ope_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -370,7 +360,7 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_ope_platform_remove(struct platform_device *pdev)
|
static int tegra210_ope_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_ope_alt.h - Definitions for Tegra210 OPE driver
|
* tegra210_ope.h - Definitions for Tegra210 OPE driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef __TEGRA210_OPE_ALT_H__
|
#ifndef __TEGRA210_OPE_ALT_H__
|
||||||
#define __TEGRA210_OPE_ALT_H__
|
#define __TEGRA210_OPE_ALT_H__
|
||||||
|
|
||||||
#include "tegra210_peq_alt.h"
|
#include "tegra210_peq.h"
|
||||||
|
|
||||||
/* Register offsets from TEGRA210_OPE*_BASE */
|
/* Register offsets from TEGRA210_OPE*_BASE */
|
||||||
/*
|
/*
|
||||||
@@ -79,10 +79,35 @@ struct tegra210_ope {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern int tegra210_peq_init(struct platform_device *pdev, int id);
|
extern int tegra210_peq_init(struct platform_device *pdev, int id);
|
||||||
extern int tegra210_peq_codec_init(struct snd_soc_codec *codec);
|
extern int tegra210_peq_codec_init(struct snd_soc_component *cmpnt);
|
||||||
extern void tegra210_peq_restore(struct tegra210_ope *ope);
|
extern void tegra210_peq_restore(struct tegra210_ope *ope);
|
||||||
extern void tegra210_peq_save(struct tegra210_ope *ope);
|
extern void tegra210_peq_save(struct tegra210_ope *ope);
|
||||||
extern int tegra210_mbdrc_init(struct platform_device *pdev, int id);
|
extern int tegra210_mbdrc_init(struct platform_device *pdev, int id);
|
||||||
extern int tegra210_mbdrc_codec_init(struct snd_soc_codec *codec);
|
extern int tegra210_mbdrc_codec_init(struct snd_soc_component *cmpnt);
|
||||||
extern int tegra210_mbdrc_hw_params(struct snd_soc_codec *codec);
|
extern int tegra210_mbdrc_hw_params(struct snd_soc_component *cmpnt);
|
||||||
|
|
||||||
|
/* Extension of soc_bytes structure defined in sound/soc.h */
|
||||||
|
struct tegra_soc_bytes {
|
||||||
|
struct soc_bytes soc;
|
||||||
|
u32 shift; /* Used as offset for ahub ram related programing */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Utility structures for using mixer control of type snd_soc_bytes */
|
||||||
|
#define TEGRA_SOC_BYTES_EXT(xname, xbase, xregs, xshift, xmask, \
|
||||||
|
xhandler_get, xhandler_put, xinfo) \
|
||||||
|
{ \
|
||||||
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
||||||
|
.name = xname, \
|
||||||
|
.info = xinfo, \
|
||||||
|
.get = xhandler_get, \
|
||||||
|
.put = xhandler_put, \
|
||||||
|
.private_value = ((unsigned long)&(struct tegra_soc_bytes) \
|
||||||
|
{ \
|
||||||
|
.soc.base = xbase, \
|
||||||
|
.soc.num_regs = xregs, \
|
||||||
|
.soc.mask = xmask, \
|
||||||
|
.shift = xshift \
|
||||||
|
}) \
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_peq_alt.c - Tegra210 PEQ driver
|
* tegra210_peq.c - Tegra210 PEQ driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -30,9 +30,9 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_ope_alt.h"
|
#include "tegra210_ope.h"
|
||||||
#include "tegra210_peq_alt.h"
|
#include "tegra210_peq.h"
|
||||||
|
|
||||||
static const struct reg_default tegra210_peq_reg_defaults[] = {
|
static const struct reg_default tegra210_peq_reg_defaults[] = {
|
||||||
{ TEGRA210_PEQ_CONFIG, 0x00000013},
|
{ TEGRA210_PEQ_CONFIG, 0x00000013},
|
||||||
@@ -73,8 +73,8 @@ static int tegra210_peq_get(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
@@ -92,8 +92,8 @@ static int tegra210_peq_put(struct snd_kcontrol *kcontrol,
|
|||||||
{
|
{
|
||||||
struct soc_mixer_control *mc =
|
struct soc_mixer_control *mc =
|
||||||
(struct soc_mixer_control *)kcontrol->private_value;
|
(struct soc_mixer_control *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
unsigned int mask = (1 << fls(mc->max)) - 1;
|
unsigned int mask = (1 << fls(mc->max)) - 1;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
@@ -110,16 +110,16 @@ static int tegra210_peq_ahub_ram_get(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 i, reg_ctrl = params->soc.base;
|
u32 i, reg_ctrl = params->soc.base;
|
||||||
u32 reg_data = reg_ctrl + codec->component.val_bytes;
|
u32 reg_data = reg_ctrl + cmpnt->val_bytes;
|
||||||
s32 *data = (s32 *)biquad_coeff_buffer;
|
s32 *data = (s32 *)biquad_coeff_buffer;
|
||||||
|
|
||||||
pm_runtime_get_sync(codec->dev);
|
pm_runtime_get_sync(cmpnt->dev);
|
||||||
tegra210_xbar_read_ahubram(ope->peq_regmap, reg_ctrl, reg_data,
|
tegra210_ahub_read_ram(ope->peq_regmap, reg_ctrl, reg_data,
|
||||||
params->shift, data, params->soc.num_regs);
|
params->shift, data, params->soc.num_regs);
|
||||||
pm_runtime_put_sync(codec->dev);
|
pm_runtime_put_sync(cmpnt->dev);
|
||||||
|
|
||||||
for (i = 0; i < params->soc.num_regs; i++)
|
for (i = 0; i < params->soc.num_regs; i++)
|
||||||
ucontrol->value.integer.value[i] = (long)data[i];
|
ucontrol->value.integer.value[i] = (long)data[i];
|
||||||
@@ -131,19 +131,19 @@ static int tegra210_peq_ahub_ram_put(struct snd_kcontrol *kcontrol,
|
|||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
struct tegra_soc_bytes *params = (void *)kcontrol->private_value;
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
u32 i, reg_ctrl = params->soc.base;
|
u32 i, reg_ctrl = params->soc.base;
|
||||||
u32 reg_data = reg_ctrl + codec->component.val_bytes;
|
u32 reg_data = reg_ctrl + cmpnt->val_bytes;
|
||||||
s32 *data = (s32 *)biquad_coeff_buffer;
|
s32 *data = (s32 *)biquad_coeff_buffer;
|
||||||
|
|
||||||
for (i = 0; i < params->soc.num_regs; i++)
|
for (i = 0; i < params->soc.num_regs; i++)
|
||||||
data[i] = (s32)ucontrol->value.integer.value[i];
|
data[i] = (s32)ucontrol->value.integer.value[i];
|
||||||
|
|
||||||
pm_runtime_get_sync(codec->dev);
|
pm_runtime_get_sync(cmpnt->dev);
|
||||||
tegra210_xbar_write_ahubram(ope->peq_regmap, reg_ctrl, reg_data,
|
tegra210_ahub_write_ram(ope->peq_regmap, reg_ctrl, reg_data,
|
||||||
params->shift, data, params->soc.num_regs);
|
params->shift, data, params->soc.num_regs);
|
||||||
pm_runtime_put_sync(codec->dev);
|
pm_runtime_put_sync(cmpnt->dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -284,14 +284,14 @@ void tegra210_peq_restore(struct tegra210_ope *ope)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < TEGRA210_PEQ_MAX_CHANNELS; i++) {
|
for (i = 0; i < TEGRA210_PEQ_MAX_CHANNELS; i++) {
|
||||||
tegra210_xbar_write_ahubram(ope->peq_regmap,
|
tegra210_ahub_write_ram(ope->peq_regmap,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_DATA,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_DATA,
|
||||||
(i * TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH),
|
(i * TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH),
|
||||||
(u32 *)&ope->peq_biquad_gains,
|
(u32 *)&ope->peq_biquad_gains,
|
||||||
TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH);
|
TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH);
|
||||||
|
|
||||||
tegra210_xbar_write_ahubram(ope->peq_regmap,
|
tegra210_ahub_write_ram(ope->peq_regmap,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_CTRL,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_CTRL,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_DATA,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_DATA,
|
||||||
(i * TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH),
|
(i * TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH),
|
||||||
@@ -307,14 +307,14 @@ void tegra210_peq_save(struct tegra210_ope *ope)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < TEGRA210_PEQ_MAX_CHANNELS; i++) {
|
for (i = 0; i < TEGRA210_PEQ_MAX_CHANNELS; i++) {
|
||||||
tegra210_xbar_read_ahubram(ope->peq_regmap,
|
tegra210_ahub_read_ram(ope->peq_regmap,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_DATA,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_DATA,
|
||||||
(i * TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH),
|
(i * TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH),
|
||||||
(u32 *)&ope->peq_biquad_gains,
|
(u32 *)&ope->peq_biquad_gains,
|
||||||
TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH);
|
TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH);
|
||||||
|
|
||||||
tegra210_xbar_read_ahubram(ope->peq_regmap,
|
tegra210_ahub_read_ram(ope->peq_regmap,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_CTRL,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_CTRL,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_DATA,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_DATA,
|
||||||
(i * TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH),
|
(i * TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH),
|
||||||
@@ -325,12 +325,12 @@ void tegra210_peq_save(struct tegra210_ope *ope)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tegra210_peq_save);
|
EXPORT_SYMBOL_GPL(tegra210_peq_save);
|
||||||
|
|
||||||
int tegra210_peq_codec_init(struct snd_soc_codec *codec)
|
int tegra210_peq_codec_init(struct snd_soc_component *cmpnt)
|
||||||
{
|
{
|
||||||
struct tegra210_ope *ope = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_ope *ope = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
pm_runtime_get_sync(codec->dev);
|
pm_runtime_get_sync(cmpnt->dev);
|
||||||
regmap_update_bits(ope->peq_regmap, TEGRA210_PEQ_CONFIG,
|
regmap_update_bits(ope->peq_regmap, TEGRA210_PEQ_CONFIG,
|
||||||
TEGRA210_PEQ_CONFIG_MODE_MASK,
|
TEGRA210_PEQ_CONFIG_MODE_MASK,
|
||||||
0 << TEGRA210_PEQ_CONFIG_MODE_SHIFT);
|
0 << TEGRA210_PEQ_CONFIG_MODE_SHIFT);
|
||||||
@@ -342,7 +342,7 @@ int tegra210_peq_codec_init(struct snd_soc_codec *codec)
|
|||||||
/* Initialize PEQ AHUB RAM with default params */
|
/* Initialize PEQ AHUB RAM with default params */
|
||||||
for (i = 0; i < TEGRA210_PEQ_MAX_CHANNELS; i++) {
|
for (i = 0; i < TEGRA210_PEQ_MAX_CHANNELS; i++) {
|
||||||
/* Set default gain params */
|
/* Set default gain params */
|
||||||
tegra210_xbar_write_ahubram(ope->peq_regmap,
|
tegra210_ahub_write_ram(ope->peq_regmap,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_CTRL,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_DATA,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_DATA,
|
||||||
(i * TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH),
|
(i * TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH),
|
||||||
@@ -350,17 +350,18 @@ int tegra210_peq_codec_init(struct snd_soc_codec *codec)
|
|||||||
TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH);
|
TEGRA210_PEQ_GAIN_PARAM_SIZE_PER_CH);
|
||||||
|
|
||||||
/* Set default shift params */
|
/* Set default shift params */
|
||||||
tegra210_xbar_write_ahubram(ope->peq_regmap,
|
tegra210_ahub_write_ram(ope->peq_regmap,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_CTRL,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_CTRL,
|
||||||
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_DATA,
|
TEGRA210_PEQ_AHUBRAMCTL_CONFIG_RAM_SHIFT_DATA,
|
||||||
(i * TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH),
|
(i * TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH),
|
||||||
(u32 *)&biquad_init_shifts,
|
(u32 *)&biquad_init_shifts,
|
||||||
TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH);
|
TEGRA210_PEQ_SHIFT_PARAM_SIZE_PER_CH);
|
||||||
}
|
}
|
||||||
pm_runtime_put_sync(codec->dev);
|
pm_runtime_put_sync(cmpnt->dev);
|
||||||
|
|
||||||
snd_soc_add_codec_controls(codec, tegra210_peq_controls,
|
snd_soc_add_component_controls(cmpnt, tegra210_peq_controls,
|
||||||
ARRAY_SIZE(tegra210_peq_controls));
|
ARRAY_SIZE(tegra210_peq_controls));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tegra210_peq_codec_init);
|
EXPORT_SYMBOL_GPL(tegra210_peq_codec_init);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_peq_alt.h - Definitions for Tegra210 PEQ driver
|
* tegra210_peq.h - Definitions for Tegra210 PEQ driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_sfc_alt.c - Tegra210 SFC driver
|
* tegra210_sfc.c - Tegra210 SFC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2020 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -29,8 +29,9 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
||||||
#include "tegra210_xbar_alt.h"
|
#include "tegra210_ahub.h"
|
||||||
#include "tegra210_sfc_alt.h"
|
#include "tegra210_sfc.h"
|
||||||
|
#include "tegra_cif.h"
|
||||||
|
|
||||||
#define DRV_NAME "tegra210-sfc"
|
#define DRV_NAME "tegra210-sfc"
|
||||||
|
|
||||||
@@ -2941,7 +2942,7 @@ static int tegra210_sfc_write_coeff_ram(struct tegra210_sfc *sfc)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (coeff_ram) {
|
if (coeff_ram) {
|
||||||
tegra210_xbar_write_ahubram(sfc->regmap,
|
tegra210_ahub_write_ram(sfc->regmap,
|
||||||
TEGRA210_SFC_AHUBRAMCTL_SFC_CTRL,
|
TEGRA210_SFC_AHUBRAMCTL_SFC_CTRL,
|
||||||
TEGRA210_SFC_AHUBRAMCTL_SFC_DATA,
|
TEGRA210_SFC_AHUBRAMCTL_SFC_DATA,
|
||||||
0, coeff_ram, TEGRA210_SFC_COEF_RAM_DEPTH);
|
0, coeff_ram, TEGRA210_SFC_COEF_RAM_DEPTH);
|
||||||
@@ -2957,8 +2958,8 @@ static int tegra210_sfc_write_coeff_ram(struct tegra210_sfc *sfc)
|
|||||||
|
|
||||||
static const int tegra210_sfc_fmt_values[] = {
|
static const int tegra210_sfc_fmt_values[] = {
|
||||||
0,
|
0,
|
||||||
TEGRA210_AUDIOCIF_BITS_16,
|
TEGRA_ACIF_BITS_16,
|
||||||
TEGRA210_AUDIOCIF_BITS_32,
|
TEGRA_ACIF_BITS_32,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int tegra210_sfc_set_audio_cif(struct tegra210_sfc *sfc,
|
static int tegra210_sfc_set_audio_cif(struct tegra210_sfc *sfc,
|
||||||
@@ -2966,18 +2967,18 @@ static int tegra210_sfc_set_audio_cif(struct tegra210_sfc *sfc,
|
|||||||
unsigned int reg)
|
unsigned int reg)
|
||||||
{
|
{
|
||||||
int channels, audio_bits;
|
int channels, audio_bits;
|
||||||
struct tegra210_xbar_cif_conf cif_conf;
|
struct tegra_cif_conf cif_conf;
|
||||||
|
|
||||||
memset(&cif_conf, 0, sizeof(struct tegra210_xbar_cif_conf));
|
memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
|
||||||
|
|
||||||
channels = params_channels(params);
|
channels = params_channels(params);
|
||||||
|
|
||||||
switch (params_format(params)) {
|
switch (params_format(params)) {
|
||||||
case SNDRV_PCM_FORMAT_S16_LE:
|
case SNDRV_PCM_FORMAT_S16_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_16;
|
audio_bits = TEGRA_ACIF_BITS_16;
|
||||||
break;
|
break;
|
||||||
case SNDRV_PCM_FORMAT_S32_LE:
|
case SNDRV_PCM_FORMAT_S32_LE:
|
||||||
audio_bits = TEGRA210_AUDIOCIF_BITS_32;
|
audio_bits = TEGRA_ACIF_BITS_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -2989,24 +2990,24 @@ static int tegra210_sfc_set_audio_cif(struct tegra210_sfc *sfc,
|
|||||||
if (sfc->stereo_conv_input > 0 && 2 == channels &&
|
if (sfc->stereo_conv_input > 0 && 2 == channels &&
|
||||||
(reg == TEGRA210_SFC_AXBAR_RX_CIF_CTRL)) {
|
(reg == TEGRA210_SFC_AXBAR_RX_CIF_CTRL)) {
|
||||||
cif_conf.stereo_conv = sfc->stereo_conv_input - 1;
|
cif_conf.stereo_conv = sfc->stereo_conv_input - 1;
|
||||||
cif_conf.client_channels = 1;
|
cif_conf.client_ch = 1;
|
||||||
} else if (sfc->mono_conv_output > 0 && 2 == channels &&
|
} else if (sfc->mono_conv_output > 0 && 2 == channels &&
|
||||||
(reg == TEGRA210_SFC_AXBAR_TX_CIF_CTRL)) {
|
(reg == TEGRA210_SFC_AXBAR_TX_CIF_CTRL)) {
|
||||||
cif_conf.mono_conv = sfc->mono_conv_output - 1;
|
cif_conf.mono_conv = sfc->mono_conv_output - 1;
|
||||||
cif_conf.client_channels = 1;
|
cif_conf.client_ch = 1;
|
||||||
} else {
|
} else {
|
||||||
cif_conf.client_channels = channels;
|
cif_conf.client_ch = channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
cif_conf.audio_channels = channels;
|
cif_conf.audio_ch = channels;
|
||||||
cif_conf.audio_bits = audio_bits;
|
cif_conf.audio_bits = audio_bits;
|
||||||
if (sfc->format_in && (reg == TEGRA210_SFC_AXBAR_RX_CIF_CTRL))
|
if (sfc->format_in && (reg == TEGRA210_SFC_AXBAR_RX_CIF_CTRL))
|
||||||
cif_conf.audio_bits = tegra210_sfc_fmt_values[sfc->format_in];
|
cif_conf.audio_bits = tegra210_sfc_fmt_values[sfc->format_in];
|
||||||
if (sfc->format_out && (reg == TEGRA210_SFC_AXBAR_TX_CIF_CTRL))
|
if (sfc->format_out && (reg == TEGRA210_SFC_AXBAR_TX_CIF_CTRL))
|
||||||
cif_conf.audio_bits = tegra210_sfc_fmt_values[sfc->format_out];
|
cif_conf.audio_bits = tegra210_sfc_fmt_values[sfc->format_out];
|
||||||
cif_conf.client_bits = TEGRA210_AUDIOCIF_BITS_32;
|
cif_conf.client_bits = TEGRA_ACIF_BITS_32;
|
||||||
|
|
||||||
tegra210_xbar_set_cif(sfc->regmap, reg, &cif_conf);
|
tegra_set_cif(sfc->regmap, reg, &cif_conf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3099,8 +3100,8 @@ static int tegra210_sfc_out_hw_params(struct snd_pcm_substream *substream,
|
|||||||
static int tegra210_sfc_get_srate(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_get_srate(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
/* get the sfc output rate */
|
/* get the sfc output rate */
|
||||||
if (strstr(kcontrol->id.name, "input"))
|
if (strstr(kcontrol->id.name, "input"))
|
||||||
@@ -3114,8 +3115,8 @@ static int tegra210_sfc_get_srate(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_put_srate(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_put_srate(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int srate = tegra210_sfc_rate_to_index(ucontrol->value.integer.value[0]);
|
int srate = tegra210_sfc_rate_to_index(ucontrol->value.integer.value[0]);
|
||||||
|
|
||||||
if (srate < 0)
|
if (srate < 0)
|
||||||
@@ -3133,8 +3134,8 @@ static int tegra210_sfc_put_srate(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_get_format(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_get_format(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
/* get the format control flag */
|
/* get the format control flag */
|
||||||
if (strstr(kcontrol->id.name, "input"))
|
if (strstr(kcontrol->id.name, "input"))
|
||||||
@@ -3150,8 +3151,8 @@ static int tegra210_sfc_get_format(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_put_format(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_put_format(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int value = ucontrol->value.integer.value[0];
|
int value = ucontrol->value.integer.value[0];
|
||||||
|
|
||||||
/* set the format control flag */
|
/* set the format control flag */
|
||||||
@@ -3178,8 +3179,8 @@ static int tegra210_sfc_init_get(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
int init = ucontrol->value.enumerated.item[0];
|
int init = ucontrol->value.enumerated.item[0];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int is_enabled = 0;
|
int is_enabled = 0;
|
||||||
@@ -3187,12 +3188,12 @@ static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
|||||||
if (!init)
|
if (!init)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
dev_dbg(codec->dev, "%s: inrate %d outrate %d\n",
|
dev_dbg(cmpnt->dev, "%s: inrate %d outrate %d\n",
|
||||||
__func__, sfc->srate_in, sfc->srate_out);
|
__func__, sfc->srate_in, sfc->srate_out);
|
||||||
|
|
||||||
ret = pm_runtime_get_sync(codec->dev->parent);
|
ret = pm_runtime_get_sync(cmpnt->dev->parent);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev, "parent get_sync failed: %d\n", ret);
|
dev_err(cmpnt->dev, "parent get_sync failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3207,7 +3208,7 @@ static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
|||||||
TEGRA210_SFC_STATUS, val,
|
TEGRA210_SFC_STATUS, val,
|
||||||
!(val & 0x1), 10, 10000);
|
!(val & 0x1), 10, 10000);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev,
|
dev_err(cmpnt->dev,
|
||||||
"failed to disable SFC, err = %d\n", ret);
|
"failed to disable SFC, err = %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -3219,7 +3220,7 @@ static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
|||||||
|
|
||||||
ret = tegra210_sfc_soft_reset(sfc);
|
ret = tegra210_sfc_soft_reset(sfc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(codec->dev,
|
dev_err(cmpnt->dev,
|
||||||
"failed to reset SFC in %s, err = %d\n",
|
"failed to reset SFC in %s, err = %d\n",
|
||||||
__func__, ret);
|
__func__, ret);
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -3228,14 +3229,14 @@ static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
|||||||
ret = tegra210_sfc_set_audio_cif(sfc, &sfc->in_hw_params,
|
ret = tegra210_sfc_set_audio_cif(sfc, &sfc->in_hw_params,
|
||||||
TEGRA210_SFC_AXBAR_RX_CIF_CTRL);
|
TEGRA210_SFC_AXBAR_RX_CIF_CTRL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev, "Can't set SFC RX CIF: %d\n", ret);
|
dev_err(cmpnt->dev, "Can't set SFC RX CIF: %d\n", ret);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = tegra210_sfc_set_audio_cif(sfc, &sfc->out_hw_params,
|
ret = tegra210_sfc_set_audio_cif(sfc, &sfc->out_hw_params,
|
||||||
TEGRA210_SFC_AXBAR_TX_CIF_CTRL);
|
TEGRA210_SFC_AXBAR_TX_CIF_CTRL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev, "Can't set SFC TX CIF: %d\n", ret);
|
dev_err(cmpnt->dev, "Can't set SFC TX CIF: %d\n", ret);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3245,7 +3246,7 @@ static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
|||||||
if (sfc->srate_in != sfc->srate_out) {
|
if (sfc->srate_in != sfc->srate_out) {
|
||||||
ret = tegra210_sfc_write_coeff_ram(sfc);
|
ret = tegra210_sfc_write_coeff_ram(sfc);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(codec->dev, "Conversion from %d to %d is not supported\n",
|
dev_err(cmpnt->dev, "Conversion from %d to %d is not supported\n",
|
||||||
sfc->srate_in, sfc->srate_out);
|
sfc->srate_in, sfc->srate_out);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
@@ -3254,7 +3255,7 @@ static int tegra210_sfc_init_put(struct snd_kcontrol *kcontrol,
|
|||||||
regmap_write(sfc->regmap, TEGRA210_SFC_ENABLE, 1);
|
regmap_write(sfc->regmap, TEGRA210_SFC_ENABLE, 1);
|
||||||
}
|
}
|
||||||
exit:
|
exit:
|
||||||
pm_runtime_put(codec->dev->parent);
|
pm_runtime_put(cmpnt->dev->parent);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -3262,8 +3263,8 @@ exit:
|
|||||||
static int tegra210_sfc_get_stereo_conv(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_get_stereo_conv(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = sfc->stereo_conv_input;
|
ucontrol->value.integer.value[0] = sfc->stereo_conv_input;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3272,8 +3273,8 @@ static int tegra210_sfc_get_stereo_conv(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_put_stereo_conv(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_put_stereo_conv(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
sfc->stereo_conv_input = ucontrol->value.integer.value[0];
|
sfc->stereo_conv_input = ucontrol->value.integer.value[0];
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3282,8 +3283,8 @@ static int tegra210_sfc_put_stereo_conv(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_get_mono_conv(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_get_mono_conv(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
ucontrol->value.integer.value[0] = sfc->mono_conv_output;
|
ucontrol->value.integer.value[0] = sfc->mono_conv_output;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3292,8 +3293,8 @@ static int tegra210_sfc_get_mono_conv(struct snd_kcontrol *kcontrol,
|
|||||||
static int tegra210_sfc_put_mono_conv(struct snd_kcontrol *kcontrol,
|
static int tegra210_sfc_put_mono_conv(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
|
||||||
struct tegra210_sfc *sfc = snd_soc_codec_get_drvdata(codec);
|
struct tegra210_sfc *sfc = snd_soc_component_get_drvdata(cmpnt);
|
||||||
|
|
||||||
sfc->mono_conv_output = ucontrol->value.integer.value[0];
|
sfc->mono_conv_output = ucontrol->value.integer.value[0];
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3397,16 +3398,13 @@ static const struct snd_kcontrol_new tegra210_sfc_controls[] = {
|
|||||||
tegra210_sfc_get_mono_conv, tegra210_sfc_put_mono_conv),
|
tegra210_sfc_get_mono_conv, tegra210_sfc_put_mono_conv),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_codec_driver tegra210_sfc_codec = {
|
static struct snd_soc_component_driver tegra210_sfc_cmpnt = {
|
||||||
.idle_bias_off = 1,
|
.dapm_widgets = tegra210_sfc_widgets,
|
||||||
.component_driver = {
|
.num_dapm_widgets = ARRAY_SIZE(tegra210_sfc_widgets),
|
||||||
.dapm_widgets = tegra210_sfc_widgets,
|
.dapm_routes = tegra210_sfc_routes,
|
||||||
.num_dapm_widgets = ARRAY_SIZE(tegra210_sfc_widgets),
|
.num_dapm_routes = ARRAY_SIZE(tegra210_sfc_routes),
|
||||||
.dapm_routes = tegra210_sfc_routes,
|
.controls = tegra210_sfc_controls,
|
||||||
.num_dapm_routes = ARRAY_SIZE(tegra210_sfc_routes),
|
.num_controls = ARRAY_SIZE(tegra210_sfc_controls),
|
||||||
.controls = tegra210_sfc_controls,
|
|
||||||
.num_controls = ARRAY_SIZE(tegra210_sfc_controls),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool tegra210_sfc_wr_reg(struct device *dev, unsigned int reg)
|
static bool tegra210_sfc_wr_reg(struct device *dev, unsigned int reg)
|
||||||
@@ -3553,7 +3551,7 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
|
|||||||
regcache_cache_only(sfc->regmap, true);
|
regcache_cache_only(sfc->regmap, true);
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
ret = snd_soc_register_codec(&pdev->dev, &tegra210_sfc_codec,
|
ret = snd_soc_register_component(&pdev->dev, &tegra210_sfc_cmpnt,
|
||||||
tegra210_sfc_dais,
|
tegra210_sfc_dais,
|
||||||
ARRAY_SIZE(tegra210_sfc_dais));
|
ARRAY_SIZE(tegra210_sfc_dais));
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -3567,7 +3565,7 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
static int tegra210_sfc_platform_remove(struct platform_device *pdev)
|
static int tegra210_sfc_platform_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
snd_soc_unregister_codec(&pdev->dev);
|
snd_soc_unregister_component(&pdev->dev);
|
||||||
|
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* tegra210_sfc_alt.h - Definitions for Tegra210 SFC driver
|
* tegra210_sfc.h - Definitions for Tegra210 SFC driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user