ASoC: nau8821: Add slew rate controls.

The patch supports DMIC clock slew rate controls.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Link: https://lore.kernel.org/r/20231107035230.1241683-3-wtli@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Seven Lee 2023-11-07 11:52:30 +08:00 committed by Mark Brown
parent 1fb1a7c4a6
commit 91d1a18b63
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 10 additions and 0 deletions

View File

@ -1738,6 +1738,10 @@ static int nau8821_read_device_properties(struct device *dev,
&nau8821->dmic_clk_threshold);
if (ret)
nau8821->dmic_clk_threshold = 3072000;
ret = device_property_read_u32(dev, "nuvoton,dmic-slew-rate",
&nau8821->dmic_slew_rate);
if (ret)
nau8821->dmic_slew_rate = 0;
return 0;
}
@ -1797,6 +1801,9 @@ static void nau8821_init_regs(struct nau8821 *nau8821)
NAU8821_ADC_SYNC_DOWN_MASK, NAU8821_ADC_SYNC_DOWN_64);
regmap_update_bits(regmap, NAU8821_R2C_DAC_CTRL1,
NAU8821_DAC_OVERSAMPLE_MASK, NAU8821_DAC_OVERSAMPLE_64);
regmap_update_bits(regmap, NAU8821_R13_DMIC_CTRL,
NAU8821_DMIC_SLEW_MASK, nau8821->dmic_slew_rate <<
NAU8821_DMIC_SLEW_SFT);
if (nau8821->left_input_single_end) {
regmap_update_bits(regmap, NAU8821_R6B_PGA_MUTE,
NAU8821_MUTE_MICNL_EN, NAU8821_MUTE_MICNL_EN);

View File

@ -236,6 +236,8 @@
#define NAU8821_DMIC_SRC_MASK (0x3 << NAU8821_DMIC_SRC_SFT)
#define NAU8821_CLK_DMIC_SRC (0x2 << NAU8821_DMIC_SRC_SFT)
#define NAU8821_DMIC_EN_SFT 0
#define NAU8821_DMIC_SLEW_SFT 8
#define NAU8821_DMIC_SLEW_MASK (0x7 << NAU8821_DMIC_SLEW_SFT)
/* GPIO12_CTRL (0x1a) */
#define NAU8821_JKDET_PULL_UP (0x1 << 11) /* 0 - pull down, 1 - pull up */
@ -573,6 +575,7 @@ struct nau8821 {
int jack_eject_debounce;
int fs;
int dmic_clk_threshold;
int dmic_slew_rate;
int key_enable;
};