Skip to content

Commit 4f11714

Browse files
committed
ASoC: amd: renoir: Add a module parameter to influence pdm_gain
In case of regressions for any users that the new pdm_gain value is too high and for additional debugging, introduce a module parameter that would let them configure it. This parameter should be removed in the future: * If it's determined that the parameter is not needed, just hardcode the correct value as before * If users do end up using it to debug and report different values we should introduce a config knob that can have policy set by ucm. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230131184653.10216-5-mario.limonciello@amd.com Signed-off-by: Mark Brown <broonie@kernel.org> Author: Mario Limonciello <mario.limonciello@amd.com> Date: Tue Jan 31 12:46:50 2023 -0600 Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git Signed-off-by: Jaroslav Kysela <jkysela@redhat.com> (cherry picked from commit b7d8d4e) Bugzilla: https://bugzilla.redhat.com/2169760
1 parent 175c398 commit 4f11714

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sound/soc/amd/renoir/acp3x-pdm-dma.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <linux/platform_device.h>
88
#include <linux/module.h>
9+
#include <linux/bitfield.h>
910
#include <linux/err.h>
1011
#include <linux/io.h>
1112
#include <linux/pm_runtime.h>
@@ -17,6 +18,10 @@
1718

1819
#define DRV_NAME "acp_rn_pdm_dma"
1920

21+
static int pdm_gain = 3;
22+
module_param(pdm_gain, int, 0644);
23+
MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)");
24+
2025
static const struct snd_pcm_hardware acp_pdm_hardware_capture = {
2126
.info = SNDRV_PCM_INFO_INTERLEAVED |
2227
SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -80,7 +85,8 @@ static void enable_pdm_clock(void __iomem *acp_base)
8085

8186
rn_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL);
8287
pdm_ctrl = rn_readl(acp_base + ACP_WOV_MISC_CTRL);
83-
pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK;
88+
pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL;
89+
pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3));
8490
rn_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL);
8591
}
8692

sound/soc/amd/renoir/rn_acp3x.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#define ACP_ERROR_STAT 29
3535
#define PDM_DECIMATION_FACTOR 0x2
3636
#define ACP_PDM_CLK_FREQ_MASK 0x07
37-
#define ACP_WOV_MISC_CTRL_MASK 0x18
37+
#define ACP_WOV_GAIN_CONTROL GENMASK(4, 3)
3838
#define ACP_PDM_ENABLE 0x01
3939
#define ACP_PDM_DISABLE 0x00
4040
#define ACP_PDM_DMA_EN_STATUS 0x02

0 commit comments

Comments
 (0)