Commit 440174ac authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/fix/dpcm', 'asoc/fix/imx',...

Merge remote-tracking branches 'asoc/fix/dpcm', 'asoc/fix/imx', 'asoc/fix/msm8916', 'asoc/fix/multi-pcm', 'asoc/fix/of-graph' and 'asoc/fix/pxa' into asoc-linus
...@@ -708,6 +708,15 @@ struct device_node *of_graph_get_port_parent(struct device_node *node) ...@@ -708,6 +708,15 @@ struct device_node *of_graph_get_port_parent(struct device_node *node)
{ {
unsigned int depth; unsigned int depth;
if (!node)
return NULL;
/*
* Preserve usecount for passed in node as of_get_next_parent()
* will do of_node_put() on it.
*/
of_node_get(node);
/* Walk 3 levels up only if there is 'ports' node. */ /* Walk 3 levels up only if there is 'ports' node. */
for (depth = 3; depth && node; depth--) { for (depth = 3; depth && node; depth--) {
node = of_get_next_parent(node); node = of_get_next_parent(node);
...@@ -728,12 +737,16 @@ EXPORT_SYMBOL(of_graph_get_port_parent); ...@@ -728,12 +737,16 @@ EXPORT_SYMBOL(of_graph_get_port_parent);
struct device_node *of_graph_get_remote_port_parent( struct device_node *of_graph_get_remote_port_parent(
const struct device_node *node) const struct device_node *node)
{ {
struct device_node *np; struct device_node *np, *pp;
/* Get remote endpoint node. */ /* Get remote endpoint node. */
np = of_graph_get_remote_endpoint(node); np = of_graph_get_remote_endpoint(node);
return of_graph_get_port_parent(np); pp = of_graph_get_port_parent(np);
of_node_put(np);
return pp;
} }
EXPORT_SYMBOL(of_graph_get_remote_port_parent); EXPORT_SYMBOL(of_graph_get_remote_port_parent);
......
...@@ -795,10 +795,6 @@ struct snd_soc_component_driver { ...@@ -795,10 +795,6 @@ struct snd_soc_component_driver {
int (*suspend)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *);
int (*resume)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *);
/* pcm creation and destruction */
int (*pcm_new)(struct snd_soc_pcm_runtime *);
void (*pcm_free)(struct snd_pcm *);
/* DT */ /* DT */
int (*of_xlate_dai_name)(struct snd_soc_component *component, int (*of_xlate_dai_name)(struct snd_soc_component *component,
struct of_phandle_args *args, struct of_phandle_args *args,
...@@ -874,8 +870,6 @@ struct snd_soc_component { ...@@ -874,8 +870,6 @@ struct snd_soc_component {
void (*remove)(struct snd_soc_component *); void (*remove)(struct snd_soc_component *);
int (*suspend)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *);
int (*resume)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *);
int (*pcm_new)(struct snd_soc_pcm_runtime *);
void (*pcm_free)(struct snd_pcm *);
/* machine specific init */ /* machine specific init */
int (*init)(struct snd_soc_component *component); int (*init)(struct snd_soc_component *component);
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define CDC_D_CDC_DIG_CLK_CTL (0xf04A) #define CDC_D_CDC_DIG_CLK_CTL (0xf04A)
#define DIG_CLK_CTL_RXD1_CLK_EN BIT(0) #define DIG_CLK_CTL_RXD1_CLK_EN BIT(0)
#define DIG_CLK_CTL_RXD2_CLK_EN BIT(1) #define DIG_CLK_CTL_RXD2_CLK_EN BIT(1)
#define DIG_CLK_CTL_RXD3_CLK_EN BIT(3) #define DIG_CLK_CTL_RXD3_CLK_EN BIT(2)
#define DIG_CLK_CTL_TXD_CLK_EN BIT(4) #define DIG_CLK_CTL_TXD_CLK_EN BIT(4)
#define DIG_CLK_CTL_NCP_CLK_EN_MASK BIT(6) #define DIG_CLK_CTL_NCP_CLK_EN_MASK BIT(6)
#define DIG_CLK_CTL_NCP_CLK_EN BIT(6) #define DIG_CLK_CTL_NCP_CLK_EN BIT(6)
......
...@@ -527,6 +527,10 @@ static int imx_ssi_probe(struct platform_device *pdev) ...@@ -527,6 +527,10 @@ static int imx_ssi_probe(struct platform_device *pdev)
} }
ssi->irq = platform_get_irq(pdev, 0); ssi->irq = platform_get_irq(pdev, 0);
if (ssi->irq < 0) {
dev_err(&pdev->dev, "Failed to get IRQ: %d\n", ssi->irq);
return ssi->irq;
}
ssi->clk = devm_clk_get(&pdev->dev, NULL); ssi->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(ssi->clk)) { if (IS_ERR(ssi->clk)) {
......
...@@ -224,9 +224,11 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) ...@@ -224,9 +224,11 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { of_for_each_phandle(&it, rc, node, "dais", NULL, 0) {
ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); ret = asoc_graph_card_dai_link_of(it.node, priv, idx++);
of_node_put(it.node); if (ret < 0) {
if (ret < 0) of_node_put(it.node);
return ret; return ret;
}
} }
return asoc_simple_card_parse_card_name(card, NULL); return asoc_simple_card_parse_card_name(card, NULL);
...@@ -239,10 +241,8 @@ static int asoc_graph_get_dais_count(struct device *dev) ...@@ -239,10 +241,8 @@ static int asoc_graph_get_dais_count(struct device *dev)
int count = 0; int count = 0;
int rc; int rc;
of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { of_for_each_phandle(&it, rc, node, "dais", NULL, 0)
count++; count++;
of_node_put(it.node);
}
return count; return count;
} }
......
...@@ -215,7 +215,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) ...@@ -215,7 +215,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
codec_ep = of_graph_get_remote_endpoint(cpu_ep); codec_ep = of_graph_get_remote_endpoint(cpu_ep);
rcpu_ep = of_graph_get_remote_endpoint(codec_ep); rcpu_ep = of_graph_get_remote_endpoint(codec_ep);
of_node_put(cpu_port);
of_node_put(cpu_ep); of_node_put(cpu_ep);
of_node_put(codec_ep); of_node_put(codec_ep);
of_node_put(rcpu_ep); of_node_put(rcpu_ep);
...@@ -232,8 +231,10 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) ...@@ -232,8 +231,10 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep, ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep,
NULL, &daifmt); NULL, &daifmt);
if (ret < 0) if (ret < 0) {
of_node_put(cpu_port);
goto parse_of_err; goto parse_of_err;
}
} }
dai_idx = 0; dai_idx = 0;
...@@ -250,7 +251,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) ...@@ -250,7 +251,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
codec_ep = of_graph_get_remote_endpoint(cpu_ep); codec_ep = of_graph_get_remote_endpoint(cpu_ep);
codec_port = of_graph_get_port_parent(codec_ep); codec_port = of_graph_get_port_parent(codec_ep);
of_node_put(cpu_port);
of_node_put(cpu_ep); of_node_put(cpu_ep);
of_node_put(codec_ep); of_node_put(codec_ep);
of_node_put(codec_port); of_node_put(codec_port);
...@@ -266,13 +266,17 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) ...@@ -266,13 +266,17 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
/* Back-End (= Codec) */ /* Back-End (= Codec) */
ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0); ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0);
if (ret < 0) if (ret < 0) {
of_node_put(cpu_port);
goto parse_of_err; goto parse_of_err;
}
} else { } else {
/* Front-End (= CPU) */ /* Front-End (= CPU) */
ret = asoc_graph_card_dai_link_of(cpu_ep, priv, daifmt, dai_idx++, 1); ret = asoc_graph_card_dai_link_of(cpu_ep, priv, daifmt, dai_idx++, 1);
if (ret < 0) if (ret < 0) {
of_node_put(cpu_port);
goto parse_of_err; goto parse_of_err;
}
} }
} }
} }
...@@ -306,7 +310,6 @@ static int asoc_graph_get_dais_count(struct device *dev) ...@@ -306,7 +310,6 @@ static int asoc_graph_get_dais_count(struct device *dev)
codec_ep = of_graph_get_remote_endpoint(cpu_ep); codec_ep = of_graph_get_remote_endpoint(cpu_ep);
codec_port = of_graph_get_port_parent(codec_ep); codec_port = of_graph_get_port_parent(codec_ep);
of_node_put(cpu_port);
of_node_put(cpu_ep); of_node_put(cpu_ep);
of_node_put(codec_ep); of_node_put(codec_ep);
of_node_put(codec_port); of_node_put(codec_port);
......
...@@ -263,6 +263,9 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep) ...@@ -263,6 +263,9 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)
id = i; id = i;
i++; i++;
} }
of_node_put(node);
if (id < 0) if (id < 0)
return -ENODEV; return -ENODEV;
...@@ -282,11 +285,6 @@ int asoc_simple_card_parse_graph_dai(struct device_node *ep, ...@@ -282,11 +285,6 @@ int asoc_simple_card_parse_graph_dai(struct device_node *ep,
if (!dai_name) if (!dai_name)
return 0; return 0;
/*
* of_graph_get_port_parent() will call
* of_node_put(). So, call of_node_get() here
*/
of_node_get(ep);
node = of_graph_get_port_parent(ep); node = of_graph_get_port_parent(ep);
/* Get dai->name */ /* Get dai->name */
......
config SND_PXA2XX_SOC config SND_PXA2XX_SOC
tristate "SoC Audio for the Intel PXA2xx chip" tristate "SoC Audio for the Intel PXA2xx chip"
depends on ARCH_PXA || COMPILE_TEST depends on ARCH_PXA || COMPILE_TEST
depends on HAS_DMA
select SND_PXA2XX_LIB select SND_PXA2XX_LIB
help help
Say Y or M if you want to add support for codecs attached to Say Y or M if you want to add support for codecs attached to
......
...@@ -3171,8 +3171,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, ...@@ -3171,8 +3171,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
component->remove = component->driver->remove; component->remove = component->driver->remove;
component->suspend = component->driver->suspend; component->suspend = component->driver->suspend;
component->resume = component->driver->resume; component->resume = component->driver->resume;
component->pcm_new = component->driver->pcm_new;
component->pcm_free = component->driver->pcm_free;
dapm = &component->dapm; dapm = &component->dapm;
dapm->dev = dev; dapm->dev = dev;
...@@ -3360,25 +3358,6 @@ static void snd_soc_platform_drv_remove(struct snd_soc_component *component) ...@@ -3360,25 +3358,6 @@ static void snd_soc_platform_drv_remove(struct snd_soc_component *component)
platform->driver->remove(platform); platform->driver->remove(platform);
} }
static int snd_soc_platform_drv_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_platform *platform = rtd->platform;
if (platform->driver->pcm_new)
return platform->driver->pcm_new(rtd);
else
return 0;
}
static void snd_soc_platform_drv_pcm_free(struct snd_pcm *pcm)
{
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
struct snd_soc_platform *platform = rtd->platform;
if (platform->driver->pcm_free)
platform->driver->pcm_free(pcm);
}
/** /**
* snd_soc_add_platform - Add a platform to the ASoC core * snd_soc_add_platform - Add a platform to the ASoC core
* @dev: The parent device for the platform * @dev: The parent device for the platform
...@@ -3402,10 +3381,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, ...@@ -3402,10 +3381,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
platform->component.probe = snd_soc_platform_drv_probe; platform->component.probe = snd_soc_platform_drv_probe;
if (platform_drv->remove) if (platform_drv->remove)
platform->component.remove = snd_soc_platform_drv_remove; platform->component.remove = snd_soc_platform_drv_remove;
if (platform_drv->pcm_new)
platform->component.pcm_new = snd_soc_platform_drv_pcm_new;
if (platform_drv->pcm_free)
platform->component.pcm_free = snd_soc_platform_drv_pcm_free;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
platform->component.debugfs_prefix = "platform"; platform->component.debugfs_prefix = "platform";
...@@ -4113,6 +4088,8 @@ int snd_soc_get_dai_id(struct device_node *ep) ...@@ -4113,6 +4088,8 @@ int snd_soc_get_dai_id(struct device_node *ep)
} }
mutex_unlock(&client_mutex); mutex_unlock(&client_mutex);
of_node_put(node);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_get_dai_id); EXPORT_SYMBOL_GPL(snd_soc_get_dai_id);
......
...@@ -181,6 +181,10 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, ...@@ -181,6 +181,10 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
be->dai_link->name, event, dir); be->dai_link->name, event, dir);
if ((event == SND_SOC_DAPM_STREAM_STOP) &&
(be->dpcm[dir].users >= 1))
continue;
snd_soc_dapm_stream_event(be, dir, event); snd_soc_dapm_stream_event(be, dir, event);
} }
...@@ -2628,25 +2632,12 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream) ...@@ -2628,25 +2632,12 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
return ret; return ret;
} }
static void soc_pcm_free(struct snd_pcm *pcm)
{
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
struct snd_soc_component *component;
list_for_each_entry(component, &rtd->card->component_dev_list,
card_list) {
if (component->pcm_free)
component->pcm_free(pcm);
}
}
/* create a new pcm */ /* create a new pcm */
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
{ {
struct snd_soc_platform *platform = rtd->platform; struct snd_soc_platform *platform = rtd->platform;
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_component *component;
struct snd_pcm *pcm; struct snd_pcm *pcm;
char new_name[64]; char new_name[64];
int ret = 0, playback = 0, capture = 0; int ret = 0, playback = 0, capture = 0;
...@@ -2756,18 +2747,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2756,18 +2747,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
if (capture) if (capture)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
list_for_each_entry(component, &rtd->card->component_dev_list, card_list) { if (platform->driver->pcm_new) {
if (component->pcm_new) { ret = platform->driver->pcm_new(rtd);
ret = component->pcm_new(rtd); if (ret < 0) {
if (ret < 0) { dev_err(platform->dev,
dev_err(component->dev, "ASoC: pcm constructor failed: %d\n",
"ASoC: pcm constructor failed: %d\n", ret);
ret); return ret;
return ret;
}
} }
} }
pcm->private_free = soc_pcm_free;
pcm->private_free = platform->driver->pcm_free;
out: out:
dev_info(rtd->card->dev, "%s <-> %s mapping ok\n", dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
(rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name, (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name,
......
...@@ -33,6 +33,7 @@ static struct snd_soc_dai_link mop500_dai_links[] = { ...@@ -33,6 +33,7 @@ static struct snd_soc_dai_link mop500_dai_links[] = {
.stream_name = "ab8500_0", .stream_name = "ab8500_0",
.cpu_dai_name = "ux500-msp-i2s.1", .cpu_dai_name = "ux500-msp-i2s.1",
.codec_dai_name = "ab8500-codec-dai.0", .codec_dai_name = "ab8500-codec-dai.0",
.platform_name = "ux500-msp-i2s.1",
.codec_name = "ab8500-codec.0", .codec_name = "ab8500-codec.0",
.init = mop500_ab8500_machine_init, .init = mop500_ab8500_machine_init,
.ops = mop500_ab8500_ops, .ops = mop500_ab8500_ops,
...@@ -42,6 +43,7 @@ static struct snd_soc_dai_link mop500_dai_links[] = { ...@@ -42,6 +43,7 @@ static struct snd_soc_dai_link mop500_dai_links[] = {
.stream_name = "ab8500_1", .stream_name = "ab8500_1",
.cpu_dai_name = "ux500-msp-i2s.3", .cpu_dai_name = "ux500-msp-i2s.3",
.codec_dai_name = "ab8500-codec-dai.1", .codec_dai_name = "ab8500-codec-dai.1",
.platform_name = "ux500-msp-i2s.3",
.codec_name = "ab8500-codec.0", .codec_name = "ab8500-codec.0",
.init = NULL, .init = NULL,
.ops = mop500_ab8500_ops, .ops = mop500_ab8500_ops,
...@@ -85,6 +87,8 @@ static int mop500_of_probe(struct platform_device *pdev, ...@@ -85,6 +87,8 @@ static int mop500_of_probe(struct platform_device *pdev,
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
mop500_dai_links[i].cpu_of_node = msp_np[i]; mop500_dai_links[i].cpu_of_node = msp_np[i];
mop500_dai_links[i].cpu_dai_name = NULL; mop500_dai_links[i].cpu_dai_name = NULL;
mop500_dai_links[i].platform_of_node = msp_np[i];
mop500_dai_links[i].platform_name = NULL;
mop500_dai_links[i].codec_of_node = codec_np; mop500_dai_links[i].codec_of_node = codec_np;
mop500_dai_links[i].codec_name = NULL; mop500_dai_links[i].codec_name = NULL;
} }
......
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