Commit e83ce4a5 authored by Takashi Iwai's avatar Takashi Iwai

Merge tag 'asoc-fix-v3.19-rc2' of...

Merge tag 'asoc-fix-v3.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v3.19

A few fixes for v3.19, a few driver specifics and one core fix which
fixes a boot crash on OMAP if deferred probing kicks in due to
attempting to modify static data.
parents d6795827 f2ec1d3b
...@@ -784,8 +784,8 @@ static unsigned int bst_tlv[] = { ...@@ -784,8 +784,8 @@ static unsigned int bst_tlv[] = {
static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; ucontrol->value.integer.value[0] = rt5677->dsp_vad_en;
...@@ -795,8 +795,9 @@ static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, ...@@ -795,8 +795,9 @@ static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0];
......
...@@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
switch (config->chan_nr) { switch (config->chan_nr) {
case EIGHT_CHANNEL_SUPPORT: case EIGHT_CHANNEL_SUPPORT:
ch_reg = 3;
break;
case SIX_CHANNEL_SUPPORT: case SIX_CHANNEL_SUPPORT:
ch_reg = 2;
break;
case FOUR_CHANNEL_SUPPORT: case FOUR_CHANNEL_SUPPORT:
ch_reg = 1;
break;
case TWO_CHANNEL_SUPPORT: case TWO_CHANNEL_SUPPORT:
ch_reg = 0;
break; break;
default: default:
dev_err(dev->dev, "channel not supported\n"); dev_err(dev->dev, "channel not supported\n");
...@@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
i2s_disable_channels(dev, substream->stream); i2s_disable_channels(dev, substream->stream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) {
i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); i2s_write_reg(dev->i2s_base, TCR(ch_reg),
irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); xfer_resolution);
i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02);
i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
} else { i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30);
i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); i2s_write_reg(dev->i2s_base, TER(ch_reg), 1);
i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); } else {
irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); i2s_write_reg(dev->i2s_base, RCR(ch_reg),
i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); xfer_resolution);
i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07);
irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03);
i2s_write_reg(dev->i2s_base, RER(ch_reg), 1);
}
} }
i2s_write_reg(dev->i2s_base, CCR, ccr); i2s_write_reg(dev->i2s_base, CCR, ccr);
...@@ -263,6 +260,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream, ...@@ -263,6 +260,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream,
snd_soc_dai_set_dma_data(dai, substream, NULL); snd_soc_dai_set_dma_data(dai, substream, NULL);
} }
static int dw_i2s_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
i2s_write_reg(dev->i2s_base, TXFFR, 1);
else
i2s_write_reg(dev->i2s_base, RXFFR, 1);
return 0;
}
static int dw_i2s_trigger(struct snd_pcm_substream *substream, static int dw_i2s_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai) int cmd, struct snd_soc_dai *dai)
{ {
...@@ -294,6 +304,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = { ...@@ -294,6 +304,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = {
.startup = dw_i2s_startup, .startup = dw_i2s_startup,
.shutdown = dw_i2s_shutdown, .shutdown = dw_i2s_shutdown,
.hw_params = dw_i2s_hw_params, .hw_params = dw_i2s_hw_params,
.prepare = dw_i2s_prepare,
.trigger = dw_i2s_trigger, .trigger = dw_i2s_trigger,
}; };
......
...@@ -89,7 +89,7 @@ config SND_SOC_INTEL_BROADWELL_MACH ...@@ -89,7 +89,7 @@ config SND_SOC_INTEL_BROADWELL_MACH
config SND_SOC_INTEL_BYTCR_RT5640_MACH config SND_SOC_INTEL_BYTCR_RT5640_MACH
tristate "ASoC Audio DSP Support for MID BYT Platform" tristate "ASoC Audio DSP Support for MID BYT Platform"
depends on X86 depends on X86 && I2C
select SND_SOC_RT5640 select SND_SOC_RT5640
select SND_SST_MFLD_PLATFORM select SND_SST_MFLD_PLATFORM
select SND_SST_IPC_ACPI select SND_SST_IPC_ACPI
...@@ -101,7 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH ...@@ -101,7 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
config SND_SOC_INTEL_CHT_BSW_RT5672_MACH config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
depends on X86_INTEL_LPSS depends on X86_INTEL_LPSS && I2C
select SND_SOC_RT5670 select SND_SOC_RT5670
select SND_SST_MFLD_PLATFORM select SND_SST_MFLD_PLATFORM
select SND_SST_IPC_ACPI select SND_SST_IPC_ACPI
......
...@@ -227,4 +227,4 @@ module_platform_driver(snd_byt_mc_driver); ...@@ -227,4 +227,4 @@ module_platform_driver(snd_byt_mc_driver);
MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver");
MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:bytrt5640-audio"); MODULE_ALIAS("platform:bytt100_rt5640");
...@@ -763,8 +763,12 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba ...@@ -763,8 +763,12 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
/* does block span more than 1 section */ /* does block span more than 1 section */
if (ba->offset >= block->offset && ba->offset < block_end) { if (ba->offset >= block->offset && ba->offset < block_end) {
/* add block */
list_move(&block->list, &dsp->used_block_list);
list_add(&block->module_list, block_list);
/* align ba to block boundary */ /* align ba to block boundary */
ba->offset = block->offset; ba->size -= block_end - ba->offset;
ba->offset = block_end;
err = block_alloc_contiguous(dsp, ba, block_list); err = block_alloc_contiguous(dsp, ba, block_list);
if (err < 0) if (err < 0)
......
...@@ -343,7 +343,7 @@ int sst_acpi_remove(struct platform_device *pdev) ...@@ -343,7 +343,7 @@ int sst_acpi_remove(struct platform_device *pdev)
} }
static struct sst_machines sst_acpi_bytcr[] = { static struct sst_machines sst_acpi_bytcr[] = {
{"10EC5640", "T100", "bytt100_rt5640", NULL, "fw_sst_0f28.bin", {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin",
&byt_rvp_platform_data }, &byt_rvp_platform_data },
{}, {},
}; };
......
...@@ -454,11 +454,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev) ...@@ -454,11 +454,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
i2s->playback_dma_data.addr = res->start + I2S_TXDR; i2s->playback_dma_data.addr = res->start + I2S_TXDR;
i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
i2s->playback_dma_data.maxburst = 16; i2s->playback_dma_data.maxburst = 4;
i2s->capture_dma_data.addr = res->start + I2S_RXDR; i2s->capture_dma_data.addr = res->start + I2S_RXDR;
i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
i2s->capture_dma_data.maxburst = 16; i2s->capture_dma_data.maxburst = 4;
i2s->dev = &pdev->dev; i2s->dev = &pdev->dev;
dev_set_drvdata(&pdev->dev, i2s); dev_set_drvdata(&pdev->dev, i2s);
......
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
#define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) #define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT)
#define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) #define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT)
#define I2S_DMACR_TDL_SHIFT 0 #define I2S_DMACR_TDL_SHIFT 0
#define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT) #define I2S_DMACR_TDL(x) ((x) << I2S_DMACR_TDL_SHIFT)
#define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) #define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT)
/* /*
......
...@@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
const char *propname) const char *propname)
{ {
struct device_node *np = card->dev->of_node; struct device_node *np = card->dev->of_node;
int num_routes, old_routes; int num_routes;
struct snd_soc_dapm_route *routes; struct snd_soc_dapm_route *routes;
int i, ret; int i, ret;
...@@ -3248,9 +3248,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -3248,9 +3248,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
return -EINVAL; return -EINVAL;
} }
old_routes = card->num_dapm_routes; routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
routes = devm_kzalloc(card->dev,
(old_routes + num_routes) * sizeof(*routes),
GFP_KERNEL); GFP_KERNEL);
if (!routes) { if (!routes) {
dev_err(card->dev, dev_err(card->dev,
...@@ -3258,11 +3256,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -3258,11 +3256,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
return -EINVAL; return -EINVAL;
} }
memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
for (i = 0; i < num_routes; i++) { for (i = 0; i < num_routes; i++) {
ret = of_property_read_string_index(np, propname, ret = of_property_read_string_index(np, propname,
2 * i, &routes[old_routes + i].sink); 2 * i, &routes[i].sink);
if (ret) { if (ret) {
dev_err(card->dev, dev_err(card->dev,
"ASoC: Property '%s' index %d could not be read: %d\n", "ASoC: Property '%s' index %d could not be read: %d\n",
...@@ -3270,7 +3266,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -3270,7 +3266,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
return -EINVAL; return -EINVAL;
} }
ret = of_property_read_string_index(np, propname, ret = of_property_read_string_index(np, propname,
(2 * i) + 1, &routes[old_routes + i].source); (2 * i) + 1, &routes[i].source);
if (ret) { if (ret) {
dev_err(card->dev, dev_err(card->dev,
"ASoC: Property '%s' index %d could not be read: %d\n", "ASoC: Property '%s' index %d could not be read: %d\n",
...@@ -3279,7 +3275,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, ...@@ -3279,7 +3275,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
} }
} }
card->num_dapm_routes += num_routes; card->num_dapm_routes = num_routes;
card->dapm_routes = routes; card->dapm_routes = routes;
return 0; return 0;
......
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