Merge "asoc: codec: wcd934x: enable auto recovery when port overflows"

This commit is contained in:
QCTECMDR Service 2024-09-25 02:16:44 -07:00 • committed by Gerrit - the friendly Code Review server
commit 8d2afad305
2 changed files with 22 additions and 1 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
@ -153,6 +153,8 @@ static const struct snd_kcontrol_new name##_mux = \
#define WCD934X_DIG_CORE_COLLAPSE_TIMER_MS (5 * 1000)
#define ENABLE_FIFO_OVERRUN_AUTO_RECOVERY_BIT 0x1
enum {
POWER_COLLAPSE,
POWER_RESUME,
@ -1561,6 +1563,14 @@ static void tavil_codec_enable_slim_port_intr(
val = wcd9xxx_interface_reg_read(
tavil_p->wcd9xxx, reg);
}
/* Enable auto recovery from slim port overflow on port_num */
reg = WCD934X_SLIM_PGD_PORT_TX_OR_UR_CFG_0 + port_num;
val = wcd9xxx_interface_reg_read(tavil_p->wcd9xxx, reg);
if(!(val & (1 << ENABLE_FIFO_OVERRUN_AUTO_RECOVERY_BIT))) {
val = val | (1 << ENABLE_FIFO_OVERRUN_AUTO_RECOVERY_BIT);
wcd9xxx_interface_reg_write(tavil_p->wcd9xxx, reg, val);
val = wcd9xxx_interface_reg_read(tavil_p->wcd9xxx, reg);
}
}
}
}
@ -10018,6 +10028,15 @@ static irqreturn_t tavil_slimbus_irq(int irq, void *data)
WARN(!cleared,
"Couldn't find slimbus %s port %d for closing\n",
(tx ? "TX" : "RX"), port_id);
/* Enable auto recovery from slim port overflow on port_num */
reg = WCD934X_SLIM_PGD_PORT_TX_OR_UR_CFG_0 + port_id;
val = wcd9xxx_interface_reg_read(tavil->wcd9xxx, reg);
if((val & (1 << ENABLE_FIFO_OVERRUN_AUTO_RECOVERY_BIT))) {
val = val ^ (1 << ENABLE_FIFO_OVERRUN_AUTO_RECOVERY_BIT);
wcd9xxx_interface_reg_write(tavil->wcd9xxx, reg, val);
val = wcd9xxx_interface_reg_read(tavil->wcd9xxx, reg);
}
}
wcd9xxx_interface_reg_write(tavil->wcd9xxx,
WCD934X_SLIM_PGD_PORT_INT_CLR_RX_0 +

View file

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _WCD934X_REGISTERS_H
@ -1836,5 +1837,6 @@ enum {
#define WCD934X_SLIM_PGD_PORT_INT_CLR_TX_1 (0x3B)
#define WCD934X_SLIM_PGD_PORT_INT_RX_SOURCE0 (0x60)
#define WCD934X_SLIM_PGD_PORT_INT_TX_SOURCE0 (0x70)
#define WCD934X_SLIM_PGD_PORT_TX_OR_UR_CFG_0 (0x1F0)
#endif