Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es7134', 'asoc/topic/es8316', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next
This commit is contained in:
commit
323a56ed22
|
@ -69,28 +69,24 @@ static const struct snd_soc_dapm_route es7134_dapm_routes[] = {
|
|||
{ "AOUTR", NULL, "DAC" },
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver es7134_codec_driver = {
|
||||
.component_driver = {
|
||||
.dapm_widgets = es7134_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(es7134_dapm_widgets),
|
||||
.dapm_routes = es7134_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(es7134_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver es7134_component_driver = {
|
||||
.dapm_widgets = es7134_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(es7134_dapm_widgets),
|
||||
.dapm_routes = es7134_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(es7134_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int es7134_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&es7134_codec_driver,
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&es7134_component_driver,
|
||||
&es7134_dai, 1);
|
||||
}
|
||||
|
||||
static int es7134_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static const struct of_device_id es7134_ids[] = {
|
||||
{ .compatible = "everest,es7134", },
|
||||
|
@ -106,7 +102,6 @@ static struct platform_driver es7134_driver = {
|
|||
.of_match_table = of_match_ptr(es7134_ids),
|
||||
},
|
||||
.probe = es7134_probe,
|
||||
.remove = es7134_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(es7134_driver);
|
||||
|
|
|
@ -356,8 +356,8 @@ static const struct snd_soc_dapm_route es8316_dapm_routes[] = {
|
|||
static int es8316_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 es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
int count = 0;
|
||||
|
||||
|
@ -385,19 +385,19 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
|
|||
static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
u8 serdata1 = 0;
|
||||
u8 serdata2 = 0;
|
||||
u8 clksw;
|
||||
u8 mask;
|
||||
|
||||
if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) {
|
||||
dev_err(codec->dev, "Codec driver only supports slave mode\n");
|
||||
dev_err(component->dev, "Codec driver only supports slave mode\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != SND_SOC_DAIFMT_I2S) {
|
||||
dev_err(codec->dev, "Codec driver only supports I2S format\n");
|
||||
dev_err(component->dev, "Codec driver only supports I2S format\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -420,15 +420,15 @@ static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
|||
}
|
||||
|
||||
mask = ES8316_SERDATA1_MASTER | ES8316_SERDATA1_BCLK_INV;
|
||||
snd_soc_update_bits(codec, ES8316_SERDATA1, mask, serdata1);
|
||||
snd_soc_component_update_bits(component, ES8316_SERDATA1, mask, serdata1);
|
||||
|
||||
mask = ES8316_SERDATA2_FMT_MASK | ES8316_SERDATA2_ADCLRP;
|
||||
snd_soc_update_bits(codec, ES8316_SERDATA_ADC, mask, serdata2);
|
||||
snd_soc_update_bits(codec, ES8316_SERDATA_DAC, mask, serdata2);
|
||||
snd_soc_component_update_bits(component, ES8316_SERDATA_ADC, mask, serdata2);
|
||||
snd_soc_component_update_bits(component, ES8316_SERDATA_DAC, mask, serdata2);
|
||||
|
||||
/* Enable BCLK and MCLK inputs in slave mode */
|
||||
clksw = ES8316_CLKMGR_CLKSW_MCLK_ON | ES8316_CLKMGR_CLKSW_BCLK_ON;
|
||||
snd_soc_update_bits(codec, ES8316_CLKMGR_CLKSW, clksw, clksw);
|
||||
snd_soc_component_update_bits(component, ES8316_CLKMGR_CLKSW, clksw, clksw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -436,11 +436,11 @@ static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
|||
static int es8316_pcm_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (es8316->sysclk == 0) {
|
||||
dev_err(codec->dev, "No sysclk provided\n");
|
||||
dev_err(component->dev, "No sysclk provided\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -458,13 +458,12 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct es8316_priv *es8316 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
|
||||
u8 wordlen = 0;
|
||||
|
||||
if (!es8316->sysclk) {
|
||||
dev_err(codec->dev, "No MCLK configured\n");
|
||||
dev_err(component->dev, "No MCLK configured\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -485,16 +484,16 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, ES8316_SERDATA_DAC,
|
||||
snd_soc_component_update_bits(component, ES8316_SERDATA_DAC,
|
||||
ES8316_SERDATA2_LEN_MASK, wordlen);
|
||||
snd_soc_update_bits(codec, ES8316_SERDATA_ADC,
|
||||
snd_soc_component_update_bits(component, ES8316_SERDATA_ADC,
|
||||
ES8316_SERDATA2_LEN_MASK, wordlen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int es8316_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
snd_soc_update_bits(dai->codec, ES8316_DAC_SET1, 0x20,
|
||||
snd_soc_component_update_bits(dai->component, ES8316_DAC_SET1, 0x20,
|
||||
mute ? 0x20 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -530,42 +529,41 @@ static struct snd_soc_dai_driver es8316_dai = {
|
|||
.symmetric_rates = 1,
|
||||
};
|
||||
|
||||
static int es8316_probe(struct snd_soc_codec *codec)
|
||||
static int es8316_probe(struct snd_soc_component *component)
|
||||
{
|
||||
/* Reset codec and enable current state machine */
|
||||
snd_soc_write(codec, ES8316_RESET, 0x3f);
|
||||
snd_soc_component_write(component, ES8316_RESET, 0x3f);
|
||||
usleep_range(5000, 5500);
|
||||
snd_soc_write(codec, ES8316_RESET, ES8316_RESET_CSM_ON);
|
||||
snd_soc_component_write(component, ES8316_RESET, ES8316_RESET_CSM_ON);
|
||||
msleep(30);
|
||||
|
||||
/*
|
||||
* Documentation is unclear, but this value from the vendor driver is
|
||||
* needed otherwise audio output is silent.
|
||||
*/
|
||||
snd_soc_write(codec, ES8316_SYS_VMIDSEL, 0xff);
|
||||
snd_soc_component_write(component, ES8316_SYS_VMIDSEL, 0xff);
|
||||
|
||||
/*
|
||||
* Documentation for this register is unclear and incomplete,
|
||||
* but here is a vendor-provided value that improves volume
|
||||
* and quality for Intel CHT platforms.
|
||||
*/
|
||||
snd_soc_write(codec, ES8316_CLKMGR_ADCOSR, 0x32);
|
||||
snd_soc_component_write(component, ES8316_CLKMGR_ADCOSR, 0x32);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_es8316 = {
|
||||
.probe = es8316_probe,
|
||||
.idle_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = es8316_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(es8316_snd_controls),
|
||||
.dapm_widgets = es8316_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(es8316_dapm_widgets),
|
||||
.dapm_routes = es8316_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(es8316_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_es8316 = {
|
||||
.probe = es8316_probe,
|
||||
.controls = es8316_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(es8316_snd_controls),
|
||||
.dapm_widgets = es8316_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(es8316_dapm_widgets),
|
||||
.dapm_routes = es8316_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(es8316_dapm_routes),
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct regmap_config es8316_regmap = {
|
||||
|
@ -592,16 +590,11 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client,
|
|||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
return snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_es8316,
|
||||
return devm_snd_soc_register_component(&i2c_client->dev,
|
||||
&soc_component_dev_es8316,
|
||||
&es8316_dai, 1);
|
||||
}
|
||||
|
||||
static int es8316_i2c_remove(struct i2c_client *client)
|
||||
{
|
||||
snd_soc_unregister_codec(&client->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id es8316_i2c_id[] = {
|
||||
{"es8316", 0 },
|
||||
{}
|
||||
|
@ -627,7 +620,6 @@ static struct i2c_driver es8316_i2c_driver = {
|
|||
.of_match_table = of_match_ptr(es8316_of_match),
|
||||
},
|
||||
.probe = es8316_i2c_probe,
|
||||
.remove = es8316_i2c_remove,
|
||||
.id_table = es8316_i2c_id,
|
||||
};
|
||||
module_i2c_driver(es8316_i2c_driver);
|
||||
|
|
|
@ -39,19 +39,12 @@ static int es8328_i2c_probe(struct i2c_client *i2c,
|
|||
devm_regmap_init_i2c(i2c, &es8328_regmap_config));
|
||||
}
|
||||
|
||||
static int es8328_i2c_remove(struct i2c_client *i2c)
|
||||
{
|
||||
snd_soc_unregister_codec(&i2c->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver es8328_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "es8328",
|
||||
.of_match_table = es8328_of_match,
|
||||
},
|
||||
.probe = es8328_i2c_probe,
|
||||
.remove = es8328_i2c_remove,
|
||||
.id_table = es8328_id,
|
||||
};
|
||||
|
||||
|
|
|
@ -28,19 +28,12 @@ static int es8328_spi_probe(struct spi_device *spi)
|
|||
devm_regmap_init_spi(spi, &es8328_regmap_config));
|
||||
}
|
||||
|
||||
static int es8328_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
snd_soc_unregister_codec(&spi->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_driver es8328_spi_driver = {
|
||||
.driver = {
|
||||
.name = "es8328",
|
||||
.of_match_table = es8328_of_match,
|
||||
},
|
||||
.probe = es8328_spi_probe,
|
||||
.remove = es8328_spi_remove,
|
||||
};
|
||||
|
||||
module_spi_driver(es8328_spi_driver);
|
||||
|
|
|
@ -116,9 +116,9 @@ static const struct {
|
|||
{ 48000, ES8328_DACCONTROL6_DEEMPH_48k },
|
||||
};
|
||||
|
||||
static int es8328_set_deemph(struct snd_soc_codec *codec)
|
||||
static int es8328_set_deemph(struct snd_soc_component *component)
|
||||
{
|
||||
struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
int val, i, best;
|
||||
|
||||
/*
|
||||
|
@ -138,17 +138,17 @@ static int es8328_set_deemph(struct snd_soc_codec *codec)
|
|||
val = ES8328_DACCONTROL6_DEEMPH_OFF;
|
||||
}
|
||||
|
||||
dev_dbg(codec->dev, "Set deemphasis %d\n", val);
|
||||
dev_dbg(component->dev, "Set deemphasis %d\n", val);
|
||||
|
||||
return snd_soc_update_bits(codec, ES8328_DACCONTROL6,
|
||||
return snd_soc_component_update_bits(component, ES8328_DACCONTROL6,
|
||||
ES8328_DACCONTROL6_DEEMPH_MASK, val);
|
||||
}
|
||||
|
||||
static int es8328_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = es8328->deemph;
|
||||
return 0;
|
||||
|
@ -157,15 +157,15 @@ static int es8328_get_deemph(struct snd_kcontrol *kcontrol,
|
|||
static int es8328_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int deemph = ucontrol->value.integer.value[0];
|
||||
int ret;
|
||||
|
||||
if (deemph > 1)
|
||||
return -EINVAL;
|
||||
|
||||
ret = es8328_set_deemph(codec);
|
||||
ret = es8328_set_deemph(component);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -455,7 +455,7 @@ static const struct snd_soc_dapm_route es8328_dapm_routes[] = {
|
|||
|
||||
static int es8328_mute(struct snd_soc_dai *dai, int mute)
|
||||
{
|
||||
return snd_soc_update_bits(dai->codec, ES8328_DACCONTROL3,
|
||||
return snd_soc_component_update_bits(dai->component, ES8328_DACCONTROL3,
|
||||
ES8328_DACCONTROL3_DACMUTE,
|
||||
mute ? ES8328_DACCONTROL3_DACMUTE : 0);
|
||||
}
|
||||
|
@ -463,8 +463,8 @@ static int es8328_mute(struct snd_soc_dai *dai, int mute)
|
|||
static int es8328_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_codec *codec = dai->codec;
|
||||
struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (es8328->master && es8328->sysclk_constraints)
|
||||
snd_pcm_hw_constraint_list(substream->runtime, 0,
|
||||
|
@ -478,8 +478,8 @@ static int es8328_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 es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
int reg;
|
||||
int wl;
|
||||
|
@ -492,7 +492,7 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
|
|||
|
||||
if (es8328->master) {
|
||||
if (!es8328->sysclk_constraints) {
|
||||
dev_err(codec->dev, "No MCLK configured\n");
|
||||
dev_err(component->dev, "No MCLK configured\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
|
|||
break;
|
||||
|
||||
if (i == es8328->sysclk_constraints->count) {
|
||||
dev_err(codec->dev,
|
||||
dev_err(component->dev,
|
||||
"LRCLK %d unsupported with current clock\n",
|
||||
params_rate(params));
|
||||
return -EINVAL;
|
||||
|
@ -513,7 +513,7 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
|
|||
es8328->mclkdiv2 = 0;
|
||||
}
|
||||
|
||||
snd_soc_update_bits(codec, ES8328_MASTERMODE,
|
||||
snd_soc_component_update_bits(component, ES8328_MASTERMODE,
|
||||
ES8328_MASTERMODE_MCLKDIV2,
|
||||
es8328->mclkdiv2 ? ES8328_MASTERMODE_MCLKDIV2 : 0);
|
||||
|
||||
|
@ -538,25 +538,25 @@ static int es8328_hw_params(struct snd_pcm_substream *substream,
|
|||
}
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
snd_soc_update_bits(codec, ES8328_DACCONTROL1,
|
||||
snd_soc_component_update_bits(component, ES8328_DACCONTROL1,
|
||||
ES8328_DACCONTROL1_DACWL_MASK,
|
||||
wl << ES8328_DACCONTROL1_DACWL_SHIFT);
|
||||
|
||||
es8328->playback_fs = params_rate(params);
|
||||
es8328_set_deemph(codec);
|
||||
es8328_set_deemph(component);
|
||||
} else
|
||||
snd_soc_update_bits(codec, ES8328_ADCCONTROL4,
|
||||
snd_soc_component_update_bits(component, ES8328_ADCCONTROL4,
|
||||
ES8328_ADCCONTROL4_ADCWL_MASK,
|
||||
wl << ES8328_ADCCONTROL4_ADCWL_SHIFT);
|
||||
|
||||
return snd_soc_update_bits(codec, reg, ES8328_RATEMASK, ratio);
|
||||
return snd_soc_component_update_bits(component, reg, ES8328_RATEMASK, ratio);
|
||||
}
|
||||
|
||||
static int es8328_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 es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
int mclkdiv2 = 0;
|
||||
|
||||
switch (freq) {
|
||||
|
@ -589,22 +589,22 @@ static int es8328_set_sysclk(struct snd_soc_dai *codec_dai,
|
|||
static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct snd_soc_codec *codec = codec_dai->codec;
|
||||
struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
struct snd_soc_component *component = codec_dai->component;
|
||||
struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component);
|
||||
u8 dac_mode = 0;
|
||||
u8 adc_mode = 0;
|
||||
|
||||
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
|
||||
case SND_SOC_DAIFMT_CBM_CFM:
|
||||
/* Master serial port mode, with BCLK generated automatically */
|
||||
snd_soc_update_bits(codec, ES8328_MASTERMODE,
|
||||
snd_soc_component_update_bits(component, ES8328_MASTERMODE,
|
||||
ES8328_MASTERMODE_MSC,
|
||||
ES8328_MASTERMODE_MSC);
|
||||
es8328->master = true;
|
||||
break;
|
||||
case SND_SOC_DAIFMT_CBS_CFS:
|
||||
/* Slave serial port mode */
|
||||
snd_soc_update_bits(codec, ES8328_MASTERMODE,
|
||||
snd_soc_component_update_bits(component, ES8328_MASTERMODE,
|
||||
ES8328_MASTERMODE_MSC, 0);
|
||||
es8328->master = false;
|
||||
break;
|
||||
|
@ -634,15 +634,15 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
|||
if ((fmt & SND_SOC_DAIFMT_INV_MASK) != SND_SOC_DAIFMT_NB_NF)
|
||||
return -EINVAL;
|
||||
|
||||
snd_soc_update_bits(codec, ES8328_DACCONTROL1,
|
||||
snd_soc_component_update_bits(component, ES8328_DACCONTROL1,
|
||||
ES8328_DACCONTROL1_DACFORMAT_MASK, dac_mode);
|
||||
snd_soc_update_bits(codec, ES8328_ADCCONTROL4,
|
||||
snd_soc_component_update_bits(component, ES8328_ADCCONTROL4,
|
||||
ES8328_ADCCONTROL4_ADCFORMAT_MASK, adc_mode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int es8328_set_bias_level(struct snd_soc_codec *codec,
|
||||
static int es8328_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
switch (level) {
|
||||
|
@ -651,8 +651,8 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec,
|
|||
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
/* VREF, VMID=2x50k, digital enabled */
|
||||
snd_soc_write(codec, ES8328_CHIPPOWER, 0);
|
||||
snd_soc_update_bits(codec, ES8328_CONTROL1,
|
||||
snd_soc_component_write(component, ES8328_CHIPPOWER, 0);
|
||||
snd_soc_component_update_bits(component, ES8328_CONTROL1,
|
||||
ES8328_CONTROL1_VMIDSEL_MASK |
|
||||
ES8328_CONTROL1_ENREF,
|
||||
ES8328_CONTROL1_VMIDSEL_50k |
|
||||
|
@ -660,8 +660,8 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec,
|
|||
break;
|
||||
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
|
||||
snd_soc_update_bits(codec, ES8328_CONTROL1,
|
||||
if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
|
||||
snd_soc_component_update_bits(component, ES8328_CONTROL1,
|
||||
ES8328_CONTROL1_VMIDSEL_MASK |
|
||||
ES8328_CONTROL1_ENREF,
|
||||
ES8328_CONTROL1_VMIDSEL_5k |
|
||||
|
@ -671,12 +671,12 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec,
|
|||
msleep(100);
|
||||
}
|
||||
|
||||
snd_soc_write(codec, ES8328_CONTROL2,
|
||||
snd_soc_component_write(component, ES8328_CONTROL2,
|
||||
ES8328_CONTROL2_OVERCURRENT_ON |
|
||||
ES8328_CONTROL2_THERMAL_SHUTDOWN_ON);
|
||||
|
||||
/* VREF, VMID=2*500k, digital stopped */
|
||||
snd_soc_update_bits(codec, ES8328_CONTROL1,
|
||||
snd_soc_component_update_bits(component, ES8328_CONTROL1,
|
||||
ES8328_CONTROL1_VMIDSEL_MASK |
|
||||
ES8328_CONTROL1_ENREF,
|
||||
ES8328_CONTROL1_VMIDSEL_500k |
|
||||
|
@ -684,7 +684,7 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec,
|
|||
break;
|
||||
|
||||
case SND_SOC_BIAS_OFF:
|
||||
snd_soc_update_bits(codec, ES8328_CONTROL1,
|
||||
snd_soc_component_update_bits(component, ES8328_CONTROL1,
|
||||
ES8328_CONTROL1_VMIDSEL_MASK |
|
||||
ES8328_CONTROL1_ENREF,
|
||||
0);
|
||||
|
@ -721,80 +721,80 @@ static struct snd_soc_dai_driver es8328_dai = {
|
|||
.symmetric_rates = 1,
|
||||
};
|
||||
|
||||
static int es8328_suspend(struct snd_soc_codec *codec)
|
||||
static int es8328_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
struct es8328_priv *es8328;
|
||||
int ret;
|
||||
|
||||
es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
es8328 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
clk_disable_unprepare(es8328->clk);
|
||||
|
||||
ret = regulator_bulk_disable(ARRAY_SIZE(es8328->supplies),
|
||||
es8328->supplies);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "unable to disable regulators\n");
|
||||
dev_err(component->dev, "unable to disable regulators\n");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int es8328_resume(struct snd_soc_codec *codec)
|
||||
static int es8328_resume(struct snd_soc_component *component)
|
||||
{
|
||||
struct regmap *regmap = dev_get_regmap(codec->dev, NULL);
|
||||
struct regmap *regmap = dev_get_regmap(component->dev, NULL);
|
||||
struct es8328_priv *es8328;
|
||||
int ret;
|
||||
|
||||
es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
es8328 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ret = clk_prepare_enable(es8328->clk);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "unable to enable clock\n");
|
||||
dev_err(component->dev, "unable to enable clock\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(es8328->supplies),
|
||||
es8328->supplies);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "unable to enable regulators\n");
|
||||
dev_err(component->dev, "unable to enable regulators\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
regcache_mark_dirty(regmap);
|
||||
ret = regcache_sync(regmap);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "unable to sync regcache\n");
|
||||
dev_err(component->dev, "unable to sync regcache\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int es8328_codec_probe(struct snd_soc_codec *codec)
|
||||
static int es8328_component_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct es8328_priv *es8328;
|
||||
int ret;
|
||||
|
||||
es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
es8328 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ret = regulator_bulk_enable(ARRAY_SIZE(es8328->supplies),
|
||||
es8328->supplies);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "unable to enable regulators\n");
|
||||
dev_err(component->dev, "unable to enable regulators\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Setup clocks */
|
||||
es8328->clk = devm_clk_get(codec->dev, NULL);
|
||||
es8328->clk = devm_clk_get(component->dev, NULL);
|
||||
if (IS_ERR(es8328->clk)) {
|
||||
dev_err(codec->dev, "codec clock missing or invalid\n");
|
||||
dev_err(component->dev, "codec clock missing or invalid\n");
|
||||
ret = PTR_ERR(es8328->clk);
|
||||
goto clk_fail;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(es8328->clk);
|
||||
if (ret) {
|
||||
dev_err(codec->dev, "unable to prepare codec clk\n");
|
||||
dev_err(component->dev, "unable to prepare codec clk\n");
|
||||
goto clk_fail;
|
||||
}
|
||||
|
||||
|
@ -806,19 +806,17 @@ static int es8328_codec_probe(struct snd_soc_codec *codec)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int es8328_remove(struct snd_soc_codec *codec)
|
||||
static void es8328_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct es8328_priv *es8328;
|
||||
|
||||
es8328 = snd_soc_codec_get_drvdata(codec);
|
||||
es8328 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (es8328->clk)
|
||||
clk_disable_unprepare(es8328->clk);
|
||||
|
||||
regulator_bulk_disable(ARRAY_SIZE(es8328->supplies),
|
||||
es8328->supplies);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct regmap_config es8328_regmap_config = {
|
||||
|
@ -830,22 +828,23 @@ const struct regmap_config es8328_regmap_config = {
|
|||
};
|
||||
EXPORT_SYMBOL_GPL(es8328_regmap_config);
|
||||
|
||||
static const struct snd_soc_codec_driver es8328_codec_driver = {
|
||||
.probe = es8328_codec_probe,
|
||||
.suspend = es8328_suspend,
|
||||
.resume = es8328_resume,
|
||||
.remove = es8328_remove,
|
||||
.set_bias_level = es8328_set_bias_level,
|
||||
.suspend_bias_off = true,
|
||||
|
||||
.component_driver = {
|
||||
.controls = es8328_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(es8328_snd_controls),
|
||||
.dapm_widgets = es8328_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(es8328_dapm_widgets),
|
||||
.dapm_routes = es8328_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(es8328_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver es8328_component_driver = {
|
||||
.probe = es8328_component_probe,
|
||||
.remove = es8328_remove,
|
||||
.suspend = es8328_suspend,
|
||||
.resume = es8328_resume,
|
||||
.set_bias_level = es8328_set_bias_level,
|
||||
.controls = es8328_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(es8328_snd_controls),
|
||||
.dapm_widgets = es8328_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(es8328_dapm_widgets),
|
||||
.dapm_routes = es8328_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(es8328_dapm_routes),
|
||||
.suspend_bias_off = 1,
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
int es8328_probe(struct device *dev, struct regmap *regmap)
|
||||
|
@ -875,8 +874,8 @@ int es8328_probe(struct device *dev, struct regmap *regmap)
|
|||
|
||||
dev_set_drvdata(dev, es8328);
|
||||
|
||||
return snd_soc_register_codec(dev,
|
||||
&es8328_codec_driver, &es8328_dai, 1);
|
||||
return devm_snd_soc_register_component(dev,
|
||||
&es8328_component_driver, &es8328_dai, 1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(es8328_probe);
|
||||
|
||||
|
|
|
@ -491,6 +491,10 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
|
|||
dev->quirks & DW_I2S_QUIRK_COMP_PARAM1)
|
||||
comp1 = comp1 & ~BIT(5);
|
||||
|
||||
if (dev->capability & DWC_I2S_PLAY &&
|
||||
dev->quirks & DW_I2S_QUIRK_COMP_PARAM1)
|
||||
comp1 = comp1 & ~BIT(6);
|
||||
|
||||
if (COMP1_TX_ENABLED(comp1)) {
|
||||
dev_dbg(dev->dev, " designware: play supported\n");
|
||||
idx = COMP1_TX_WORDSIZE_0(comp1);
|
||||
|
|
|
@ -91,9 +91,9 @@ struct fsl_asoc_card_priv {
|
|||
struct cpu_priv cpu_priv;
|
||||
struct snd_soc_card card;
|
||||
u32 sample_rate;
|
||||
u32 sample_format;
|
||||
snd_pcm_format_t sample_format;
|
||||
u32 asrc_rate;
|
||||
u32 asrc_format;
|
||||
snd_pcm_format_t asrc_format;
|
||||
u32 dai_fmt;
|
||||
char name[32];
|
||||
};
|
||||
|
@ -199,7 +199,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||
|
||||
mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||
snd_mask_none(mask);
|
||||
snd_mask_set(mask, priv->asrc_format);
|
||||
snd_mask_set(mask, (__force int)priv->asrc_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue