Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix default DMIC gain on AMD PDM drivers

Merge series from Mario Limonciello <mario.limonciello@amd.com>:

It's been reported that a number of laptops have a low volume
level from the digital microphone compared to Windows.

AMD offers a register that can adjust the gain for PDM which is not
configured at maximum gain by default.

To fix this change the default for all 3 drivers to raise the gain
but also offer a module parameter. The module parameter can be used
for debugging if the gain is too high on a given laptop.

This is intentionally split into multiple patches for default and
parameter so that if the default really does behave better universally
we can bring it back to stable too later.

+24 -6
+1 -1
sound/soc/amd/ps/acp63.h
··· 29 29 #define ACP_ERROR_STAT 29 30 30 #define PDM_DECIMATION_FACTOR 2 31 31 #define ACP_PDM_CLK_FREQ_MASK 7 32 - #define ACP_WOV_MISC_CTRL_MASK 0x10 32 + #define ACP_WOV_GAIN_CONTROL GENMASK(4, 3) 33 33 #define ACP_PDM_ENABLE 1 34 34 #define ACP_PDM_DISABLE 0 35 35 #define ACP_PDM_DMA_EN_STATUS 2
+7 -1
sound/soc/amd/ps/ps-pdm-dma.c
··· 7 7 8 8 #include <linux/platform_device.h> 9 9 #include <linux/module.h> 10 + #include <linux/bitfield.h> 10 11 #include <linux/err.h> 11 12 #include <linux/io.h> 12 13 #include <sound/pcm_params.h> ··· 18 17 #include "acp63.h" 19 18 20 19 #define DRV_NAME "acp_ps_pdm_dma" 20 + 21 + static int pdm_gain = 3; 22 + module_param(pdm_gain, int, 0644); 23 + MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)"); 21 24 22 25 static const struct snd_pcm_hardware acp63_pdm_hardware_capture = { 23 26 .info = SNDRV_PCM_INFO_INTERLEAVED | ··· 60 55 61 56 acp63_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL); 62 57 pdm_ctrl = acp63_readl(acp_base + ACP_WOV_MISC_CTRL); 63 - pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK; 58 + pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL; 59 + pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3)); 64 60 acp63_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL); 65 61 } 66 62
+7 -1
sound/soc/amd/renoir/acp3x-pdm-dma.c
··· 6 6 7 7 #include <linux/platform_device.h> 8 8 #include <linux/module.h> 9 + #include <linux/bitfield.h> 9 10 #include <linux/err.h> 10 11 #include <linux/io.h> 11 12 #include <linux/pm_runtime.h> ··· 17 16 #include "rn_acp3x.h" 18 17 19 18 #define DRV_NAME "acp_rn_pdm_dma" 19 + 20 + static int pdm_gain = 3; 21 + module_param(pdm_gain, int, 0644); 22 + MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)"); 20 23 21 24 static const struct snd_pcm_hardware acp_pdm_hardware_capture = { 22 25 .info = SNDRV_PCM_INFO_INTERLEAVED | ··· 85 80 86 81 rn_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL); 87 82 pdm_ctrl = rn_readl(acp_base + ACP_WOV_MISC_CTRL); 88 - pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK; 83 + pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL; 84 + pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3)); 89 85 rn_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL); 90 86 } 91 87
+1 -1
sound/soc/amd/renoir/rn_acp3x.h
··· 34 34 #define ACP_ERROR_STAT 29 35 35 #define PDM_DECIMATION_FACTOR 0x2 36 36 #define ACP_PDM_CLK_FREQ_MASK 0x07 37 - #define ACP_WOV_MISC_CTRL_MASK 0x10 37 + #define ACP_WOV_GAIN_CONTROL GENMASK(4, 3) 38 38 #define ACP_PDM_ENABLE 0x01 39 39 #define ACP_PDM_DISABLE 0x00 40 40 #define ACP_PDM_DMA_EN_STATUS 0x02
+7 -1
sound/soc/amd/yc/acp6x-pdm-dma.c
··· 7 7 8 8 #include <linux/platform_device.h> 9 9 #include <linux/module.h> 10 + #include <linux/bitfield.h> 10 11 #include <linux/err.h> 11 12 #include <linux/io.h> 12 13 #include <sound/pcm_params.h> ··· 18 17 #include "acp6x.h" 19 18 20 19 #define DRV_NAME "acp_yc_pdm_dma" 20 + 21 + static int pdm_gain = 3; 22 + module_param(pdm_gain, int, 0644); 23 + MODULE_PARM_DESC(pdm_gain, "Gain control (0-3)"); 21 24 22 25 static const struct snd_pcm_hardware acp6x_pdm_hardware_capture = { 23 26 .info = SNDRV_PCM_INFO_INTERLEAVED | ··· 60 55 61 56 acp6x_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL); 62 57 pdm_ctrl = acp6x_readl(acp_base + ACP_WOV_MISC_CTRL); 63 - pdm_ctrl |= ACP_WOV_MISC_CTRL_MASK; 58 + pdm_ctrl &= ~ACP_WOV_GAIN_CONTROL; 59 + pdm_ctrl |= FIELD_PREP(ACP_WOV_GAIN_CONTROL, clamp(pdm_gain, 0, 3)); 64 60 acp6x_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL); 65 61 } 66 62
+1 -1
sound/soc/amd/yc/acp6x.h
··· 31 31 #define ACP_ERROR_STAT 29 32 32 #define PDM_DECIMATION_FACTOR 2 33 33 #define ACP_PDM_CLK_FREQ_MASK 7 34 - #define ACP_WOV_MISC_CTRL_MASK 0x10 34 + #define ACP_WOV_GAIN_CONTROL GENMASK(4, 3) 35 35 #define ACP_PDM_ENABLE 1 36 36 #define ACP_PDM_DISABLE 0 37 37 #define ACP_PDM_DMA_EN_STATUS 2