Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53a2c4db authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next

parents da8ab21c f9fa2b18
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -461,6 +461,7 @@ int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
				const char *pin);
				const char *pin);
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm);
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
				  const char *pin);
				  const char *pin);
int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
@@ -470,7 +471,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);


/* Mostly internal - should not normally be used */
/* Mostly internal - should not normally be used */
void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);


/* dapm path query */
/* dapm path query */
+11 −0
Original line number Original line Diff line number Diff line
@@ -1208,4 +1208,15 @@ extern struct dentry *snd_soc_debugfs_root;


extern const struct dev_pm_ops snd_soc_pm_ops;
extern const struct dev_pm_ops snd_soc_pm_ops;


/* Helper functions */
static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
{
	mutex_lock(&dapm->card->dapm_mutex);
}

static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
{
	mutex_unlock(&dapm->card->dapm_mutex);
}

#endif
#endif
+11 −6
Original line number Original line Diff line number Diff line
@@ -541,6 +541,7 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec,
			      unsigned int freq, int dir)
			      unsigned int freq, int dir)
{
{
	struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
	struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_dapm_context *dapm = &codec->dapm;


	if (dir == SND_SOC_CLOCK_IN) {
	if (dir == SND_SOC_CLOCK_IN) {
		switch (clk_id) {
		switch (clk_id) {
@@ -573,7 +574,7 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec,
			regmap_write(adav80x->regmap, ADAV80X_ICLK_CTRL2,
			regmap_write(adav80x->regmap, ADAV80X_ICLK_CTRL2,
				iclk_ctrl2);
				iclk_ctrl2);


			snd_soc_dapm_sync(&codec->dapm);
			snd_soc_dapm_sync(dapm);
		}
		}
	} else {
	} else {
		unsigned int mask;
		unsigned int mask;
@@ -600,17 +601,21 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec,
			adav80x->sysclk_pd[clk_id] = false;
			adav80x->sysclk_pd[clk_id] = false;
		}
		}


		snd_soc_dapm_mutex_lock(dapm);

		if (adav80x->sysclk_pd[0])
		if (adav80x->sysclk_pd[0])
			snd_soc_dapm_disable_pin(&codec->dapm, "PLL1");
			snd_soc_dapm_disable_pin_unlocked(dapm, "PLL1");
		else
		else
			snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1");
			snd_soc_dapm_force_enable_pin_unlocked(dapm, "PLL1");


		if (adav80x->sysclk_pd[1] || adav80x->sysclk_pd[2])
		if (adav80x->sysclk_pd[1] || adav80x->sysclk_pd[2])
			snd_soc_dapm_disable_pin(&codec->dapm, "PLL2");
			snd_soc_dapm_disable_pin_unlocked(dapm, "PLL2");
		else
		else
			snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2");
			snd_soc_dapm_force_enable_pin_unlocked(dapm, "PLL2");


		snd_soc_dapm_sync(&codec->dapm);
		snd_soc_dapm_sync_unlocked(dapm);

		snd_soc_dapm_mutex_unlock(dapm);
	}
	}


	return 0;
	return 0;
+9 −3
Original line number Original line Diff line number Diff line
@@ -2100,6 +2100,7 @@ static void wm5100_micd_irq(struct wm5100_priv *wm5100)
int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
{
{
	struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
	struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_dapm_context *dapm = &codec->dapm;


	if (jack) {
	if (jack) {
		wm5100->jack = jack;
		wm5100->jack = jack;
@@ -2117,9 +2118,14 @@ int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
				    WM5100_ACCDET_RATE_MASK);
				    WM5100_ACCDET_RATE_MASK);


		/* We need the charge pump to power MICBIAS */
		/* We need the charge pump to power MICBIAS */
		snd_soc_dapm_force_enable_pin(&codec->dapm, "CP2");
		snd_soc_dapm_mutex_lock(dapm);
		snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK");

		snd_soc_dapm_sync(&codec->dapm);
		snd_soc_dapm_force_enable_pin_unlocked(dapm, "CP2");
		snd_soc_dapm_force_enable_pin_unlocked(dapm, "SYSCLK");

		snd_soc_dapm_sync_unlocked(dapm);

		snd_soc_dapm_mutex_unlock(dapm);


		/* We start off just enabling microphone detection - even a
		/* We start off just enabling microphone detection - even a
		 * plain headphone will trigger detection.
		 * plain headphone will trigger detection.
+9 −4
Original line number Original line Diff line number Diff line
@@ -3089,6 +3089,7 @@ static irqreturn_t wm8962_irq(int irq, void *data)
int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
{
{
	struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
	struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
	struct snd_soc_dapm_context *dapm = &codec->dapm;
	int irq_mask, enable;
	int irq_mask, enable;


	wm8962->jack = jack;
	wm8962->jack = jack;
@@ -3109,14 +3110,18 @@ int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
	snd_soc_jack_report(wm8962->jack, 0,
	snd_soc_jack_report(wm8962->jack, 0,
			    SND_JACK_MICROPHONE | SND_JACK_BTN_0);
			    SND_JACK_MICROPHONE | SND_JACK_BTN_0);


	snd_soc_dapm_mutex_lock(dapm);

	if (jack) {
	if (jack) {
		snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK");
		snd_soc_dapm_force_enable_pin_unlocked(dapm, "SYSCLK");
		snd_soc_dapm_force_enable_pin(&codec->dapm, "MICBIAS");
		snd_soc_dapm_force_enable_pin_unlocked(dapm, "MICBIAS");
	} else {
	} else {
		snd_soc_dapm_disable_pin(&codec->dapm, "SYSCLK");
		snd_soc_dapm_disable_pin_unlocked(dapm, "SYSCLK");
		snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS");
		snd_soc_dapm_disable_pin_unlocked(dapm, "MICBIAS");
	}
	}


	snd_soc_dapm_mutex_unlock(dapm);

	return 0;
	return 0;
}
}
EXPORT_SYMBOL_GPL(wm8962_mic_detect);
EXPORT_SYMBOL_GPL(wm8962_mic_detect);
Loading