Commit 323a56ed authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es7134',...

Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es7134', 'asoc/topic/es8316', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next
......@@ -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 = {
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 = {
static const struct snd_soc_component_driver soc_component_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),
},
.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);
......
This diff is collapsed.
......@@ -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;
}
......
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