mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
Merge remote-tracking branches 'asoc/topic/cs35l33', 'asoc/topic/cs35l34', 'asoc/topic/cs35l35', 'asoc/topic/cs4265' and 'asoc/topic/cs4270' into asoc-next
This commit is contained in:
commit
7ffd9d486d
@ -42,7 +42,7 @@
|
||||
#define CS35L33_BOOT_DELAY 50
|
||||
|
||||
struct cs35l33_private {
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct cs35l33_pdata pdata;
|
||||
struct regmap *regmap;
|
||||
struct gpio_desc *reset_gpio;
|
||||
@ -201,8 +201,8 @@ static const struct snd_kcontrol_new cs35l33_snd_controls[] = {
|
||||
static int cs35l33_spkrdrv_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 cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
@ -211,15 +211,15 @@ static int cs35l33_spkrdrv_event(struct snd_soc_dapm_widget *w,
|
||||
priv->amp_cal = true;
|
||||
regmap_update_bits(priv->regmap, CS35L33_CLASSD_CTL,
|
||||
CS35L33_AMP_CAL, 0);
|
||||
dev_dbg(codec->dev, "Amp calibration done\n");
|
||||
dev_dbg(component->dev, "Amp calibration done\n");
|
||||
}
|
||||
dev_dbg(codec->dev, "Amp turned on\n");
|
||||
dev_dbg(component->dev, "Amp turned on\n");
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
dev_dbg(codec->dev, "Amp turned off\n");
|
||||
dev_dbg(component->dev, "Amp turned off\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid event = 0x%x\n", event);
|
||||
dev_err(component->dev, "Invalid event = 0x%x\n", event);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -229,8 +229,8 @@ static int cs35l33_spkrdrv_event(struct snd_soc_dapm_widget *w,
|
||||
static int cs35l33_sdin_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 cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
unsigned int val;
|
||||
|
||||
switch (event) {
|
||||
@ -240,14 +240,14 @@ static int cs35l33_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
val = priv->is_tdm_mode ? 0 : CS35L33_PDN_TDM;
|
||||
regmap_update_bits(priv->regmap, CS35L33_PWRCTL2,
|
||||
CS35L33_PDN_TDM, val);
|
||||
dev_dbg(codec->dev, "BST turned on\n");
|
||||
dev_dbg(component->dev, "BST turned on\n");
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
dev_dbg(codec->dev, "SDIN turned on\n");
|
||||
dev_dbg(component->dev, "SDIN turned on\n");
|
||||
if (!priv->amp_cal) {
|
||||
regmap_update_bits(priv->regmap, CS35L33_CLASSD_CTL,
|
||||
CS35L33_AMP_CAL, CS35L33_AMP_CAL);
|
||||
dev_dbg(codec->dev, "Amp calibration started\n");
|
||||
dev_dbg(component->dev, "Amp calibration started\n");
|
||||
usleep_range(10000, 11000);
|
||||
}
|
||||
break;
|
||||
@ -257,10 +257,10 @@ static int cs35l33_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
usleep_range(4000, 4100);
|
||||
regmap_update_bits(priv->regmap, CS35L33_PWRCTL1,
|
||||
CS35L33_PDN_BST, CS35L33_PDN_BST);
|
||||
dev_dbg(codec->dev, "BST and SDIN turned off\n");
|
||||
dev_dbg(component->dev, "BST and SDIN turned off\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid event = 0x%x\n", event);
|
||||
dev_err(component->dev, "Invalid event = 0x%x\n", event);
|
||||
|
||||
}
|
||||
|
||||
@ -270,8 +270,8 @@ static int cs35l33_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
static int cs35l33_sdout_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 cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
unsigned int mask = CS35L33_SDOUT_3ST_I2S | CS35L33_PDN_TDM;
|
||||
unsigned int mask2 = CS35L33_SDOUT_3ST_TDM;
|
||||
unsigned int val, val2;
|
||||
@ -289,15 +289,15 @@ static int cs35l33_sdout_event(struct snd_soc_dapm_widget *w,
|
||||
/* set sdout_3st_tdm */
|
||||
val2 = CS35L33_SDOUT_3ST_TDM;
|
||||
}
|
||||
dev_dbg(codec->dev, "SDOUT turned on\n");
|
||||
dev_dbg(component->dev, "SDOUT turned on\n");
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
val = CS35L33_SDOUT_3ST_I2S | CS35L33_PDN_TDM;
|
||||
val2 = CS35L33_SDOUT_3ST_TDM;
|
||||
dev_dbg(codec->dev, "SDOUT turned off\n");
|
||||
dev_dbg(component->dev, "SDOUT turned off\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid event = 0x%x\n", event);
|
||||
dev_err(component->dev, "Invalid event = 0x%x\n", event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -360,11 +360,11 @@ static const struct snd_soc_dapm_route cs35l33_vp_vbst_mon_route[] = {
|
||||
{"VBSTMON", NULL, "MON"},
|
||||
};
|
||||
|
||||
static int cs35l33_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int cs35l33_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
unsigned int val;
|
||||
struct cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
@ -441,19 +441,19 @@ static int cs35l33_get_mclk_coeff(int mclk, int srate)
|
||||
|
||||
static int cs35l33_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
regmap_update_bits(priv->regmap, CS35L33_ADSP_CTL,
|
||||
CS35L33_MS_MASK, CS35L33_MS_MASK);
|
||||
dev_dbg(codec->dev, "Audio port in master mode\n");
|
||||
dev_dbg(component->dev, "Audio port in master mode\n");
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFS:
|
||||
regmap_update_bits(priv->regmap, CS35L33_ADSP_CTL,
|
||||
CS35L33_MS_MASK, 0);
|
||||
dev_dbg(codec->dev, "Audio port in slave mode\n");
|
||||
dev_dbg(component->dev, "Audio port in slave mode\n");
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@ -466,11 +466,11 @@ static int cs35l33_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
* closely, it is dsp-a with fsync shifted left by half bclk
|
||||
*/
|
||||
priv->is_tdm_mode = true;
|
||||
dev_dbg(codec->dev, "Audio port in TDM mode\n");
|
||||
dev_dbg(component->dev, "Audio port in TDM mode\n");
|
||||
break;
|
||||
case SND_SOC_DAIFMT_I2S:
|
||||
priv->is_tdm_mode = false;
|
||||
dev_dbg(codec->dev, "Audio port in I2S mode\n");
|
||||
dev_dbg(component->dev, "Audio port in I2S mode\n");
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@ -483,8 +483,8 @@ static int cs35l33_pcm_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 cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
int sample_size = params_width(params);
|
||||
int coeff = cs35l33_get_mclk_coeff(priv->mclk_int, params_rate(params));
|
||||
|
||||
@ -505,7 +505,7 @@ static int cs35l33_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
sample_size << CS35L33_AUDIN_RX_DEPTH_SHIFT);
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "sample rate=%d, bits per sample=%d\n",
|
||||
dev_dbg(component->dev, "sample rate=%d, bits per sample=%d\n",
|
||||
params_rate(params), params_width(params));
|
||||
|
||||
return 0;
|
||||
@ -532,8 +532,8 @@ static int cs35l33_pcm_startup(struct snd_pcm_substream *substream,
|
||||
|
||||
static int cs35l33_set_tristate(struct snd_soc_dai *dai, int tristate)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (tristate) {
|
||||
regmap_update_bits(priv->regmap, CS35L33_PWRCTL2,
|
||||
@ -553,9 +553,9 @@ static int cs35l33_set_tristate(struct snd_soc_dai *dai, int tristate)
|
||||
static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
unsigned int rx_mask, int slots, int slot_width)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
unsigned int reg, bit_pos, i;
|
||||
int slot, slot_num;
|
||||
|
||||
@ -567,7 +567,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
if (slot >= 0) {
|
||||
regmap_update_bits(priv->regmap, CS35L33_RX_AUD,
|
||||
CS35L33_X_LOC, slot);
|
||||
dev_dbg(codec->dev, "Audio starts from slots %d", slot);
|
||||
dev_dbg(component->dev, "Audio starts from slots %d", slot);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -593,7 +593,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
if (slot_num == 0) {
|
||||
regmap_update_bits(priv->regmap, CS35L33_TX_VMON,
|
||||
CS35L33_X_STATE | CS35L33_X_LOC, slot);
|
||||
dev_dbg(codec->dev, "VMON enabled in slots %d-%d",
|
||||
dev_dbg(component->dev, "VMON enabled in slots %d-%d",
|
||||
slot, slot + 1);
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
if (slot_num == 3) {
|
||||
regmap_update_bits(priv->regmap, CS35L33_TX_IMON,
|
||||
CS35L33_X_STATE | CS35L33_X_LOC, slot);
|
||||
dev_dbg(codec->dev, "IMON enabled in slots %d-%d",
|
||||
dev_dbg(component->dev, "IMON enabled in slots %d-%d",
|
||||
slot, slot + 1);
|
||||
}
|
||||
|
||||
@ -611,7 +611,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
CS35L33_X_STATE | CS35L33_X_LOC, slot);
|
||||
snd_soc_dapm_add_routes(dapm,
|
||||
&cs35l33_vp_vbst_mon_route[0], 2);
|
||||
dev_dbg(codec->dev, "VPMON enabled in slots %d", slot);
|
||||
dev_dbg(component->dev, "VPMON enabled in slots %d", slot);
|
||||
}
|
||||
|
||||
/* configure VBSTMON_TX_LOC */
|
||||
@ -620,7 +620,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
CS35L33_X_STATE | CS35L33_X_LOC, slot);
|
||||
snd_soc_dapm_add_routes(dapm,
|
||||
&cs35l33_vp_vbst_mon_route[2], 2);
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"VBSTMON enabled in slots %d", slot);
|
||||
}
|
||||
|
||||
@ -638,10 +638,10 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs35l33_codec_set_sysclk(struct snd_soc_codec *codec,
|
||||
static int cs35l33_component_set_sysclk(struct snd_soc_component *component,
|
||||
int clk_id, int source, unsigned int freq, int dir)
|
||||
{
|
||||
struct cs35l33_private *cs35l33 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l33_private *cs35l33 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (freq) {
|
||||
case CS35L33_MCLK_5644:
|
||||
@ -663,7 +663,7 @@ static int cs35l33_codec_set_sysclk(struct snd_soc_codec *codec,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "external mclk freq=%d, internal mclk freq=%d\n",
|
||||
dev_dbg(component->dev, "external mclk freq=%d, internal mclk freq=%d\n",
|
||||
freq, cs35l33->mclk_int);
|
||||
|
||||
return 0;
|
||||
@ -698,12 +698,12 @@ static struct snd_soc_dai_driver cs35l33_dai = {
|
||||
.symmetric_rates = 1,
|
||||
};
|
||||
|
||||
static int cs35l33_set_hg_data(struct snd_soc_codec *codec,
|
||||
static int cs35l33_set_hg_data(struct snd_soc_component *component,
|
||||
struct cs35l33_pdata *pdata)
|
||||
{
|
||||
struct cs35l33_hg *hg_config = &pdata->hg_config;
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
|
||||
struct cs35l33_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||
struct cs35l33_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (hg_config->enable_hg_algo) {
|
||||
regmap_update_bits(priv->regmap, CS35L33_HG_MEMLDO_CTL,
|
||||
@ -747,20 +747,20 @@ static int cs35l33_set_hg_data(struct snd_soc_codec *codec,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs35l33_set_bst_ipk(struct snd_soc_codec *codec, unsigned int bst)
|
||||
static int cs35l33_set_bst_ipk(struct snd_soc_component *component, unsigned int bst)
|
||||
{
|
||||
struct cs35l33_private *cs35l33 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l33_private *cs35l33 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0, steps = 0;
|
||||
|
||||
/* Boost current in uA */
|
||||
if (bst > 3600000 || bst < 1850000) {
|
||||
dev_err(codec->dev, "Invalid boost current %d\n", bst);
|
||||
dev_err(component->dev, "Invalid boost current %d\n", bst);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (bst % 15625) {
|
||||
dev_err(codec->dev, "Current not a multiple of 15625uA (%d)\n",
|
||||
dev_err(component->dev, "Current not a multiple of 15625uA (%d)\n",
|
||||
bst);
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
@ -778,12 +778,12 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cs35l33_probe(struct snd_soc_codec *codec)
|
||||
static int cs35l33_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs35l33_private *cs35l33 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l33_private *cs35l33 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs35l33->codec = codec;
|
||||
pm_runtime_get_sync(codec->dev);
|
||||
cs35l33->component = component;
|
||||
pm_runtime_get_sync(component->dev);
|
||||
|
||||
regmap_update_bits(cs35l33->regmap, CS35L33_PROTECT_CTL,
|
||||
CS35L33_ALIVE_WD_DIS, 0x8);
|
||||
@ -799,24 +799,24 @@ static int cs35l33_probe(struct snd_soc_codec *codec)
|
||||
cs35l33->pdata.amp_drv_sel << CS35L33_AMP_DRV_SEL_SHIFT);
|
||||
|
||||
if (cs35l33->pdata.boost_ipk)
|
||||
cs35l33_set_bst_ipk(codec, cs35l33->pdata.boost_ipk);
|
||||
cs35l33_set_bst_ipk(component, cs35l33->pdata.boost_ipk);
|
||||
|
||||
if (cs35l33->enable_soft_ramp) {
|
||||
snd_soc_update_bits(codec, CS35L33_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS35L33_DAC_CTL,
|
||||
CS35L33_DIGSFT, CS35L33_DIGSFT);
|
||||
snd_soc_update_bits(codec, CS35L33_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS35L33_DAC_CTL,
|
||||
CS35L33_DSR_RATE, cs35l33->pdata.ramp_rate);
|
||||
} else {
|
||||
snd_soc_update_bits(codec, CS35L33_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS35L33_DAC_CTL,
|
||||
CS35L33_DIGSFT, 0);
|
||||
}
|
||||
|
||||
/* update IMON scaling rate if different from default of 0x8 */
|
||||
if (cs35l33->pdata.imon_adc_scale != 0x8)
|
||||
snd_soc_update_bits(codec, CS35L33_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS35L33_ADC_CTL,
|
||||
CS35L33_IMON_SCALE, cs35l33->pdata.imon_adc_scale);
|
||||
|
||||
cs35l33_set_hg_data(codec, &(cs35l33->pdata));
|
||||
cs35l33_set_hg_data(component, &(cs35l33->pdata));
|
||||
|
||||
/*
|
||||
* unmask important interrupts that causes the chip to enter
|
||||
@ -826,26 +826,24 @@ static int cs35l33_probe(struct snd_soc_codec *codec)
|
||||
CS35L33_M_OTE | CS35L33_M_OTW | CS35L33_M_AMP_SHORT |
|
||||
CS35L33_M_CAL_ERR, 0);
|
||||
|
||||
pm_runtime_put_sync(codec->dev);
|
||||
pm_runtime_put_sync(component->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs35l33 = {
|
||||
.probe = cs35l33_probe,
|
||||
|
||||
.set_bias_level = cs35l33_set_bias_level,
|
||||
.set_sysclk = cs35l33_codec_set_sysclk,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs35l33_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs35l33_snd_controls),
|
||||
.dapm_widgets = cs35l33_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs35l33_dapm_widgets),
|
||||
.dapm_routes = cs35l33_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs35l33_audio_map),
|
||||
},
|
||||
.idle_bias_off = true,
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs35l33 = {
|
||||
.probe = cs35l33_probe,
|
||||
.set_bias_level = cs35l33_set_bias_level,
|
||||
.set_sysclk = cs35l33_component_set_sysclk,
|
||||
.controls = cs35l33_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs35l33_snd_controls),
|
||||
.dapm_widgets = cs35l33_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs35l33_dapm_widgets),
|
||||
.dapm_routes = cs35l33_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs35l33_audio_map),
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct regmap_config cs35l33_regmap = {
|
||||
@ -967,7 +965,7 @@ static int cs35l33_get_hg_data(const struct device_node *np,
|
||||
static irqreturn_t cs35l33_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct cs35l33_private *cs35l33 = data;
|
||||
struct snd_soc_codec *codec = cs35l33->codec;
|
||||
struct snd_soc_component *component = cs35l33->component;
|
||||
unsigned int sticky_val1, sticky_val2, current_val, mask1, mask2;
|
||||
|
||||
regmap_read(cs35l33->regmap, CS35L33_INT_STATUS_2,
|
||||
@ -989,9 +987,9 @@ static irqreturn_t cs35l33_irq_thread(int irq, void *data)
|
||||
/* handle the interrupts */
|
||||
|
||||
if (sticky_val1 & CS35L33_AMP_SHORT) {
|
||||
dev_crit(codec->dev, "Amp short error\n");
|
||||
dev_crit(component->dev, "Amp short error\n");
|
||||
if (!(current_val & CS35L33_AMP_SHORT)) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Amp short error release\n");
|
||||
regmap_update_bits(cs35l33->regmap,
|
||||
CS35L33_AMP_CTL,
|
||||
@ -1007,13 +1005,13 @@ static irqreturn_t cs35l33_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky_val1 & CS35L33_CAL_ERR) {
|
||||
dev_err(codec->dev, "Cal error\n");
|
||||
dev_err(component->dev, "Cal error\n");
|
||||
|
||||
/* redo the calibration in next power up */
|
||||
cs35l33->amp_cal = false;
|
||||
|
||||
if (!(current_val & CS35L33_CAL_ERR)) {
|
||||
dev_dbg(codec->dev, "Cal error release\n");
|
||||
dev_dbg(component->dev, "Cal error release\n");
|
||||
regmap_update_bits(cs35l33->regmap,
|
||||
CS35L33_AMP_CTL, CS35L33_CAL_ERR_RLS,
|
||||
0);
|
||||
@ -1027,9 +1025,9 @@ static irqreturn_t cs35l33_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky_val1 & CS35L33_OTE) {
|
||||
dev_crit(codec->dev, "Over temperature error\n");
|
||||
dev_crit(component->dev, "Over temperature error\n");
|
||||
if (!(current_val & CS35L33_OTE)) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Over temperature error release\n");
|
||||
regmap_update_bits(cs35l33->regmap,
|
||||
CS35L33_AMP_CTL, CS35L33_OTE_RLS, 0);
|
||||
@ -1042,9 +1040,9 @@ static irqreturn_t cs35l33_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky_val1 & CS35L33_OTW) {
|
||||
dev_err(codec->dev, "Over temperature warning\n");
|
||||
dev_err(component->dev, "Over temperature warning\n");
|
||||
if (!(current_val & CS35L33_OTW)) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Over temperature warning release\n");
|
||||
regmap_update_bits(cs35l33->regmap,
|
||||
CS35L33_AMP_CTL, CS35L33_OTW_RLS, 0);
|
||||
@ -1056,21 +1054,21 @@ static irqreturn_t cs35l33_irq_thread(int irq, void *data)
|
||||
}
|
||||
}
|
||||
if (CS35L33_ALIVE_ERR & sticky_val1)
|
||||
dev_err(codec->dev, "ERROR: ADSPCLK Interrupt\n");
|
||||
dev_err(component->dev, "ERROR: ADSPCLK Interrupt\n");
|
||||
|
||||
if (CS35L33_MCLK_ERR & sticky_val1)
|
||||
dev_err(codec->dev, "ERROR: MCLK Interrupt\n");
|
||||
dev_err(component->dev, "ERROR: MCLK Interrupt\n");
|
||||
|
||||
if (CS35L33_VMON_OVFL & sticky_val2)
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"ERROR: VMON Overflow Interrupt\n");
|
||||
|
||||
if (CS35L33_IMON_OVFL & sticky_val2)
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"ERROR: IMON Overflow Interrupt\n");
|
||||
|
||||
if (CS35L33_VPMON_OVFL & sticky_val2)
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"ERROR: VPMON Overflow Interrupt\n");
|
||||
|
||||
return IRQ_HANDLED;
|
||||
@ -1236,10 +1234,10 @@ static int cs35l33_i2c_probe(struct i2c_client *i2c_client,
|
||||
pm_runtime_set_active(&i2c_client->dev);
|
||||
pm_runtime_enable(&i2c_client->dev);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_dev_cs35l33, &cs35l33_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_dev_cs35l33, &cs35l33_dai, 1);
|
||||
if (ret < 0) {
|
||||
dev_err(&i2c_client->dev, "%s: Register codec failed\n",
|
||||
dev_err(&i2c_client->dev, "%s: Register component failed\n",
|
||||
__func__);
|
||||
goto err_enable;
|
||||
}
|
||||
@ -1257,8 +1255,6 @@ static int cs35l33_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cs35l33_private *cs35l33 = i2c_get_clientdata(client);
|
||||
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
|
||||
gpiod_set_value_cansleep(cs35l33->reset_gpio, 0);
|
||||
|
||||
pm_runtime_disable(&client->dev);
|
||||
|
@ -43,7 +43,7 @@
|
||||
#define CS35L34_START_DELAY 50
|
||||
|
||||
struct cs35l34_private {
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
struct cs35l34_platform_data pdata;
|
||||
struct regmap *regmap;
|
||||
struct regulator_bulk_data core_supplies[2];
|
||||
@ -237,8 +237,8 @@ static bool cs35l34_precious_register(struct device *dev, unsigned int reg)
|
||||
static int cs35l34_sdin_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 cs35l34_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l34_private *priv = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
switch (event) {
|
||||
@ -250,7 +250,7 @@ static int cs35l34_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
ret = regmap_update_bits(priv->regmap, CS35L34_PWRCTL1,
|
||||
CS35L34_PDN_ALL, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "Cannot set Power bits %d\n", ret);
|
||||
dev_err(component->dev, "Cannot set Power bits %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
usleep_range(5000, 5100);
|
||||
@ -272,8 +272,8 @@ static int cs35l34_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
static int cs35l34_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
unsigned int rx_mask, int slots, int slot_width)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs35l34_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l34_private *priv = snd_soc_component_get_drvdata(component);
|
||||
unsigned int reg, bit_pos;
|
||||
int slot, slot_num;
|
||||
|
||||
@ -284,7 +284,7 @@ static int cs35l34_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
/* scan rx_mask for aud slot */
|
||||
slot = ffs(rx_mask) - 1;
|
||||
if (slot >= 0)
|
||||
snd_soc_update_bits(codec, CS35L34_TDM_RX_CTL_1_AUDIN,
|
||||
snd_soc_component_update_bits(component, CS35L34_TDM_RX_CTL_1_AUDIN,
|
||||
CS35L34_X_LOC, slot);
|
||||
|
||||
/* scan tx_mask: vmon(2 slots); imon (2 slots); vpmon (1 slot)
|
||||
@ -294,10 +294,10 @@ static int cs35l34_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
slot_num = 0;
|
||||
|
||||
/* disable vpmon/vbstmon: enable later if set in tx_mask */
|
||||
snd_soc_update_bits(codec, CS35L34_TDM_TX_CTL_3_VPMON,
|
||||
snd_soc_component_update_bits(component, CS35L34_TDM_TX_CTL_3_VPMON,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC);
|
||||
snd_soc_update_bits(codec, CS35L34_TDM_TX_CTL_4_VBSTMON,
|
||||
snd_soc_component_update_bits(component, CS35L34_TDM_TX_CTL_4_VBSTMON,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC);
|
||||
|
||||
@ -305,22 +305,22 @@ static int cs35l34_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
while (slot >= 0) {
|
||||
/* configure VMON_TX_LOC */
|
||||
if (slot_num == 0)
|
||||
snd_soc_update_bits(codec, CS35L34_TDM_TX_CTL_1_VMON,
|
||||
snd_soc_component_update_bits(component, CS35L34_TDM_TX_CTL_1_VMON,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC, slot);
|
||||
|
||||
/* configure IMON_TX_LOC */
|
||||
if (slot_num == 4) {
|
||||
snd_soc_update_bits(codec, CS35L34_TDM_TX_CTL_2_IMON,
|
||||
snd_soc_component_update_bits(component, CS35L34_TDM_TX_CTL_2_IMON,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC, slot);
|
||||
}
|
||||
/* configure VPMON_TX_LOC */
|
||||
if (slot_num == 3) {
|
||||
snd_soc_update_bits(codec, CS35L34_TDM_TX_CTL_3_VPMON,
|
||||
snd_soc_component_update_bits(component, CS35L34_TDM_TX_CTL_3_VPMON,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC, slot);
|
||||
}
|
||||
/* configure VBSTMON_TX_LOC */
|
||||
if (slot_num == 7) {
|
||||
snd_soc_update_bits(codec,
|
||||
snd_soc_component_update_bits(component,
|
||||
CS35L34_TDM_TX_CTL_4_VBSTMON,
|
||||
CS35L34_X_STATE | CS35L34_X_LOC, slot);
|
||||
}
|
||||
@ -328,7 +328,7 @@ static int cs35l34_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
/* Enable the relevant tx slot */
|
||||
reg = CS35L34_TDM_TX_SLOT_EN_4 - (slot/8);
|
||||
bit_pos = slot - ((slot / 8) * (8));
|
||||
snd_soc_update_bits(codec, reg,
|
||||
snd_soc_component_update_bits(component, reg,
|
||||
1 << bit_pos, 1 << bit_pos);
|
||||
|
||||
tx_mask &= ~(1 << slot);
|
||||
@ -342,8 +342,8 @@ static int cs35l34_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
|
||||
static int cs35l34_main_amp_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 cs35l34_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l34_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (event) {
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
@ -382,8 +382,8 @@ static const struct snd_kcontrol_new cs35l34_snd_controls[] = {
|
||||
static int cs35l34_mclk_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 cs35l34_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l34_private *priv = snd_soc_component_get_drvdata(component);
|
||||
int ret, i;
|
||||
unsigned int reg;
|
||||
|
||||
@ -524,8 +524,8 @@ static int cs35l34_get_mclk_coeff(int mclk, int srate)
|
||||
|
||||
static int cs35l34_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs35l34_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs35l34_private *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
@ -546,15 +546,15 @@ static int cs35l34_pcm_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 cs35l34_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l34_private *priv = snd_soc_component_get_drvdata(component);
|
||||
int srate = params_rate(params);
|
||||
int ret;
|
||||
|
||||
int coeff = cs35l34_get_mclk_coeff(priv->mclk_int, srate);
|
||||
|
||||
if (coeff < 0) {
|
||||
dev_err(codec->dev, "ERROR: Invalid mclk %d and/or srate %d\n",
|
||||
dev_err(component->dev, "ERROR: Invalid mclk %d and/or srate %d\n",
|
||||
priv->mclk_int, srate);
|
||||
return coeff;
|
||||
}
|
||||
@ -562,7 +562,7 @@ static int cs35l34_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
ret = regmap_update_bits(priv->regmap, CS35L34_ADSP_CLK_CTL,
|
||||
CS35L34_ADSP_RATE, cs35l34_mclk_coeffs[coeff].adsp_rate);
|
||||
if (ret != 0)
|
||||
dev_err(codec->dev, "Failed to set clock state %d\n", ret);
|
||||
dev_err(component->dev, "Failed to set clock state %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -590,13 +590,13 @@ static int cs35l34_pcm_startup(struct snd_pcm_substream *substream,
|
||||
static int cs35l34_set_tristate(struct snd_soc_dai *dai, int tristate)
|
||||
{
|
||||
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
|
||||
if (tristate)
|
||||
snd_soc_update_bits(codec, CS35L34_PWRCTL3,
|
||||
snd_soc_component_update_bits(component, CS35L34_PWRCTL3,
|
||||
CS35L34_PDN_SDOUT, CS35L34_PDN_SDOUT);
|
||||
else
|
||||
snd_soc_update_bits(codec, CS35L34_PWRCTL3,
|
||||
snd_soc_component_update_bits(component, CS35L34_PWRCTL3,
|
||||
CS35L34_PDN_SDOUT, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -604,8 +604,8 @@ static int cs35l34_set_tristate(struct snd_soc_dai *dai, int tristate)
|
||||
static int cs35l34_dai_set_sysclk(struct snd_soc_dai *dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs35l34_private *cs35l34 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l34_private *cs35l34 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int value;
|
||||
|
||||
switch (freq) {
|
||||
@ -634,7 +634,7 @@ static int cs35l34_dai_set_sysclk(struct snd_soc_dai *dai,
|
||||
cs35l34->mclk_int = freq / 2;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "ERROR: Invalid Frequency %d\n", freq);
|
||||
dev_err(component->dev, "ERROR: Invalid Frequency %d\n", freq);
|
||||
cs35l34->mclk_int = 0;
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -676,7 +676,7 @@ static struct snd_soc_dai_driver cs35l34_dai = {
|
||||
static int cs35l34_boost_inductor(struct cs35l34_private *cs35l34,
|
||||
unsigned int inductor)
|
||||
{
|
||||
struct snd_soc_codec *codec = cs35l34->codec;
|
||||
struct snd_soc_component *component = cs35l34->component;
|
||||
|
||||
switch (inductor) {
|
||||
case 1000: /* 1 uH */
|
||||
@ -708,19 +708,19 @@ static int cs35l34_boost_inductor(struct cs35l34_private *cs35l34,
|
||||
regmap_write(cs35l34->regmap, CS35L34_BST_CONV_SW_FREQ, 3);
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "%s Invalid Inductor Value %d uH\n",
|
||||
dev_err(component->dev, "%s Invalid Inductor Value %d uH\n",
|
||||
__func__, inductor);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs35l34_probe(struct snd_soc_codec *codec)
|
||||
static int cs35l34_probe(struct snd_soc_component *component)
|
||||
{
|
||||
int ret = 0;
|
||||
struct cs35l34_private *cs35l34 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l34_private *cs35l34 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
pm_runtime_get_sync(codec->dev);
|
||||
pm_runtime_get_sync(component->dev);
|
||||
|
||||
/* Set over temperature warning attenuation to 6 dB */
|
||||
regmap_update_bits(cs35l34->regmap, CS35L34_PROTECT_CTL,
|
||||
@ -773,23 +773,24 @@ static int cs35l34_probe(struct snd_soc_codec *codec)
|
||||
regmap_update_bits(cs35l34->regmap, CS35L34_ADSP_TDM_CTL,
|
||||
1, 1);
|
||||
|
||||
pm_runtime_put_sync(codec->dev);
|
||||
pm_runtime_put_sync(component->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs35l34 = {
|
||||
.probe = cs35l34_probe,
|
||||
|
||||
.component_driver = {
|
||||
.dapm_widgets = cs35l34_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs35l34_dapm_widgets),
|
||||
.dapm_routes = cs35l34_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs35l34_audio_map),
|
||||
.controls = cs35l34_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs35l34_snd_controls),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs35l34 = {
|
||||
.probe = cs35l34_probe,
|
||||
.dapm_widgets = cs35l34_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs35l34_dapm_widgets),
|
||||
.dapm_routes = cs35l34_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs35l34_audio_map),
|
||||
.controls = cs35l34_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs35l34_snd_controls),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static struct regmap_config cs35l34_regmap = {
|
||||
@ -864,7 +865,7 @@ static int cs35l34_handle_of_data(struct i2c_client *i2c_client,
|
||||
static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct cs35l34_private *cs35l34 = data;
|
||||
struct snd_soc_codec *codec = cs35l34->codec;
|
||||
struct snd_soc_component *component = cs35l34->component;
|
||||
unsigned int sticky1, sticky2, sticky3, sticky4;
|
||||
unsigned int mask1, mask2, mask3, mask4, current1;
|
||||
|
||||
@ -887,11 +888,11 @@ static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
regmap_read(cs35l34->regmap, CS35L34_INT_STATUS_1, ¤t1);
|
||||
|
||||
if (sticky1 & CS35L34_CAL_ERR) {
|
||||
dev_err(codec->dev, "Cal error\n");
|
||||
dev_err(component->dev, "Cal error\n");
|
||||
|
||||
/* error is no longer asserted; safe to reset */
|
||||
if (!(current1 & CS35L34_CAL_ERR)) {
|
||||
dev_dbg(codec->dev, "Cal error release\n");
|
||||
dev_dbg(component->dev, "Cal error release\n");
|
||||
regmap_update_bits(cs35l34->regmap,
|
||||
CS35L34_PROT_RELEASE_CTL,
|
||||
CS35L34_CAL_ERR_RLS, 0);
|
||||
@ -907,14 +908,14 @@ static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky1 & CS35L34_ALIVE_ERR)
|
||||
dev_err(codec->dev, "Alive error\n");
|
||||
dev_err(component->dev, "Alive error\n");
|
||||
|
||||
if (sticky1 & CS35L34_AMP_SHORT) {
|
||||
dev_crit(codec->dev, "Amp short error\n");
|
||||
dev_crit(component->dev, "Amp short error\n");
|
||||
|
||||
/* error is no longer asserted; safe to reset */
|
||||
if (!(current1 & CS35L34_AMP_SHORT)) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Amp short error release\n");
|
||||
regmap_update_bits(cs35l34->regmap,
|
||||
CS35L34_PROT_RELEASE_CTL,
|
||||
@ -930,11 +931,11 @@ static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky1 & CS35L34_OTW) {
|
||||
dev_crit(codec->dev, "Over temperature warning\n");
|
||||
dev_crit(component->dev, "Over temperature warning\n");
|
||||
|
||||
/* error is no longer asserted; safe to reset */
|
||||
if (!(current1 & CS35L34_OTW)) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Over temperature warning release\n");
|
||||
regmap_update_bits(cs35l34->regmap,
|
||||
CS35L34_PROT_RELEASE_CTL,
|
||||
@ -950,11 +951,11 @@ static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky1 & CS35L34_OTE) {
|
||||
dev_crit(codec->dev, "Over temperature error\n");
|
||||
dev_crit(component->dev, "Over temperature error\n");
|
||||
|
||||
/* error is no longer asserted; safe to reset */
|
||||
if (!(current1 & CS35L34_OTE)) {
|
||||
dev_dbg(codec->dev,
|
||||
dev_dbg(component->dev,
|
||||
"Over temperature error release\n");
|
||||
regmap_update_bits(cs35l34->regmap,
|
||||
CS35L34_PROT_RELEASE_CTL,
|
||||
@ -970,7 +971,7 @@ static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky3 & CS35L34_BST_HIGH) {
|
||||
dev_crit(codec->dev, "VBST too high error; powering off!\n");
|
||||
dev_crit(component->dev, "VBST too high error; powering off!\n");
|
||||
regmap_update_bits(cs35l34->regmap, CS35L34_PWRCTL2,
|
||||
CS35L34_PDN_AMP, CS35L34_PDN_AMP);
|
||||
regmap_update_bits(cs35l34->regmap, CS35L34_PWRCTL1,
|
||||
@ -978,7 +979,7 @@ static irqreturn_t cs35l34_irq_thread(int irq, void *data)
|
||||
}
|
||||
|
||||
if (sticky3 & CS35L34_LBST_SHORT) {
|
||||
dev_crit(codec->dev, "LBST short error; powering off!\n");
|
||||
dev_crit(component->dev, "LBST short error; powering off!\n");
|
||||
regmap_update_bits(cs35l34->regmap, CS35L34_PWRCTL2,
|
||||
CS35L34_PDN_AMP, CS35L34_PDN_AMP);
|
||||
regmap_update_bits(cs35l34->regmap, CS35L34_PWRCTL1,
|
||||
@ -1108,11 +1109,11 @@ static int cs35l34_i2c_probe(struct i2c_client *i2c_client,
|
||||
pm_runtime_set_active(&i2c_client->dev);
|
||||
pm_runtime_enable(&i2c_client->dev);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_dev_cs35l34, &cs35l34_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_dev_cs35l34, &cs35l34_dai, 1);
|
||||
if (ret < 0) {
|
||||
dev_err(&i2c_client->dev,
|
||||
"%s: Register codec failed\n", __func__);
|
||||
"%s: Register component failed\n", __func__);
|
||||
goto err_regulator;
|
||||
}
|
||||
|
||||
@ -1129,8 +1130,6 @@ static int cs35l34_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
struct cs35l34_private *cs35l34 = i2c_get_clientdata(client);
|
||||
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
|
||||
gpiod_set_value_cansleep(cs35l34->reset_gpio, 0);
|
||||
|
||||
pm_runtime_disable(&client->dev);
|
||||
|
@ -194,8 +194,8 @@ static int cs35l35_wait_for_pdn(struct cs35l35_private *cs35l35)
|
||||
static int cs35l35_sdin_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 cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
switch (event) {
|
||||
@ -231,7 +231,7 @@ static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
1 << CS35L35_AMP_DIGSFT_SHIFT);
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid event = 0x%x\n", event);
|
||||
dev_err(component->dev, "Invalid event = 0x%x\n", event);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
return ret;
|
||||
@ -240,8 +240,8 @@ static int cs35l35_sdin_event(struct snd_soc_dapm_widget *w,
|
||||
static int cs35l35_main_amp_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 cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int reg[4];
|
||||
int i;
|
||||
|
||||
@ -301,7 +301,7 @@ static int cs35l35_main_amp_event(struct snd_soc_dapm_widget *w,
|
||||
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid event = 0x%x\n", event);
|
||||
dev_err(component->dev, "Invalid event = 0x%x\n", event);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -369,8 +369,8 @@ static const struct snd_soc_dapm_route cs35l35_audio_map[] = {
|
||||
|
||||
static int cs35l35_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
@ -470,8 +470,8 @@ static int cs35l35_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 cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
struct classh_cfg *classh = &cs35l35->pdata.classh_algo;
|
||||
int srate = params_rate(params);
|
||||
int ret = 0;
|
||||
@ -482,7 +482,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
int clk_ctl = cs35l35_get_clk_config(cs35l35->sysclk, srate);
|
||||
|
||||
if (clk_ctl < 0) {
|
||||
dev_err(codec->dev, "Invalid CLK:Rate %d:%d\n",
|
||||
dev_err(component->dev, "Invalid CLK:Rate %d:%d\n",
|
||||
cs35l35->sysclk, srate);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -490,7 +490,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
ret = regmap_update_bits(cs35l35->regmap, CS35L35_CLK_CTL2,
|
||||
CS35L35_CLK_CTL2_MASK, clk_ctl);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set port config %d\n", ret);
|
||||
dev_err(component->dev, "Failed to set port config %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
CS35L35_CH_WKFET_DEL_MASK,
|
||||
0 << CS35L35_CH_WKFET_DEL_SHIFT);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set fet config %d\n",
|
||||
dev_err(component->dev, "Failed to set fet config %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
@ -531,7 +531,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
audin_format = CS35L35_SDIN_DEPTH_24;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Unsupported Width %d\n",
|
||||
dev_err(component->dev, "Unsupported Width %d\n",
|
||||
params_width(params));
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -554,7 +554,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
* to configure the CLOCK_CTL3 register correctly
|
||||
*/
|
||||
if ((cs35l35->sclk / srate) % 4) {
|
||||
dev_err(codec->dev, "Unsupported sclk/fs ratio %d:%d\n",
|
||||
dev_err(component->dev, "Unsupported sclk/fs ratio %d:%d\n",
|
||||
cs35l35->sclk, srate);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -568,7 +568,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
case CS35L35_SP_SCLKS_64FS:
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "ratio not supported\n");
|
||||
dev_err(component->dev, "ratio not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
@ -578,7 +578,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
case CS35L35_SP_SCLKS_64FS:
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "ratio not supported\n");
|
||||
dev_err(component->dev, "ratio not supported\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
@ -587,7 +587,7 @@ static int cs35l35_hw_params(struct snd_pcm_substream *substream,
|
||||
CS35L35_SP_SCLKS_MASK, sp_sclks <<
|
||||
CS35L35_SP_SCLKS_SHIFT);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set fsclk %d\n", ret);
|
||||
dev_err(component->dev, "Failed to set fsclk %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -607,8 +607,8 @@ static const struct snd_pcm_hw_constraint_list cs35l35_constraints = {
|
||||
static int cs35l35_pcm_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!substream->runtime)
|
||||
return 0;
|
||||
@ -635,8 +635,8 @@ static const struct snd_pcm_hw_constraint_list cs35l35_pdm_constraints = {
|
||||
static int cs35l35_pdm_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (!substream->runtime)
|
||||
return 0;
|
||||
@ -655,8 +655,8 @@ static int cs35l35_pdm_startup(struct snd_pcm_substream *substream,
|
||||
static int cs35l35_dai_set_sysclk(struct snd_soc_dai *dai,
|
||||
int clk_id, unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
/* Need the SCLK Frequency regardless of sysclk source for I2S */
|
||||
cs35l35->sclk = freq;
|
||||
@ -712,11 +712,11 @@ static struct snd_soc_dai_driver cs35l35_dai[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec,
|
||||
static int cs35l35_component_set_sysclk(struct snd_soc_component *component,
|
||||
int clk_id, int source, unsigned int freq,
|
||||
int dir)
|
||||
{
|
||||
struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
int clksrc;
|
||||
int ret = 0;
|
||||
|
||||
@ -731,7 +731,7 @@ static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec,
|
||||
clksrc = CS35L35_CLK_SOURCE_PDM;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid CLK Source\n");
|
||||
dev_err(component->dev, "Invalid CLK Source\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -749,7 +749,7 @@ static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec,
|
||||
cs35l35->sysclk = freq;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "Invalid CLK Frequency Input : %d\n", freq);
|
||||
dev_err(component->dev, "Invalid CLK Frequency Input : %d\n", freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -757,7 +757,7 @@ static int cs35l35_codec_set_sysclk(struct snd_soc_codec *codec,
|
||||
CS35L35_CLK_SOURCE_MASK,
|
||||
clksrc << CS35L35_CLK_SOURCE_SHIFT);
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set sysclk %d\n", ret);
|
||||
dev_err(component->dev, "Failed to set sysclk %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -834,9 +834,9 @@ static int cs35l35_boost_inductor(struct cs35l35_private *cs35l35,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs35l35_codec_probe(struct snd_soc_codec *codec)
|
||||
static int cs35l35_component_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs35l35_private *cs35l35 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs35l35_private *cs35l35 = snd_soc_component_get_drvdata(component);
|
||||
struct classh_cfg *classh = &cs35l35->pdata.classh_algo;
|
||||
struct monitor_cfg *monitor_config = &cs35l35->pdata.mon_cfg;
|
||||
int ret;
|
||||
@ -880,7 +880,7 @@ static int cs35l35_codec_probe(struct snd_soc_codec *codec)
|
||||
regmap_update_bits(cs35l35->regmap, CS35L35_CLASS_H_CTL,
|
||||
CS35L35_CH_STEREO_MASK,
|
||||
1 << CS35L35_CH_STEREO_SHIFT);
|
||||
ret = snd_soc_add_codec_controls(codec, cs35l35_adv_controls,
|
||||
ret = snd_soc_add_component_controls(component, cs35l35_adv_controls,
|
||||
ARRAY_SIZE(cs35l35_adv_controls));
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -1079,20 +1079,19 @@ static int cs35l35_codec_probe(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs35l35 = {
|
||||
.probe = cs35l35_codec_probe,
|
||||
.set_sysclk = cs35l35_codec_set_sysclk,
|
||||
.component_driver = {
|
||||
.dapm_widgets = cs35l35_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs35l35_dapm_widgets),
|
||||
|
||||
.dapm_routes = cs35l35_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs35l35_audio_map),
|
||||
|
||||
.controls = cs35l35_aud_controls,
|
||||
.num_controls = ARRAY_SIZE(cs35l35_aud_controls),
|
||||
},
|
||||
|
||||
static const struct snd_soc_component_driver soc_component_dev_cs35l35 = {
|
||||
.probe = cs35l35_component_probe,
|
||||
.set_sysclk = cs35l35_component_set_sysclk,
|
||||
.dapm_widgets = cs35l35_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs35l35_dapm_widgets),
|
||||
.dapm_routes = cs35l35_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs35l35_audio_map),
|
||||
.controls = cs35l35_aud_controls,
|
||||
.num_controls = ARRAY_SIZE(cs35l35_aud_controls),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static struct regmap_config cs35l35_regmap = {
|
||||
@ -1617,10 +1616,10 @@ static int cs35l35_i2c_probe(struct i2c_client *i2c_client,
|
||||
regmap_update_bits(cs35l35->regmap, CS35L35_PROTECT_CTL,
|
||||
CS35L35_AMP_MUTE_MASK, 1 << CS35L35_AMP_MUTE_SHIFT);
|
||||
|
||||
ret = snd_soc_register_codec(dev, &soc_codec_dev_cs35l35, cs35l35_dai,
|
||||
ARRAY_SIZE(cs35l35_dai));
|
||||
ret = devm_snd_soc_register_component(dev, &soc_component_dev_cs35l35,
|
||||
cs35l35_dai, ARRAY_SIZE(cs35l35_dai));
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Failed to register codec: %d\n", ret);
|
||||
dev_err(dev, "Failed to register component: %d\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -1634,12 +1633,6 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cs35l35_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id cs35l35_of_match[] = {
|
||||
{.compatible = "cirrus,cs35l35"},
|
||||
{},
|
||||
@ -1660,7 +1653,6 @@ static struct i2c_driver cs35l35_i2c_driver = {
|
||||
},
|
||||
.id_table = cs35l35_id,
|
||||
.probe = cs35l35_i2c_probe,
|
||||
.remove = cs35l35_i2c_remove,
|
||||
};
|
||||
|
||||
module_i2c_driver(cs35l35_i2c_driver);
|
||||
|
@ -322,12 +322,12 @@ static int cs4265_get_clk_index(int mclk, int rate)
|
||||
static int cs4265_set_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
|
||||
unsigned int freq, int dir)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs4265_private *cs4265 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
|
||||
if (clk_id != 0) {
|
||||
dev_err(codec->dev, "Invalid clk_id %d\n", clk_id);
|
||||
dev_err(component->dev, "Invalid clk_id %d\n", clk_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
|
||||
@ -337,24 +337,24 @@ static int cs4265_set_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
|
||||
}
|
||||
}
|
||||
cs4265->sysclk = 0;
|
||||
dev_err(codec->dev, "Invalid freq parameter %d\n", freq);
|
||||
dev_err(component->dev, "Invalid freq parameter %d\n", freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int cs4265_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs4265_private *cs4265 = snd_soc_component_get_drvdata(component);
|
||||
u8 iface = 0;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
snd_soc_update_bits(codec, CS4265_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_ADC_CTL,
|
||||
CS4265_ADC_MASTER,
|
||||
CS4265_ADC_MASTER);
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFS:
|
||||
snd_soc_update_bits(codec, CS4265_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_ADC_CTL,
|
||||
CS4265_ADC_MASTER,
|
||||
0);
|
||||
break;
|
||||
@ -383,20 +383,20 @@ static int cs4265_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
|
||||
static int cs4265_digital_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
|
||||
if (mute) {
|
||||
snd_soc_update_bits(codec, CS4265_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_DAC_CTL,
|
||||
CS4265_DAC_CTL_MUTE,
|
||||
CS4265_DAC_CTL_MUTE);
|
||||
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
|
||||
snd_soc_component_update_bits(component, CS4265_SPDIF_CTL2,
|
||||
CS4265_SPDIF_CTL2_MUTE,
|
||||
CS4265_SPDIF_CTL2_MUTE);
|
||||
} else {
|
||||
snd_soc_update_bits(codec, CS4265_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_DAC_CTL,
|
||||
CS4265_DAC_CTL_MUTE,
|
||||
0);
|
||||
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
|
||||
snd_soc_component_update_bits(component, CS4265_SPDIF_CTL2,
|
||||
CS4265_SPDIF_CTL2_MUTE,
|
||||
0);
|
||||
}
|
||||
@ -407,8 +407,8 @@ static int cs4265_pcm_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 cs4265_private *cs4265 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs4265_private *cs4265 = snd_soc_component_get_drvdata(component);
|
||||
int index;
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
|
||||
@ -418,45 +418,45 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
index = cs4265_get_clk_index(cs4265->sysclk, params_rate(params));
|
||||
if (index >= 0) {
|
||||
snd_soc_update_bits(codec, CS4265_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_ADC_CTL,
|
||||
CS4265_ADC_FM, clk_map_table[index].fm_mode << 6);
|
||||
snd_soc_update_bits(codec, CS4265_MCLK_FREQ,
|
||||
snd_soc_component_update_bits(component, CS4265_MCLK_FREQ,
|
||||
CS4265_MCLK_FREQ_MASK,
|
||||
clk_map_table[index].mclkdiv << 4);
|
||||
|
||||
} else {
|
||||
dev_err(codec->dev, "can't get correct mclk\n");
|
||||
dev_err(component->dev, "can't get correct mclk\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (cs4265->format & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_I2S:
|
||||
snd_soc_update_bits(codec, CS4265_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_DAC_CTL,
|
||||
CS4265_DAC_CTL_DIF, (1 << 4));
|
||||
snd_soc_update_bits(codec, CS4265_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_ADC_CTL,
|
||||
CS4265_ADC_DIF, (1 << 4));
|
||||
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
|
||||
snd_soc_component_update_bits(component, CS4265_SPDIF_CTL2,
|
||||
CS4265_SPDIF_CTL2_DIF, (1 << 6));
|
||||
break;
|
||||
case SND_SOC_DAIFMT_RIGHT_J:
|
||||
if (params_width(params) == 16) {
|
||||
snd_soc_update_bits(codec, CS4265_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_DAC_CTL,
|
||||
CS4265_DAC_CTL_DIF, (2 << 4));
|
||||
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
|
||||
snd_soc_component_update_bits(component, CS4265_SPDIF_CTL2,
|
||||
CS4265_SPDIF_CTL2_DIF, (2 << 6));
|
||||
} else {
|
||||
snd_soc_update_bits(codec, CS4265_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_DAC_CTL,
|
||||
CS4265_DAC_CTL_DIF, (3 << 4));
|
||||
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
|
||||
snd_soc_component_update_bits(component, CS4265_SPDIF_CTL2,
|
||||
CS4265_SPDIF_CTL2_DIF, (3 << 6));
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAIFMT_LEFT_J:
|
||||
snd_soc_update_bits(codec, CS4265_DAC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_DAC_CTL,
|
||||
CS4265_DAC_CTL_DIF, 0);
|
||||
snd_soc_update_bits(codec, CS4265_ADC_CTL,
|
||||
snd_soc_component_update_bits(component, CS4265_ADC_CTL,
|
||||
CS4265_ADC_DIF, 0);
|
||||
snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
|
||||
snd_soc_component_update_bits(component, CS4265_SPDIF_CTL2,
|
||||
CS4265_SPDIF_CTL2_DIF, 0);
|
||||
|
||||
break;
|
||||
@ -466,23 +466,23 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs4265_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int cs4265_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
break;
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
snd_soc_update_bits(codec, CS4265_PWRCTL,
|
||||
snd_soc_component_update_bits(component, CS4265_PWRCTL,
|
||||
CS4265_PWRCTL_PDN, 0);
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
snd_soc_update_bits(codec, CS4265_PWRCTL,
|
||||
snd_soc_component_update_bits(component, CS4265_PWRCTL,
|
||||
CS4265_PWRCTL_PDN,
|
||||
CS4265_PWRCTL_PDN);
|
||||
break;
|
||||
case SND_SOC_BIAS_OFF:
|
||||
snd_soc_update_bits(codec, CS4265_PWRCTL,
|
||||
snd_soc_component_update_bits(component, CS4265_PWRCTL,
|
||||
CS4265_PWRCTL_PDN,
|
||||
CS4265_PWRCTL_PDN);
|
||||
break;
|
||||
@ -544,17 +544,18 @@ static struct snd_soc_dai_driver cs4265_dai[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_cs4265 = {
|
||||
.set_bias_level = cs4265_set_bias_level,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs4265_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs4265_snd_controls),
|
||||
.dapm_widgets = cs4265_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs4265_dapm_widgets),
|
||||
.dapm_routes = cs4265_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs4265_audio_map),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_cs4265 = {
|
||||
.set_bias_level = cs4265_set_bias_level,
|
||||
.controls = cs4265_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs4265_snd_controls),
|
||||
.dapm_widgets = cs4265_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs4265_dapm_widgets),
|
||||
.dapm_routes = cs4265_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs4265_audio_map),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct regmap_config cs4265_regmap = {
|
||||
@ -616,18 +617,12 @@ static int cs4265_i2c_probe(struct i2c_client *i2c_client,
|
||||
|
||||
regmap_write(cs4265->regmap, CS4265_PWRCTL, 0x0F);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_cs4265, cs4265_dai,
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_cs4265, cs4265_dai,
|
||||
ARRAY_SIZE(cs4265_dai));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cs4265_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id cs4265_of_match[] = {
|
||||
{ .compatible = "cirrus,cs4265", },
|
||||
{ }
|
||||
@ -647,7 +642,6 @@ static struct i2c_driver cs4265_i2c_driver = {
|
||||
},
|
||||
.id_table = cs4265_id,
|
||||
.probe = cs4265_i2c_probe,
|
||||
.remove = cs4265_i2c_remove,
|
||||
};
|
||||
|
||||
module_i2c_driver(cs4265_i2c_driver);
|
||||
|
@ -254,8 +254,8 @@ static bool cs4270_reg_is_volatile(struct device *dev, unsigned int reg)
|
||||
static int cs4270_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 cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
cs4270->mclk = freq;
|
||||
return 0;
|
||||
@ -277,8 +277,8 @@ static int cs4270_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
||||
static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int format)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
/* set DAI format */
|
||||
switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
@ -287,7 +287,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
cs4270->mode = format & SND_SOC_DAIFMT_FORMAT_MASK;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "invalid dai format\n");
|
||||
dev_err(component->dev, "invalid dai format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -301,7 +301,7 @@ static int cs4270_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
break;
|
||||
default:
|
||||
/* all other modes are unsupported by the hardware */
|
||||
dev_err(codec->dev, "Unknown master/slave configuration\n");
|
||||
dev_err(component->dev, "Unknown master/slave configuration\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -326,8 +326,8 @@ static int cs4270_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 cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
unsigned int i;
|
||||
unsigned int rate;
|
||||
@ -346,13 +346,13 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
if (i == NUM_MCLK_RATIOS) {
|
||||
/* We did not find a matching ratio */
|
||||
dev_err(codec->dev, "could not find matching ratio\n");
|
||||
dev_err(component->dev, "could not find matching ratio\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Set the sample rate */
|
||||
|
||||
reg = snd_soc_read(codec, CS4270_MODE);
|
||||
reg = snd_soc_component_read32(component, CS4270_MODE);
|
||||
reg &= ~(CS4270_MODE_SPEED_MASK | CS4270_MODE_DIV_MASK);
|
||||
reg |= cs4270_mode_ratios[i].mclk;
|
||||
|
||||
@ -361,15 +361,15 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
else
|
||||
reg |= cs4270_mode_ratios[i].speed_mode;
|
||||
|
||||
ret = snd_soc_write(codec, CS4270_MODE, reg);
|
||||
ret = snd_soc_component_write(component, CS4270_MODE, reg);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "i2c write failed\n");
|
||||
dev_err(component->dev, "i2c write failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Set the DAI format */
|
||||
|
||||
reg = snd_soc_read(codec, CS4270_FORMAT);
|
||||
reg = snd_soc_component_read32(component, CS4270_FORMAT);
|
||||
reg &= ~(CS4270_FORMAT_DAC_MASK | CS4270_FORMAT_ADC_MASK);
|
||||
|
||||
switch (cs4270->mode) {
|
||||
@ -380,13 +380,13 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
reg |= CS4270_FORMAT_DAC_LJ | CS4270_FORMAT_ADC_LJ;
|
||||
break;
|
||||
default:
|
||||
dev_err(codec->dev, "unknown dai format\n");
|
||||
dev_err(component->dev, "unknown dai format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = snd_soc_write(codec, CS4270_FORMAT, reg);
|
||||
ret = snd_soc_component_write(component, CS4270_FORMAT, reg);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "i2c write failed\n");
|
||||
dev_err(component->dev, "i2c write failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -405,11 +405,11 @@ static int cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
*/
|
||||
static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
int reg6;
|
||||
|
||||
reg6 = snd_soc_read(codec, CS4270_MUTE);
|
||||
reg6 = snd_soc_component_read32(component, CS4270_MUTE);
|
||||
|
||||
if (mute)
|
||||
reg6 |= CS4270_MUTE_DAC_A | CS4270_MUTE_DAC_B;
|
||||
@ -418,7 +418,7 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
|
||||
reg6 |= cs4270->manual_mute;
|
||||
}
|
||||
|
||||
return snd_soc_write(codec, CS4270_MUTE, reg6);
|
||||
return snd_soc_component_write(component, CS4270_MUTE, reg6);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -438,8 +438,8 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
|
||||
static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
int left = !ucontrol->value.integer.value[0];
|
||||
int right = !ucontrol->value.integer.value[1];
|
||||
|
||||
@ -501,9 +501,9 @@ static struct snd_soc_dai_driver cs4270_dai = {
|
||||
* This function is called when ASoC has all the pieces it needs to
|
||||
* instantiate a sound driver.
|
||||
*/
|
||||
static int cs4270_probe(struct snd_soc_codec *codec)
|
||||
static int cs4270_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
|
||||
/* Disable auto-mute. This feature appears to be buggy. In some
|
||||
@ -511,9 +511,9 @@ static int cs4270_probe(struct snd_soc_codec *codec)
|
||||
* this feature disabled by default. An application (e.g. alsactl) can
|
||||
* re-enabled it by using the controls.
|
||||
*/
|
||||
ret = snd_soc_update_bits(codec, CS4270_MUTE, CS4270_MUTE_AUTO, 0);
|
||||
ret = snd_soc_component_update_bits(component, CS4270_MUTE, CS4270_MUTE_AUTO, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "i2c write failed\n");
|
||||
dev_err(component->dev, "i2c write failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -522,10 +522,10 @@ static int cs4270_probe(struct snd_soc_codec *codec)
|
||||
* playback has started. An application (e.g. alsactl) can
|
||||
* re-enabled it by using the controls.
|
||||
*/
|
||||
ret = snd_soc_update_bits(codec, CS4270_TRANS,
|
||||
ret = snd_soc_component_update_bits(component, CS4270_TRANS,
|
||||
CS4270_TRANS_SOFT | CS4270_TRANS_ZERO, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(codec->dev, "i2c write failed\n");
|
||||
dev_err(component->dev, "i2c write failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -541,13 +541,11 @@ static int cs4270_probe(struct snd_soc_codec *codec)
|
||||
*
|
||||
* This function is the counterpart to cs4270_probe().
|
||||
*/
|
||||
static int cs4270_remove(struct snd_soc_codec *codec)
|
||||
static void cs4270_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
@ -561,16 +559,16 @@ static int cs4270_remove(struct snd_soc_codec *codec)
|
||||
* and all registers are written back to the hardware when resuming.
|
||||
*/
|
||||
|
||||
static int cs4270_soc_suspend(struct snd_soc_codec *codec)
|
||||
static int cs4270_soc_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
int reg, ret;
|
||||
|
||||
reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
|
||||
reg = snd_soc_component_read32(component, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
|
||||
if (reg < 0)
|
||||
return reg;
|
||||
|
||||
ret = snd_soc_write(codec, CS4270_PWRCTL, reg);
|
||||
ret = snd_soc_component_write(component, CS4270_PWRCTL, reg);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -580,9 +578,9 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs4270_soc_resume(struct snd_soc_codec *codec)
|
||||
static int cs4270_soc_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component);
|
||||
int reg, ret;
|
||||
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
|
||||
@ -598,10 +596,10 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec)
|
||||
regcache_sync(cs4270->regmap);
|
||||
|
||||
/* ... then disable the power-down bits */
|
||||
reg = snd_soc_read(codec, CS4270_PWRCTL);
|
||||
reg = snd_soc_component_read32(component, CS4270_PWRCTL);
|
||||
reg &= ~CS4270_PWRCTL_PDN_ALL;
|
||||
|
||||
return snd_soc_write(codec, CS4270_PWRCTL, reg);
|
||||
return snd_soc_component_write(component, CS4270_PWRCTL, reg);
|
||||
}
|
||||
#else
|
||||
#define cs4270_soc_suspend NULL
|
||||
@ -611,20 +609,21 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec)
|
||||
/*
|
||||
* ASoC codec driver structure
|
||||
*/
|
||||
static const struct snd_soc_codec_driver soc_codec_device_cs4270 = {
|
||||
.probe = cs4270_probe,
|
||||
.remove = cs4270_remove,
|
||||
.suspend = cs4270_soc_suspend,
|
||||
.resume = cs4270_soc_resume,
|
||||
|
||||
.component_driver = {
|
||||
.controls = cs4270_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs4270_snd_controls),
|
||||
.dapm_widgets = cs4270_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs4270_dapm_widgets),
|
||||
.dapm_routes = cs4270_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs4270_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_device_cs4270 = {
|
||||
.probe = cs4270_probe,
|
||||
.remove = cs4270_remove,
|
||||
.suspend = cs4270_soc_suspend,
|
||||
.resume = cs4270_soc_resume,
|
||||
.controls = cs4270_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs4270_snd_controls),
|
||||
.dapm_widgets = cs4270_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(cs4270_dapm_widgets),
|
||||
.dapm_routes = cs4270_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(cs4270_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -718,23 +717,11 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
|
||||
|
||||
i2c_set_clientdata(i2c_client, cs4270);
|
||||
|
||||
ret = snd_soc_register_codec(&i2c_client->dev,
|
||||
&soc_codec_device_cs4270, &cs4270_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_device_cs4270, &cs4270_dai, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* cs4270_i2c_remove - remove an I2C device
|
||||
* @i2c_client: the I2C client object
|
||||
*
|
||||
* This function is the counterpart to cs4270_i2c_probe().
|
||||
*/
|
||||
static int cs4270_i2c_remove(struct i2c_client *i2c_client)
|
||||
{
|
||||
snd_soc_unregister_codec(&i2c_client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* cs4270_id - I2C device IDs supported by this driver
|
||||
*/
|
||||
@ -757,7 +744,6 @@ static struct i2c_driver cs4270_i2c_driver = {
|
||||
},
|
||||
.id_table = cs4270_id,
|
||||
.probe = cs4270_i2c_probe,
|
||||
.remove = cs4270_i2c_remove,
|
||||
};
|
||||
|
||||
module_i2c_driver(cs4270_i2c_driver);
|
||||
|
Loading…
Reference in New Issue
Block a user