Commit ab303e4a authored by Mark Brown's avatar Mark Brown
Browse files

Merge branch 'topic/dapm' of...

Merge branch 'topic/dapm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-tas751x
parents 217e0ca9 beb9969b
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -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 */
@@ -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
+53 −1
Original line number Diff line number Diff line
@@ -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
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -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;
}

+0 −1
Original line number Diff line number Diff line
@@ -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;
}

+0 −1
Original line number Diff line number Diff line
@@ -565,7 +565,6 @@ static int adau1701_set_bias_level(struct snd_soc_codec *codec,
		break;
	}

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

Loading