diff options
author | Mario Limonciello <mario.limonciello@amd.com> | 2023-01-31 21:46:52 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-02-02 14:42:26 +0300 |
commit | 5579a966229c3365d0e2c91e9a96fc40e293dffa (patch) | |
tree | 1ef4daf9d7158fa19502d38261413515318dea15 /sound/soc/amd | |
parent | 99ecc7889bee68fdf377f328c21ad0f953f8b05e (diff) | |
download | linux-5579a966229c3365d0e2c91e9a96fc40e293dffa.tar.xz |
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>
Diffstat (limited to 'sound/soc/amd')
-rw-r--r-- | sound/soc/amd/ps/acp63.h | 2 | ||||
-rw-r--r-- | sound/soc/amd/ps/ps-pdm-dma.c | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/sound/soc/amd/ps/acp63.h b/sound/soc/amd/ps/acp63.h index 893a0455cf24..6bf29b520511 100644 --- a/sound/soc/amd/ps/acp63.h +++ b/sound/soc/amd/ps/acp63.h @@ -29,7 +29,7 @@ #define ACP_ERROR_STAT 29 #define PDM_DECIMATION_FACTOR 2 #define ACP_PDM_CLK_FREQ_MASK 7 -#define ACP_WOV_MISC_CTRL_MASK 0x18 +#define ACP_WOV_GAIN_CONTROL GENMASK(4, 3) #define ACP_PDM_ENABLE 1 #define ACP_PDM_DISABLE 0 #define ACP_PDM_DMA_EN_STATUS 2 diff --git a/sound/soc/amd/ps/ps-pdm-dma.c b/sound/soc/amd/ps/ps-pdm-dma.c index 8957d8f8d3c6..454dab062e4f 100644 --- a/sound/soc/amd/ps/ps-pdm-dma.c +++ b/sound/soc/amd/ps/ps-pdm-dma.c @@ -7,6 +7,7 @@ #include <linux/platform_device.h> #include <linux/module.h> +#include <linux/bitfield.h> #include <linux/err.h> #include <linux/io.h> #include <sound/pcm_params.h> @@ -18,6 +19,10 @@ #define DRV_NAME "acp_ps_pdm_dma" +static int pdm_gain = 3; +module_param(pdm_gain, int, 0644); +MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)"); + static const struct snd_pcm_hardware acp63_pdm_hardware_capture = { .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | @@ -55,7 +60,8 @@ static void acp63_enable_pdm_clock(void __iomem *acp_base) acp63_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL); pdm_ctrl = acp63_readl(acp_base + ACP_WOV_MISC_CTRL); - pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK; + pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL; + pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3)); acp63_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL); } |