mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
ASoC: arizona: Basic support for ISRC rate selection
Since ASoC does not yet really have the framework features needed to support propagating sample rates through the device well yet implement basic support for the ISRCs equivalent to that we currently have for the ASRCs. The user can opt for 8kHz or 16kHz as the rate for the DSP blocks in addition to the main audio rate, these being the primary use cases. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
f4a76e7cc6
commit
dc91428a61
@ -433,6 +433,33 @@ EXPORT_SYMBOL_GPL(arizona_mixer_values);
|
|||||||
const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0);
|
const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0);
|
||||||
EXPORT_SYMBOL_GPL(arizona_mixer_tlv);
|
EXPORT_SYMBOL_GPL(arizona_mixer_tlv);
|
||||||
|
|
||||||
|
const char *arizona_rate_text[ARIZONA_RATE_ENUM_SIZE] = {
|
||||||
|
"SYNCCLK rate", "8kHz", "16kHz", "ASYNCCLK rate",
|
||||||
|
};
|
||||||
|
EXPORT_SYMBOL_GPL(arizona_rate_text);
|
||||||
|
|
||||||
|
const int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE] = {
|
||||||
|
0, 1, 2, 8,
|
||||||
|
};
|
||||||
|
EXPORT_SYMBOL_GPL(arizona_rate_val);
|
||||||
|
|
||||||
|
|
||||||
|
const struct soc_enum arizona_isrc_fsl[] = {
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_ISRC_1_CTRL_2,
|
||||||
|
ARIZONA_ISRC1_FSL_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_ISRC_2_CTRL_2,
|
||||||
|
ARIZONA_ISRC2_FSL_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_ISRC_3_CTRL_2,
|
||||||
|
ARIZONA_ISRC3_FSL_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
};
|
||||||
|
EXPORT_SYMBOL_GPL(arizona_isrc_fsl);
|
||||||
|
|
||||||
static const char *arizona_vol_ramp_text[] = {
|
static const char *arizona_vol_ramp_text[] = {
|
||||||
"0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB",
|
"0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB",
|
||||||
"15ms/6dB", "30ms/6dB",
|
"15ms/6dB", "30ms/6dB",
|
||||||
|
@ -180,6 +180,12 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
|
|||||||
ARIZONA_MIXER_ROUTES(name, name "L"), \
|
ARIZONA_MIXER_ROUTES(name, name "L"), \
|
||||||
ARIZONA_MIXER_ROUTES(name, name "R")
|
ARIZONA_MIXER_ROUTES(name, name "R")
|
||||||
|
|
||||||
|
#define ARIZONA_RATE_ENUM_SIZE 4
|
||||||
|
extern const char *arizona_rate_text[ARIZONA_RATE_ENUM_SIZE];
|
||||||
|
extern const int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE];
|
||||||
|
|
||||||
|
extern const struct soc_enum arizona_isrc_fsl[];
|
||||||
|
|
||||||
extern const struct soc_enum arizona_in_vi_ramp;
|
extern const struct soc_enum arizona_in_vi_ramp;
|
||||||
extern const struct soc_enum arizona_in_vd_ramp;
|
extern const struct soc_enum arizona_in_vd_ramp;
|
||||||
|
|
||||||
|
@ -731,6 +731,9 @@ SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
|
|||||||
SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
|
SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
|
||||||
SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
|
SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
|
||||||
|
|
||||||
|
SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
|
||||||
|
SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
|
||||||
|
|
||||||
ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
|
ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
|
||||||
ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
|
ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
|
||||||
|
|
||||||
@ -1532,7 +1535,7 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = snd_soc_add_codec_controls(codec, wm_adsp_fw_controls, 1);
|
ret = snd_soc_add_codec_controls(codec, wm_adsp_fw_controls, 2);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -1624,6 +1627,12 @@ static int wm5102_probe(struct platform_device *pdev)
|
|||||||
ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
|
ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
|
||||||
&wm5102->fll[1]);
|
&wm5102->fll[1]);
|
||||||
|
|
||||||
|
/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
|
||||||
|
regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
|
||||||
|
ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
|
||||||
|
regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
|
||||||
|
ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(wm5102_dai); i++)
|
for (i = 0; i < ARRAY_SIZE(wm5102_dai); i++)
|
||||||
arizona_init_dai(&wm5102->core, i);
|
arizona_init_dai(&wm5102->core, i);
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <linux/mfd/arizona/registers.h>
|
#include <linux/mfd/arizona/registers.h>
|
||||||
|
|
||||||
|
#include "arizona.h"
|
||||||
#include "wm_adsp.h"
|
#include "wm_adsp.h"
|
||||||
|
|
||||||
#define adsp_crit(_dsp, fmt, ...) \
|
#define adsp_crit(_dsp, fmt, ...) \
|
||||||
@ -246,15 +247,38 @@ static const struct soc_enum wm_adsp_fw_enum[] = {
|
|||||||
SOC_ENUM_SINGLE(0, 3, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
|
SOC_ENUM_SINGLE(0, 3, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct soc_enum wm_adsp_rate_enum[] = {
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_DSP1_CONTROL_1,
|
||||||
|
ARIZONA_DSP1_RATE_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_DSP2_CONTROL_1,
|
||||||
|
ARIZONA_DSP1_RATE_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_DSP3_CONTROL_1,
|
||||||
|
ARIZONA_DSP1_RATE_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
SOC_VALUE_ENUM_SINGLE(ARIZONA_DSP3_CONTROL_1,
|
||||||
|
ARIZONA_DSP1_RATE_SHIFT, 0xf,
|
||||||
|
ARIZONA_RATE_ENUM_SIZE,
|
||||||
|
arizona_rate_text, arizona_rate_val),
|
||||||
|
};
|
||||||
|
|
||||||
const struct snd_kcontrol_new wm_adsp_fw_controls[] = {
|
const struct snd_kcontrol_new wm_adsp_fw_controls[] = {
|
||||||
SOC_ENUM_EXT("DSP1 Firmware", wm_adsp_fw_enum[0],
|
SOC_ENUM_EXT("DSP1 Firmware", wm_adsp_fw_enum[0],
|
||||||
wm_adsp_fw_get, wm_adsp_fw_put),
|
wm_adsp_fw_get, wm_adsp_fw_put),
|
||||||
|
SOC_ENUM("DSP1 Rate", wm_adsp_rate_enum[0]),
|
||||||
SOC_ENUM_EXT("DSP2 Firmware", wm_adsp_fw_enum[1],
|
SOC_ENUM_EXT("DSP2 Firmware", wm_adsp_fw_enum[1],
|
||||||
wm_adsp_fw_get, wm_adsp_fw_put),
|
wm_adsp_fw_get, wm_adsp_fw_put),
|
||||||
|
SOC_ENUM("DSP2 Rate", wm_adsp_rate_enum[1]),
|
||||||
SOC_ENUM_EXT("DSP3 Firmware", wm_adsp_fw_enum[2],
|
SOC_ENUM_EXT("DSP3 Firmware", wm_adsp_fw_enum[2],
|
||||||
wm_adsp_fw_get, wm_adsp_fw_put),
|
wm_adsp_fw_get, wm_adsp_fw_put),
|
||||||
|
SOC_ENUM("DSP3 Rate", wm_adsp_rate_enum[2]),
|
||||||
SOC_ENUM_EXT("DSP4 Firmware", wm_adsp_fw_enum[3],
|
SOC_ENUM_EXT("DSP4 Firmware", wm_adsp_fw_enum[3],
|
||||||
wm_adsp_fw_get, wm_adsp_fw_put),
|
wm_adsp_fw_get, wm_adsp_fw_put),
|
||||||
|
SOC_ENUM("DSP4 Rate", wm_adsp_rate_enum[3]),
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(wm_adsp_fw_controls);
|
EXPORT_SYMBOL_GPL(wm_adsp_fw_controls);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user