Commit ad797a04 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'for-linus' into for-next

parents 9732c148 dc0dc8a7
...@@ -19992,7 +19992,8 @@ F: Documentation/devicetree/bindings/extcon/wlf,arizona.yaml ...@@ -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/wlf,arizona.yaml
F: Documentation/devicetree/bindings/mfd/wm831x.txt F: Documentation/devicetree/bindings/mfd/wm831x.txt
F: Documentation/devicetree/bindings/regulator/wlf,arizona.yaml 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: Documentation/hwmon/wm83??.rst
F: arch/arm/mach-s3c/mach-crag6410* F: arch/arm/mach-s3c/mach-crag6410*
F: drivers/clk/clk-wm83*.c F: drivers/clk/clk-wm83*.c
......
...@@ -251,7 +251,10 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream) ...@@ -251,7 +251,10 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream)
switch (substream->dma_buffer.dev.type) { switch (substream->dma_buffer.dev.type) {
case SNDRV_DMA_TYPE_UNKNOWN: case SNDRV_DMA_TYPE_UNKNOWN:
return false; /* we can't know the device, so just assume that the driver does
* everything right
*/
return true;
case SNDRV_DMA_TYPE_CONTINUOUS: case SNDRV_DMA_TYPE_CONTINUOUS:
case SNDRV_DMA_TYPE_VMALLOC: case SNDRV_DMA_TYPE_VMALLOC:
return true; return true;
......
...@@ -514,10 +514,11 @@ static int check_and_subscribe_port(struct snd_seq_client *client, ...@@ -514,10 +514,11 @@ static int check_and_subscribe_port(struct snd_seq_client *client,
return err; return err;
} }
static void delete_and_unsubscribe_port(struct snd_seq_client *client, /* called with grp->list_mutex held */
struct snd_seq_client_port *port, static void __delete_and_unsubscribe_port(struct snd_seq_client *client,
struct snd_seq_subscribers *subs, struct snd_seq_client_port *port,
bool is_src, bool ack) struct snd_seq_subscribers *subs,
bool is_src, bool ack)
{ {
struct snd_seq_port_subs_info *grp; struct snd_seq_port_subs_info *grp;
struct list_head *list; struct list_head *list;
...@@ -525,7 +526,6 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, ...@@ -525,7 +526,6 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client,
grp = is_src ? &port->c_src : &port->c_dest; grp = is_src ? &port->c_src : &port->c_dest;
list = is_src ? &subs->src_list : &subs->dest_list; list = is_src ? &subs->src_list : &subs->dest_list;
down_write(&grp->list_mutex);
write_lock_irq(&grp->list_lock); write_lock_irq(&grp->list_lock);
empty = list_empty(list); empty = list_empty(list);
if (!empty) if (!empty)
...@@ -535,6 +535,18 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, ...@@ -535,6 +535,18 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client,
if (!empty) if (!empty)
unsubscribe_port(client, port, grp, &subs->info, ack); unsubscribe_port(client, port, grp, &subs->info, ack);
}
static void delete_and_unsubscribe_port(struct snd_seq_client *client,
struct snd_seq_client_port *port,
struct snd_seq_subscribers *subs,
bool is_src, bool ack)
{
struct snd_seq_port_subs_info *grp;
grp = is_src ? &port->c_src : &port->c_dest;
down_write(&grp->list_mutex);
__delete_and_unsubscribe_port(client, port, subs, is_src, ack);
up_write(&grp->list_mutex); up_write(&grp->list_mutex);
} }
...@@ -590,27 +602,30 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, ...@@ -590,27 +602,30 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector,
struct snd_seq_client_port *dest_port, struct snd_seq_client_port *dest_port,
struct snd_seq_port_subscribe *info) struct snd_seq_port_subscribe *info)
{ {
struct snd_seq_port_subs_info *src = &src_port->c_src; struct snd_seq_port_subs_info *dest = &dest_port->c_dest;
struct snd_seq_subscribers *subs; struct snd_seq_subscribers *subs;
int err = -ENOENT; int err = -ENOENT;
down_write(&src->list_mutex); /* always start from deleting the dest port for avoiding concurrent
* deletions
*/
down_write(&dest->list_mutex);
/* look for the connection */ /* look for the connection */
list_for_each_entry(subs, &src->list_head, src_list) { list_for_each_entry(subs, &dest->list_head, dest_list) {
if (match_subs_info(info, &subs->info)) { if (match_subs_info(info, &subs->info)) {
atomic_dec(&subs->ref_count); /* mark as not ready */ __delete_and_unsubscribe_port(dest_client, dest_port,
subs, false,
connector->number != dest_client->number);
err = 0; err = 0;
break; break;
} }
} }
up_write(&src->list_mutex); up_write(&dest->list_mutex);
if (err < 0) if (err < 0)
return err; return err;
delete_and_unsubscribe_port(src_client, src_port, subs, true, delete_and_unsubscribe_port(src_client, src_port, subs, true,
connector->number != src_client->number); connector->number != src_client->number);
delete_and_unsubscribe_port(dest_client, dest_port, subs, false,
connector->number != dest_client->number);
kfree(subs); kfree(subs);
return 0; return 0;
} }
......
...@@ -8465,6 +8465,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { ...@@ -8465,6 +8465,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
......
...@@ -36,6 +36,7 @@ config SND_SOC_COMPRESS ...@@ -36,6 +36,7 @@ config SND_SOC_COMPRESS
config SND_SOC_TOPOLOGY config SND_SOC_TOPOLOGY
bool bool
select SND_DYNAMIC_MINORS
config SND_SOC_TOPOLOGY_KUNIT_TEST config SND_SOC_TOPOLOGY_KUNIT_TEST
tristate "KUnit tests for SoC topology" tristate "KUnit tests for SoC topology"
......
...@@ -525,6 +525,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { ...@@ -525,6 +525,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = {
| SND_SOC_DAIFMT_CBM_CFM, | SND_SOC_DAIFMT_CBM_CFM,
.init = cz_da7219_init, .init = cz_da7219_init,
.dpcm_playback = 1, .dpcm_playback = 1,
.stop_dma_first = 1,
.ops = &cz_da7219_play_ops, .ops = &cz_da7219_play_ops,
SND_SOC_DAILINK_REG(designware1, dlgs, platform), SND_SOC_DAILINK_REG(designware1, dlgs, platform),
}, },
...@@ -534,6 +535,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { ...@@ -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 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM, | SND_SOC_DAIFMT_CBM_CFM,
.dpcm_capture = 1, .dpcm_capture = 1,
.stop_dma_first = 1,
.ops = &cz_da7219_cap_ops, .ops = &cz_da7219_cap_ops,
SND_SOC_DAILINK_REG(designware2, dlgs, platform), SND_SOC_DAILINK_REG(designware2, dlgs, platform),
}, },
...@@ -543,6 +545,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { ...@@ -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 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM, | SND_SOC_DAIFMT_CBM_CFM,
.dpcm_playback = 1, .dpcm_playback = 1,
.stop_dma_first = 1,
.ops = &cz_max_play_ops, .ops = &cz_max_play_ops,
SND_SOC_DAILINK_REG(designware3, mx, platform), SND_SOC_DAILINK_REG(designware3, mx, platform),
}, },
...@@ -553,6 +556,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { ...@@ -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 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM, | SND_SOC_DAIFMT_CBM_CFM,
.dpcm_capture = 1, .dpcm_capture = 1,
.stop_dma_first = 1,
.ops = &cz_dmic0_cap_ops, .ops = &cz_dmic0_cap_ops,
SND_SOC_DAILINK_REG(designware3, adau, platform), SND_SOC_DAILINK_REG(designware3, adau, platform),
}, },
...@@ -563,6 +567,7 @@ static struct snd_soc_dai_link cz_dai_7219_98357[] = { ...@@ -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 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM, | SND_SOC_DAIFMT_CBM_CFM,
.dpcm_capture = 1, .dpcm_capture = 1,
.stop_dma_first = 1,
.ops = &cz_dmic1_cap_ops, .ops = &cz_dmic1_cap_ops,
SND_SOC_DAILINK_REG(designware2, adau, platform), SND_SOC_DAILINK_REG(designware2, adau, platform),
}, },
......
...@@ -969,7 +969,7 @@ static int acp_dma_hw_params(struct snd_soc_component *component, ...@@ -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); acp_set_sram_bank_state(rtd->acp_mmio, 0, true);
/* Save for runtime private data */ /* Save for runtime private data */
rtd->dma_addr = substream->dma_buffer.addr; rtd->dma_addr = runtime->dma_addr;
rtd->order = get_order(size); rtd->order = get_order(size);
/* Fill the page table entries in ACP SRAM */ /* Fill the page table entries in ACP SRAM */
......
...@@ -286,7 +286,7 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component, ...@@ -286,7 +286,7 @@ static int acp3x_dma_hw_params(struct snd_soc_component *component,
pr_err("pinfo failed\n"); pr_err("pinfo failed\n");
} }
size = params_buffer_bytes(params); 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); rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
config_acp3x_dma(rtd, substream->stream); config_acp3x_dma(rtd, substream->stream);
return 0; return 0;
......
...@@ -242,7 +242,7 @@ static int acp_pdm_dma_hw_params(struct snd_soc_component *component, ...@@ -242,7 +242,7 @@ static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
return -EINVAL; return -EINVAL;
size = params_buffer_bytes(params); size = params_buffer_bytes(params);
period_bytes = params_period_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); rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
config_acp_dma(rtd, substream->stream); config_acp_dma(rtd, substream->stream);
init_pdm_ring_buffer(MEM_WINDOW_START, size, period_bytes, init_pdm_ring_buffer(MEM_WINDOW_START, size, period_bytes,
......
...@@ -382,6 +382,8 @@ static const struct dev_pm_ops rn_acp_pm = { ...@@ -382,6 +382,8 @@ static const struct dev_pm_ops rn_acp_pm = {
.runtime_resume = snd_rn_acp_resume, .runtime_resume = snd_rn_acp_resume,
.suspend = snd_rn_acp_suspend, .suspend = snd_rn_acp_suspend,
.resume = snd_rn_acp_resume, .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) static void snd_rn_acp_remove(struct pci_dev *pci)
......
...@@ -1559,6 +1559,7 @@ config SND_SOC_WCD934X ...@@ -1559,6 +1559,7 @@ config SND_SOC_WCD934X
config SND_SOC_WCD938X config SND_SOC_WCD938X
depends on SND_SOC_WCD938X_SDW depends on SND_SOC_WCD938X_SDW
tristate tristate
depends on SOUNDWIRE || !SOUNDWIRE
config SND_SOC_WCD938X_SDW config SND_SOC_WCD938X_SDW
tristate "WCD9380/WCD9385 Codec - SDW" tristate "WCD9380/WCD9385 Codec - SDW"
......
...@@ -583,7 +583,10 @@ obj-$(CONFIG_SND_SOC_WCD_MBHC) += snd-soc-wcd-mbhc.o ...@@ -583,7 +583,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_WCD9335) += snd-soc-wcd9335.o
obj-$(CONFIG_SND_SOC_WCD934X) += snd-soc-wcd934x.o obj-$(CONFIG_SND_SOC_WCD934X) += snd-soc-wcd934x.o
obj-$(CONFIG_SND_SOC_WCD938X) += snd-soc-wcd938x.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_WL1273) += snd-soc-wl1273.o
obj-$(CONFIG_SND_SOC_WM0010) += snd-soc-wm0010.o obj-$(CONFIG_SND_SOC_WM0010) += snd-soc-wm0010.o
obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o
......
...@@ -405,7 +405,7 @@ static const struct regmap_config cs42l42_regmap = { ...@@ -405,7 +405,7 @@ static const struct regmap_config cs42l42_regmap = {
.use_single_write = true, .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 DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true);
static const char * const cs42l42_hpf_freq_text[] = { 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, ...@@ -425,34 +425,23 @@ static SOC_ENUM_SINGLE_DECL(cs42l42_wnf3_freq_enum, CS42L42_ADC_WNF_HPF_CTL,
CS42L42_ADC_WNF_CF_SHIFT, CS42L42_ADC_WNF_CF_SHIFT,
cs42l42_wnf3_freq_text); 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[] = { static const struct snd_kcontrol_new cs42l42_snd_controls[] = {
/* ADC Volume and Filter Controls */ /* ADC Volume and Filter Controls */
SOC_SINGLE("ADC Notch Switch", CS42L42_ADC_CTL, 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, SOC_SINGLE("ADC Weak Force Switch", CS42L42_ADC_CTL,
CS42L42_ADC_FORCE_WEAK_VCM_SHIFT, true, false), CS42L42_ADC_FORCE_WEAK_VCM_SHIFT, true, false),
SOC_SINGLE("ADC Invert Switch", CS42L42_ADC_CTL, SOC_SINGLE("ADC Invert Switch", CS42L42_ADC_CTL,
CS42L42_ADC_INV_SHIFT, true, false), CS42L42_ADC_INV_SHIFT, true, false),
SOC_SINGLE("ADC Boost Switch", CS42L42_ADC_CTL, SOC_SINGLE("ADC Boost Switch", CS42L42_ADC_CTL,
CS42L42_ADC_DIG_BOOST_SHIFT, true, false), CS42L42_ADC_DIG_BOOST_SHIFT, true, false),
SOC_SINGLE_SX_TLV("ADC Volume", CS42L42_ADC_VOLUME, SOC_SINGLE_S8_TLV("ADC Volume", CS42L42_ADC_VOLUME, -97, 12, adc_tlv),
CS42L42_ADC_VOL_SHIFT, 0xA0, 0x6C, adc_tlv),
SOC_SINGLE("ADC WNF Switch", CS42L42_ADC_WNF_HPF_CTL, SOC_SINGLE("ADC WNF Switch", CS42L42_ADC_WNF_HPF_CTL,
CS42L42_ADC_WNF_EN_SHIFT, true, false), CS42L42_ADC_WNF_EN_SHIFT, true, false),
SOC_SINGLE("ADC HPF Switch", CS42L42_ADC_WNF_HPF_CTL, SOC_SINGLE("ADC HPF Switch", CS42L42_ADC_WNF_HPF_CTL,
CS42L42_ADC_HPF_EN_SHIFT, true, false), CS42L42_ADC_HPF_EN_SHIFT, true, false),
SOC_ENUM("HPF Corner Freq", cs42l42_hpf_freq_enum), SOC_ENUM("HPF Corner Freq", cs42l42_hpf_freq_enum),
SOC_ENUM("WNF 3dB Freq", cs42l42_wnf3_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 */ /* DAC Volume and Filter Controls */
SOC_SINGLE("DACA Invert Switch", CS42L42_DAC_CTL1, SOC_SINGLE("DACA Invert Switch", CS42L42_DAC_CTL1,
...@@ -471,8 +460,8 @@ static const struct snd_soc_dapm_widget cs42l42_dapm_widgets[] = { ...@@ -471,8 +460,8 @@ static const struct snd_soc_dapm_widget cs42l42_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("HP"), SND_SOC_DAPM_OUTPUT("HP"),
SND_SOC_DAPM_DAC("DAC", NULL, CS42L42_PWR_CTL1, CS42L42_HP_PDN_SHIFT, 1), 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_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("SDIN1", NULL, 0, SND_SOC_NOPM, 0, 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("SDIN2", NULL, 1, SND_SOC_NOPM, 0, 0),
/* Playback Requirements */ /* Playback Requirements */
SND_SOC_DAPM_SUPPLY("ASP DAI0", CS42L42_PWR_CTL1, CS42L42_ASP_DAI_PDN_SHIFT, 1, NULL, 0), SND_SOC_DAPM_SUPPLY("ASP DAI0", CS42L42_PWR_CTL1, CS42L42_ASP_DAI_PDN_SHIFT, 1, NULL, 0),
...@@ -630,6 +619,8 @@ static int cs42l42_pll_config(struct snd_soc_component *component) ...@@ -630,6 +619,8 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
for (i = 0; i < ARRAY_SIZE(pll_ratio_table); i++) { for (i = 0; i < ARRAY_SIZE(pll_ratio_table); i++) {
if (pll_ratio_table[i].sclk == clk) { if (pll_ratio_table[i].sclk == clk) {
cs42l42->pll_config = i;
/* Configure the internal sample rate */ /* Configure the internal sample rate */
snd_soc_component_update_bits(component, CS42L42_MCLK_CTL, snd_soc_component_update_bits(component, CS42L42_MCLK_CTL,
CS42L42_INTERNAL_FS_MASK, CS42L42_INTERNAL_FS_MASK,
...@@ -638,14 +629,9 @@ static int cs42l42_pll_config(struct snd_soc_component *component) ...@@ -638,14 +629,9 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
(pll_ratio_table[i].mclk_int != (pll_ratio_table[i].mclk_int !=
24000000)) << 24000000)) <<
CS42L42_INTERNAL_FS_SHIFT); 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, snd_soc_component_update_bits(component, CS42L42_MCLK_SRC_SEL,
CS42L42_MCLK_SRC_SEL_MASK |
CS42L42_MCLKDIV_MASK, CS42L42_MCLKDIV_MASK,
(pll_ratio_table[i].mclk_src_sel
<< CS42L42_MCLK_SRC_SEL_SHIFT) |
(pll_ratio_table[i].mclk_div << (pll_ratio_table[i].mclk_div <<
CS42L42_MCLKDIV_SHIFT)); CS42L42_MCLKDIV_SHIFT));
/* Set up the LRCLK */ /* Set up the LRCLK */
...@@ -681,15 +667,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component) ...@@ -681,15 +667,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
CS42L42_FSYNC_PULSE_WIDTH_MASK, CS42L42_FSYNC_PULSE_WIDTH_MASK,
CS42L42_FRAC1_VAL(fsync - 1) << CS42L42_FRAC1_VAL(fsync - 1) <<
CS42L42_FSYNC_PULSE_WIDTH_SHIFT); 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) */ /* Set the sample rates (96k or lower) */
snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN, snd_soc_component_update_bits(component, CS42L42_FS_RATE_EN,
CS42L42_FS_EN_MASK, CS42L42_FS_EN_MASK,
...@@ -789,7 +766,18 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -789,7 +766,18 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
/* interface format */ /* interface format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: 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; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -819,6 +807,25 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) ...@@ -819,6 +807,25 @@ static int cs42l42_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
return 0; 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, static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
...@@ -832,6 +839,10 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -832,6 +839,10 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
cs42l42->srate = params_rate(params); cs42l42->srate = params_rate(params);
cs42l42->bclk = snd_soc_params_to_bclk(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;
switch(substream->stream) { switch(substream->stream) {
case SNDRV_PCM_STREAM_CAPTURE: case SNDRV_PCM_STREAM_CAPTURE:
if (channels == 2) { if (channels == 2) {
...@@ -855,6 +866,17 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -855,6 +866,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, snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES,
CS42L42_ASP_RX_CH_AP_MASK | CS42L42_ASP_RX_CH_AP_MASK |
CS42L42_ASP_RX_CH_RES_MASK, val); 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; break;
default: default:
break; break;
...@@ -900,13 +922,21 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ...@@ -900,13 +922,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, regmap_multi_reg_write(cs42l42->regmap, cs42l42_to_osc_seq,
ARRAY_SIZE(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, snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
CS42L42_PLL_START_MASK, 0); CS42L42_PLL_START_MASK, 0);
} }
} else { } else {
if (!cs42l42->stream_use) { if (!cs42l42->stream_use) {
/* SCLK must be running before codec unmute */ /* 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, snd_soc_component_update_bits(component, CS42L42_PLL_CTL1,
CS42L42_PLL_START_MASK, 1); CS42L42_PLL_START_MASK, 1);
...@@ -927,6 +957,12 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ...@@ -927,6 +957,12 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
CS42L42_PLL_LOCK_TIMEOUT_US); CS42L42_PLL_LOCK_TIMEOUT_US);
if (ret < 0) if (ret < 0)
dev_warn(component->dev, "PLL failed to lock: %d\n", ret); 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 */ /* Mark SCLK as present, turn off internal oscillator */
...@@ -960,8 +996,8 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream) ...@@ -960,8 +996,8 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
SNDRV_PCM_FMTBIT_S24_LE |\ SNDRV_PCM_FMTBIT_S24_LE |\
SNDRV_PCM_FMTBIT_S32_LE ) SNDRV_PCM_FMTBIT_S32_LE )
static const struct snd_soc_dai_ops cs42l42_ops = { static const struct snd_soc_dai_ops cs42l42_ops = {
.startup = cs42l42_dai_startup,
.hw_params = cs42l42_pcm_hw_params, .hw_params = cs42l42_pcm_hw_params,
.set_fmt = cs42l42_set_dai_fmt, .set_fmt = cs42l42_set_dai_fmt,
.set_sysclk = cs42l42_set_sysclk, .set_sysclk = cs42l42_set_sysclk,
......
...@@ -653,6 +653,8 @@ ...@@ -653,6 +653,8 @@
/* Page 0x25 Audio Port Registers */ /* Page 0x25 Audio Port Registers */
#define CS42L42_SP_RX_CH_SEL (CS42L42_PAGE_25 + 0x01) #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_ISOC_CTL (CS42L42_PAGE_25 + 0x02)
#define CS42L42_SP_RX_RSYNC_SHIFT 6 #define CS42L42_SP_RX_RSYNC_SHIFT 6
...@@ -775,6 +777,7 @@ struct cs42l42_private { ...@@ -775,6 +777,7 @@ struct cs42l42_private {
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
struct completion pdn_done; struct completion pdn_done;
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
int pll_config;
int bclk; int bclk;
u32 sclk; u32 sclk;
u32 srate; u32 srate;
......
...@@ -828,36 +828,6 @@ static void nau8824_int_status_clear_all(struct regmap *regmap) ...@@ -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) static void nau8824_eject_jack(struct nau8824 *nau8824)
{ {
struct snd_soc_dapm_context *dapm = nau8824->dapm; struct snd_soc_dapm_context *dapm = nau8824->dapm;
...@@ -866,8 +836,8 @@ static void nau8824_eject_jack(struct nau8824 *nau8824) ...@@ -866,8 +836,8 @@ static void nau8824_eject_jack(struct nau8824 *nau8824)
/* Clear all interruption status */ /* Clear all interruption status */
nau8824_int_status_clear_all(regmap); nau8824_int_status_clear_all(regmap);
nau8824_dapm_disable_pin(nau8824, "SAR"); snd_soc_dapm_disable_pin(dapm, "SAR");
nau8824_dapm_disable_pin(nau8824, "MICBIAS"); snd_soc_dapm_disable_pin(dapm, "MICBIAS");
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
/* Enable the insertion interruption, disable the ejection /* Enable the insertion interruption, disable the ejection
...@@ -897,8 +867,8 @@ static void nau8824_jdet_work(struct work_struct *work) ...@@ -897,8 +867,8 @@ static void nau8824_jdet_work(struct work_struct *work)
struct regmap *regmap = nau8824->regmap; struct regmap *regmap = nau8824->regmap;
int adc_value, event = 0, event_mask = 0; int adc_value, event = 0, event_mask = 0;
nau8824_dapm_enable_pin(nau8824, "MICBIAS"); snd_soc_dapm_enable_pin(dapm, "MICBIAS");
nau8824_dapm_enable_pin(nau8824, "SAR"); snd_soc_dapm_enable_pin(dapm, "SAR");
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
msleep(100); msleep(100);
...@@ -909,8 +879,8 @@ static void nau8824_jdet_work(struct work_struct *work) ...@@ -909,8 +879,8 @@ static void nau8824_jdet_work(struct work_struct *work)
if (adc_value < HEADSET_SARADC_THD) { if (adc_value < HEADSET_SARADC_THD) {
event |= SND_JACK_HEADPHONE; event |= SND_JACK_HEADPHONE;
nau8824_dapm_disable_pin(nau8824, "SAR"); snd_soc_dapm_disable_pin(dapm, "SAR");
nau8824_dapm_disable_pin(nau8824, "MICBIAS"); snd_soc_dapm_disable_pin(dapm, "MICBIAS");
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);
} else { } else {
event |= SND_JACK_HEADSET; event |= SND_JACK_HEADSET;
......
...@@ -44,6 +44,7 @@ static const struct reg_sequence patch_list[] = { ...@@ -44,6 +44,7 @@ static const struct reg_sequence patch_list[] = {
{RT5682_I2C_CTRL, 0x000f}, {RT5682_I2C_CTRL, 0x000f},
{RT5682_PLL2_INTERNAL, 0x8266}, {RT5682_PLL2_INTERNAL, 0x8266},
{RT5682_SAR_IL_CMD_3, 0x8365}, {RT5682_SAR_IL_CMD_3, 0x8365},
{RT5682_SAR_IL_CMD_6, 0x0180},
}; };
void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev) void rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev)
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#include "tlv320aic31xx.h" #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[] = { static const struct reg_default aic31xx_reg_defaults[] = {
{ AIC31XX_CLKMUX, 0x00 }, { AIC31XX_CLKMUX, 0x00 },
{ AIC31XX_PLLPR, 0x11 }, { AIC31XX_PLLPR, 0x11 },
...@@ -1256,6 +1259,13 @@ static int aic31xx_power_on(struct snd_soc_component *component) ...@@ -1256,6 +1259,13 @@ static int aic31xx_power_on(struct snd_soc_component *component)
return ret; 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; return 0;
} }
......
...@@ -682,11 +682,20 @@ static int aic32x4_set_dosr(struct snd_soc_component *component, u16 dosr) ...@@ -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, static int aic32x4_set_processing_blocks(struct snd_soc_component *component,
u8 r_block, u8 p_block) u8 r_block, u8 p_block)
{ {
if (r_block > 18 || p_block > 25) struct aic32x4_priv *aic32x4 = snd_soc_component_get_drvdata(component);
return -EINVAL;
if (aic32x4->type == AIC32X4_TYPE_TAS2505) {
if (r_block || p_block > 3)
return -EINVAL;
snd_soc_component_write(component, AIC32X4_ADCSPB, r_block); snd_soc_component_write(component, AIC32X4_DACSPB, p_block);
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; return 0;
} }
...@@ -695,6 +704,7 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component, ...@@ -695,6 +704,7 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
unsigned int sample_rate, unsigned int channels, unsigned int sample_rate, unsigned int channels,
unsigned int bit_depth) unsigned int bit_depth)
{ {
struct aic32x4_priv *aic32x4 = snd_soc_component_get_drvdata(component);
u8 aosr; u8 aosr;
u16 dosr; u16 dosr;
u8 adc_resource_class, dac_resource_class; u8 adc_resource_class, dac_resource_class;
...@@ -721,19 +731,28 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component, ...@@ -721,19 +731,28 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
adc_resource_class = 6; adc_resource_class = 6;
dac_resource_class = 8; dac_resource_class = 8;
dosr_increment = 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) { } else if (sample_rate <= 96000) {
aosr = 64; aosr = 64;
adc_resource_class = 6; adc_resource_class = 6;
dac_resource_class = 8; dac_resource_class = 8;
dosr_increment = 4; 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) { } else if (sample_rate == 192000) {
aosr = 32; aosr = 32;
adc_resource_class = 3; adc_resource_class = 3;
dac_resource_class = 4; dac_resource_class = 4;
dosr_increment = 2; 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 { } else {
dev_err(component->dev, "Sampling rate not supported\n"); dev_err(component->dev, "Sampling rate not supported\n");
return -EINVAL; return -EINVAL;
......
...@@ -747,7 +747,6 @@ static void wm_adsp2_init_debugfs(struct wm_adsp *dsp, ...@@ -747,7 +747,6 @@ static void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp) static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp)
{ {
wm_adsp_debugfs_clear(dsp); wm_adsp_debugfs_clear(dsp);
debugfs_remove_recursive(dsp->debugfs_root);
} }
#else #else
static inline void wm_adsp2_init_debugfs(struct wm_adsp *dsp, 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, ...@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,
snd_pcm_uframes_t period_size; snd_pcm_uframes_t period_size;
ssize_t periodbytes; ssize_t periodbytes;
ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream); 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; channels = substream->runtime->channels;
period_size = substream->runtime->period_size; period_size = substream->runtime->period_size;
...@@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream, ...@@ -233,7 +233,6 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
/* set codec params and inform SST driver the same */ /* set codec params and inform SST driver the same */
sst_fill_pcm_params(substream, &param); sst_fill_pcm_params(substream, &param);
sst_fill_alloc_params(substream, &alloc_params); sst_fill_alloc_params(substream, &alloc_params);
substream->runtime->dma_area = substream->dma_buffer.area;
str_params.sparams = param; str_params.sparams = param;
str_params.aparams = alloc_params; str_params.aparams = alloc_params;
str_params.codec = SST_CODEC_TYPE_PCM; str_params.codec = SST_CODEC_TYPE_PCM;
......
...@@ -404,7 +404,7 @@ static int audio_probe(struct platform_device *pdev) ...@@ -404,7 +404,7 @@ static int audio_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
/* By default dais[0] is configured for max98373 */ /* 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) { dais[0] = (struct snd_soc_dai_link) {
.name = "SSP1-Codec", .name = "SSP1-Codec",
.id = 0, .id = 0,
......
...@@ -104,8 +104,6 @@ static int kirkwood_dma_open(struct snd_soc_component *component, ...@@ -104,8 +104,6 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
int err; int err;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct kirkwood_dma_data *priv = kirkwood_priv(substream); 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); snd_soc_set_runtime_hwparams(substream, &kirkwood_dma_snd_hw);
...@@ -142,20 +140,14 @@ static int kirkwood_dma_open(struct snd_soc_component *component, ...@@ -142,20 +140,14 @@ static int kirkwood_dma_open(struct snd_soc_component *component,
writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK); 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 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (priv->substream_play) if (priv->substream_play)
return -EBUSY; return -EBUSY;
priv->substream_play = substream; priv->substream_play = substream;
kirkwood_dma_conf_mbus_windows(priv->io,
KIRKWOOD_PLAYBACK_WIN, addr, dram);
} else { } else {
if (priv->substream_rec) if (priv->substream_rec)
return -EBUSY; return -EBUSY;
priv->substream_rec = substream; priv->substream_rec = substream;
kirkwood_dma_conf_mbus_windows(priv->io,
KIRKWOOD_RECORD_WIN, addr, dram);
} }
return 0; return 0;
...@@ -182,6 +174,23 @@ static int kirkwood_dma_close(struct snd_soc_component *component, ...@@ -182,6 +174,23 @@ static int kirkwood_dma_close(struct snd_soc_component *component,
return 0; 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, static int kirkwood_dma_prepare(struct snd_soc_component *component,
struct snd_pcm_substream *substream) struct snd_pcm_substream *substream)
{ {
...@@ -246,6 +255,7 @@ const struct snd_soc_component_driver kirkwood_soc_component = { ...@@ -246,6 +255,7 @@ const struct snd_soc_component_driver kirkwood_soc_component = {
.name = DRV_NAME, .name = DRV_NAME,
.open = kirkwood_dma_open, .open = kirkwood_dma_open,
.close = kirkwood_dma_close, .close = kirkwood_dma_close,
.hw_params = kirkwood_dma_hw_params,
.prepare = kirkwood_dma_prepare, .prepare = kirkwood_dma_prepare,
.pointer = kirkwood_dma_pointer, .pointer = kirkwood_dma_pointer,
.pcm_construct = kirkwood_dma_new, .pcm_construct = kirkwood_dma_new,
......
...@@ -148,86 +148,75 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component, ...@@ -148,86 +148,75 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
return soc_component_ret(component, ret); 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, int snd_soc_component_enable_pin(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin);
int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component, int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked);
int snd_soc_component_disable_pin(struct snd_soc_component *component, int snd_soc_component_disable_pin(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin);
int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component, int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked);
int snd_soc_component_nc_pin(struct snd_soc_component *component, int snd_soc_component_nc_pin(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin);
int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component, int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked);
int snd_soc_component_get_pin_status(struct snd_soc_component *component, int snd_soc_component_get_pin_status(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status);
int snd_soc_component_force_enable_pin(struct snd_soc_component *component, int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin);
...@@ -235,7 +224,9 @@ int snd_soc_component_force_enable_pin_unlocked( ...@@ -235,7 +224,9 @@ int snd_soc_component_force_enable_pin_unlocked(
struct snd_soc_component *component, struct snd_soc_component *component,
const char *pin) 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); EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked);
......
...@@ -278,6 +278,8 @@ config SND_SOC_SOF_HDA ...@@ -278,6 +278,8 @@ config SND_SOC_SOF_HDA
config SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE config SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
tristate 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 config SND_SOC_SOF_INTEL_SOUNDWIRE
tristate "SOF support for SoundWire" tristate "SOF support for SoundWire"
...@@ -285,8 +287,6 @@ config SND_SOC_SOF_INTEL_SOUNDWIRE ...@@ -285,8 +287,6 @@ config SND_SOC_SOF_INTEL_SOUNDWIRE
depends on SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE depends on SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE
depends on ACPI && SOUNDWIRE depends on ACPI && SOUNDWIRE
depends on !(SOUNDWIRE=m && SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE=y) depends on !(SOUNDWIRE=m && SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE=y)
select SOUNDWIRE_INTEL
select SND_INTEL_SOUNDWIRE_ACPI
help help
This adds support for SoundWire with Sound Open Firmware This adds support for SoundWire with Sound Open Firmware
for Intel(R) platforms. for Intel(R) platforms.
......
...@@ -107,8 +107,8 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev) ...@@ -107,8 +107,8 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev)
} else { } else {
/* reply correct size ? */ /* reply correct size ? */
if (reply.hdr.size != msg->reply_size && if (reply.hdr.size != msg->reply_size &&
/* getter payload is never known upfront */ /* getter payload is never known upfront */
!(reply.hdr.cmd & SOF_IPC_GLB_PROBE)) { ((reply.hdr.cmd & SOF_GLB_TYPE_MASK) != SOF_IPC_GLB_PROBE)) {
dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n", dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n",
msg->reply_size, reply.hdr.size); msg->reply_size, reply.hdr.size);
ret = -EINVAL; ret = -EINVAL;
......
...@@ -187,12 +187,16 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev) ...@@ -187,12 +187,16 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev)
int hda_sdw_startup(struct snd_sof_dev *sdev) int hda_sdw_startup(struct snd_sof_dev *sdev)
{ {
struct sof_intel_hda_dev *hdev; struct sof_intel_hda_dev *hdev;
struct snd_sof_pdata *pdata = sdev->pdata;
hdev = sdev->pdata->hw_pdata; hdev = sdev->pdata->hw_pdata;
if (!hdev->sdw) if (!hdev->sdw)
return 0; return 0;
if (pdata->machine && !pdata->machine->mach_params.link_mask)
return 0;
return sdw_intel_startup(hdev->sdw); return sdw_intel_startup(hdev->sdw);
} }
...@@ -1002,6 +1006,14 @@ static int hda_generic_machine_select(struct snd_sof_dev *sdev) ...@@ -1002,6 +1006,14 @@ static int hda_generic_machine_select(struct snd_sof_dev *sdev)
hda_mach->mach_params.dmic_num = dmic_num; hda_mach->mach_params.dmic_num = dmic_num;
pdata->machine = hda_mach; pdata->machine = hda_mach;
pdata->tplg_filename = tplg_filename; 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;
}
} }
} }
......
...@@ -198,7 +198,7 @@ static int uniphier_aiodma_mmap(struct snd_soc_component *component, ...@@ -198,7 +198,7 @@ static int uniphier_aiodma_mmap(struct snd_soc_component *component,
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
return remap_pfn_range(vma, vma->vm_start, 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); 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, ...@@ -452,8 +452,8 @@ static int xlnx_formatter_pcm_hw_params(struct snd_soc_component *component,
stream_data->buffer_size = size; stream_data->buffer_size = size;
low = lower_32_bits(substream->dma_buffer.addr); low = lower_32_bits(runtime->dma_addr);
high = upper_32_bits(substream->dma_buffer.addr); high = upper_32_bits(runtime->dma_addr);
writel(low, stream_data->mmio + XLNX_AUD_BUFF_ADDR_LSB); writel(low, stream_data->mmio + XLNX_AUD_BUFF_ADDR_LSB);
writel(high, stream_data->mmio + XLNX_AUD_BUFF_ADDR_MSB); writel(high, stream_data->mmio + XLNX_AUD_BUFF_ADDR_MSB);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment