mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 20:48:49 +08:00
Merge some cs42l42 patches into asoc-5.15
This commit is contained in:
commit
ddaa1ed52c
@ -114,7 +114,7 @@ properties:
|
||||
|
||||
ports:
|
||||
$ref: /schemas/graph.yaml#/properties/ports
|
||||
properties:
|
||||
patternProperties:
|
||||
port(@[0-9a-f]+)?:
|
||||
$ref: audio-graph-port.yaml#
|
||||
unevaluatedProperties: false
|
||||
|
@ -19992,7 +19992,8 @@ F: Documentation/devicetree/bindings/extcon/wlf,arizona.yaml
|
||||
F: Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
|
||||
F: Documentation/devicetree/bindings/mfd/wm831x.txt
|
||||
F: Documentation/devicetree/bindings/regulator/wlf,arizona.yaml
|
||||
F: Documentation/devicetree/bindings/sound/wlf,arizona.yaml
|
||||
F: Documentation/devicetree/bindings/sound/wlf,*.yaml
|
||||
F: Documentation/devicetree/bindings/sound/wm*
|
||||
F: Documentation/hwmon/wm83??.rst
|
||||
F: arch/arm/mach-s3c/mach-crag6410*
|
||||
F: drivers/clk/clk-wm83*.c
|
||||
|
@ -712,6 +712,12 @@ struct snd_soc_dai_link {
|
||||
/* Do not create a PCM for this DAI link (Backend link) */
|
||||
unsigned int ignore:1;
|
||||
|
||||
/* This flag will reorder stop sequence. By enabling this flag
|
||||
* DMA controller stop sequence will be invoked first followed by
|
||||
* CPU DAI driver stop sequence
|
||||
*/
|
||||
unsigned int stop_dma_first:1;
|
||||
|
||||
#ifdef CONFIG_SND_SOC_TOPOLOGY
|
||||
struct snd_soc_dobj dobj; /* For topology */
|
||||
#endif
|
||||
|
@ -36,6 +36,7 @@ config SND_SOC_COMPRESS
|
||||
|
||||
config SND_SOC_TOPOLOGY
|
||||
bool
|
||||
select SND_DYNAMIC_MINORS
|
||||
|
||||
config SND_SOC_TOPOLOGY_KUNIT_TEST
|
||||
tristate "KUnit tests for SoC topology"
|
||||
|
@ -525,6 +525,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = {
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.init = cz_da7219_init,
|
||||
.dpcm_playback = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_da7219_play_ops,
|
||||
SND_SOC_DAILINK_REG(designware1, dlgs, platform),
|
||||
},
|
||||
@ -534,6 +535,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_capture = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_da7219_cap_ops,
|
||||
SND_SOC_DAILINK_REG(designware2, dlgs, platform),
|
||||
},
|
||||
@ -543,6 +545,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_playback = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_max_play_ops,
|
||||
SND_SOC_DAILINK_REG(designware3, mx, platform),
|
||||
},
|
||||
@ -553,6 +556,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_capture = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_dmic0_cap_ops,
|
||||
SND_SOC_DAILINK_REG(designware3, adau, platform),
|
||||
},
|
||||
@ -563,6 +567,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_capture = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_dmic1_cap_ops,
|
||||
SND_SOC_DAILINK_REG(designware2, adau, platform),
|
||||
},
|
||||
@ -576,6 +581,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = {
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.init = cz_rt5682_init,
|
||||
.dpcm_playback = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_rt5682_play_ops,
|
||||
SND_SOC_DAILINK_REG(designware1, rt5682, platform),
|
||||
},
|
||||
@ -585,6 +591,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_capture = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_rt5682_cap_ops,
|
||||
SND_SOC_DAILINK_REG(designware2, rt5682, platform),
|
||||
},
|
||||
@ -594,6 +601,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_playback = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_rt5682_max_play_ops,
|
||||
SND_SOC_DAILINK_REG(designware3, mx, platform),
|
||||
},
|
||||
@ -604,6 +612,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_capture = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_rt5682_dmic0_cap_ops,
|
||||
SND_SOC_DAILINK_REG(designware3, adau, platform),
|
||||
},
|
||||
@ -614,6 +623,7 @@ static struct snd_soc_dai_link cz_dai_5682_98357[] = {
|
||||
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
|
||||
| SND_SOC_DAIFMT_CBM_CFM,
|
||||
.dpcm_capture = 1,
|
||||
.stop_dma_first = 1,
|
||||
.ops = &cz_rt5682_dmic1_cap_ops,
|
||||
SND_SOC_DAILINK_REG(designware2, adau, platform),
|
||||
},
|
||||
|
@ -969,7 +969,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component,
|
||||
|
||||
acp_set_sram_bank_state(rtd->acp_mmio, 0, true);
|
||||
/* Save for runtime private data */
|
||||
rtd->dma_addr = substream->dma_buffer.addr;
|
||||
rtd->dma_addr = runtime->dma_addr;
|
||||
rtd->order = get_order(size);
|
||||
|
||||
/* Fill the page table entries in ACP SRAM */
|
||||
|
@ -286,7 +286,7 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component,
|
||||
pr_err("pinfo failed\n");
|
||||
}
|
||||
size = params_buffer_bytes(params);
|
||||
rtd->dma_addr = substream->dma_buffer.addr;
|
||||
rtd->dma_addr = substream->runtime->dma_addr;
|
||||
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
|
||||
config_acp3x_dma(rtd, substream->stream);
|
||||
return 0;
|
||||
|
@ -242,7 +242,7 @@ static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
|
||||
return -EINVAL;
|
||||
size = params_buffer_bytes(params);
|
||||
period_bytes = params_period_bytes(params);
|
||||
rtd->dma_addr = substream->dma_buffer.addr;
|
||||
rtd->dma_addr = substream->runtime->dma_addr;
|
||||
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
|
||||
config_acp_dma(rtd, substream->stream);
|
||||
init_pdm_ring_buffer(MEM_WINDOW_START, size, period_bytes,
|
||||
|
@ -382,6 +382,8 @@ static const struct dev_pm_ops rn_acp_pm = {
|
||||
.runtime_resume = snd_rn_acp_resume,
|
||||
.suspend = snd_rn_acp_suspend,
|
||||
.resume = snd_rn_acp_resume,
|
||||
.restore = snd_rn_acp_resume,
|
||||
.poweroff = snd_rn_acp_suspend,
|
||||
};
|
||||
|
||||
static void snd_rn_acp_remove(struct pci_dev *pci)
|
||||
|
@ -1575,7 +1575,9 @@ config SND_SOC_WCD934X
|
||||
Qualcomm SoCs like SDM845.
|
||||
|
||||
config SND_SOC_WCD938X
|
||||
depends on SND_SOC_WCD938X_SDW
|
||||
tristate
|
||||
depends on SOUNDWIRE || !SOUNDWIRE
|
||||
|
||||
config SND_SOC_WCD938X_SDW
|
||||
tristate "WCD9380/WCD9385 Codec - SDW"
|
||||
|
@ -585,7 +585,10 @@ obj-$(CONFIG_SND_SOC_WCD_MBHC) += snd-soc-wcd-mbhc.o
|
||||
obj-$(CONFIG_SND_SOC_WCD9335) += snd-soc-wcd9335.o
|
||||
obj-$(CONFIG_SND_SOC_WCD934X) += snd-soc-wcd934x.o
|
||||
obj-$(CONFIG_SND_SOC_WCD938X) += snd-soc-wcd938x.o
|
||||
obj-$(CONFIG_SND_SOC_WCD938X_SDW) += snd-soc-wcd938x-sdw.o
|
||||
ifdef CONFIG_SND_SOC_WCD938X_SDW
|
||||
# avoid link failure by forcing sdw code built-in when needed
|
||||
obj-$(CONFIG_SND_SOC_WCD938X) += snd-soc-wcd938x-sdw.o
|
||||
endif
|
||||
obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o
|
||||
obj-$(CONFIG_SND_SOC_WM0010) += snd-soc-wm0010.o
|
||||
obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o
|
||||
|
@ -405,7 +405,7 @@ static const struct regmap_config cs42l42_regmap = {
|
||||
.use_single_write = true,
|
||||
};
|
||||
|
||||
static DECLARE_TLV_DB_SCALE(adc_tlv, -9600, 100, false);
|
||||
static DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 100, true);
|
||||
static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true);
|
||||
|
||||
static const char * const cs42l42_hpf_freq_text[] = {
|
||||
@ -425,34 +425,23 @@ static SOC_ENUM_SINGLE_DECL(cs42l42_wnf3_freq_enum, CS42L42_ADC_WNF_HPF_CTL,
|
||||
CS42L42_ADC_WNF_CF_SHIFT,
|
||||
cs42l42_wnf3_freq_text);
|
||||
|
||||
static const char * const cs42l42_wnf05_freq_text[] = {
|
||||
"280Hz", "315Hz", "350Hz", "385Hz",
|
||||
"420Hz", "455Hz", "490Hz", "525Hz"
|
||||
};
|
||||
|
||||
static SOC_ENUM_SINGLE_DECL(cs42l42_wnf05_freq_enum, CS42L42_ADC_WNF_HPF_CTL,
|
||||
CS42L42_ADC_WNF_CF_SHIFT,
|
||||
cs42l42_wnf05_freq_text);
|
||||
|
||||
static const struct snd_kcontrol_new cs42l42_snd_controls[] = {
|
||||
/* ADC Volume and Filter Controls */
|
||||
SOC_SINGLE("ADC Notch Switch", CS42L42_ADC_CTL,
|
||||
CS42L42_ADC_NOTCH_DIS_SHIFT, true, false),
|
||||
CS42L42_ADC_NOTCH_DIS_SHIFT, true, true),
|
||||
SOC_SINGLE("ADC Weak Force Switch", CS42L42_ADC_CTL,
|
||||
CS42L42_ADC_FORCE_WEAK_VCM_SHIFT, true, false),
|
||||
SOC_SINGLE("ADC Invert Switch", CS42L42_ADC_CTL,
|
||||
CS42L42_ADC_INV_SHIFT, true, false),
|
||||
SOC_SINGLE("ADC Boost Switch", CS42L42_ADC_CTL,
|
||||
CS42L42_ADC_DIG_BOOST_SHIFT, true, false),
|
||||
SOC_SINGLE_SX_TLV("ADC Volume", CS42L42_ADC_VOLUME,
|
||||
CS42L42_ADC_VOL_SHIFT, 0xA0, 0x6C, adc_tlv),
|
||||
SOC_SINGLE_S8_TLV("ADC Volume", CS42L42_ADC_VOLUME, -97, 12, adc_tlv),
|
||||
SOC_SINGLE("ADC WNF Switch", CS42L42_ADC_WNF_HPF_CTL,
|
||||
CS42L42_ADC_WNF_EN_SHIFT, true, false),
|
||||
SOC_SINGLE("ADC HPF Switch", CS42L42_ADC_WNF_HPF_CTL,
|
||||
CS42L42_ADC_HPF_EN_SHIFT, true, false),
|
||||
SOC_ENUM("HPF Corner Freq", cs42l42_hpf_freq_enum),
|
||||
SOC_ENUM("WNF 3dB Freq", cs42l42_wnf3_freq_enum),
|
||||
SOC_ENUM("WNF 05dB Freq", cs42l42_wnf05_freq_enum),
|
||||
|
||||
/* DAC Volume and Filter Controls */
|
||||
SOC_SINGLE("DACA Invert Switch", CS42L42_DAC_CTL1,
|
||||
@ -471,8 +460,8 @@ static const struct snd_soc_dapm_widget cs42l42_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_OUTPUT("HP"),
|
||||
SND_SOC_DAPM_DAC("DAC", NULL, CS42L42_PWR_CTL1, CS42L42_HP_PDN_SHIFT, 1),
|
||||
SND_SOC_DAPM_MIXER("MIXER", CS42L42_PWR_CTL1, CS42L42_MIXER_PDN_SHIFT, 1, NULL, 0),
|
||||
SND_SOC_DAPM_AIF_IN("SDIN1", NULL, 0, CS42L42_ASP_RX_DAI0_EN, CS42L42_ASP_RX0_CH1_SHIFT, 0),
|
||||
SND_SOC_DAPM_AIF_IN("SDIN2", NULL, 1, CS42L42_ASP_RX_DAI0_EN, CS42L42_ASP_RX0_CH2_SHIFT, 0),
|
||||
SND_SOC_DAPM_AIF_IN("SDIN1", NULL, 0, SND_SOC_NOPM, 0, 0),
|
||||
SND_SOC_DAPM_AIF_IN("SDIN2", NULL, 1, SND_SOC_NOPM, 0, 0),
|
||||
|
||||
/* Playback Requirements */
|
||||
SND_SOC_DAPM_SUPPLY("ASP DAI0", CS42L42_PWR_CTL1, CS42L42_ASP_DAI_PDN_SHIFT, 1, NULL, 0),
|
||||
@ -597,6 +586,7 @@ struct cs42l42_pll_params {
|
||||
* Table 4-5 from the Datasheet
|
||||
*/
|
||||
static const struct cs42l42_pll_params pll_ratio_table[] = {
|
||||
{ 1411200, 0, 1, 0x00, 0x80, 0x000000, 0x03, 0x10, 11289600, 128, 2},
|
||||
{ 1536000, 0, 1, 0x00, 0x7D, 0x000000, 0x03, 0x10, 12000000, 125, 2},
|
||||
{ 2304000, 0, 1, 0x00, 0x55, 0xC00000, 0x02, 0x10, 12288000, 85, 2},
|
||||
{ 2400000, 0, 1, 0x00, 0x50, 0x000000, 0x03, 0x10, 12000000, 80, 2},
|
||||
@ -630,6 +620,8 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pll_ratio_table); i++) {
|
||||
if (pll_ratio_table[i].sclk == clk) {
|
||||
cs42l42->pll_config = i;
|
||||
|
||||
/* Configure the internal sample rate */
|
||||
snd_soc_component_update_bits(component, CS42L42_MCLK_CTL,
|
||||
CS42L42_INTERNAL_FS_MASK,
|
||||
@ -638,14 +630,9 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
|
||||
(pll_ratio_table[i].mclk_int !=
|
||||
24000000)) <<
|
||||
CS42L42_INTERNAL_FS_SHIFT);
|
||||
/* Set the MCLK src (PLL or SCLK) and the divide
|
||||
* ratio
|
||||
*/
|
||||
|
||||
snd_soc_component_update_bits(component, CS42L42_MCLK_SRC_SEL,
|
||||
CS42L42_MCLK_SRC_SEL_MASK |
|
||||
CS42L42_MCLKDIV_MASK,
|
||||
(pll_ratio_table[i].mclk_src_sel
|
||||
<< CS42L42_MCLK_SRC_SEL_SHIFT) |
|
||||
(pll_ratio_table[i].mclk_div <<
|
||||
CS42L42_MCLKDIV_SHIFT));
|
||||
/* Set up the LRCLK */
|
||||
@ -681,15 +668,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
|
||||
CS42L42_FSYNC_PULSE_WIDTH_MASK,
|
||||
CS42L42_FRAC1_VAL(fsync - 1) <<
|
||||
CS42L42_FSYNC_PULSE_WIDTH_SHIFT);
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_ASP_FRM_CFG,
|
||||
CS42L42_ASP_5050_MASK,
|
||||
CS42L42_ASP_5050_MASK);
|
||||
/* Set the frame delay to 1.0 SCLK clocks */
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_FRM_CFG,
|
||||
CS42L42_ASP_FSD_MASK,
|
||||
CS42L42_ASP_FSD_1_0 <<
|
||||
CS42L42_ASP_FSD_SHIFT);
|
||||
/* Set the sample rates (96k or lower) */
|
||||
snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN,
|
||||
CS42L42_FS_EN_MASK,
|
||||
@ -789,7 +767,18 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
/* interface format */
|
||||
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||
case SND_SOC_DAIFMT_I2S:
|
||||
case SND_SOC_DAIFMT_LEFT_J:
|
||||
/*
|
||||
* 5050 mode, frame starts on falling edge of LRCLK,
|
||||
* frame delayed by 1.0 SCLKs
|
||||
*/
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_ASP_FRM_CFG,
|
||||
CS42L42_ASP_STP_MASK |
|
||||
CS42L42_ASP_5050_MASK |
|
||||
CS42L42_ASP_FSD_MASK,
|
||||
CS42L42_ASP_5050_MASK |
|
||||
(CS42L42_ASP_FSD_1_0 <<
|
||||
CS42L42_ASP_FSD_SHIFT));
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@ -819,6 +808,25 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs42l42_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
/*
|
||||
* Sample rates < 44.1 kHz would produce an out-of-range SCLK with
|
||||
* a standard I2S frame. If the machine driver sets SCLK it must be
|
||||
* legal.
|
||||
*/
|
||||
if (cs42l42->sclk)
|
||||
return 0;
|
||||
|
||||
/* Machine driver has not set a SCLK, limit bottom end to 44.1 kHz */
|
||||
return snd_pcm_hw_constraint_minmax(substream->runtime,
|
||||
SNDRV_PCM_HW_PARAM_RATE,
|
||||
44100, 192000);
|
||||
}
|
||||
|
||||
static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
@ -832,6 +840,17 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
cs42l42->srate = params_rate(params);
|
||||
cs42l42->bclk = snd_soc_params_to_bclk(params);
|
||||
|
||||
/* I2S frame always has 2 channels even for mono audio */
|
||||
if (channels == 1)
|
||||
cs42l42->bclk *= 2;
|
||||
|
||||
/*
|
||||
* Assume 24-bit samples are in 32-bit slots, to prevent SCLK being
|
||||
* more than assumed (which would result in overclocking).
|
||||
*/
|
||||
if (params_width(params) == 24)
|
||||
cs42l42->bclk = (cs42l42->bclk / 3) * 4;
|
||||
|
||||
switch(substream->stream) {
|
||||
case SNDRV_PCM_STREAM_CAPTURE:
|
||||
if (channels == 2) {
|
||||
@ -855,6 +874,17 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES,
|
||||
CS42L42_ASP_RX_CH_AP_MASK |
|
||||
CS42L42_ASP_RX_CH_RES_MASK, val);
|
||||
|
||||
/* Channel B comes from the last active channel */
|
||||
snd_soc_component_update_bits(component, CS42L42_SP_RX_CH_SEL,
|
||||
CS42L42_SP_RX_CHB_SEL_MASK,
|
||||
(channels - 1) << CS42L42_SP_RX_CHB_SEL_SHIFT);
|
||||
|
||||
/* Both LRCLK slots must be enabled */
|
||||
snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_EN,
|
||||
CS42L42_ASP_RX0_CH_EN_MASK,
|
||||
BIT(CS42L42_ASP_RX0_CH1_SHIFT) |
|
||||
BIT(CS42L42_ASP_RX0_CH2_SHIFT));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -868,10 +898,23 @@ static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
|
||||
cs42l42->sclk = freq;
|
||||
if (freq == 0) {
|
||||
cs42l42->sclk = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
for (i = 0; i < ARRAY_SIZE(pll_ratio_table); i++) {
|
||||
if (pll_ratio_table[i].sclk == freq) {
|
||||
cs42l42->sclk = freq;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
dev_err(component->dev, "SCLK %u not supported\n", freq);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
@ -900,13 +943,21 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
*/
|
||||
regmap_multi_reg_write(cs42l42->regmap, cs42l42_to_osc_seq,
|
||||
ARRAY_SIZE(cs42l42_to_osc_seq));
|
||||
|
||||
/* Must disconnect PLL before stopping it */
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_MCLK_SRC_SEL,
|
||||
CS42L42_MCLK_SRC_SEL_MASK,
|
||||
0);
|
||||
usleep_range(100, 200);
|
||||
|
||||
snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
|
||||
CS42L42_PLL_START_MASK, 0);
|
||||
}
|
||||
} else {
|
||||
if (!cs42l42->stream_use) {
|
||||
/* SCLK must be running before codec unmute */
|
||||
if ((cs42l42->bclk < 11289600) && (cs42l42->sclk < 11289600)) {
|
||||
if (pll_ratio_table[cs42l42->pll_config].mclk_src_sel) {
|
||||
snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
|
||||
CS42L42_PLL_START_MASK, 1);
|
||||
|
||||
@ -927,6 +978,12 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
CS42L42_PLL_LOCK_TIMEOUT_US);
|
||||
if (ret < 0)
|
||||
dev_warn(component->dev, "PLL failed to lock: %d\n", ret);
|
||||
|
||||
/* PLL must be running to drive glitchless switch logic */
|
||||
snd_soc_component_update_bits(component,
|
||||
CS42L42_MCLK_SRC_SEL,
|
||||
CS42L42_MCLK_SRC_SEL_MASK,
|
||||
CS42L42_MCLK_SRC_SEL_MASK);
|
||||
}
|
||||
|
||||
/* Mark SCLK as present, turn off internal oscillator */
|
||||
@ -960,8 +1017,8 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
SNDRV_PCM_FMTBIT_S24_LE |\
|
||||
SNDRV_PCM_FMTBIT_S32_LE )
|
||||
|
||||
|
||||
static const struct snd_soc_dai_ops cs42l42_ops = {
|
||||
.startup = cs42l42_dai_startup,
|
||||
.hw_params = cs42l42_pcm_hw_params,
|
||||
.set_fmt = cs42l42_set_dai_fmt,
|
||||
.set_sysclk = cs42l42_set_sysclk,
|
||||
@ -2070,4 +2127,7 @@ MODULE_DESCRIPTION("ASoC CS42L42 driver");
|
||||
MODULE_AUTHOR("James Schulman, Cirrus Logic Inc, <james.schulman@cirrus.com>");
|
||||
MODULE_AUTHOR("Brian Austin, Cirrus Logic Inc, <brian.austin@cirrus.com>");
|
||||
MODULE_AUTHOR("Michael White, Cirrus Logic Inc, <michael.white@cirrus.com>");
|
||||
MODULE_AUTHOR("Lucas Tanure <tanureal@opensource.cirrus.com>");
|
||||
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
|
||||
MODULE_AUTHOR("Vitaly Rodionov <vitalyr@opensource.cirrus.com>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -653,6 +653,8 @@
|
||||
|
||||
/* Page 0x25 Audio Port Registers */
|
||||
#define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01)
|
||||
#define CS42L42_SP_RX_CHB_SEL_SHIFT 2
|
||||
#define CS42L42_SP_RX_CHB_SEL_MASK (3 << CS42L42_SP_RX_CHB_SEL_SHIFT)
|
||||
|
||||
#define CS42L42_SP_RX_ISOC_CTL (CS42L42_PAGE_25 + 0x02)
|
||||
#define CS42L42_SP_RX_RSYNC_SHIFT 6
|
||||
@ -775,6 +777,7 @@ struct cs42l42_private {
|
||||
struct gpio_desc *reset_gpio;
|
||||
struct completion pdn_done;
|
||||
struct snd_soc_jack *jack;
|
||||
int pll_config;
|
||||
int bclk;
|
||||
u32 sclk;
|
||||
u32 srate;
|
||||
|
@ -828,36 +828,6 @@ static void nau8824_int_status_clear_all(struct regmap *regmap)
|
||||
}
|
||||
}
|
||||
|
||||
static void nau8824_dapm_disable_pin(struct nau8824 *nau8824, const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = nau8824->dapm;
|
||||
const char *prefix = dapm->component->name_prefix;
|
||||
char prefixed_pin[80];
|
||||
|
||||
if (prefix) {
|
||||
snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
|
||||
prefix, pin);
|
||||
snd_soc_dapm_disable_pin(dapm, prefixed_pin);
|
||||
} else {
|
||||
snd_soc_dapm_disable_pin(dapm, pin);
|
||||
}
|
||||
}
|
||||
|
||||
static void nau8824_dapm_enable_pin(struct nau8824 *nau8824, const char *pin)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = nau8824->dapm;
|
||||
const char *prefix = dapm->component->name_prefix;
|
||||
char prefixed_pin[80];
|
||||
|
||||
if (prefix) {
|
||||
snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
|
||||
prefix, pin);
|
||||
snd_soc_dapm_force_enable_pin(dapm, prefixed_pin);
|
||||
} else {
|
||||
snd_soc_dapm_force_enable_pin(dapm, pin);
|
||||
}
|
||||
}
|
||||
|
||||
static void nau8824_eject_jack(struct nau8824 *nau8824)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = nau8824->dapm;
|
||||
@ -866,8 +836,8 @@ static void nau8824_eject_jack(struct nau8824 *nau8824)
|
||||
/* Clear all interruption status */
|
||||
nau8824_int_status_clear_all(regmap);
|
||||
|
||||
nau8824_dapm_disable_pin(nau8824, "SAR");
|
||||
nau8824_dapm_disable_pin(nau8824, "MICBIAS");
|
||||
snd_soc_dapm_disable_pin(dapm, "SAR");
|
||||
snd_soc_dapm_disable_pin(dapm, "MICBIAS");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
|
||||
/* Enable the insertion interruption, disable the ejection
|
||||
@ -897,8 +867,8 @@ static void nau8824_jdet_work(struct work_struct *work)
|
||||
struct regmap *regmap = nau8824->regmap;
|
||||
int adc_value, event = 0, event_mask = 0;
|
||||
|
||||
nau8824_dapm_enable_pin(nau8824, "MICBIAS");
|
||||
nau8824_dapm_enable_pin(nau8824, "SAR");
|
||||
snd_soc_dapm_enable_pin(dapm, "MICBIAS");
|
||||
snd_soc_dapm_enable_pin(dapm, "SAR");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
|
||||
msleep(100);
|
||||
@ -909,8 +879,8 @@ static void nau8824_jdet_work(struct work_struct *work)
|
||||
if (adc_value < HEADSET_SARADC_THD) {
|
||||
event |= SND_JACK_HEADPHONE;
|
||||
|
||||
nau8824_dapm_disable_pin(nau8824, "SAR");
|
||||
nau8824_dapm_disable_pin(nau8824, "MICBIAS");
|
||||
snd_soc_dapm_disable_pin(dapm, "SAR");
|
||||
snd_soc_dapm_disable_pin(dapm, "MICBIAS");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
} else {
|
||||
event |= SND_JACK_HEADSET;
|
||||
|
@ -1695,6 +1695,8 @@ static const struct regmap_config rt5631_regmap_config = {
|
||||
.reg_defaults = rt5631_reg,
|
||||
.num_reg_defaults = ARRAY_SIZE(rt5631_reg),
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
.use_single_read = true,
|
||||
.use_single_write = true,
|
||||
};
|
||||
|
||||
static int rt5631_i2c_probe(struct i2c_client *i2c,
|
||||
|
@ -44,6 +44,7 @@ static const struct reg_sequence patch_list[] = {
|
||||
{RT5682_I2C_CTRL, 0x000f},
|
||||
{RT5682_PLL2_INTERNAL, 0x8266},
|
||||
{RT5682_SAR_IL_CMD_3, 0x8365},
|
||||
{RT5682_SAR_IL_CMD_6, 0x0180},
|
||||
};
|
||||
|
||||
void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev)
|
||||
@ -973,10 +974,14 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
|
||||
rt5682_enable_push_button_irq(component, false);
|
||||
snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_1,
|
||||
RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_LOW);
|
||||
if (!snd_soc_dapm_get_pin_status(dapm, "MICBIAS"))
|
||||
if (!snd_soc_dapm_get_pin_status(dapm, "MICBIAS") &&
|
||||
!snd_soc_dapm_get_pin_status(dapm, "PLL1") &&
|
||||
!snd_soc_dapm_get_pin_status(dapm, "PLL2B"))
|
||||
snd_soc_component_update_bits(component,
|
||||
RT5682_PWR_ANLG_1, RT5682_PWR_MB, 0);
|
||||
if (!snd_soc_dapm_get_pin_status(dapm, "Vref2"))
|
||||
if (!snd_soc_dapm_get_pin_status(dapm, "Vref2") &&
|
||||
!snd_soc_dapm_get_pin_status(dapm, "PLL1") &&
|
||||
!snd_soc_dapm_get_pin_status(dapm, "PLL2B"))
|
||||
snd_soc_component_update_bits(component,
|
||||
RT5682_PWR_ANLG_1, RT5682_PWR_VREF2, 0);
|
||||
snd_soc_component_update_bits(component, RT5682_PWR_ANLG_3,
|
||||
|
@ -35,6 +35,9 @@
|
||||
|
||||
#include "tlv320aic31xx.h"
|
||||
|
||||
static int aic31xx_set_jack(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *jack, void *data);
|
||||
|
||||
static const struct reg_default aic31xx_reg_defaults[] = {
|
||||
{ AIC31XX_CLKMUX, 0x00 },
|
||||
{ AIC31XX_PLLPR, 0x11 },
|
||||
@ -1256,6 +1259,13 @@ static int aic31xx_power_on(struct snd_soc_component *component)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* The jack detection configuration is in the same register
|
||||
* that is used to report jack detect status so is volatile
|
||||
* and not covered by the cache sync, restore it separately.
|
||||
*/
|
||||
aic31xx_set_jack(component, aic31xx->jack, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1604,6 +1614,8 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
regcache_cache_only(aic31xx->regmap, true);
|
||||
|
||||
aic31xx->dev = &i2c->dev;
|
||||
aic31xx->irq = i2c->irq;
|
||||
|
||||
|
@ -250,8 +250,8 @@ static DECLARE_TLV_DB_SCALE(tlv_pcm, -6350, 50, 0);
|
||||
static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0);
|
||||
/* -12dB min, 0.5dB steps */
|
||||
static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0);
|
||||
|
||||
static DECLARE_TLV_DB_LINEAR(tlv_spk_vol, TLV_DB_GAIN_MUTE, 0);
|
||||
/* -6dB min, 1dB steps */
|
||||
static DECLARE_TLV_DB_SCALE(tlv_tas_driver_gain, -5850, 50, 0);
|
||||
static DECLARE_TLV_DB_SCALE(tlv_amp_vol, 0, 600, 1);
|
||||
|
||||
static const char * const lo_cm_text[] = {
|
||||
@ -682,11 +682,20 @@ static int aic32x4_set_dosr(struct snd_soc_component *component, u16 dosr)
|
||||
static int aic32x4_set_processing_blocks(struct snd_soc_component *component,
|
||||
u8 r_block, u8 p_block)
|
||||
{
|
||||
if (r_block > 18 || p_block > 25)
|
||||
return -EINVAL;
|
||||
struct aic32x4_priv *aic32x4 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
snd_soc_component_write(component, AIC32X4_ADCSPB, r_block);
|
||||
snd_soc_component_write(component, AIC32X4_DACSPB, p_block);
|
||||
if (aic32x4->type == AIC32X4_TYPE_TAS2505) {
|
||||
if (r_block || p_block > 3)
|
||||
return -EINVAL;
|
||||
|
||||
snd_soc_component_write(component, AIC32X4_DACSPB, p_block);
|
||||
} else { /* AIC32x4 */
|
||||
if (r_block > 18 || p_block > 25)
|
||||
return -EINVAL;
|
||||
|
||||
snd_soc_component_write(component, AIC32X4_ADCSPB, r_block);
|
||||
snd_soc_component_write(component, AIC32X4_DACSPB, p_block);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -695,6 +704,7 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
|
||||
unsigned int sample_rate, unsigned int channels,
|
||||
unsigned int bit_depth)
|
||||
{
|
||||
struct aic32x4_priv *aic32x4 = snd_soc_component_get_drvdata(component);
|
||||
u8 aosr;
|
||||
u16 dosr;
|
||||
u8 adc_resource_class, dac_resource_class;
|
||||
@ -721,19 +731,28 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
|
||||
adc_resource_class = 6;
|
||||
dac_resource_class = 8;
|
||||
dosr_increment = 8;
|
||||
aic32x4_set_processing_blocks(component, 1, 1);
|
||||
if (aic32x4->type == AIC32X4_TYPE_TAS2505)
|
||||
aic32x4_set_processing_blocks(component, 0, 1);
|
||||
else
|
||||
aic32x4_set_processing_blocks(component, 1, 1);
|
||||
} else if (sample_rate <= 96000) {
|
||||
aosr = 64;
|
||||
adc_resource_class = 6;
|
||||
dac_resource_class = 8;
|
||||
dosr_increment = 4;
|
||||
aic32x4_set_processing_blocks(component, 1, 9);
|
||||
if (aic32x4->type == AIC32X4_TYPE_TAS2505)
|
||||
aic32x4_set_processing_blocks(component, 0, 1);
|
||||
else
|
||||
aic32x4_set_processing_blocks(component, 1, 9);
|
||||
} else if (sample_rate == 192000) {
|
||||
aosr = 32;
|
||||
adc_resource_class = 3;
|
||||
dac_resource_class = 4;
|
||||
dosr_increment = 2;
|
||||
aic32x4_set_processing_blocks(component, 13, 19);
|
||||
if (aic32x4->type == AIC32X4_TYPE_TAS2505)
|
||||
aic32x4_set_processing_blocks(component, 0, 1);
|
||||
else
|
||||
aic32x4_set_processing_blocks(component, 13, 19);
|
||||
} else {
|
||||
dev_err(component->dev, "Sampling rate not supported\n");
|
||||
return -EINVAL;
|
||||
@ -1063,21 +1082,20 @@ static const struct snd_soc_component_driver soc_component_dev_aic32x4 = {
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new aic32x4_tas2505_snd_controls[] = {
|
||||
SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL,
|
||||
AIC32X4_LDACVOL, 0, -0x7f, 0x30, 7, 0, tlv_pcm),
|
||||
SOC_SINGLE_S8_TLV("PCM Playback Volume",
|
||||
AIC32X4_LDACVOL, -0x7f, 0x30, tlv_pcm),
|
||||
SOC_ENUM("DAC Playback PowerTune Switch", l_ptm_enum),
|
||||
SOC_DOUBLE_R_S_TLV("HP Driver Playback Volume", AIC32X4_HPLGAIN,
|
||||
AIC32X4_HPLGAIN, 0, -0x6, 0x1d, 5, 0,
|
||||
tlv_driver_gain),
|
||||
SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN,
|
||||
AIC32X4_HPLGAIN, 6, 0x01, 1),
|
||||
|
||||
SOC_SINGLE_TLV("HP Driver Gain Volume",
|
||||
AIC32X4_HPLGAIN, 0, 0x74, 1, tlv_tas_driver_gain),
|
||||
SOC_SINGLE("HP DAC Playback Switch", AIC32X4_HPLGAIN, 6, 1, 1),
|
||||
|
||||
SOC_SINGLE_TLV("Speaker Driver Playback Volume",
|
||||
TAS2505_SPKVOL1, 0, 0x74, 1, tlv_tas_driver_gain),
|
||||
SOC_SINGLE_TLV("Speaker Amplifier Playback Volume",
|
||||
TAS2505_SPKVOL2, 4, 5, 0, tlv_amp_vol),
|
||||
|
||||
SOC_SINGLE("Auto-mute Switch", AIC32X4_DACMUTE, 4, 7, 0),
|
||||
|
||||
SOC_SINGLE_RANGE_TLV("Speaker Driver Playback Volume", TAS2505_SPKVOL1,
|
||||
0, 0, 117, 1, tlv_spk_vol),
|
||||
SOC_SINGLE_TLV("Speaker Amplifier Playback Volume", TAS2505_SPKVOL2,
|
||||
4, 5, 0, tlv_amp_vol),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new hp_output_mixer_controls[] = {
|
||||
|
@ -4076,13 +4076,6 @@ static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
|
||||
(WCD938X_DIGITAL_INTR_LEVEL_0 + i), 0);
|
||||
}
|
||||
|
||||
ret = wcd938x_irq_init(wcd938x, component->dev);
|
||||
if (ret) {
|
||||
dev_err(component->dev, "%s: IRQ init failed: %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
wcd938x->hphr_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip,
|
||||
WCD938X_IRQ_HPHR_PDM_WD_INT);
|
||||
wcd938x->hphl_pdm_wd_int = regmap_irq_get_virq(wcd938x->irq_chip,
|
||||
@ -4342,7 +4335,6 @@ static int wcd938x_bind(struct device *dev)
|
||||
}
|
||||
wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev);
|
||||
wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x;
|
||||
wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq;
|
||||
|
||||
wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode);
|
||||
if (!wcd938x->txdev) {
|
||||
@ -4351,7 +4343,6 @@ static int wcd938x_bind(struct device *dev)
|
||||
}
|
||||
wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev);
|
||||
wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x;
|
||||
wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq;
|
||||
wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev);
|
||||
if (!wcd938x->tx_sdw_dev) {
|
||||
dev_err(dev, "could not get txslave with matching of dev\n");
|
||||
@ -4384,6 +4375,15 @@ static int wcd938x_bind(struct device *dev)
|
||||
return PTR_ERR(wcd938x->regmap);
|
||||
}
|
||||
|
||||
ret = wcd938x_irq_init(wcd938x, dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "%s: IRQ init failed: %d\n", __func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq;
|
||||
wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq;
|
||||
|
||||
ret = wcd938x_set_micbias_data(wcd938x);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "%s: bad micbias pdata\n", __func__);
|
||||
|
@ -747,7 +747,6 @@ static void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
|
||||
static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp)
|
||||
{
|
||||
wm_adsp_debugfs_clear(dsp);
|
||||
debugfs_remove_recursive(dsp->debugfs_root);
|
||||
}
|
||||
#else
|
||||
static inline void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
|
||||
|
@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,
|
||||
snd_pcm_uframes_t period_size;
|
||||
ssize_t periodbytes;
|
||||
ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
|
||||
u32 buffer_addr = virt_to_phys(substream->dma_buffer.area);
|
||||
u32 buffer_addr = substream->runtime->dma_addr;
|
||||
|
||||
channels = substream->runtime->channels;
|
||||
period_size = substream->runtime->period_size;
|
||||
@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
|
||||
/* set codec params and inform SST driver the same */
|
||||
sst_fill_pcm_params(substream, ¶m);
|
||||
sst_fill_alloc_params(substream, &alloc_params);
|
||||
substream->runtime->dma_area = substream->dma_buffer.area;
|
||||
str_params.sparams = param;
|
||||
str_params.aparams = alloc_params;
|
||||
str_params.codec = SST_CODEC_TYPE_PCM;
|
||||
|
@ -404,7 +404,7 @@ static int audio_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
/* By default dais[0] is configured for max98373 */
|
||||
if (!strcmp(pdev->name, "sof_da7219_max98360a")) {
|
||||
if (!strcmp(pdev->name, "sof_da7219_mx98360a")) {
|
||||
dais[0] = (struct snd_soc_dai_link) {
|
||||
.name = "SSP1-Codec",
|
||||
.id = 0,
|
||||
|
@ -104,8 +104,6 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
|
||||
int err;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
|
||||
const struct mbus_dram_target_info *dram;
|
||||
unsigned long addr;
|
||||
|
||||
snd_soc_set_runtime_hwparams(substream, &kirkwood_dma_snd_hw);
|
||||
|
||||
@ -142,20 +140,14 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
|
||||
writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK);
|
||||
}
|
||||
|
||||
dram = mv_mbus_dram_info();
|
||||
addr = substream->dma_buffer.addr;
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
if (priv->substream_play)
|
||||
return -EBUSY;
|
||||
priv->substream_play = substream;
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_PLAYBACK_WIN, addr, dram);
|
||||
} else {
|
||||
if (priv->substream_rec)
|
||||
return -EBUSY;
|
||||
priv->substream_rec = substream;
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_RECORD_WIN, addr, dram);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -182,6 +174,23 @@ static int kirkwood_dma_close(struct snd_soc_component *component,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirkwood_dma_hw_params(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
|
||||
const struct mbus_dram_target_info *dram = mv_mbus_dram_info();
|
||||
unsigned long addr = substream->runtime->dma_addr;
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_PLAYBACK_WIN, addr, dram);
|
||||
else
|
||||
kirkwood_dma_conf_mbus_windows(priv->io,
|
||||
KIRKWOOD_RECORD_WIN, addr, dram);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kirkwood_dma_prepare(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
@ -246,6 +255,7 @@ const struct snd_soc_component_driver kirkwood_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.open = kirkwood_dma_open,
|
||||
.close = kirkwood_dma_close,
|
||||
.hw_params = kirkwood_dma_hw_params,
|
||||
.prepare = kirkwood_dma_prepare,
|
||||
.pointer = kirkwood_dma_pointer,
|
||||
.pcm_construct = kirkwood_dma_new,
|
||||
|
@ -148,86 +148,75 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
|
||||
return soc_component_ret(component, ret);
|
||||
}
|
||||
|
||||
static int soc_component_pin(struct snd_soc_component *component,
|
||||
const char *pin,
|
||||
int (*pin_func)(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin))
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
char *full_name;
|
||||
int ret;
|
||||
|
||||
if (!component->name_prefix) {
|
||||
ret = pin_func(dapm, pin);
|
||||
goto end;
|
||||
}
|
||||
|
||||
full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
||||
if (!full_name) {
|
||||
ret = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = pin_func(dapm, full_name);
|
||||
kfree(full_name);
|
||||
end:
|
||||
return soc_component_ret(component, ret);
|
||||
}
|
||||
|
||||
int snd_soc_component_enable_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_enable_pin);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_enable_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin);
|
||||
|
||||
int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_enable_pin_unlocked);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_enable_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked);
|
||||
|
||||
int snd_soc_component_disable_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_disable_pin);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_disable_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin);
|
||||
|
||||
int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_disable_pin_unlocked);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_disable_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked);
|
||||
|
||||
int snd_soc_component_nc_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_nc_pin);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_nc_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin);
|
||||
|
||||
int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_nc_pin_unlocked);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_nc_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked);
|
||||
|
||||
int snd_soc_component_get_pin_status(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_get_pin_status);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_get_pin_status(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status);
|
||||
|
||||
int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_force_enable_pin(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin);
|
||||
|
||||
@ -235,7 +224,9 @@ int snd_soc_component_force_enable_pin_unlocked(
|
||||
struct snd_soc_component *component,
|
||||
const char *pin)
|
||||
{
|
||||
return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin_unlocked);
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(component);
|
||||
return snd_soc_dapm_force_enable_pin_unlocked(dapm, pin);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked);
|
||||
|
||||
|
@ -1014,6 +1014,7 @@ out:
|
||||
|
||||
static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
int ret = -EINVAL, _ret = 0;
|
||||
int rollback = 0;
|
||||
|
||||
@ -1054,14 +1055,23 @@ start_err:
|
||||
case SNDRV_PCM_TRIGGER_STOP:
|
||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
||||
ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback);
|
||||
if (ret < 0)
|
||||
break;
|
||||
if (rtd->dai_link->stop_dma_first) {
|
||||
ret = snd_soc_pcm_component_trigger(substream, cmd, rollback);
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
||||
ret = snd_soc_pcm_component_trigger(substream, cmd, rollback);
|
||||
if (ret < 0)
|
||||
break;
|
||||
ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback);
|
||||
if (ret < 0)
|
||||
break;
|
||||
} else {
|
||||
ret = snd_soc_pcm_dai_trigger(substream, cmd, rollback);
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
||||
ret = snd_soc_pcm_component_trigger(substream, cmd, rollback);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
ret = snd_soc_link_trigger(substream, cmd, rollback);
|
||||
break;
|
||||
}
|
||||
|
@ -278,6 +278,8 @@ config SND_SOC_SOF_HDA
|
||||
|
||||
config SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
|
||||
tristate
|
||||
select SOUNDWIRE_INTEL if SND_SOC_SOF_INTEL_SOUNDWIRE
|
||||
select SND_INTEL_SOUNDWIRE_ACPI if SND_SOC_SOF_INTEL_SOUNDWIRE
|
||||
|
||||
config SND_SOC_SOF_INTEL_SOUNDWIRE
|
||||
tristate "SOF support for SoundWire"
|
||||
@ -285,8 +287,6 @@ config SND_SOC_SOF_INTEL_SOUNDWIRE
|
||||
depends on SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
|
||||
depends on ACPI && SOUNDWIRE
|
||||
depends on !(SOUNDWIRE=m && SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE=y)
|
||||
select SOUNDWIRE_INTEL
|
||||
select SND_INTEL_SOUNDWIRE_ACPI
|
||||
help
|
||||
This adds support for SoundWire with Sound Open Firmware
|
||||
for Intel(R) platforms.
|
||||
|
@ -107,8 +107,8 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev)
|
||||
} else {
|
||||
/* reply correct size ? */
|
||||
if (reply.hdr.size != msg->reply_size &&
|
||||
/* getter payload is never known upfront */
|
||||
!(reply.hdr.cmd & SOF_IPC_GLB_PROBE)) {
|
||||
/* getter payload is never known upfront */
|
||||
((reply.hdr.cmd & SOF_GLB_TYPE_MASK) != SOF_IPC_GLB_PROBE)) {
|
||||
dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n",
|
||||
msg->reply_size, reply.hdr.size);
|
||||
ret = -EINVAL;
|
||||
|
@ -200,12 +200,16 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev)
|
||||
int hda_sdw_startup(struct snd_sof_dev *sdev)
|
||||
{
|
||||
struct sof_intel_hda_dev *hdev;
|
||||
struct snd_sof_pdata *pdata = sdev->pdata;
|
||||
|
||||
hdev = sdev->pdata->hw_pdata;
|
||||
|
||||
if (!hdev->sdw)
|
||||
return 0;
|
||||
|
||||
if (pdata->machine && !pdata->machine->mach_params.link_mask)
|
||||
return 0;
|
||||
|
||||
return sdw_intel_startup(hdev->sdw);
|
||||
}
|
||||
|
||||
@ -1015,6 +1019,14 @@ static int hda_generic_machine_select(struct snd_sof_dev *sdev)
|
||||
hda_mach->mach_params.dmic_num = dmic_num;
|
||||
pdata->machine = hda_mach;
|
||||
pdata->tplg_filename = tplg_filename;
|
||||
|
||||
if (codec_num == 2) {
|
||||
/*
|
||||
* Prevent SoundWire links from starting when an external
|
||||
* HDaudio codec is used
|
||||
*/
|
||||
hda_mach->mach_params.link_mask = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +89,7 @@ static const struct sof_dev_desc adls_desc = {
|
||||
static const struct sof_dev_desc adl_desc = {
|
||||
.machines = snd_soc_acpi_intel_adl_machines,
|
||||
.alt_machines = snd_soc_acpi_intel_adl_sdw_machines,
|
||||
.use_acpi_target_states = true,
|
||||
.resindex_lpe_base = 0,
|
||||
.resindex_pcicfg_base = -1,
|
||||
.resindex_imr_base = -1,
|
||||
|
@ -213,19 +213,19 @@ snd_pcm_uframes_t tegra_pcm_pointer(struct snd_soc_component *component,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_pcm_pointer);
|
||||
|
||||
static int tegra_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream,
|
||||
static int tegra_pcm_preallocate_dma_buffer(struct device *dev, struct snd_pcm *pcm, int stream,
|
||||
size_t size)
|
||||
{
|
||||
struct snd_pcm_substream *substream = pcm->streams[stream].substream;
|
||||
struct snd_dma_buffer *buf = &substream->dma_buffer;
|
||||
|
||||
buf->area = dma_alloc_wc(pcm->card->dev, size, &buf->addr, GFP_KERNEL);
|
||||
buf->area = dma_alloc_wc(dev, size, &buf->addr, GFP_KERNEL);
|
||||
if (!buf->area)
|
||||
return -ENOMEM;
|
||||
|
||||
buf->private_data = NULL;
|
||||
buf->dev.type = SNDRV_DMA_TYPE_DEV;
|
||||
buf->dev.dev = pcm->card->dev;
|
||||
buf->dev.dev = dev;
|
||||
buf->bytes = size;
|
||||
|
||||
return 0;
|
||||
@ -244,31 +244,28 @@ static void tegra_pcm_deallocate_dma_buffer(struct snd_pcm *pcm, int stream)
|
||||
if (!buf->area)
|
||||
return;
|
||||
|
||||
dma_free_wc(pcm->card->dev, buf->bytes, buf->area, buf->addr);
|
||||
dma_free_wc(buf->dev.dev, buf->bytes, buf->area, buf->addr);
|
||||
buf->area = NULL;
|
||||
}
|
||||
|
||||
static int tegra_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd,
|
||||
static int tegra_pcm_dma_allocate(struct device *dev, struct snd_soc_pcm_runtime *rtd,
|
||||
size_t size)
|
||||
{
|
||||
struct snd_card *card = rtd->card->snd_card;
|
||||
struct snd_pcm *pcm = rtd->pcm;
|
||||
int ret;
|
||||
|
||||
ret = dma_set_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
|
||||
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
|
||||
ret = tegra_pcm_preallocate_dma_buffer(pcm,
|
||||
SNDRV_PCM_STREAM_PLAYBACK, size);
|
||||
ret = tegra_pcm_preallocate_dma_buffer(dev, pcm, SNDRV_PCM_STREAM_PLAYBACK, size);
|
||||
if (ret)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
|
||||
ret = tegra_pcm_preallocate_dma_buffer(pcm,
|
||||
SNDRV_PCM_STREAM_CAPTURE, size);
|
||||
ret = tegra_pcm_preallocate_dma_buffer(dev, pcm, SNDRV_PCM_STREAM_CAPTURE, size);
|
||||
if (ret)
|
||||
goto err_free_play;
|
||||
}
|
||||
@ -284,7 +281,16 @@ err:
|
||||
int tegra_pcm_construct(struct snd_soc_component *component,
|
||||
struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
return tegra_pcm_dma_allocate(rtd, tegra_pcm_hardware.buffer_bytes_max);
|
||||
struct device *dev = component->dev;
|
||||
|
||||
/*
|
||||
* Fallback for backwards-compatibility with older device trees that
|
||||
* have the iommus property in the virtual, top-level "sound" node.
|
||||
*/
|
||||
if (!of_get_property(dev->of_node, "iommus", NULL))
|
||||
dev = rtd->card->snd_card->dev;
|
||||
|
||||
return tegra_pcm_dma_allocate(dev, rtd, tegra_pcm_hardware.buffer_bytes_max);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tegra_pcm_construct);
|
||||
|
||||
|
@ -200,7 +200,7 @@ static int j721e_configure_refclk(struct j721e_priv *priv,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (priv->hsdiv_rates[domain->parent_clk_id] != scki) {
|
||||
if (domain->parent_clk_id == -1 || priv->hsdiv_rates[domain->parent_clk_id] != scki) {
|
||||
dev_dbg(priv->dev,
|
||||
"domain%u configuration for %u Hz: %s, %dxFS (SCKI: %u Hz)\n",
|
||||
audio_domain, rate,
|
||||
@ -281,23 +281,29 @@ static int j721e_audio_startup(struct snd_pcm_substream *substream)
|
||||
j721e_rule_rate, &priv->rate_range,
|
||||
SNDRV_PCM_HW_PARAM_RATE, -1);
|
||||
|
||||
mutex_unlock(&priv->mutex);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
|
||||
/* Reset TDM slots to 32 */
|
||||
ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, 32);
|
||||
if (ret && ret != -ENOTSUPP)
|
||||
return ret;
|
||||
goto out;
|
||||
|
||||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 2, 32);
|
||||
if (ret && ret != -ENOTSUPP)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (ret == -ENOTSUPP)
|
||||
ret = 0;
|
||||
out:
|
||||
if (ret)
|
||||
domain->active--;
|
||||
mutex_unlock(&priv->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int j721e_audio_hw_params(struct snd_pcm_substream *substream,
|
||||
|
@ -198,7 +198,7 @@ static int uniphier_aiodma_mmap(struct snd_soc_component *component,
|
||||
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
|
||||
|
||||
return remap_pfn_range(vma, vma->vm_start,
|
||||
substream->dma_buffer.addr >> PAGE_SHIFT,
|
||||
substream->runtime->dma_addr >> PAGE_SHIFT,
|
||||
vma->vm_end - vma->vm_start, vma->vm_page_prot);
|
||||
}
|
||||
|
||||
|
@ -452,8 +452,8 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
|
||||
|
||||
stream_data->buffer_size = size;
|
||||
|
||||
low = lower_32_bits(substream->dma_buffer.addr);
|
||||
high = upper_32_bits(substream->dma_buffer.addr);
|
||||
low = lower_32_bits(runtime->dma_addr);
|
||||
high = upper_32_bits(runtime->dma_addr);
|
||||
writel(low, stream_data->mmio + XLNX_AUD_BUFF_ADDR_LSB);
|
||||
writel(high, stream_data->mmio + XLNX_AUD_BUFF_ADDR_MSB);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user