[alsa-devel] [PATCH 114/187] ASoC: tscs42xx: replace codec to component
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Fri Jan 12 02:41:36 CET 2018
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Now we can replace Codec to Component. Let's do it.
Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 0 -> .pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
sound/soc/codecs/tscs42xx.c | 222 +++++++++++++++++++++-----------------------
1 file changed, 108 insertions(+), 114 deletions(-)
diff --git a/sound/soc/codecs/tscs42xx.c b/sound/soc/codecs/tscs42xx.c
index eedd600..d76844d 100644
--- a/sound/soc/codecs/tscs42xx.c
+++ b/sound/soc/codecs/tscs42xx.c
@@ -91,15 +91,15 @@ static bool tscs42xx_precious(struct device *dev, unsigned int reg)
};
#define MAX_PLL_LOCK_20MS_WAITS 1
-static bool plls_locked(struct snd_soc_codec *codec)
+static bool plls_locked(struct snd_soc_component *component)
{
int ret;
int count = MAX_PLL_LOCK_20MS_WAITS;
do {
- ret = snd_soc_read(codec, R_PLLCTL0);
+ ret = snd_soc_component_read32(component, R_PLLCTL0);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to read PLL lock status (%d)\n", ret);
return false;
} else if (ret > 0) {
@@ -131,10 +131,10 @@ static int sample_rate_to_pll_freq_out(int sample_rate)
}
#define DACCRSTAT_MAX_TRYS 10
-static int write_coeff_ram(struct snd_soc_codec *codec, u8 *coeff_ram,
+static int write_coeff_ram(struct snd_soc_component *component, u8 *coeff_ram,
unsigned int addr, unsigned int coeff_cnt)
{
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
int cnt;
int trys;
int ret;
@@ -142,9 +142,9 @@ static int write_coeff_ram(struct snd_soc_codec *codec, u8 *coeff_ram,
for (cnt = 0; cnt < coeff_cnt; cnt++, addr++) {
for (trys = 0; trys < DACCRSTAT_MAX_TRYS; trys++) {
- ret = snd_soc_read(codec, R_DACCRSTAT);
+ ret = snd_soc_component_read32(component, R_DACCRSTAT);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to read stat (%d)\n", ret);
return ret;
}
@@ -154,14 +154,14 @@ static int write_coeff_ram(struct snd_soc_codec *codec, u8 *coeff_ram,
if (trys == DACCRSTAT_MAX_TRYS) {
ret = -EIO;
- dev_err(codec->dev,
+ dev_err(component->dev,
"dac coefficient write error (%d)\n", ret);
return ret;
}
ret = regmap_write(tscs42xx->regmap, R_DACCRADDR, addr);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to write dac ram address (%d)\n", ret);
return ret;
}
@@ -170,7 +170,7 @@ static int write_coeff_ram(struct snd_soc_codec *codec, u8 *coeff_ram,
&coeff_ram[addr * COEFF_SIZE],
COEFF_SIZE);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to write dac ram (%d)\n", ret);
return ret;
}
@@ -179,9 +179,9 @@ static int write_coeff_ram(struct snd_soc_codec *codec, u8 *coeff_ram,
return 0;
}
-static int power_up_audio_plls(struct snd_soc_codec *codec)
+static int power_up_audio_plls(struct snd_soc_component *component)
{
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
int freq_out;
int ret;
unsigned int mask;
@@ -199,20 +199,20 @@ static int power_up_audio_plls(struct snd_soc_codec *codec)
break;
default:
ret = -EINVAL;
- dev_err(codec->dev, "Unrecognized PLL output freq (%d)\n", ret);
+ dev_err(component->dev, "Unrecognized PLL output freq (%d)\n", ret);
return ret;
}
mutex_lock(&tscs42xx->pll_lock);
- ret = snd_soc_update_bits(codec, R_PLLCTL1C, mask, val);
+ ret = snd_soc_component_update_bits(component, R_PLLCTL1C, mask, val);
if (ret < 0) {
- dev_err(codec->dev, "Failed to turn PLL on (%d)\n", ret);
+ dev_err(component->dev, "Failed to turn PLL on (%d)\n", ret);
goto exit;
}
- if (!plls_locked(codec)) {
- dev_err(codec->dev, "Failed to lock plls\n");
+ if (!plls_locked(component)) {
+ dev_err(component->dev, "Failed to lock plls\n");
ret = -ENOMSG;
goto exit;
}
@@ -224,25 +224,25 @@ static int power_up_audio_plls(struct snd_soc_codec *codec)
return ret;
}
-static int power_down_audio_plls(struct snd_soc_codec *codec)
+static int power_down_audio_plls(struct snd_soc_component *component)
{
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
int ret;
mutex_lock(&tscs42xx->pll_lock);
- ret = snd_soc_update_bits(codec, R_PLLCTL1C,
+ ret = snd_soc_component_update_bits(component, R_PLLCTL1C,
RM_PLLCTL1C_PDB_PLL1,
RV_PLLCTL1C_PDB_PLL1_DISABLE);
if (ret < 0) {
- dev_err(codec->dev, "Failed to turn PLL off (%d)\n", ret);
+ dev_err(component->dev, "Failed to turn PLL off (%d)\n", ret);
goto exit;
}
- ret = snd_soc_update_bits(codec, R_PLLCTL1C,
+ ret = snd_soc_component_update_bits(component, R_PLLCTL1C,
RM_PLLCTL1C_PDB_PLL2,
RV_PLLCTL1C_PDB_PLL2_DISABLE);
if (ret < 0) {
- dev_err(codec->dev, "Failed to turn PLL off (%d)\n", ret);
+ dev_err(component->dev, "Failed to turn PLL off (%d)\n", ret);
goto exit;
}
@@ -256,8 +256,8 @@ static int power_down_audio_plls(struct snd_soc_codec *codec)
static int coeff_ram_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
struct coeff_ram_ctl *ctl =
(struct coeff_ram_ctl *)kcontrol->private_value;
struct soc_bytes_ext *params = &ctl->bytes_ext;
@@ -275,8 +275,8 @@ static int coeff_ram_get(struct snd_kcontrol *kcontrol,
static int coeff_ram_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
struct coeff_ram_ctl *ctl =
(struct coeff_ram_ctl *)kcontrol->private_value;
struct soc_bytes_ext *params = &ctl->bytes_ext;
@@ -292,11 +292,11 @@ static int coeff_ram_put(struct snd_kcontrol *kcontrol,
mutex_lock(&tscs42xx->pll_lock);
- if (plls_locked(codec)) {
- ret = write_coeff_ram(codec, tscs42xx->coeff_ram,
+ if (plls_locked(component)) {
+ ret = write_coeff_ram(component, tscs42xx->coeff_ram,
ctl->addr, coeff_cnt);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to flush coeff ram cache (%d)\n", ret);
goto exit;
}
@@ -358,13 +358,13 @@ static int dapm_micb_event(struct snd_soc_dapm_widget *w,
int pll_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
int ret;
if (SND_SOC_DAPM_EVENT_ON(event))
- ret = power_up_audio_plls(codec);
+ ret = power_up_audio_plls(component);
else
- ret = power_down_audio_plls(codec);
+ ret = power_down_audio_plls(component);
return ret;
}
@@ -372,14 +372,14 @@ int pll_event(struct snd_soc_dapm_widget *w,
int dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
int ret;
mutex_lock(&tscs42xx->coeff_ram_lock);
if (tscs42xx->coeff_ram_synced == false) {
- ret = write_coeff_ram(codec, tscs42xx->coeff_ram, 0x00,
+ ret = write_coeff_ram(component, tscs42xx->coeff_ram, 0x00,
COEFF_RAM_COEFF_COUNT);
if (ret < 0)
goto exit;
@@ -790,7 +790,7 @@ static int bytes_info_ext(struct snd_kcontrol *kcontrol,
R_DACMBCREL3L, 2),
};
-static int setup_sample_format(struct snd_soc_codec *codec,
+static int setup_sample_format(struct snd_soc_component *component,
snd_pcm_format_t format)
{
unsigned int width;
@@ -811,21 +811,21 @@ static int setup_sample_format(struct snd_soc_codec *codec,
break;
default:
ret = -EINVAL;
- dev_err(codec->dev, "Unsupported format width (%d)\n", ret);
+ dev_err(component->dev, "Unsupported format width (%d)\n", ret);
return ret;
}
- ret = snd_soc_update_bits(codec, R_AIC1, RM_AIC1_WL, width);
+ ret = snd_soc_component_update_bits(component, R_AIC1, RM_AIC1_WL, width);
if (ret < 0) {
- dev_err(codec->dev, "Failed to set sample width (%d)\n", ret);
+ dev_err(component->dev, "Failed to set sample width (%d)\n", ret);
return ret;
}
return 0;
}
-static int setup_sample_rate(struct snd_soc_codec *codec, unsigned int rate)
+static int setup_sample_rate(struct snd_soc_component *component, unsigned int rate)
{
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
unsigned int br, bm;
int ret;
@@ -871,29 +871,29 @@ static int setup_sample_rate(struct snd_soc_codec *codec, unsigned int rate)
bm = RV_DACSR_DBM_2;
break;
default:
- dev_err(codec->dev, "Unsupported sample rate %d\n", rate);
+ dev_err(component->dev, "Unsupported sample rate %d\n", rate);
return -EINVAL;
}
/* DAC and ADC share bit and frame clock */
- ret = snd_soc_update_bits(codec, R_DACSR, RM_DACSR_DBR, br);
+ ret = snd_soc_component_update_bits(component, R_DACSR, RM_DACSR_DBR, br);
if (ret < 0) {
- dev_err(codec->dev, "Failed to update register (%d)\n", ret);
+ dev_err(component->dev, "Failed to update register (%d)\n", ret);
return ret;
}
- ret = snd_soc_update_bits(codec, R_DACSR, RM_DACSR_DBM, bm);
+ ret = snd_soc_component_update_bits(component, R_DACSR, RM_DACSR_DBM, bm);
if (ret < 0) {
- dev_err(codec->dev, "Failed to update register (%d)\n", ret);
+ dev_err(component->dev, "Failed to update register (%d)\n", ret);
return ret;
}
- ret = snd_soc_update_bits(codec, R_ADCSR, RM_DACSR_DBR, br);
+ ret = snd_soc_component_update_bits(component, R_ADCSR, RM_DACSR_DBR, br);
if (ret < 0) {
- dev_err(codec->dev, "Failed to update register (%d)\n", ret);
+ dev_err(component->dev, "Failed to update register (%d)\n", ret);
return ret;
}
- ret = snd_soc_update_bits(codec, R_ADCSR, RM_DACSR_DBM, bm);
+ ret = snd_soc_component_update_bits(component, R_ADCSR, RM_DACSR_DBM, bm);
if (ret < 0) {
- dev_err(codec->dev, "Failed to update register (%d)\n", ret);
+ dev_err(component->dev, "Failed to update register (%d)\n", ret);
return ret;
}
@@ -1025,7 +1025,7 @@ static const struct pll_ctl *get_pll_ctl(int input_freq)
return pll_ctl;
}
-static int set_pll_ctl_from_input_freq(struct snd_soc_codec *codec,
+static int set_pll_ctl_from_input_freq(struct snd_soc_component *component,
const int input_freq)
{
int ret;
@@ -1035,18 +1035,18 @@ static int set_pll_ctl_from_input_freq(struct snd_soc_codec *codec,
pll_ctl = get_pll_ctl(input_freq);
if (!pll_ctl) {
ret = -EINVAL;
- dev_err(codec->dev, "No PLL input entry for %d (%d)\n",
+ dev_err(component->dev, "No PLL input entry for %d (%d)\n",
input_freq, ret);
return ret;
}
for (i = 0; i < PLL_REG_SETTINGS_COUNT; ++i) {
- ret = snd_soc_update_bits(codec,
+ ret = snd_soc_component_update_bits(component,
pll_ctl->settings[i].addr,
pll_ctl->settings[i].mask,
pll_ctl->settings[i].val);
if (ret < 0) {
- dev_err(codec->dev, "Failed to set pll ctl (%d)\n",
+ dev_err(component->dev, "Failed to set pll ctl (%d)\n",
ret);
return ret;
}
@@ -1059,33 +1059,33 @@ static int tscs42xx_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *codec_dai)
{
- struct snd_soc_codec *codec = codec_dai->codec;
+ struct snd_soc_component *component = codec_dai->component;
int ret;
- ret = setup_sample_format(codec, params_format(params));
+ ret = setup_sample_format(component, params_format(params));
if (ret < 0) {
- dev_err(codec->dev, "Failed to setup sample format (%d)\n",
+ dev_err(component->dev, "Failed to setup sample format (%d)\n",
ret);
return ret;
}
- ret = setup_sample_rate(codec, params_rate(params));
+ ret = setup_sample_rate(component, params_rate(params));
if (ret < 0) {
- dev_err(codec->dev, "Failed to setup sample rate (%d)\n", ret);
+ dev_err(component->dev, "Failed to setup sample rate (%d)\n", ret);
return ret;
}
return 0;
}
-static inline int dac_mute(struct snd_soc_codec *codec)
+static inline int dac_mute(struct snd_soc_component *component)
{
int ret;
- ret = snd_soc_update_bits(codec, R_CNVRTR1, RM_CNVRTR1_DACMU,
+ ret = snd_soc_component_update_bits(component, R_CNVRTR1, RM_CNVRTR1_DACMU,
RV_CNVRTR1_DACMU_ENABLE);
if (ret < 0) {
- dev_err(codec->dev, "Failed to mute DAC (%d)\n",
+ dev_err(component->dev, "Failed to mute DAC (%d)\n",
ret);
return ret;
}
@@ -1093,14 +1093,14 @@ static inline int dac_mute(struct snd_soc_codec *codec)
return 0;
}
-static inline int dac_unmute(struct snd_soc_codec *codec)
+static inline int dac_unmute(struct snd_soc_component *component)
{
int ret;
- ret = snd_soc_update_bits(codec, R_CNVRTR1, RM_CNVRTR1_DACMU,
+ ret = snd_soc_component_update_bits(component, R_CNVRTR1, RM_CNVRTR1_DACMU,
RV_CNVRTR1_DACMU_DISABLE);
if (ret < 0) {
- dev_err(codec->dev, "Failed to unmute DAC (%d)\n",
+ dev_err(component->dev, "Failed to unmute DAC (%d)\n",
ret);
return ret;
}
@@ -1108,14 +1108,14 @@ static inline int dac_unmute(struct snd_soc_codec *codec)
return 0;
}
-static inline int adc_mute(struct snd_soc_codec *codec)
+static inline int adc_mute(struct snd_soc_component *component)
{
int ret;
- ret = snd_soc_update_bits(codec, R_CNVRTR0, RM_CNVRTR0_ADCMU,
+ ret = snd_soc_component_update_bits(component, R_CNVRTR0, RM_CNVRTR0_ADCMU,
RV_CNVRTR0_ADCMU_ENABLE);
if (ret < 0) {
- dev_err(codec->dev, "Failed to mute ADC (%d)\n",
+ dev_err(component->dev, "Failed to mute ADC (%d)\n",
ret);
return ret;
}
@@ -1123,14 +1123,14 @@ static inline int adc_mute(struct snd_soc_codec *codec)
return 0;
}
-static inline int adc_unmute(struct snd_soc_codec *codec)
+static inline int adc_unmute(struct snd_soc_component *component)
{
int ret;
- ret = snd_soc_update_bits(codec, R_CNVRTR0, RM_CNVRTR0_ADCMU,
+ ret = snd_soc_component_update_bits(component, R_CNVRTR0, RM_CNVRTR0_ADCMU,
RV_CNVRTR0_ADCMU_DISABLE);
if (ret < 0) {
- dev_err(codec->dev, "Failed to unmute ADC (%d)\n",
+ dev_err(component->dev, "Failed to unmute ADC (%d)\n",
ret);
return ret;
}
@@ -1140,19 +1140,19 @@ static inline int adc_unmute(struct snd_soc_codec *codec)
static int tscs42xx_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{
- struct snd_soc_codec *codec = dai->codec;
+ struct snd_soc_component *component = dai->component;
int ret;
if (mute)
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
- ret = dac_mute(codec);
+ ret = dac_mute(component);
else
- ret = adc_mute(codec);
+ ret = adc_mute(component);
else
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
- ret = dac_unmute(codec);
+ ret = dac_unmute(component);
else
- ret = adc_unmute(codec);
+ ret = adc_unmute(component);
return ret;
}
@@ -1160,23 +1160,23 @@ static int tscs42xx_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
static int tscs42xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{
- struct snd_soc_codec *codec = codec_dai->codec;
+ struct snd_soc_component *component = codec_dai->component;
int ret;
/* Slave mode not supported since it needs always-on frame clock */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM:
- ret = snd_soc_update_bits(codec, R_AIC1, RM_AIC1_MS,
+ ret = snd_soc_component_update_bits(component, R_AIC1, RM_AIC1_MS,
RV_AIC1_MS_MASTER);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to set codec DAI master (%d)\n", ret);
return ret;
}
break;
default:
ret = -EINVAL;
- dev_err(codec->dev, "Unsupported format (%d)\n", ret);
+ dev_err(component->dev, "Unsupported format (%d)\n", ret);
return ret;
}
@@ -1186,8 +1186,8 @@ static int tscs42xx_set_dai_fmt(struct snd_soc_dai *codec_dai,
static int tscs42xx_set_dai_bclk_ratio(struct snd_soc_dai *codec_dai,
unsigned int ratio)
{
- struct snd_soc_codec *codec = codec_dai->codec;
- struct tscs42xx *tscs42xx = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_component *component = codec_dai->component;
+ struct tscs42xx *tscs42xx = snd_soc_component_get_drvdata(component);
unsigned int value;
int ret = 0;
@@ -1202,18 +1202,18 @@ static int tscs42xx_set_dai_bclk_ratio(struct snd_soc_dai *codec_dai,
value = RV_DACSR_DBCM_64;
break;
default:
- dev_err(codec->dev, "Unsupported bclk ratio (%d)\n", ret);
+ dev_err(component->dev, "Unsupported bclk ratio (%d)\n", ret);
return -EINVAL;
}
- ret = snd_soc_update_bits(codec, R_DACSR, RM_DACSR_DBCM, value);
+ ret = snd_soc_component_update_bits(component, R_DACSR, RM_DACSR_DBCM, value);
if (ret < 0) {
- dev_err(codec->dev, "Failed to set DAC BCLK ratio (%d)\n", ret);
+ dev_err(component->dev, "Failed to set DAC BCLK ratio (%d)\n", ret);
return ret;
}
- ret = snd_soc_update_bits(codec, R_ADCSR, RM_ADCSR_ABCM, value);
+ ret = snd_soc_component_update_bits(component, R_ADCSR, RM_ADCSR_ABCM, value);
if (ret < 0) {
- dev_err(codec->dev, "Failed to set ADC BCLK ratio (%d)\n", ret);
+ dev_err(component->dev, "Failed to set ADC BCLK ratio (%d)\n", ret);
return ret;
}
@@ -1229,40 +1229,40 @@ static int tscs42xx_set_dai_bclk_ratio(struct snd_soc_dai *codec_dai,
static int tscs42xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
- struct snd_soc_codec *codec = codec_dai->codec;
+ struct snd_soc_component *component = codec_dai->component;
int ret;
switch (clk_id) {
case TSCS42XX_PLL_SRC_XTAL:
case TSCS42XX_PLL_SRC_MCLK1:
- ret = snd_soc_write(codec, R_PLLREFSEL,
+ ret = snd_soc_component_write(component, R_PLLREFSEL,
RV_PLLREFSEL_PLL1_REF_SEL_XTAL_MCLK1 |
RV_PLLREFSEL_PLL2_REF_SEL_XTAL_MCLK1);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to set pll reference input (%d)\n",
ret);
return ret;
}
break;
case TSCS42XX_PLL_SRC_MCLK2:
- ret = snd_soc_write(codec, R_PLLREFSEL,
+ ret = snd_soc_component_write(component, R_PLLREFSEL,
RV_PLLREFSEL_PLL1_REF_SEL_MCLK2 |
RV_PLLREFSEL_PLL2_REF_SEL_MCLK2);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to set PLL reference (%d)\n", ret);
return ret;
}
break;
default:
- dev_err(codec->dev, "pll src is unsupported\n");
+ dev_err(component->dev, "pll src is unsupported\n");
return -EINVAL;
}
- ret = set_pll_ctl_from_input_freq(codec, freq);
+ ret = set_pll_ctl_from_input_freq(component, freq);
if (ret < 0) {
- dev_err(codec->dev,
+ dev_err(component->dev,
"Failed to setup PLL input freq (%d)\n", ret);
return ret;
}
@@ -1304,15 +1304,17 @@ static int part_is_valid(struct tscs42xx *tscs42xx)
};
}
-static struct snd_soc_codec_driver soc_codec_dev_tscs42xx = {
- .component_driver = {
- .dapm_widgets = tscs42xx_dapm_widgets,
- .num_dapm_widgets = ARRAY_SIZE(tscs42xx_dapm_widgets),
- .dapm_routes = tscs42xx_intercon,
- .num_dapm_routes = ARRAY_SIZE(tscs42xx_intercon),
- .controls = tscs42xx_snd_controls,
- .num_controls = ARRAY_SIZE(tscs42xx_snd_controls),
- },
+static struct snd_soc_component_driver soc_codec_dev_tscs42xx = {
+ .dapm_widgets = tscs42xx_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(tscs42xx_dapm_widgets),
+ .dapm_routes = tscs42xx_intercon,
+ .num_dapm_routes = ARRAY_SIZE(tscs42xx_intercon),
+ .controls = tscs42xx_snd_controls,
+ .num_controls = ARRAY_SIZE(tscs42xx_snd_controls),
+ .idle_bias_on = 1,
+ .pmdown_time = 1,
+ .endianness = 1,
+ .non_legacy_dai_naming = 1,
};
static inline void init_coeff_ram_cache(struct tscs42xx *tscs42xx)
@@ -1407,7 +1409,7 @@ static int tscs42xx_i2c_probe(struct i2c_client *i2c,
mutex_init(&tscs42xx->coeff_ram_lock);
mutex_init(&tscs42xx->pll_lock);
- ret = snd_soc_register_codec(tscs42xx->dev, &soc_codec_dev_tscs42xx,
+ ret = devm_snd_soc_register_component(tscs42xx->dev, &soc_codec_dev_tscs42xx,
&tscs42xx_dai, 1);
if (ret) {
dev_err(tscs42xx->dev, "Failed to register codec (%d)\n", ret);
@@ -1417,13 +1419,6 @@ static int tscs42xx_i2c_probe(struct i2c_client *i2c,
return 0;
}
-static int tscs42xx_i2c_remove(struct i2c_client *client)
-{
- snd_soc_unregister_codec(&client->dev);
-
- return 0;
-}
-
static const struct i2c_device_id tscs42xx_i2c_id[] = {
{ "tscs42A1", 0 },
{ "tscs42A2", 0 },
@@ -1445,7 +1440,6 @@ static int tscs42xx_i2c_remove(struct i2c_client *client)
.of_match_table = tscs42xx_of_match,
},
.probe = tscs42xx_i2c_probe,
- .remove = tscs42xx_i2c_remove,
.id_table = tscs42xx_i2c_id,
};
--
1.9.1
More information about the Alsa-devel
mailing list