Commit b886120a authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/max98927', 'asoc/topic/mc13783',...

Merge remote-tracking branches 'asoc/topic/max98927', 'asoc/topic/mc13783', 'asoc/topic/mediatek', 'asoc/topic/ml26124' and 'asoc/topic/msm8916-wcd-analog' into asoc-next
...@@ -53,7 +53,7 @@ See ../arm/mediatek/mediatek,audsys.txt for details about the parent node. ...@@ -53,7 +53,7 @@ See ../arm/mediatek/mediatek,audsys.txt for details about the parent node.
Example: Example:
audsys: audio-subsystem@11220000 { audsys: audio-subsystem@11220000 {
compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd"; compatible = "mediatek,mt2701-audsys", "syscon";
... ...
afe: audio-controller { afe: audio-controller {
......
...@@ -142,14 +142,14 @@ static struct reg_default max98927_reg[] = { ...@@ -142,14 +142,14 @@ static struct reg_default max98927_reg[] = {
static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) static int max98927_dai_set_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;
struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component);
unsigned int mode = 0; unsigned int mode = 0;
unsigned int format = 0; unsigned int format = 0;
bool use_pdm = false; bool use_pdm = false;
unsigned int invert = 0; unsigned int invert = 0;
dev_dbg(codec->dev, "%s: fmt 0x%08X\n", __func__, fmt); dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt);
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBS_CFS:
...@@ -160,7 +160,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -160,7 +160,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
mode = MAX98927_PCM_MASTER_MODE_MASTER; mode = MAX98927_PCM_MASTER_MODE_MASTER;
break; break;
default: default:
dev_err(codec->dev, "DAI clock mode unsupported\n"); dev_err(component->dev, "DAI clock mode unsupported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -176,7 +176,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -176,7 +176,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
invert = MAX98927_PCM_MODE_CFG_PCM_BCLKEDGE; invert = MAX98927_PCM_MODE_CFG_PCM_BCLKEDGE;
break; break;
default: default:
dev_err(codec->dev, "DAI invert mode unsupported\n"); dev_err(component->dev, "DAI invert mode unsupported\n");
return -EINVAL; return -EINVAL;
} }
...@@ -268,7 +268,7 @@ static int max98927_get_bclk_sel(int bclk) ...@@ -268,7 +268,7 @@ static int max98927_get_bclk_sel(int bclk)
static int max98927_set_clock(struct max98927_priv *max98927, static int max98927_set_clock(struct max98927_priv *max98927,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
struct snd_soc_codec *codec = max98927->codec; struct snd_soc_component *component = max98927->component;
/* BCLK/LRCLK ratio calculation */ /* BCLK/LRCLK ratio calculation */
int blr_clk_ratio = params_channels(params) * max98927->ch_size; int blr_clk_ratio = params_channels(params) * max98927->ch_size;
int value; int value;
...@@ -281,7 +281,7 @@ static int max98927_set_clock(struct max98927_priv *max98927, ...@@ -281,7 +281,7 @@ static int max98927_set_clock(struct max98927_priv *max98927,
break; break;
} }
if (i == ARRAY_SIZE(rate_table)) { if (i == ARRAY_SIZE(rate_table)) {
dev_err(codec->dev, "failed to find proper clock rate.\n"); dev_err(component->dev, "failed to find proper clock rate.\n");
return -EINVAL; return -EINVAL;
} }
regmap_update_bits(max98927->regmap, regmap_update_bits(max98927->regmap,
...@@ -294,7 +294,7 @@ static int max98927_set_clock(struct max98927_priv *max98927, ...@@ -294,7 +294,7 @@ static int max98927_set_clock(struct max98927_priv *max98927,
/* BCLK configuration */ /* BCLK configuration */
value = max98927_get_bclk_sel(blr_clk_ratio); value = max98927_get_bclk_sel(blr_clk_ratio);
if (!value) { if (!value) {
dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n",
params_format(params)); params_format(params));
return -EINVAL; return -EINVAL;
} }
...@@ -311,8 +311,8 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -311,8 +311,8 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component);
unsigned int sampling_rate = 0; unsigned int sampling_rate = 0;
unsigned int chan_sz = 0; unsigned int chan_sz = 0;
...@@ -328,7 +328,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -328,7 +328,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream,
chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32; chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32;
break; break;
default: default:
dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n",
params_format(params)); params_format(params));
goto err; goto err;
} }
...@@ -339,7 +339,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -339,7 +339,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream,
MAX98927_R0020_PCM_MODE_CFG, MAX98927_R0020_PCM_MODE_CFG,
MAX98927_PCM_MODE_CFG_CHANSZ_MASK, chan_sz); MAX98927_PCM_MODE_CFG_CHANSZ_MASK, chan_sz);
dev_dbg(codec->dev, "format supported %d", dev_dbg(component->dev, "format supported %d",
params_format(params)); params_format(params));
/* sampling rate configuration */ /* sampling rate configuration */
...@@ -372,7 +372,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -372,7 +372,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream,
sampling_rate = MAX98927_PCM_SR_SET1_SR_48000; sampling_rate = MAX98927_PCM_SR_SET1_SR_48000;
break; break;
default: default:
dev_err(codec->dev, "rate %d not supported\n", dev_err(component->dev, "rate %d not supported\n",
params_rate(params)); params_rate(params));
goto err; goto err;
} }
...@@ -407,8 +407,8 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, ...@@ -407,8 +407,8 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, unsigned int tx_mask, unsigned int rx_mask,
int slots, int slot_width) int slots, int slot_width)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component);
int bsel = 0; int bsel = 0;
unsigned int chan_sz = 0; unsigned int chan_sz = 0;
...@@ -417,7 +417,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, ...@@ -417,7 +417,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai,
/* BCLK configuration */ /* BCLK configuration */
bsel = max98927_get_bclk_sel(slots * slot_width); bsel = max98927_get_bclk_sel(slots * slot_width);
if (bsel == 0) { if (bsel == 0) {
dev_err(codec->dev, "BCLK %d not supported\n", dev_err(component->dev, "BCLK %d not supported\n",
slots * slot_width); slots * slot_width);
return -EINVAL; return -EINVAL;
} }
...@@ -439,7 +439,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, ...@@ -439,7 +439,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai,
chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32; chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32;
break; break;
default: default:
dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n",
slot_width); slot_width);
return -EINVAL; return -EINVAL;
} }
...@@ -483,8 +483,8 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, ...@@ -483,8 +483,8 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai,
static int max98927_dai_set_sysclk(struct snd_soc_dai *dai, static int max98927_dai_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component);
max98927->sysclk = freq; max98927->sysclk = freq;
return 0; return 0;
...@@ -500,8 +500,8 @@ static const struct snd_soc_dai_ops max98927_dai_ops = { ...@@ -500,8 +500,8 @@ static const struct snd_soc_dai_ops max98927_dai_ops = {
static int max98927_dac_event(struct snd_soc_dapm_widget *w, static int max98927_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
...@@ -677,11 +677,11 @@ static struct snd_soc_dai_driver max98927_dai[] = { ...@@ -677,11 +677,11 @@ static struct snd_soc_dai_driver max98927_dai[] = {
} }
}; };
static int max98927_probe(struct snd_soc_codec *codec) static int max98927_probe(struct snd_soc_component *component)
{ {
struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component);
max98927->codec = codec; max98927->component = component;
/* Software Reset */ /* Software Reset */
regmap_write(max98927->regmap, regmap_write(max98927->regmap,
...@@ -823,16 +823,18 @@ static const struct dev_pm_ops max98927_pm = { ...@@ -823,16 +823,18 @@ static const struct dev_pm_ops max98927_pm = {
SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume) SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume)
}; };
static const struct snd_soc_codec_driver soc_codec_dev_max98927 = { static const struct snd_soc_component_driver soc_component_dev_max98927 = {
.probe = max98927_probe, .probe = max98927_probe,
.component_driver = { .controls = max98927_snd_controls,
.controls = max98927_snd_controls, .num_controls = ARRAY_SIZE(max98927_snd_controls),
.num_controls = ARRAY_SIZE(max98927_snd_controls), .dapm_widgets = max98927_dapm_widgets,
.dapm_widgets = max98927_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(max98927_dapm_widgets),
.num_dapm_widgets = ARRAY_SIZE(max98927_dapm_widgets), .dapm_routes = max98927_audio_map,
.dapm_routes = max98927_audio_map, .num_dapm_routes = ARRAY_SIZE(max98927_audio_map),
.num_dapm_routes = ARRAY_SIZE(max98927_audio_map), .idle_bias_on = 1,
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config max98927_regmap = { static const struct regmap_config max98927_regmap = {
...@@ -914,20 +916,15 @@ static int max98927_i2c_probe(struct i2c_client *i2c, ...@@ -914,20 +916,15 @@ static int max98927_i2c_probe(struct i2c_client *i2c,
max98927_slot_config(i2c, max98927); max98927_slot_config(i2c, max98927);
/* codec registeration */ /* codec registeration */
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98927, ret = devm_snd_soc_register_component(&i2c->dev,
&soc_component_dev_max98927,
max98927_dai, ARRAY_SIZE(max98927_dai)); max98927_dai, ARRAY_SIZE(max98927_dai));
if (ret < 0) if (ret < 0)
dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
return ret; return ret;
} }
static int max98927_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id max98927_i2c_id[] = { static const struct i2c_device_id max98927_i2c_id[] = {
{ "max98927", 0}, { "max98927", 0},
{ }, { },
...@@ -959,7 +956,6 @@ static struct i2c_driver max98927_i2c_driver = { ...@@ -959,7 +956,6 @@ static struct i2c_driver max98927_i2c_driver = {
.pm = &max98927_pm, .pm = &max98927_pm,
}, },
.probe = max98927_i2c_probe, .probe = max98927_i2c_probe,
.remove = max98927_i2c_remove,
.id_table = max98927_i2c_id, .id_table = max98927_i2c_id,
}; };
......
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
struct max98927_priv { struct max98927_priv {
struct regmap *regmap; struct regmap *regmap;
struct snd_soc_codec *codec; struct snd_soc_component *component;
struct max98927_pdata *pdata; struct max98927_pdata *pdata;
unsigned int spk_gain; unsigned int spk_gain;
unsigned int sysclk; unsigned int sysclk;
......
...@@ -107,13 +107,13 @@ static int mc13783_pcm_hw_params_dac(struct snd_pcm_substream *substream, ...@@ -107,13 +107,13 @@ static int mc13783_pcm_hw_params_dac(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
int i; int i;
for (i = 0; i < ARRAY_SIZE(mc13783_rates); i++) { for (i = 0; i < ARRAY_SIZE(mc13783_rates); i++) {
if (rate == mc13783_rates[i]) { if (rate == mc13783_rates[i]) {
snd_soc_update_bits(codec, MC13783_AUDIO_DAC, snd_soc_component_update_bits(component, MC13783_AUDIO_DAC,
0xf << 17, i << 17); 0xf << 17, i << 17);
return 0; return 0;
} }
...@@ -126,7 +126,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream, ...@@ -126,7 +126,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
unsigned int rate = params_rate(params); unsigned int rate = params_rate(params);
unsigned int val; unsigned int val;
...@@ -141,7 +141,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream, ...@@ -141,7 +141,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
snd_soc_update_bits(codec, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K, snd_soc_component_update_bits(component, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K,
val); val);
return 0; return 0;
...@@ -160,7 +160,7 @@ static int mc13783_pcm_hw_params_sync(struct snd_pcm_substream *substream, ...@@ -160,7 +160,7 @@ static int mc13783_pcm_hw_params_sync(struct snd_pcm_substream *substream,
static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt, static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt,
unsigned int reg) unsigned int reg)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
unsigned int val = 0; unsigned int val = 0;
unsigned int mask = AUDIO_CFS(3) | AUDIO_BCL_INV | AUDIO_CFS_INV | unsigned int mask = AUDIO_CFS(3) | AUDIO_BCL_INV | AUDIO_CFS_INV |
AUDIO_CSM | AUDIO_C_CLK_EN | AUDIO_C_RESET; AUDIO_CSM | AUDIO_C_CLK_EN | AUDIO_C_RESET;
...@@ -208,7 +208,7 @@ static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt, ...@@ -208,7 +208,7 @@ static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt,
val |= AUDIO_C_RESET; val |= AUDIO_C_RESET;
snd_soc_update_bits(codec, reg, mask, val); snd_soc_component_update_bits(component, reg, mask, val);
return 0; return 0;
} }
...@@ -255,7 +255,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai, ...@@ -255,7 +255,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir, int clk_id, unsigned int freq, int dir,
unsigned int reg) unsigned int reg)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
int clk; int clk;
unsigned int val = 0; unsigned int val = 0;
unsigned int mask = AUDIO_CLK(0x7) | AUDIO_CLK_SEL; unsigned int mask = AUDIO_CLK(0x7) | AUDIO_CLK_SEL;
...@@ -275,7 +275,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai, ...@@ -275,7 +275,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai,
val |= AUDIO_CLK(clk); val |= AUDIO_CLK(clk);
snd_soc_update_bits(codec, reg, mask, val); snd_soc_component_update_bits(component, reg, mask, val);
return 0; return 0;
} }
...@@ -308,7 +308,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai, ...@@ -308,7 +308,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, unsigned int tx_mask, unsigned int rx_mask, int slots,
int slot_width) int slot_width)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
unsigned int val = 0; unsigned int val = 0;
unsigned int mask = SSI_NETWORK_DAC_SLOT_MASK | unsigned int mask = SSI_NETWORK_DAC_SLOT_MASK |
SSI_NETWORK_DAC_RXSLOT_MASK; SSI_NETWORK_DAC_RXSLOT_MASK;
...@@ -344,7 +344,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai, ...@@ -344,7 +344,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai,
return -EINVAL; return -EINVAL;
} }
snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val); snd_soc_component_update_bits(component, MC13783_SSI_NETWORK, mask, val);
return 0; return 0;
} }
...@@ -353,7 +353,7 @@ static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai, ...@@ -353,7 +353,7 @@ static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, unsigned int tx_mask, unsigned int rx_mask, int slots,
int slot_width) int slot_width)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
unsigned int val = 0; unsigned int val = 0;
unsigned int mask = 0x3f; unsigned int mask = 0x3f;
...@@ -366,7 +366,7 @@ static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai, ...@@ -366,7 +366,7 @@ static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai,
val |= (0x00 << 2); /* primary timeslot RX/TX(?) is 0 */ val |= (0x00 << 2); /* primary timeslot RX/TX(?) is 0 */
val |= (0x01 << 4); /* secondary timeslot TX is 1 */ val |= (0x01 << 4); /* secondary timeslot TX is 1 */
snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val); snd_soc_component_update_bits(component, MC13783_SSI_NETWORK, mask, val);
return 0; return 0;
} }
...@@ -606,12 +606,12 @@ static struct snd_kcontrol_new mc13783_control_list[] = { ...@@ -606,12 +606,12 @@ static struct snd_kcontrol_new mc13783_control_list[] = {
SOC_SINGLE("MC2 Capture Bias Switch", MC13783_AUDIO_TX, 1, 1, 0), SOC_SINGLE("MC2 Capture Bias Switch", MC13783_AUDIO_TX, 1, 1, 0),
}; };
static int mc13783_probe(struct snd_soc_codec *codec) static int mc13783_probe(struct snd_soc_component *component)
{ {
struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); struct mc13783_priv *priv = snd_soc_component_get_drvdata(component);
snd_soc_codec_init_regmap(codec, snd_soc_component_init_regmap(component,
dev_get_regmap(codec->dev->parent, NULL)); dev_get_regmap(component->dev->parent, NULL));
/* these are the reset values */ /* these are the reset values */
mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893); mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893);
...@@ -638,14 +638,12 @@ static int mc13783_probe(struct snd_soc_codec *codec) ...@@ -638,14 +638,12 @@ static int mc13783_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int mc13783_remove(struct snd_soc_codec *codec) static void mc13783_remove(struct snd_soc_component *component)
{ {
struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); struct mc13783_priv *priv = snd_soc_component_get_drvdata(component);
/* Make sure VAUDIOON is off */ /* Make sure VAUDIOON is off */
mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_RX0, 0x3, 0); mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_RX0, 0x3, 0);
return 0;
} }
#define MC13783_RATES_RECORD (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) #define MC13783_RATES_RECORD (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000)
...@@ -731,17 +729,19 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = { ...@@ -731,17 +729,19 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = {
} }
}; };
static const struct snd_soc_codec_driver soc_codec_dev_mc13783 = { static const struct snd_soc_component_driver soc_component_dev_mc13783 = {
.probe = mc13783_probe, .probe = mc13783_probe,
.remove = mc13783_remove, .remove = mc13783_remove,
.component_driver = { .controls = mc13783_control_list,
.controls = mc13783_control_list, .num_controls = ARRAY_SIZE(mc13783_control_list),
.num_controls = ARRAY_SIZE(mc13783_control_list), .dapm_widgets = mc13783_dapm_widgets,
.dapm_widgets = mc13783_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(mc13783_dapm_widgets),
.num_dapm_widgets = ARRAY_SIZE(mc13783_dapm_widgets), .dapm_routes = mc13783_routes,
.dapm_routes = mc13783_routes, .num_dapm_routes = ARRAY_SIZE(mc13783_routes),
.num_dapm_routes = ARRAY_SIZE(mc13783_routes), .idle_bias_on = 1,
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int __init mc13783_codec_probe(struct platform_device *pdev) static int __init mc13783_codec_probe(struct platform_device *pdev)
...@@ -782,10 +782,10 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) ...@@ -782,10 +782,10 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
priv->mc13xxx = dev_get_drvdata(pdev->dev.parent); priv->mc13xxx = dev_get_drvdata(pdev->dev.parent);
if (priv->adc_ssi_port == priv->dac_ssi_port) if (priv->adc_ssi_port == priv->dac_ssi_port)
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783, ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783,
mc13783_dai_sync, ARRAY_SIZE(mc13783_dai_sync)); mc13783_dai_sync, ARRAY_SIZE(mc13783_dai_sync));
else else
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783, ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783,
mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async)); mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async));
return ret; return ret;
...@@ -793,8 +793,6 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) ...@@ -793,8 +793,6 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
static int mc13783_codec_remove(struct platform_device *pdev) static int mc13783_codec_remove(struct platform_device *pdev)
{ {
snd_soc_unregister_codec(&pdev->dev);
return 0; return 0;
} }
......
...@@ -338,8 +338,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, ...@@ -338,8 +338,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params, struct snd_pcm_hw_params *hw_params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct ml26124_priv *priv = snd_soc_component_get_drvdata(component);
int i = get_coeff(priv->mclk, params_rate(hw_params)); int i = get_coeff(priv->mclk, params_rate(hw_params));
int srate; int srate;
...@@ -351,23 +351,23 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, ...@@ -351,23 +351,23 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
if (priv->clk_in) { if (priv->clk_in) {
switch (priv->mclk / params_rate(hw_params)) { switch (priv->mclk / params_rate(hw_params)) {
case 256: case 256:
snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL,
BIT(0) | BIT(1), 1); BIT(0) | BIT(1), 1);
break; break;
case 512: case 512:
snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL,
BIT(0) | BIT(1), 2); BIT(0) | BIT(1), 2);
break; break;
case 1024: case 1024:
snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL,
BIT(0) | BIT(1), 3); BIT(0) | BIT(1), 3);
break; break;
default: default:
dev_err(codec->dev, "Unsupported MCLKI\n"); dev_err(component->dev, "Unsupported MCLKI\n");
break; break;
} }
} else { } else {
snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL,
BIT(0) | BIT(1), 0); BIT(0) | BIT(1), 0);
} }
...@@ -375,35 +375,35 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, ...@@ -375,35 +375,35 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
if (srate < 0) if (srate < 0)
return srate; return srate;
snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf, srate); snd_soc_component_update_bits(component, ML26124_SMPLING_RATE, 0xf, srate);
snd_soc_update_bits(codec, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); snd_soc_component_update_bits(component, ML26124_PLLNL, 0xff, coeff_div[i].pllnl);
snd_soc_update_bits(codec, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); snd_soc_component_update_bits(component, ML26124_PLLNH, 0x1, coeff_div[i].pllnh);
snd_soc_update_bits(codec, ML26124_PLLML, 0xff, coeff_div[i].pllml); snd_soc_component_update_bits(component, ML26124_PLLML, 0xff, coeff_div[i].pllml);
snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); snd_soc_component_update_bits(component, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh);
snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); snd_soc_component_update_bits(component, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv);
return 0; return 0;
} }
static int ml26124_mute(struct snd_soc_dai *dai, int mute) static int ml26124_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct ml26124_priv *priv = snd_soc_component_get_drvdata(component);
switch (priv->substream->stream) { switch (priv->substream->stream) {
case SNDRV_PCM_STREAM_CAPTURE: case SNDRV_PCM_STREAM_CAPTURE:
snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(0), 1); snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(0), 1);
break; break;
case SNDRV_PCM_STREAM_PLAYBACK: case SNDRV_PCM_STREAM_PLAYBACK:
snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(1), 2); snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(1), 2);
break; break;
} }
if (mute) if (mute)
snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4),
DVOL_CTL_DVMUTE_ON); DVOL_CTL_DVMUTE_ON);
else else
snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4),
DVOL_CTL_DVMUTE_OFF); DVOL_CTL_DVMUTE_OFF);
return 0; return 0;
...@@ -413,7 +413,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -413,7 +413,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt) unsigned int fmt)
{ {
unsigned char mode; unsigned char mode;
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
/* set master/slave audio interface */ /* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
...@@ -426,7 +426,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -426,7 +426,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai,
default: default:
return -EINVAL; return -EINVAL;
} }
snd_soc_update_bits(codec, ML26124_SAI_MODE_SEL, BIT(0), mode); snd_soc_component_update_bits(component, ML26124_SAI_MODE_SEL, BIT(0), mode);
/* interface format */ /* interface format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
...@@ -450,8 +450,8 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -450,8 +450,8 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai,
static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct ml26124_priv *priv = snd_soc_component_get_drvdata(component);
switch (clk_id) { switch (clk_id) {
case ML26124_USE_PLLOUT: case ML26124_USE_PLLOUT:
...@@ -469,17 +469,17 @@ static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -469,17 +469,17 @@ static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai,
return 0; return 0;
} }
static int ml26124_set_bias_level(struct snd_soc_codec *codec, static int ml26124_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct ml26124_priv *priv = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG,
ML26124_R26_MASK, ML26124_BLT_PREAMP_ON); ML26124_R26_MASK, ML26124_BLT_PREAMP_ON);
msleep(100); msleep(100);
snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG,
ML26124_R26_MASK, ML26124_R26_MASK,
ML26124_MICBEN_ON | ML26124_BLT_ALL_ON); ML26124_MICBEN_ON | ML26124_BLT_ALL_ON);
break; break;
...@@ -487,8 +487,8 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, ...@@ -487,8 +487,8 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
/* VMID ON */ /* VMID ON */
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG,
ML26124_VMID, ML26124_VMID); ML26124_VMID, ML26124_VMID);
msleep(500); msleep(500);
regcache_sync(priv->regmap); regcache_sync(priv->regmap);
...@@ -496,7 +496,7 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, ...@@ -496,7 +496,7 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
/* VMID OFF */ /* VMID OFF */
snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG,
ML26124_VMID, 0); ML26124_VMID, 0);
break; break;
} }
...@@ -528,27 +528,29 @@ static struct snd_soc_dai_driver ml26124_dai = { ...@@ -528,27 +528,29 @@ static struct snd_soc_dai_driver ml26124_dai = {
.symmetric_rates = 1, .symmetric_rates = 1,
}; };
static int ml26124_probe(struct snd_soc_codec *codec) static int ml26124_probe(struct snd_soc_component *component)
{ {
/* Software Reset */ /* Software Reset */
snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 1); snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 1);
snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0); snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 0);
return 0; return 0;
} }
static const struct snd_soc_codec_driver soc_codec_dev_ml26124 = { static const struct snd_soc_component_driver soc_component_dev_ml26124 = {
.probe = ml26124_probe, .probe = ml26124_probe,
.set_bias_level = ml26124_set_bias_level, .set_bias_level = ml26124_set_bias_level,
.suspend_bias_off = true, .controls = ml26124_snd_controls,
.component_driver = { .num_controls = ARRAY_SIZE(ml26124_snd_controls),
.controls = ml26124_snd_controls, .dapm_widgets = ml26124_dapm_widgets,
.num_controls = ARRAY_SIZE(ml26124_snd_controls), .num_dapm_widgets = ARRAY_SIZE(ml26124_dapm_widgets),
.dapm_widgets = ml26124_dapm_widgets, .dapm_routes = ml26124_intercon,
.num_dapm_widgets = ARRAY_SIZE(ml26124_dapm_widgets), .num_dapm_routes = ARRAY_SIZE(ml26124_intercon),
.dapm_routes = ml26124_intercon, .suspend_bias_off = 1,
.num_dapm_routes = ARRAY_SIZE(ml26124_intercon), .idle_bias_on = 1,
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config ml26124_i2c_regmap = { static const struct regmap_config ml26124_i2c_regmap = {
...@@ -580,14 +582,8 @@ static int ml26124_i2c_probe(struct i2c_client *i2c, ...@@ -580,14 +582,8 @@ static int ml26124_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
return snd_soc_register_codec(&i2c->dev, return devm_snd_soc_register_component(&i2c->dev,
&soc_codec_dev_ml26124, &ml26124_dai, 1); &soc_component_dev_ml26124, &ml26124_dai, 1);
}
static int ml26124_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
} }
static const struct i2c_device_id ml26124_i2c_id[] = { static const struct i2c_device_id ml26124_i2c_id[] = {
...@@ -601,7 +597,6 @@ static struct i2c_driver ml26124_i2c_driver = { ...@@ -601,7 +597,6 @@ static struct i2c_driver ml26124_i2c_driver = {
.name = "ml26124", .name = "ml26124",
}, },
.probe = ml26124_i2c_probe, .probe = ml26124_i2c_probe,
.remove = ml26124_i2c_remove,
.id_table = ml26124_i2c_id, .id_table = ml26124_i2c_id,
}; };
......
This diff is collapsed.
...@@ -343,7 +343,7 @@ static int mt2701_btmrg_hw_params(struct snd_pcm_substream *substream, ...@@ -343,7 +343,7 @@ static int mt2701_btmrg_hw_params(struct snd_pcm_substream *substream,
stream_fs = params_rate(params); stream_fs = params_rate(params);
if ((stream_fs != 8000) && (stream_fs != 16000)) { if ((stream_fs != 8000) && (stream_fs != 16000)) {
dev_err(afe->dev, "%s() btmgr not supprt this stream_fs %d\n", dev_err(afe->dev, "%s() btmgr not support this stream_fs %d\n",
__func__, stream_fs); __func__, stream_fs);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment