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

Commit 2964a9ae authored by Bhalchandra Gajare's avatar Bhalchandra Gajare
Browse files

ASoC: wcd9335: Fix CPE exception interrupt handling



Codec version 1.x and 2.0 have difference in CPE exception interrupt
bits. Changes to add exception interrupt mask/unmask/clear based on codec
type and change only the requested interrupts.

CRs-fixed: 874196
Change-Id: Iacee18b4a80f320400287a3c4518ef94fca38108
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 5f1d4ae4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1563,6 +1563,8 @@ static bool wcd9335_is_volatile_register(struct device *dev, unsigned int reg)
	case WCD9335_ANA_MBHC_ZDET:
	case WCD9335_ANA_MICB2:
	case WCD9335_CPE_SS_SS_ERROR_INT_STATUS:
	case WCD9335_CPE_SS_SS_ERROR_INT_MASK:
	case WCD9335_CPE_SS_SS_ERROR_INT_CLEAR:
	case WCD9335_CPE_SS_STATUS:
	case WCD9335_CPE_SS_BACKUP_INT:
	case WCD9335_CPE_SS_CFG:
+15 −5
Original line number Diff line number Diff line
@@ -9453,21 +9453,31 @@ static int tasha_codec_vote_max_bw(struct snd_soc_codec *codec,
static int tasha_cpe_err_irq_control(struct snd_soc_codec *codec,
	enum cpe_err_irq_cntl_type cntl_type, u8 *status)
{
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
	u8 irq_bits;

	if (TASHA_IS_2_0(tasha->wcd9xxx->version))
		irq_bits = 0xFF;
	else
		irq_bits = 0x3F;

	if (status)
		irq_bits = (*status) & irq_bits;

	switch (cntl_type) {
	case CPE_ERR_IRQ_MASK:
		snd_soc_update_bits(codec,
				    WCD9335_CPE_SS_SS_ERROR_INT_MASK,
				    0x3F, 0x3F);
				    irq_bits, irq_bits);
		break;
	case CPE_ERR_IRQ_UNMASK:
		snd_soc_update_bits(codec,
				    WCD9335_CPE_SS_SS_ERROR_INT_MASK,
				    0x3F, 0x00);
				    irq_bits, 0x00);
		break;
	case CPE_ERR_IRQ_CLEAR:
		snd_soc_update_bits(codec,
				    WCD9335_CPE_SS_SS_ERROR_INT_CLEAR,
				    0x3F, 0x3F);
		snd_soc_write(codec, WCD9335_CPE_SS_SS_ERROR_INT_CLEAR,
			      irq_bits);
		break;
	case CPE_ERR_IRQ_STATUS:
		if (!status)