Skip to content

Commit

Permalink
ASoC: codec: Simplify ASoC probe code.
Browse files Browse the repository at this point in the history
For some CODEC drivers like who act as the MFDs children are ignored
by this patch.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Xiubo Li authored and Mark Brown committed Mar 11, 2014
1 parent db5a5ee commit 5d6be5a
Show file tree
Hide file tree
Showing 73 changed files with 13 additions and 562 deletions.
10 changes: 1 addition & 9 deletions sound/soc/codecs/ad193x.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,6 @@ static struct snd_soc_dai_driver ad193x_dai = {
static int ad193x_codec_probe(struct snd_soc_codec *codec)
{
struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
int ret;

codec->control_data = ad193x->regmap;
ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
return ret;
}

/* default setting for ad193x */

Expand All @@ -347,7 +339,7 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */
regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL1, 0x04);

return ret;
return 0;
}

static struct snd_soc_codec_driver soc_codec_dev_ad193x = {
Expand Down
7 changes: 0 additions & 7 deletions sound/soc/codecs/adau1373.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,15 +1376,8 @@ static int adau1373_probe(struct snd_soc_codec *codec)
struct adau1373_platform_data *pdata = codec->dev->platform_data;
bool lineout_differential = false;
unsigned int val;
int ret;
int i;

ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
if (ret) {
dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
return ret;
}

if (pdata) {
if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting))
return -EINVAL;
Expand Down
7 changes: 0 additions & 7 deletions sound/soc/codecs/adav80x.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,15 +798,8 @@ static struct snd_soc_dai_driver adav80x_dais[] = {

static int adav80x_probe(struct snd_soc_codec *codec)
{
int ret;
struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);

ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
if (ret) {
dev_err(codec->dev, "failed to set cache I/O: %d\n", ret);
return ret;
}

/* Force PLLs on for SYSCLK output */
snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1");
snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2");
Expand Down
9 changes: 0 additions & 9 deletions sound/soc/codecs/ak4535.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,6 @@ static int ak4535_resume(struct snd_soc_codec *codec)

static int ak4535_probe(struct snd_soc_codec *codec)
{
struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec);
int ret;

codec->control_data = ak4535->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}
/* power on device */
ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

Expand Down
8 changes: 0 additions & 8 deletions sound/soc/codecs/ak4641.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,6 @@ static int ak4641_resume(struct snd_soc_codec *codec)

static int ak4641_probe(struct snd_soc_codec *codec)
{
int ret;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret != 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

/* power on device */
ak4641_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

Expand Down
8 changes: 0 additions & 8 deletions sound/soc/codecs/ak4642.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,6 @@ static int ak4642_resume(struct snd_soc_codec *codec)

static int ak4642_probe(struct snd_soc_codec *codec)
{
int ret;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

return 0;
Expand Down
12 changes: 1 addition & 11 deletions sound/soc/codecs/ak4671.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,17 +613,7 @@ static struct snd_soc_dai_driver ak4671_dai = {

static int ak4671_probe(struct snd_soc_codec *codec)
{
int ret;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

return ret;
return ak4671_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
}

static int ak4671_remove(struct snd_soc_codec *codec)
Expand Down
7 changes: 0 additions & 7 deletions sound/soc/codecs/alc5623.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,13 +904,6 @@ static int alc5623_probe(struct snd_soc_codec *codec)
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret;

codec->control_data = alc5623->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

alc5623_reset(codec);

/* power on device */
Expand Down
8 changes: 0 additions & 8 deletions sound/soc/codecs/alc5632.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,14 +1063,6 @@ static int alc5632_probe(struct snd_soc_codec *codec)
struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
int ret;

codec->control_data = alc5632->regmap;

ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
if (ret != 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

/* power on device */
alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

Expand Down
9 changes: 0 additions & 9 deletions sound/soc/codecs/cs4270.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,6 @@ static int cs4270_probe(struct snd_soc_codec *codec)
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
int ret;

/* Tell ASoC what kind of I/O to use to read the registers. ASoC will
* then do the I2C transactions itself.
*/
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "failed to set cache I/O (ret=%i)\n", ret);
return ret;
}

/* Disable auto-mute. This feature appears to be buggy. In some
* situations, auto-mute will not deactivate when it should, so we want
* this feature disabled by default. An application (e.g. alsactl) can
Expand Down
6 changes: 0 additions & 6 deletions sound/soc/codecs/cs42l51.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,6 @@ static int cs42l51_probe(struct snd_soc_codec *codec)
{
int ret, reg;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

/*
* DAC configuration
* - Use signal processor
Expand Down
9 changes: 1 addition & 8 deletions sound/soc/codecs/cs42l52.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,14 +1115,7 @@ static void cs42l52_free_beep(struct snd_soc_codec *codec)
static int cs42l52_probe(struct snd_soc_codec *codec)
{
struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
int ret;

codec->control_data = cs42l52->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}
regcache_cache_only(cs42l52->regmap, true);

cs42l52_add_mic_controls(codec);
Expand All @@ -1134,7 +1127,7 @@ static int cs42l52_probe(struct snd_soc_codec *codec)
cs42l52->sysclk = CS42L52_DEFAULT_CLK;
cs42l52->config.format = CS42L52_DEFAULT_FORMAT;

return ret;
return 0;
}

static int cs42l52_remove(struct snd_soc_codec *codec)
Expand Down
11 changes: 1 addition & 10 deletions sound/soc/codecs/cs42l73.c
Original file line number Diff line number Diff line change
Expand Up @@ -1348,17 +1348,8 @@ static int cs42l73_resume(struct snd_soc_codec *codec)

static int cs42l73_probe(struct snd_soc_codec *codec)
{
int ret;
struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec);

codec->control_data = cs42l73->regmap;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

/* Set Charge Pump Frequency */
Expand All @@ -1371,7 +1362,7 @@ static int cs42l73_probe(struct snd_soc_codec *codec)
cs42l73->mclksel = CS42L73_CLKID_MCLK1;
cs42l73->mclk = 0;

return ret;
return 0;
}

static int cs42l73_remove(struct snd_soc_codec *codec)
Expand Down
8 changes: 0 additions & 8 deletions sound/soc/codecs/da7210.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,17 +1071,9 @@ static struct snd_soc_dai_driver da7210_dai = {
static int da7210_probe(struct snd_soc_codec *codec)
{
struct da7210_priv *da7210 = snd_soc_codec_get_drvdata(codec);
int ret;

dev_info(codec->dev, "DA7210 Audio Codec %s\n", DA7210_VERSION);

codec->control_data = da7210->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

da7210->mclk_rate = 0; /* This will be set from set_sysclk() */
da7210->master = 0; /* This will be set from set_fmt() */

Expand Down
8 changes: 0 additions & 8 deletions sound/soc/codecs/da7213.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,17 +1384,9 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec,

static int da7213_probe(struct snd_soc_codec *codec)
{
int ret;
struct da7213_priv *da7213 = snd_soc_codec_get_drvdata(codec);
struct da7213_platform_data *pdata = da7213->pdata;

codec->control_data = da7213->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

/* Default to using ALC auto offset calibration mode. */
snd_soc_update_bits(codec, DA7213_ALC_CTRL1,
DA7213_ALC_CALIB_MODE_MAN, 0);
Expand Down
13 changes: 2 additions & 11 deletions sound/soc/codecs/da732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1516,23 +1516,14 @@ static int da732x_probe(struct snd_soc_codec *codec)
{
struct da732x_priv *da732x = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret = 0;

da732x->codec = codec;

dapm->idle_bias_off = false;

codec->control_data = da732x->regmap;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret != 0) {
dev_err(codec->dev, "Failed to register codec.\n");
goto err;
}

da732x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
err:
return ret;

return 0;
}

static int da732x_remove(struct snd_soc_codec *codec)
Expand Down
8 changes: 0 additions & 8 deletions sound/soc/codecs/da9055.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,16 +1381,8 @@ static int da9055_set_bias_level(struct snd_soc_codec *codec,

static int da9055_probe(struct snd_soc_codec *codec)
{
int ret;
struct da9055_priv *da9055 = snd_soc_codec_get_drvdata(codec);

codec->control_data = da9055->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

/* Enable all Gain Ramps */
snd_soc_update_bits(codec, DA9055_AUX_L_CTRL,
DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN);
Expand Down
16 changes: 0 additions & 16 deletions sound/soc/codecs/isabelle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,23 +1082,7 @@ static struct snd_soc_dai_driver isabelle_dai[] = {
},
};

static int isabelle_probe(struct snd_soc_codec *codec)
{
int ret = 0;

codec->control_data = dev_get_regmap(codec->dev, NULL);

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

return 0;
}

static struct snd_soc_codec_driver soc_codec_dev_isabelle = {
.probe = isabelle_probe,
.set_bias_level = isabelle_set_bias_level,
.controls = isabelle_snd_controls,
.num_controls = ARRAY_SIZE(isabelle_snd_controls),
Expand Down
17 changes: 0 additions & 17 deletions sound/soc/codecs/lm49453.c
Original file line number Diff line number Diff line change
Expand Up @@ -1409,22 +1409,6 @@ static int lm49453_resume(struct snd_soc_codec *codec)
return 0;
}

static int lm49453_probe(struct snd_soc_codec *codec)
{
struct lm49453_priv *lm49453 = snd_soc_codec_get_drvdata(codec);
int ret = 0;

codec->control_data = lm49453->regmap;

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

return 0;
}

/* power down chip */
static int lm49453_remove(struct snd_soc_codec *codec)
{
Expand All @@ -1433,7 +1417,6 @@ static int lm49453_remove(struct snd_soc_codec *codec)
}

static struct snd_soc_codec_driver soc_codec_dev_lm49453 = {
.probe = lm49453_probe,
.remove = lm49453_remove,
.suspend = lm49453_suspend,
.resume = lm49453_resume,
Expand Down
5 changes: 0 additions & 5 deletions sound/soc/codecs/max9768.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ static int max9768_probe(struct snd_soc_codec *codec)
struct max9768 *max9768 = snd_soc_codec_get_drvdata(codec);
int ret;

codec->control_data = max9768->regmap;
ret = snd_soc_codec_set_cache_io(codec, 2, 6, SND_SOC_REGMAP);
if (ret)
return ret;

if (max9768->flags & MAX9768_FLAG_CLASSIC_PWM) {
ret = snd_soc_write(codec, MAX9768_CTRL, MAX9768_CTRL_PWM);
if (ret)
Expand Down
6 changes: 0 additions & 6 deletions sound/soc/codecs/max98088.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,12 +1915,6 @@ static int max98088_probe(struct snd_soc_codec *codec)

regcache_mark_dirty(max98088->regmap);

ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret != 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}

/* initialize private data */

max98088->sysclk = (unsigned)-1;
Expand Down
Loading

0 comments on commit 5d6be5a

Please sign in to comment.