ASoC: rpmsg_ak4497: replace codec to component
replace codec to component Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>5.4-rM2-2.2.x-imx-squashed
parent
26e4c3d80f
commit
d4215f5953
|
@ -30,7 +30,7 @@
|
|||
#include <linux/regulator/consumer.h>
|
||||
#include "../fsl/fsl_rpmsg_i2s.h"
|
||||
|
||||
#include "ak4497.h"
|
||||
#include "rpmsg_ak4497.h"
|
||||
|
||||
//#define AK4497_DEBUG //used at debug mode
|
||||
#define AK4497_NUM_SUPPLIES 2
|
||||
|
@ -176,14 +176,14 @@ static const struct soc_enum ak4497_dac_enum2[] = {
|
|||
ak4497_adfs_select)
|
||||
};
|
||||
|
||||
static int ak4497_read(struct snd_soc_codec *codec, unsigned int reg,
|
||||
static int ak4497_read(struct snd_soc_component *component, unsigned int reg,
|
||||
unsigned int *val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_component_read(&codec->component, reg, val);
|
||||
ret = snd_soc_component_read(component, reg, val);
|
||||
if (ret < 0)
|
||||
dev_err(codec->dev, "Register %u read failed, ret=%d.\n", reg, ret);
|
||||
dev_err(component->dev, "Register %u read failed, ret=%d.\n", reg, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -191,13 +191,13 @@ static int ak4497_read(struct snd_soc_codec *codec, unsigned int reg,
|
|||
static int ak4497_get_dsdsel(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int dsdsel0, dsdsel1;
|
||||
|
||||
ak4497_read(codec, AK4497_06_DSD1, &dsdsel0);
|
||||
ak4497_read(component, AK4497_06_DSD1, &dsdsel0);
|
||||
dsdsel0 &= AK4497_DSDSEL0;
|
||||
|
||||
ak4497_read(codec, AK4497_09_DSD2, &dsdsel1);
|
||||
ak4497_read(component, AK4497_09_DSD2, &dsdsel1);
|
||||
dsdsel1 &= AK4497_DSDSEL1;
|
||||
|
||||
ucontrol->value.enumerated.item[0] = ((dsdsel1 << 1) | dsdsel0);
|
||||
|
@ -208,25 +208,25 @@ static int ak4497_get_dsdsel(struct snd_kcontrol *kcontrol,
|
|||
static int ak4497_set_dsdsel(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int dsdsel = ucontrol->value.enumerated.item[0];
|
||||
|
||||
switch (dsdsel) {
|
||||
case 0: /* 2.8224MHz */
|
||||
snd_soc_update_bits(codec, AK4497_06_DSD1, 0x01, 0x00);
|
||||
snd_soc_update_bits(codec, AK4497_09_DSD2, 0x01, 0x00);
|
||||
snd_soc_component_update_bits(component, AK4497_06_DSD1, 0x01, 0x00);
|
||||
snd_soc_component_update_bits(component, AK4497_09_DSD2, 0x01, 0x00);
|
||||
break;
|
||||
case 1: /* 5.6448MHz */
|
||||
snd_soc_update_bits(codec, AK4497_06_DSD1, 0x01, 0x01);
|
||||
snd_soc_update_bits(codec, AK4497_09_DSD2, 0x01, 0x00);
|
||||
snd_soc_component_update_bits(component, AK4497_06_DSD1, 0x01, 0x01);
|
||||
snd_soc_component_update_bits(component, AK4497_09_DSD2, 0x01, 0x00);
|
||||
break;
|
||||
case 2: /* 11.2896MHz */
|
||||
snd_soc_update_bits(codec, AK4497_06_DSD1, 0x01, 0x00);
|
||||
snd_soc_update_bits(codec, AK4497_09_DSD2, 0x01, 0x01);
|
||||
snd_soc_component_update_bits(component, AK4497_06_DSD1, 0x01, 0x00);
|
||||
snd_soc_component_update_bits(component, AK4497_09_DSD2, 0x01, 0x01);
|
||||
break;
|
||||
case 3: /* 22.5792MHz */
|
||||
snd_soc_update_bits(codec, AK4497_06_DSD1, 0x01, 0x01);
|
||||
snd_soc_update_bits(codec, AK4497_09_DSD2, 0x01, 0x01);
|
||||
snd_soc_component_update_bits(component, AK4497_06_DSD1, 0x01, 0x01);
|
||||
snd_soc_component_update_bits(component, AK4497_09_DSD2, 0x01, 0x01);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
@ -238,8 +238,8 @@ static int ak4497_set_dsdsel(struct snd_kcontrol *kcontrol,
|
|||
static int ak4497_get_bickfs(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = ak4497->nBickFreq;
|
||||
|
||||
|
@ -249,8 +249,8 @@ static int ak4497_get_bickfs(struct snd_kcontrol *kcontrol,
|
|||
static int ak4497_set_bickfs(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ak4497->nBickFreq = ucontrol->value.enumerated.item[0];
|
||||
|
||||
|
@ -260,8 +260,8 @@ static int ak4497_set_bickfs(struct snd_kcontrol *kcontrol,
|
|||
static int ak4497_get_tdmsds(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = ak4497->nTdmSds;
|
||||
|
||||
|
@ -271,8 +271,8 @@ static int ak4497_get_tdmsds(struct snd_kcontrol *kcontrol,
|
|||
static int ak4497_set_tdmsds(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
int regA, regB;
|
||||
|
||||
ak4497->nTdmSds = ucontrol->value.enumerated.item[0];
|
||||
|
@ -323,8 +323,8 @@ static int ak4497_set_tdmsds(struct snd_kcontrol *kcontrol,
|
|||
regA <<= 4;
|
||||
regB <<= 4;
|
||||
|
||||
snd_soc_update_bits(codec, AK4497_0A_CONTROL7, 0xF0, regA);
|
||||
snd_soc_update_bits(codec, AK4497_0B_CONTROL8, 0x10, regB);
|
||||
snd_soc_component_update_bits(component, AK4497_0A_CONTROL7, 0xF0, regA);
|
||||
snd_soc_component_update_bits(component, AK4497_0B_CONTROL8, 0x10, regB);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -332,10 +332,10 @@ static int ak4497_set_tdmsds(struct snd_kcontrol *kcontrol,
|
|||
static int ak4497_get_adfs(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
unsigned int nADFSbit;
|
||||
|
||||
ak4497_read(codec, AK4497_15_DFSREAD, &nADFSbit);
|
||||
ak4497_read(component, AK4497_15_DFSREAD, &nADFSbit);
|
||||
nADFSbit &= 0x7;
|
||||
|
||||
ucontrol->value.enumerated.item[0] = nADFSbit;
|
||||
|
@ -390,7 +390,7 @@ static int get_test_reg(struct snd_kcontrol *kcontrol,
|
|||
static int set_test_reg(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
u32 currMode = ucontrol->value.enumerated.item[0];
|
||||
int i, regs, rege;
|
||||
unsigned int value;
|
||||
|
@ -406,7 +406,7 @@ static int set_test_reg(struct snd_kcontrol *kcontrol,
|
|||
}
|
||||
|
||||
for (i = regs; i <= rege; i++) {
|
||||
ak4497_read(codec, i, &value);
|
||||
ak4497_read(component, i, &value);
|
||||
pr_debug("***AK4497 Addr,Reg=(%x, %x)\n", i, value);
|
||||
}
|
||||
|
||||
|
@ -515,8 +515,8 @@ static int ak4497_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
snd_pcm_format_t pcm_format = params_format(params);
|
||||
|
||||
unsigned int dfs, dfs2, dsdsel0, dsdsel1, format;
|
||||
|
@ -534,16 +534,16 @@ static int ak4497_hw_params(struct snd_pcm_substream *substream,
|
|||
nfs1 = params_rate(params);
|
||||
ak4497->fs1 = nfs1;
|
||||
|
||||
ak4497_read(codec, AK4497_01_CONTROL2, &dfs);
|
||||
ak4497_read(component, AK4497_01_CONTROL2, &dfs);
|
||||
dfs &= ~AK4497_DFS;
|
||||
|
||||
ak4497_read(codec, AK4497_05_CONTROL4, &dfs2);
|
||||
ak4497_read(component, AK4497_05_CONTROL4, &dfs2);
|
||||
dfs2 &= ~AK4497_DFS2;
|
||||
|
||||
ak4497_read(codec, AK4497_06_DSD1, &dsdsel0);
|
||||
ak4497_read(component, AK4497_06_DSD1, &dsdsel0);
|
||||
dsdsel0 &= ~AK4497_DSDSEL0;
|
||||
|
||||
ak4497_read(codec, AK4497_09_DSD2, &dsdsel1);
|
||||
ak4497_read(component, AK4497_09_DSD2, &dsdsel1);
|
||||
dsdsel1 &= ~AK4497_DSDSEL1;
|
||||
|
||||
if (!is_dsd) {
|
||||
|
@ -606,14 +606,14 @@ static int ak4497_hw_params(struct snd_pcm_substream *substream,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, AK4497_06_DSD1, dsdsel0);
|
||||
snd_soc_write(codec, AK4497_09_DSD2, dsdsel1);
|
||||
snd_soc_component_write(component, AK4497_06_DSD1, dsdsel0);
|
||||
snd_soc_component_write(component, AK4497_09_DSD2, dsdsel1);
|
||||
}
|
||||
|
||||
snd_soc_write(codec, AK4497_01_CONTROL2, dfs);
|
||||
snd_soc_write(codec, AK4497_05_CONTROL4, dfs2);
|
||||
snd_soc_component_write(component, AK4497_01_CONTROL2, dfs);
|
||||
snd_soc_component_write(component, AK4497_05_CONTROL4, dfs2);
|
||||
|
||||
ak4497_read(codec, AK4497_00_CONTROL1, &format);
|
||||
ak4497_read(component, AK4497_00_CONTROL1, &format);
|
||||
format &= ~AK4497_DIF;
|
||||
|
||||
switch (params_format(params)) {
|
||||
|
@ -642,7 +642,7 @@ static int ak4497_hw_params(struct snd_pcm_substream *substream,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_write(codec, AK4497_00_CONTROL1, format);
|
||||
snd_soc_component_write(component, AK4497_00_CONTROL1, format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -655,15 +655,15 @@ static int ak4497_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
|
|||
|
||||
static int ak4497_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int format, format2;
|
||||
|
||||
/* set master/slave audio interface */
|
||||
ak4497_read(codec, AK4497_00_CONTROL1, &format);
|
||||
ak4497_read(component, AK4497_00_CONTROL1, &format);
|
||||
format &= ~AK4497_DIF;
|
||||
|
||||
ak4497_read(codec, AK4497_02_CONTROL3, &format2);
|
||||
ak4497_read(component, AK4497_02_CONTROL3, &format2);
|
||||
format2 &= ~AK4497_DIF_DSD;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
|
@ -673,7 +673,7 @@ static int ak4497_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||
case SND_SOC_DAIFMT_CBS_CFM:
|
||||
case SND_SOC_DAIFMT_CBM_CFS:
|
||||
default:
|
||||
dev_err(codec->dev, "Clock mode unsupported");
|
||||
dev_err(component->dev, "Clock mode unsupported");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -695,8 +695,8 @@ static int ak4497_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||
}
|
||||
|
||||
/* set format */
|
||||
snd_soc_write(codec, AK4497_00_CONTROL1, format);
|
||||
snd_soc_write(codec, AK4497_02_CONTROL3, format2);
|
||||
snd_soc_component_write(component, AK4497_00_CONTROL1, format);
|
||||
snd_soc_component_write(component, AK4497_02_CONTROL3, format2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ static bool ak4497_volatile(struct device *dev, unsigned int reg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ak4497_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int ak4497_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
switch (level) {
|
||||
|
@ -728,11 +728,11 @@ static int ak4497_set_bias_level(struct snd_soc_codec *codec,
|
|||
case SND_SOC_BIAS_PREPARE:
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
/* RSTN bit = 1 */
|
||||
snd_soc_update_bits(codec, AK4497_00_CONTROL1, 0x01, 0x01);
|
||||
snd_soc_component_update_bits(component, AK4497_00_CONTROL1, 0x01, 0x01);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
/* RSTN bit = 0 */
|
||||
snd_soc_update_bits(codec, AK4497_00_CONTROL1, 0x01, 0x00);
|
||||
snd_soc_component_update_bits(component, AK4497_00_CONTROL1, 0x01, 0x00);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,8 @@ static const struct snd_pcm_hw_constraint_list ak4497_rate_constraints = {
|
|||
};
|
||||
|
||||
static int ak4497_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai) {
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = snd_pcm_hw_constraint_list(substream->runtime, 0,
|
||||
|
@ -796,9 +797,9 @@ struct snd_soc_dai_driver rpmsg_ak4497_dai[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static int ak4497_init_reg(struct snd_soc_codec *codec)
|
||||
static int ak4497_init_reg(struct snd_soc_component *component)
|
||||
{
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
/* External Mute ON */
|
||||
|
@ -815,12 +816,12 @@ static int ak4497_init_reg(struct snd_soc_codec *codec)
|
|||
/* ak4497_set_bias_level(codec, SND_SOC_BIAS_STANDBY); */
|
||||
|
||||
/* SYNCE bit = 1 */
|
||||
ret = snd_soc_update_bits(codec, AK4497_07_CONTROL5, 0x01, 0x01);
|
||||
ret = snd_soc_component_update_bits(component, AK4497_07_CONTROL5, 0x01, 0x01);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* HLOAD bit = 1, SC2 bit = 1 */
|
||||
ret = snd_soc_update_bits(codec, AK4497_08_SOUNDCONTROL, 0x0F, 0x0C);
|
||||
ret = snd_soc_component_update_bits(component, AK4497_08_SOUNDCONTROL, 0x0F, 0x0C);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -864,9 +865,9 @@ static int ak4497_parse_dt(struct rpmsg_ak4497_priv *ak4497)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ak4497_probe(struct snd_soc_codec *codec)
|
||||
static int ak4497_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
ret = ak4497_parse_dt(ak4497);
|
||||
|
@ -886,7 +887,7 @@ static int ak4497_probe(struct snd_soc_codec *codec)
|
|||
gpio_direction_output(ak4497->mute_gpio, 0);
|
||||
}
|
||||
|
||||
ret = ak4497_init_reg(codec);
|
||||
ret = ak4497_init_reg(component);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -897,11 +898,11 @@ static int ak4497_probe(struct snd_soc_codec *codec)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ak4497_remove(struct snd_soc_codec *codec)
|
||||
static void ak4497_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_codec_get_drvdata(codec);
|
||||
struct rpmsg_ak4497_priv *ak4497 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ak4497_set_bias_level(codec, SND_SOC_BIAS_OFF);
|
||||
ak4497_set_bias_level(component, SND_SOC_BIAS_OFF);
|
||||
if (gpio_is_valid(ak4497->pdn_gpio)) {
|
||||
gpio_set_value_cansleep(ak4497->pdn_gpio, 0);
|
||||
gpio_free(ak4497->pdn_gpio);
|
||||
|
@ -909,7 +910,6 @@ static int ak4497_remove(struct snd_soc_codec *codec)
|
|||
if (gpio_is_valid(ak4497->mute_gpio))
|
||||
gpio_free(ak4497->mute_gpio);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
@ -955,21 +955,22 @@ static const struct dev_pm_ops ak4497_pm = {
|
|||
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
|
||||
};
|
||||
|
||||
struct snd_soc_codec_driver rpmsg_codec_dev_ak4497 = {
|
||||
struct snd_soc_component_driver rpmsg_codec_dev_ak4497 = {
|
||||
.probe = ak4497_probe,
|
||||
.remove = ak4497_remove,
|
||||
|
||||
.idle_bias_off = true,
|
||||
.set_bias_level = ak4497_set_bias_level,
|
||||
|
||||
.component_driver = {
|
||||
.controls = ak4497_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(ak4497_snd_controls),
|
||||
.dapm_widgets = ak4497_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ak4497_dapm_widgets),
|
||||
.dapm_routes = ak4497_intercon,
|
||||
.num_dapm_routes = ARRAY_SIZE(ak4497_intercon),
|
||||
},
|
||||
.controls = ak4497_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(ak4497_snd_controls),
|
||||
.dapm_widgets = ak4497_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ak4497_dapm_widgets),
|
||||
.dapm_routes = ak4497_intercon,
|
||||
.num_dapm_routes = ARRAY_SIZE(ak4497_intercon),
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int rpmsg_ak4497_read(void *context, unsigned int reg, unsigned int *val)
|
||||
|
@ -1072,7 +1073,7 @@ static int rpmsg_ak4497_codec_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &rpmsg_codec_dev_ak4497,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &rpmsg_codec_dev_ak4497,
|
||||
&rpmsg_ak4497_dai[0], ARRAY_SIZE(rpmsg_ak4497_dai));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -1084,7 +1085,6 @@ static int rpmsg_ak4497_codec_probe(struct platform_device *pdev)
|
|||
|
||||
static int rpmsg_ak4497_codec_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* ak4497.h -- audio driver for ak4497
|
||||
*
|
||||
* Copyright (C) 2016 Asahi Kasei Microdevices Corporation
|
||||
* Copyright (C) 2017, NXP
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
*/
|
||||
#ifndef _RPMSG_AK4497_H
|
||||
#define _RPMSG_AK4497_H
|
||||
|
||||
#define AK4497_00_CONTROL1 0x00
|
||||
#define AK4497_01_CONTROL2 0x01
|
||||
#define AK4497_02_CONTROL3 0x02
|
||||
#define AK4497_03_LCHATT 0x03
|
||||
#define AK4497_04_RCHATT 0x04
|
||||
#define AK4497_05_CONTROL4 0x05
|
||||
#define AK4497_06_DSD1 0x06
|
||||
#define AK4497_07_CONTROL5 0x07
|
||||
#define AK4497_08_SOUNDCONTROL 0x08
|
||||
#define AK4497_09_DSD2 0x09
|
||||
#define AK4497_0A_CONTROL7 0x0A
|
||||
#define AK4497_0B_CONTROL8 0x0B
|
||||
#define AK4497_0C_RESERVED 0x0C
|
||||
#define AK4497_0D_RESERVED 0x0D
|
||||
#define AK4497_0E_RESERVED 0x0E
|
||||
#define AK4497_0F_RESERVED 0x0F
|
||||
#define AK4497_10_RESERVED 0x10
|
||||
#define AK4497_11_RESERVED 0x11
|
||||
#define AK4497_12_RESERVED 0x12
|
||||
#define AK4497_13_RESERVED 0x13
|
||||
#define AK4497_14_RESERVED 0x14
|
||||
#define AK4497_15_DFSREAD 0x15
|
||||
|
||||
|
||||
#define AK4497_MAX_REGISTERS (AK4497_15_DFSREAD)
|
||||
|
||||
/* Bitfield Definitions */
|
||||
|
||||
/* AK4497_00_CONTROL1 (0x00) Fields */
|
||||
#define AK4497_DIF 0x0E
|
||||
#define AK4497_DIF_MSB_MODE (2 << 1)
|
||||
#define AK4497_DIF_I2S_MODE (3 << 1)
|
||||
#define AK4497_DIF_32BIT_MODE (4 << 1)
|
||||
|
||||
#define AK4497_DIF_16BIT_LSB (0 << 1)
|
||||
#define AK4497_DIF_20BIT_LSB (1 << 1)
|
||||
#define AK4497_DIF_24BIT_MSB (2 << 1)
|
||||
#define AK4497_DIF_24BIT_I2S (3 << 1)
|
||||
#define AK4497_DIF_24BIT_LSB (4 << 1)
|
||||
#define AK4497_DIF_32BIT_LSB (5 << 1)
|
||||
#define AK4497_DIF_32BIT_MSB (6 << 1)
|
||||
#define AK4497_DIF_32BIT_I2S (7 << 1)
|
||||
|
||||
/* AK4497_02_CONTROL3 (0x02) Fields */
|
||||
#define AK4497_DIF_DSD 0x80
|
||||
#define AK4497_DIF_DSD_MODE (1 << 7)
|
||||
|
||||
|
||||
/* AK4497_01_CONTROL2 (0x01) Fields */
|
||||
/* AK4497_05_CONTROL4 (0x05) Fields */
|
||||
#define AK4497_DFS 0x18
|
||||
#define AK4497_DFS_48KHZ (0x0 << 3) // 30kHz to 54kHz
|
||||
#define AK4497_DFS_96KHZ (0x1 << 3) // 54kHz to 108kHz
|
||||
#define AK4497_DFS_192KHZ (0x2 << 3) // 120kHz to 216kHz
|
||||
#define AK4497_DFS_384KHZ (0x0 << 3)
|
||||
#define AK4497_DFS_768KHZ (0x1 << 3)
|
||||
|
||||
#define AK4497_DFS2 0x2
|
||||
#define AK4497_DFS2_48KHZ (0x0 << 1) // 30kHz to 216kHz
|
||||
#define AK4497_DFS2_384KHZ (0x1 << 1) // 384kHz, 768kHz to 108kHz
|
||||
|
||||
|
||||
#define AK4497_DSDSEL0 0x1
|
||||
#define AK4497_DSDSEL0_2MHZ 0x0
|
||||
#define AK4497_DSDSEL0_5MHZ 0x1
|
||||
#define AK4497_DSDSEL0_11MHZ 0x0
|
||||
#define AK4497_DSDSEL0_22MHZ 0x1
|
||||
|
||||
#define AK4497_DSDSEL1 0x1
|
||||
#define AK4497_DSDSEL1_2MHZ 0x0
|
||||
#define AK4497_DSDSEL1_5MHZ 0x0
|
||||
#define AK4497_DSDSEL1_11MHZ 0x1
|
||||
#define AK4497_DSDSEL1_22MHZ 0x1
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue