summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tscs42xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tscs42xx.c')
-rw-r--r--sound/soc/codecs/tscs42xx.c244
1 files changed, 122 insertions, 122 deletions
diff --git a/sound/soc/codecs/tscs42xx.c b/sound/soc/codecs/tscs42xx.c
index e7661d0315e6..bbfc73a79b18 100644
--- a/sound/soc/codecs/tscs42xx.c
+++ b/sound/soc/codecs/tscs42xx.c
@@ -3,14 +3,19 @@
// Copyright 2017 Tempo Semiconductor, Inc.
// Author: Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/regmap.h>
#include <linux/i2c.h>
+#include <linux/err.h>
+#include <linux/string.h>
#include <linux/module.h>
+#include <linux/delay.h>
#include <linux/mutex.h>
-#include <linux/regmap.h>
+#include <sound/tlv.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
-#include <sound/tlv.h>
#include "tscs42xx.h"
@@ -91,15 +96,15 @@ static const struct regmap_config tscs42xx_regmap = {
};
#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 +136,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 +147,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 +159,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 +175,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 +184,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 +204,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 +229,25 @@ exit:
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 +261,8 @@ exit:
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 +280,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 +297,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 +363,13 @@ static int dapm_micb_event(struct snd_soc_dapm_widget *w,
static 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 +377,14 @@ static int pll_event(struct snd_soc_dapm_widget *w,
static 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 +795,7 @@ static const struct snd_kcontrol_new tscs42xx_snd_controls[] = {
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 +816,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 +876,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 +1030,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 +1040,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 +1064,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 +1098,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 +1113,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 +1128,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 +1145,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 +1165,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 +1191,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 +1207,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 +1234,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,24 +1309,28 @@ 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,
+ .use_pmdown_time = 1,
+ .endianness = 1,
+ .non_legacy_dai_naming = 1,
};
static inline void init_coeff_ram_cache(struct tscs42xx *tscs42xx)
{
- const u8 norm_addrs[] = { 0x00, 0x05, 0x0a, 0x0f, 0x14, 0x19, 0x1f,
- 0x20, 0x25, 0x2a, 0x2f, 0x34, 0x39, 0x3f, 0x40, 0x45, 0x4a,
- 0x4f, 0x54, 0x59, 0x5f, 0x60, 0x65, 0x6a, 0x6f, 0x74, 0x79,
- 0x7f, 0x80, 0x85, 0x8c, 0x91, 0x96, 0x97, 0x9c, 0xa3, 0xa8,
- 0xad, 0xaf, 0xb0, 0xb5, 0xba, 0xbf, 0xc4, 0xc9, };
+ static const u8 norm_addrs[] = {
+ 0x00, 0x05, 0x0a, 0x0f, 0x14, 0x19, 0x1f, 0x20, 0x25, 0x2a,
+ 0x2f, 0x34, 0x39, 0x3f, 0x40, 0x45, 0x4a, 0x4f, 0x54, 0x59,
+ 0x5f, 0x60, 0x65, 0x6a, 0x6f, 0x74, 0x79, 0x7f, 0x80, 0x85,
+ 0x8c, 0x91, 0x96, 0x97, 0x9c, 0xa3, 0xa8, 0xad, 0xaf, 0xb0,
+ 0xb5, 0xba, 0xbf, 0xc4, 0xc9,
+ };
u8 *coeff_ram = tscs42xx->coeff_ram;
int i;
@@ -1407,7 +1416,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 +1426,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 },
@@ -1441,11 +1443,9 @@ MODULE_DEVICE_TABLE(of, tscs42xx_of_match);
static struct i2c_driver tscs42xx_i2c_driver = {
.driver = {
.name = "tscs42xx",
- .owner = THIS_MODULE,
.of_match_table = tscs42xx_of_match,
},
.probe = tscs42xx_i2c_probe,
- .remove = tscs42xx_i2c_remove,
.id_table = tscs42xx_i2c_id,
};