Эх сурвалжийг харах

Merge remote-tracking branches 'asoc/topic/rt5670', 'asoc/topic/rt5677', 'asoc/topic/simple', 'asoc/topic/tegra' and 'asoc/topic/wm-adsp' into asoc-next

Mark Brown 10 жил өмнө

+ 1 - 0
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max98090.txt

@@ -18,6 +18,7 @@ Required properties:
   * Headphones
   * Headphones
   * Speakers
   * Speakers
   * Mic Jack
   * Mic Jack
+  * Int Mic
 
 
 - nvidia,i2s-controller : The phandle of the Tegra I2S controller that's
 - nvidia,i2s-controller : The phandle of the Tegra I2S controller that's
   connected to the CODEC.
   connected to the CODEC.

+ 3 - 0
sound/soc/codecs/rt5670.h

@@ -1950,17 +1950,20 @@ enum {
 };
 };
 
 
 enum {
 enum {
+	RT5670_DMIC1_DISABLED,
 	RT5670_DMIC_DATA_GPIO6,
 	RT5670_DMIC_DATA_GPIO6,
 	RT5670_DMIC_DATA_IN2P,
 	RT5670_DMIC_DATA_IN2P,
 	RT5670_DMIC_DATA_GPIO7,
 	RT5670_DMIC_DATA_GPIO7,
 };
 };
 
 
 enum {
 enum {
+	RT5670_DMIC2_DISABLED,
 	RT5670_DMIC_DATA_GPIO8,
 	RT5670_DMIC_DATA_GPIO8,
 	RT5670_DMIC_DATA_IN3N,
 	RT5670_DMIC_DATA_IN3N,
 };
 };
 
 
 enum {
 enum {
+	RT5670_DMIC3_DISABLED,
 	RT5670_DMIC_DATA_GPIO9,
 	RT5670_DMIC_DATA_GPIO9,
 	RT5670_DMIC_DATA_GPIO10,
 	RT5670_DMIC_DATA_GPIO10,
 	RT5670_DMIC_DATA_GPIO5,
 	RT5670_DMIC_DATA_GPIO5,

+ 30 - 14
sound/soc/codecs/rt5677.c

@@ -718,11 +718,24 @@ static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on)
 			RT5677_LDO1_SEL_MASK, 0x0);
 			RT5677_LDO1_SEL_MASK, 0x0);
 		regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2,
 		regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2,
 			RT5677_PWR_LDO1, RT5677_PWR_LDO1);
 			RT5677_PWR_LDO1, RT5677_PWR_LDO1);
-		regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1,
-			RT5677_MCLK_SRC_MASK, RT5677_MCLK2_SRC);
-		regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2,
-			RT5677_PLL2_PR_SRC_MASK | RT5677_DSP_CLK_SRC_MASK,
-			RT5677_PLL2_PR_SRC_MCLK2 | RT5677_DSP_CLK_SRC_BYPASS);
+		switch (rt5677->type) {
+		case RT5677:
+			regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1,
+				RT5677_MCLK_SRC_MASK, RT5677_MCLK2_SRC);
+			regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2,
+				RT5677_PLL2_PR_SRC_MASK |
+				RT5677_DSP_CLK_SRC_MASK,
+				RT5677_PLL2_PR_SRC_MCLK2 |
+				RT5677_DSP_CLK_SRC_BYPASS);
+			break;
+		case RT5676:
+			regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2,
+				RT5677_DSP_CLK_SRC_MASK,
+				RT5677_DSP_CLK_SRC_BYPASS);
+			break;
+		default:
+			break;
+		}
 		regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x07ff);
 		regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x07ff);
 		regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x07fd);
 		regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x07fd);
 		rt5677_set_dsp_mode(codec, true);
 		rt5677_set_dsp_mode(codec, true);
@@ -4500,10 +4513,10 @@ static int rt5677_suspend(struct snd_soc_codec *codec)
 	if (!rt5677->dsp_vad_en) {
 	if (!rt5677->dsp_vad_en) {
 		regcache_cache_only(rt5677->regmap, true);
 		regcache_cache_only(rt5677->regmap, true);
 		regcache_mark_dirty(rt5677->regmap);
 		regcache_mark_dirty(rt5677->regmap);
-	}
 
 
-	if (gpio_is_valid(rt5677->pow_ldo2))
-		gpio_set_value_cansleep(rt5677->pow_ldo2, 0);
+		if (gpio_is_valid(rt5677->pow_ldo2))
+			gpio_set_value_cansleep(rt5677->pow_ldo2, 0);
+	}
 
 
 	return 0;
 	return 0;
 }
 }
@@ -4512,12 +4525,12 @@ static int rt5677_resume(struct snd_soc_codec *codec)
 {
 {
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
 
-	if (gpio_is_valid(rt5677->pow_ldo2)) {
-		gpio_set_value_cansleep(rt5677->pow_ldo2, 1);
-		msleep(10);
-	}
-
 	if (!rt5677->dsp_vad_en) {
 	if (!rt5677->dsp_vad_en) {
+		if (gpio_is_valid(rt5677->pow_ldo2)) {
+			gpio_set_value_cansleep(rt5677->pow_ldo2, 1);
+			msleep(10);
+		}
+
 		regcache_cache_only(rt5677->regmap, false);
 		regcache_cache_only(rt5677->regmap, false);
 		regcache_sync(rt5677->regmap);
 		regcache_sync(rt5677->regmap);
 	}
 	}
@@ -4733,7 +4746,8 @@ static const struct regmap_config rt5677_regmap = {
 };
 };
 
 
 static const struct i2c_device_id rt5677_i2c_id[] = {
 static const struct i2c_device_id rt5677_i2c_id[] = {
-	{ "rt5677", 0 },
+	{ "rt5677", RT5677 },
+	{ "rt5676", RT5676 },
 	{ }
 	{ }
 };
 };
 MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
 MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
@@ -4850,6 +4864,8 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
 
 
 	i2c_set_clientdata(i2c, rt5677);
 	i2c_set_clientdata(i2c, rt5677);
 
 
+	rt5677->type = id->driver_data;
+
 	if (pdata)
 	if (pdata)
 		rt5677->pdata = *pdata;
 		rt5677->pdata = *pdata;
 
 

+ 6 - 0
sound/soc/codecs/rt5677.h

@@ -1665,6 +1665,11 @@ enum {
 	RT5677_IRQ_JD3,
 	RT5677_IRQ_JD3,
 };
 };
 
 
+enum rt5677_type {
+	RT5677,
+	RT5676,
+};
+
 struct rt5677_priv {
 struct rt5677_priv {
 	struct snd_soc_codec *codec;
 	struct snd_soc_codec *codec;
 	struct rt5677_platform_data pdata;
 	struct rt5677_platform_data pdata;
@@ -1681,6 +1686,7 @@ struct rt5677_priv {
 	int pll_in;
 	int pll_in;
 	int pll_out;
 	int pll_out;
 	int pow_ldo2; /* POW_LDO2 pin */
 	int pow_ldo2; /* POW_LDO2 pin */
+	enum rt5677_type type;
 #ifdef CONFIG_GPIOLIB
 #ifdef CONFIG_GPIOLIB
 	struct gpio_chip gpio_chip;
 	struct gpio_chip gpio_chip;
 #endif
 #endif

+ 3 - 10
sound/soc/codecs/wm_adsp.c

@@ -420,10 +420,9 @@ static int wm_coeff_put(struct snd_kcontrol *kcontrol,
 
 
 	memcpy(ctl->cache, p, ctl->len);
 	memcpy(ctl->cache, p, ctl->len);
 
 
-	if (!ctl->enabled) {
-		ctl->set = 1;
+	ctl->set = 1;
+	if (!ctl->enabled)
 		return 0;
 		return 0;
-	}
 
 
 	return wm_coeff_write_control(kcontrol, p, ctl->len);
 	return wm_coeff_write_control(kcontrol, p, ctl->len);
 }
 }
@@ -1185,7 +1184,6 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
 	int ret, pos, blocks, type, offset, reg;
 	int ret, pos, blocks, type, offset, reg;
 	char *file;
 	char *file;
 	struct wm_adsp_buf *buf;
 	struct wm_adsp_buf *buf;
-	int tmp;
 
 
 	file = kzalloc(PAGE_SIZE, GFP_KERNEL);
 	file = kzalloc(PAGE_SIZE, GFP_KERNEL);
 	if (file == NULL)
 	if (file == NULL)
@@ -1335,12 +1333,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
 			}
 			}
 		}
 		}
 
 
-		tmp = le32_to_cpu(blk->len) % 4;
-		if (tmp)
-			pos += le32_to_cpu(blk->len) + (4 - tmp) + sizeof(*blk);
-		else
-			pos += le32_to_cpu(blk->len) + sizeof(*blk);
-
+		pos += (le32_to_cpu(blk->len) + sizeof(*blk) + 3) & ~0x03;
 		blocks++;
 		blocks++;
 	}
 	}
 
 

+ 4 - 0
sound/soc/tegra/tegra_max98090.c

@@ -133,10 +133,14 @@ static const struct snd_soc_dapm_widget tegra_max98090_dapm_widgets[] = {
 	SND_SOC_DAPM_HP("Headphones", NULL),
 	SND_SOC_DAPM_HP("Headphones", NULL),
 	SND_SOC_DAPM_SPK("Speakers", NULL),
 	SND_SOC_DAPM_SPK("Speakers", NULL),
 	SND_SOC_DAPM_MIC("Mic Jack", NULL),
 	SND_SOC_DAPM_MIC("Mic Jack", NULL),
+	SND_SOC_DAPM_MIC("Int Mic", NULL),
 };
 };
 
 
 static const struct snd_kcontrol_new tegra_max98090_controls[] = {
 static const struct snd_kcontrol_new tegra_max98090_controls[] = {
+	SOC_DAPM_PIN_SWITCH("Headphones"),
 	SOC_DAPM_PIN_SWITCH("Speakers"),
 	SOC_DAPM_PIN_SWITCH("Speakers"),
+	SOC_DAPM_PIN_SWITCH("Mic Jack"),
+	SOC_DAPM_PIN_SWITCH("Int Mic"),
 };
 };
 
 
 static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)
 static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)