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

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

Merge tag 'asoc-v3.14-rc4' into asoc-linus

ASoC: Fixes for v3.14

A somewhat large set of fixes here due to the identification of some
systematic problems with hard to use APIs in the subsystem.  Takashi did
a lot of work to address the enumeration API which uncovered a number of
off by one bugs caused by confusing APIs while Charles addressed issues
in the locking around DAPM.

# gpg: Signature made Sun 23 Feb 2014 13:29:34 KST using RSA key ID 7EA229BD
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>"
# gpg:                 aka "Mark Brown <broonie@debian.org>"
# gpg:                 aka "Mark Brown <broonie@kernel.org>"
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>"
# gpg:                 aka "Mark Brown <broonie@linaro.org>"
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>"
parents e2f45592 57374bb4
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -222,27 +222,19 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info)
	struct snd_soc_dapm_context *dapm = arizona->dapm;
	int ret;

	mutex_lock(&dapm->card->dapm_mutex);

	ret = snd_soc_dapm_force_enable_pin(dapm, widget);
	if (ret != 0)
		dev_warn(arizona->dev, "Failed to enable %s: %d\n",
			 widget, ret);

	mutex_unlock(&dapm->card->dapm_mutex);

	snd_soc_dapm_sync(dapm);

	if (!arizona->pdata.micd_force_micbias) {
		mutex_lock(&dapm->card->dapm_mutex);

		ret = snd_soc_dapm_disable_pin(arizona->dapm, widget);
		if (ret != 0)
			dev_warn(arizona->dev, "Failed to disable %s: %d\n",
				 widget, ret);

		mutex_unlock(&dapm->card->dapm_mutex);

		snd_soc_dapm_sync(dapm);
	}
}
@@ -304,16 +296,12 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
				 ARIZONA_MICD_ENA, 0,
				 &change);

	mutex_lock(&dapm->card->dapm_mutex);

	ret = snd_soc_dapm_disable_pin(dapm, widget);
	if (ret != 0)
		dev_warn(arizona->dev,
			 "Failed to disable %s: %d\n",
			 widget, ret);

	mutex_unlock(&dapm->card->dapm_mutex);

	snd_soc_dapm_sync(dapm);

	if (info->micd_reva) {
+0 −19
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ static void arizona_haptics_work(struct work_struct *work)
						       struct arizona_haptics,
						       work);
	struct arizona *arizona = haptics->arizona;
	struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex;
	int ret;

	if (!haptics->arizona->dapm) {
@@ -67,13 +66,10 @@ static void arizona_haptics_work(struct work_struct *work)
			return;
		}

		mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);

		ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS");
		if (ret != 0) {
			dev_err(arizona->dev, "Failed to start HAPTICS: %d\n",
				ret);
			mutex_unlock(dapm_mutex);
			return;
		}

@@ -81,21 +77,14 @@ static void arizona_haptics_work(struct work_struct *work)
		if (ret != 0) {
			dev_err(arizona->dev, "Failed to sync DAPM: %d\n",
				ret);
			mutex_unlock(dapm_mutex);
			return;
		}

		mutex_unlock(dapm_mutex);

	} else {
		/* This disable sequence will be a noop if already enabled */
		mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);

		ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS");
		if (ret != 0) {
			dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n",
				ret);
			mutex_unlock(dapm_mutex);
			return;
		}

@@ -103,12 +92,9 @@ static void arizona_haptics_work(struct work_struct *work)
		if (ret != 0) {
			dev_err(arizona->dev, "Failed to sync DAPM: %d\n",
				ret);
			mutex_unlock(dapm_mutex);
			return;
		}

		mutex_unlock(dapm_mutex);

		ret = regmap_update_bits(arizona->regmap,
					 ARIZONA_HAPTICS_CONTROL_1,
					 ARIZONA_HAP_CTRL_MASK,
@@ -155,16 +141,11 @@ static int arizona_haptics_play(struct input_dev *input, void *data,
static void arizona_haptics_close(struct input_dev *input)
{
	struct arizona_haptics *haptics = input_get_drvdata(input);
	struct mutex *dapm_mutex = &haptics->arizona->dapm->card->dapm_mutex;

	cancel_work_sync(&haptics->work);

	mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);

	if (haptics->arizona->dapm)
		snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS");

	mutex_unlock(dapm_mutex);
}

static int arizona_haptics_probe(struct platform_device *pdev)
+8 −0
Original line number Diff line number Diff line
@@ -449,14 +449,22 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
/* dapm audio pin control and status */
int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
			    const char *pin);
int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
				     const char *pin);
int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
			     const char *pin);
int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm,
				      const char *pin);
int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin);
int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
				 const char *pin);
int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
				const char *pin);
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
				  const char *pin);
int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
					   const char *pin);
int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
				const char *pin);
void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
+2 −2
Original line number Diff line number Diff line
@@ -57,8 +57,8 @@ static const u16 ad1980_reg[] = {
static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line",
		"Stereo Mix", "Mono Mix", "Phone"};

static const struct soc_enum ad1980_cap_src =
	SOC_ENUM_DOUBLE(AC97_REC_SEL, 8, 0, 7, ad1980_rec_sel);
static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src,
			    AC97_REC_SEL, 8, 0, ad1980_rec_sel);

static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = {
SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1),
+30 −22
Original line number Diff line number Diff line
@@ -140,13 +140,17 @@ static const char *isabelle_rx1_texts[] = {"VRX1", "ARX1"};
static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"};

static const struct soc_enum isabelle_rx1_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, 1, isabelle_rx1_texts),
	SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, 1, isabelle_rx1_texts),
	SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3,
			ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts),
	SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5,
			ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts),
};

static const struct soc_enum isabelle_rx2_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, 1, isabelle_rx2_texts),
	SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, 1, isabelle_rx2_texts),
	SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2,
			ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts),
	SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4,
			ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts),
};

/* Headset DAC playback switches */
@@ -161,13 +165,17 @@ static const char *isabelle_atx_texts[] = {"AMIC1", "DMIC"};
static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"};

static const struct soc_enum isabelle_atx_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, 1, isabelle_atx_texts),
	SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_atx_texts),
	SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7,
			ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts),
	SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0,
			ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts),
};

static const struct soc_enum isabelle_vtx_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, 1, isabelle_vtx_texts),
	SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_vtx_texts),
	SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6,
			ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts),
	SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0,
			ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts),
};

static const struct snd_kcontrol_new atx_mux_controls =
@@ -183,17 +191,13 @@ static const char *isabelle_amic1_texts[] = {
/* Left analog microphone selection */
static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"};

static const struct soc_enum isabelle_amic1_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 5,
			ARRAY_SIZE(isabelle_amic1_texts),
			isabelle_amic1_texts),
};
static SOC_ENUM_SINGLE_DECL(isabelle_amic1_enum,
			    ISABELLE_AMIC_CFG_REG, 5,
			    isabelle_amic1_texts);

static const struct soc_enum isabelle_amic2_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 4,
			ARRAY_SIZE(isabelle_amic2_texts),
			isabelle_amic2_texts),
};
static SOC_ENUM_SINGLE_DECL(isabelle_amic2_enum,
			    ISABELLE_AMIC_CFG_REG, 4,
			    isabelle_amic2_texts);

static const struct snd_kcontrol_new amic1_control =
	SOC_DAPM_ENUM("Route", isabelle_amic1_enum);
@@ -206,16 +210,20 @@ static const char *isabelle_st_audio_texts[] = {"ATX1", "ATX2"};
static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"};

static const struct soc_enum isabelle_st_audio_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, 1,
	SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7,
			ARRAY_SIZE(isabelle_st_audio_texts),
			isabelle_st_audio_texts),
	SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, 1,
	SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7,
			ARRAY_SIZE(isabelle_st_audio_texts),
			isabelle_st_audio_texts),
};

static const struct soc_enum isabelle_st_voice_enum[] = {
	SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, 1,
	SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7,
			ARRAY_SIZE(isabelle_st_voice_texts),
			isabelle_st_voice_texts),
	SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, 1,
	SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7,
			ARRAY_SIZE(isabelle_st_voice_texts),
			isabelle_st_voice_texts),
};

Loading