Skip to content

Commit 94dc177

Browse files
committed
ASoC: amd: ps: 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-7-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:52 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 5579a96) Bugzilla: https://bugzilla.redhat.com/2169760
1 parent eed1f77 commit 94dc177

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sound/soc/amd/ps/acp63.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define ACP_ERROR_STAT 29
3131
#define PDM_DECIMATION_FACTOR 2
3232
#define ACP_PDM_CLK_FREQ_MASK 7
33-
#define ACP_WOV_MISC_CTRL_MASK 0x18
33+
#define ACP_WOV_GAIN_CONTROL GENMASK(4, 3)
3434
#define ACP_PDM_ENABLE 1
3535
#define ACP_PDM_DISABLE 0
3636
#define ACP_PDM_DMA_EN_STATUS 2

sound/soc/amd/ps/ps-pdm-dma.c

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

88
#include <linux/platform_device.h>
99
#include <linux/module.h>
10+
#include <linux/bitfield.h>
1011
#include <linux/err.h>
1112
#include <linux/io.h>
1213
#include <sound/pcm_params.h>
@@ -18,6 +19,10 @@
1819

1920
#define DRV_NAME "acp_ps_pdm_dma"
2021

22+
static int pdm_gain = 3;
23+
module_param(pdm_gain, int, 0644);
24+
MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)");
25+
2126
static const struct snd_pcm_hardware acp63_pdm_hardware_capture = {
2227
.info = SNDRV_PCM_INFO_INTERLEAVED |
2328
SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -55,7 +60,8 @@ static void acp63_enable_pdm_clock(void __iomem *acp_base)
5560

5661
acp63_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL);
5762
pdm_ctrl = acp63_readl(acp_base + ACP_WOV_MISC_CTRL);
58-
pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK;
63+
pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL;
64+
pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3));
5965
acp63_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL);
6066
}
6167

0 commit comments

Comments
 (0)