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

Commit 9f6b70e9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm8x16-wcd: Fix SSR mute issue on speaker"

parents 018a211e 695f2ab6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -311,7 +311,7 @@ const u8 msm8x16_wcd_reg_readonly[MSM8X16_WCD_CACHE_SIZE] = {
		[MSM8X16_WCD_A_DIGITAL_CDC_DIG_CLK_CTL] = 1,
		/* To detect cajon codec */
		[MSM8X16_WCD_A_ANALOG_NCP_FBCTRL] = 1,

		[MSM8X16_WCD_A_ANALOG_MBHC_DET_CTL_1] = 1,
};

const u8 cajon_digital_reg[MSM8X16_WCD_CACHE_SIZE] = {
+9 −25
Original line number Diff line number Diff line
@@ -5263,8 +5263,6 @@ static int msm8x16_wcd_device_up(struct snd_soc_codec *codec)
{
	struct msm8x16_wcd_priv *msm8x16_wcd_priv =
		snd_soc_codec_get_drvdata(codec);
	const struct snd_soc_codec_driver *codec_drv = codec->driver;
	u32 reg;
	int ret = 0;

	dev_dbg(codec->dev, "%s: device up!\n", __func__);
@@ -5273,30 +5271,7 @@ static int msm8x16_wcd_device_up(struct snd_soc_codec *codec)

	clear_bit(BUS_DOWN, &msm8x16_wcd_priv->status_mask);

	for (reg = 0; reg < ARRAY_SIZE(msm8x16_wcd_reset_reg_defaults);
			reg++) {
		if (msm8x16_wcd_reg_readable[reg]) {
			if (get_codec_version(msm8x16_wcd_priv) != CAJON &&
					cajon_digital_reg[reg])
				continue;
			msm8x16_wcd_write(codec,
				reg, msm8x16_wcd_reset_reg_defaults[reg]);
		}
	}

	if (codec_drv->reg_cache_default) {
		pr_debug("%s: Update ASOC cache", __func__);
		kfree(codec->reg_cache);
		codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
					   (codec_drv->reg_cache_size
					    * codec_drv->reg_word_size),
					   GFP_KERNEL);
		if (!codec->reg_cache) {
			pr_err("%s: Cache update failed!\n", __func__);
			mutex_unlock(&codec->mutex);
			return -ENOMEM;
		}
	}

	snd_soc_card_change_online_state(codec->component.card, 1);
	/* delay is required to make sure sound card state updated */
@@ -5305,6 +5280,15 @@ static int msm8x16_wcd_device_up(struct snd_soc_codec *codec)
	msm8x16_wcd_codec_init_reg(codec);
	msm8x16_wcd_update_reg_defaults(codec);

	codec->cache_sync = true;
	snd_soc_cache_sync(codec);
	codec->cache_sync = false;

	msm8x16_wcd_write(codec, MSM8X16_WCD_A_DIGITAL_INT_EN_SET,
				MSM8X16_WCD_A_DIGITAL_INT_EN_SET__POR);
	msm8x16_wcd_write(codec, MSM8X16_WCD_A_DIGITAL_INT_EN_CLR,
				MSM8X16_WCD_A_DIGITAL_INT_EN_CLR__POR);

	msm8x16_wcd_set_boost_v(codec);

	msm8x16_wcd_set_micb_v(codec);