Skip to content

Commit

Permalink
Merge branch 'topic/dapm' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/broonie/sound into asoc-tas751x
  • Loading branch information
Mark Brown committed May 4, 2015
2 parents 217e0ca + beb9969 commit ab303e4
Show file tree
Hide file tree
Showing 100 changed files with 149 additions and 168 deletions.
34 changes: 34 additions & 0 deletions include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm(
struct snd_kcontrol *kcontrol);

int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm,
enum snd_soc_bias_level level);

/* dapm widget types */
enum snd_soc_dapm_type {
snd_soc_dapm_input = 0, /* input pin */
Expand Down Expand Up @@ -623,4 +626,35 @@ struct snd_soc_dapm_stats {
int neighbour_checks;
};

/**
* snd_soc_dapm_init_bias_level() - Initialize DAPM bias level
* @dapm: The DAPM context to initialize
* @level: The DAPM level to initialize to
*
* This function only sets the driver internal state of the DAPM level and will
* not modify the state of the device. Hence it should not be used during normal
* operation, but only to synchronize the internal state to the device state.
* E.g. during driver probe to set the DAPM level to the one corresponding with
* the power-on reset state of the device.
*
* To change the DAPM state of the device use snd_soc_dapm_set_bias_level().
*/
static inline void snd_soc_dapm_init_bias_level(
struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level)
{
dapm->bias_level = level;
}

/**
* snd_soc_dapm_get_bias_level() - Get current DAPM bias level
* @dapm: The context for which to get the bias level
*
* Returns: The current bias level of the passed DAPM context.
*/
static inline enum snd_soc_bias_level snd_soc_dapm_get_bias_level(
struct snd_soc_dapm_context *dapm)
{
return dapm->bias_level;
}

#endif
54 changes: 53 additions & 1 deletion include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ struct snd_soc_codec {
/* component */
struct snd_soc_component component;

/* dapm */
/* Don't access this directly, use snd_soc_codec_get_dapm() */
struct snd_soc_dapm_context dapm;

#ifdef CONFIG_DEBUG_FS
Expand Down Expand Up @@ -1269,6 +1269,58 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm(
return component->dapm_ptr;
}

/**
* snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC
* @codec: The CODEC for which to get the DAPM context
*
* Note: Use this function instead of directly accessing the CODEC's dapm field
*/
static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm(
struct snd_soc_codec *codec)
{
return &codec->dapm;
}

/**
* snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level
* @dapm: The CODEC for which to initialize the DAPM bias level
* @level: The DAPM level to initialize to
*
* Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level().
*/
static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level);
}

/**
* snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level
* @codec: The CODEC for which to get the DAPM bias level
*
* Returns: The current DAPM bias level of the CODEC.
*/
static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level(
struct snd_soc_codec *codec)
{
return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec));
}

/**
* snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level
* @codec: The CODEC for which to set the level
* @level: The level to set to
*
* Forces the CODEC bias level to a specific state. See
* snd_soc_dapm_force_bias_level().
*/
static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec),
level);
}

/**
* snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol
* @kcontrol: The kcontrol
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/88pm860x-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,6 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/adau1373.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,6 @@ static int adau1373_set_bias_level(struct snd_soc_codec *codec,
ADAU1373_PWDN_CTRL3_PWR_EN, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/adau1701.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ static int adau1701_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/adau1761.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec,
break;

}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/adau1781.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ static int adau1781_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;
return 0;
}

Expand Down
7 changes: 1 addition & 6 deletions sound/soc/codecs/adau1977.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,7 @@ static int adau1977_set_bias_level(struct snd_soc_codec *codec,
break;
}

if (ret)
return ret;

codec->dapm.bias_level = level;

return 0;
return ret;
}

static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/adav80x.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ static int adav80x_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/ak4535.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ static int ak4535_set_bias_level(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/ak4641.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec,
regcache_mark_dirty(ak4641->regmap);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/ak4642.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ static int ak4642_set_bias_level(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM);
break;
}
codec->dapm.bias_level = level;

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/ak4671.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ static int ak4671_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/alc5623.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ static int alc5623_set_bias_level(struct snd_soc_codec *codec,
snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/alc5632.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,6 @@ static int alc5632_set_bias_level(struct snd_soc_codec *codec,
ALC5632_PWR_MANAG_ADD1_MASK, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/cq93vc.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec,
DAVINCI_VC_REG12_POWER_ALL_OFF);
break;
}
codec->dapm.bias_level = level;

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/cs4265.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ static int cs4265_set_bias_level(struct snd_soc_codec *codec,
CS4265_PWRCTL_PDN);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/cs42l52.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ static int cs42l52_set_bias_level(struct snd_soc_codec *codec,
regcache_cache_only(cs42l52->regmap, true);
break;
}
codec->dapm.bias_level = level;

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/cs42l56.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,6 @@ static int cs42l56_set_bias_level(struct snd_soc_codec *codec,
cs42l56->supplies);
break;
}
codec->dapm.bias_level = level;

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/cs42l73.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,6 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 1);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/soc/codecs/cx20442.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,6 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec,
default:
break;
}
if (!err)
codec->dapm.bias_level = level;

return err;
}
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/da7213.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,6 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec,
DA7213_VMID_EN | DA7213_BIAS_EN, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/soc/codecs/da732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1502,8 +1502,6 @@ static int da732x_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;

return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/da9055.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,6 @@ static int da9055_set_bias_level(struct snd_soc_codec *codec,
DA9055_VMID_EN | DA9055_BIAS_EN, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/es8328.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec,
0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/soc/codecs/isabelle.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,8 +909,6 @@ static int isabelle_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;

return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/soc/codecs/jz4740.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;

return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/soc/codecs/lm4857.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ static int lm4857_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;

return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/soc/codecs/lm49453.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,8 +1284,6 @@ static int lm49453_set_bias_level(struct snd_soc_codec *codec,
break;
}

codec->dapm.bias_level = level;

return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/max98088.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,6 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
regcache_mark_dirty(max98088->regmap);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,6 @@ static int max98090_set_bias_level(struct snd_soc_codec *codec,
regcache_mark_dirty(max98090->regmap);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
5 changes: 2 additions & 3 deletions sound/soc/codecs/max98095.c
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,6 @@ static int max98095_set_bias_level(struct snd_soc_codec *codec,
regcache_mark_dirty(max98095->regmap);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down Expand Up @@ -2198,7 +2197,7 @@ static int max98095_suspend(struct snd_soc_codec *codec)
if (max98095->headphone_jack || max98095->mic_jack)
max98095_jack_detect_disable(codec);

max98095_set_bias_level(codec, SND_SOC_BIAS_OFF);
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF);

return 0;
}
Expand All @@ -2208,7 +2207,7 @@ static int max98095_resume(struct snd_soc_codec *codec)
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
struct i2c_client *client = to_i2c_client(codec->dev);

max98095_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY);

if (max98095->headphone_jack || max98095->mic_jack) {
max98095_jack_detect_enable(codec);
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/max9850.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_OFF:
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/ml26124.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec,
ML26124_VMID, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}

Expand Down
Loading

0 comments on commit ab303e4

Please sign in to comment.