mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 06:34:12 +08:00
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.
This commit is contained in:
commit
1d78f19d90
@ -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 0x10
|
||||
#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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
@ -17,6 +18,10 @@
|
||||
|
||||
#define DRV_NAME "acp_rn_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 acp_pdm_hardware_capture = {
|
||||
.info = SNDRV_PCM_INFO_INTERLEAVED |
|
||||
SNDRV_PCM_INFO_BLOCK_TRANSFER |
|
||||
@ -80,7 +85,8 @@ static void enable_pdm_clock(void __iomem *acp_base)
|
||||
|
||||
rn_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL);
|
||||
pdm_ctrl = rn_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));
|
||||
rn_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#define ACP_ERROR_STAT 29
|
||||
#define PDM_DECIMATION_FACTOR 0x2
|
||||
#define ACP_PDM_CLK_FREQ_MASK 0x07
|
||||
#define ACP_WOV_MISC_CTRL_MASK 0x10
|
||||
#define ACP_WOV_GAIN_CONTROL GENMASK(4, 3)
|
||||
#define ACP_PDM_ENABLE 0x01
|
||||
#define ACP_PDM_DISABLE 0x00
|
||||
#define ACP_PDM_DMA_EN_STATUS 0x02
|
||||
|
@ -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_yc_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 acp6x_pdm_hardware_capture = {
|
||||
.info = SNDRV_PCM_INFO_INTERLEAVED |
|
||||
SNDRV_PCM_INFO_BLOCK_TRANSFER |
|
||||
@ -55,7 +60,8 @@ static void acp6x_enable_pdm_clock(void __iomem *acp_base)
|
||||
|
||||
acp6x_writel(pdm_clk_enable, acp_base + ACP_WOV_CLK_CTRL);
|
||||
pdm_ctrl = acp6x_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));
|
||||
acp6x_writel(pdm_ctrl, acp_base + ACP_WOV_MISC_CTRL);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define ACP_ERROR_STAT 29
|
||||
#define PDM_DECIMATION_FACTOR 2
|
||||
#define ACP_PDM_CLK_FREQ_MASK 7
|
||||
#define ACP_WOV_MISC_CTRL_MASK 0x10
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user