Commit 2e9ac12a authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear',...

Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic/sta32x', 'asoc/topic/stm32' and 'asoc/topic/sunxi' into asoc-next
...@@ -86,6 +86,9 @@ Optional CPU/CODEC subnodes properties: ...@@ -86,6 +86,9 @@ Optional CPU/CODEC subnodes properties:
in dai startup() and disabled with in dai startup() and disabled with
clk_disable_unprepare() in dai clk_disable_unprepare() in dai
shutdown(). shutdown().
- system-clock-direction-out : specifies clock direction as 'out' on
initialization. It is useful for some aCPUs with
fixed clocks.
Example 1 - single DAI link: Example 1 - single DAI link:
......
...@@ -24,6 +24,7 @@ Optional subnode properties: ...@@ -24,6 +24,7 @@ Optional subnode properties:
- simple-audio-card,convert-rate : platform specified sampling rate convert - simple-audio-card,convert-rate : platform specified sampling rate convert
- simple-audio-card,convert-channels : platform specified converted channel size (2 - 8 ch) - simple-audio-card,convert-channels : platform specified converted channel size (2 - 8 ch)
- simple-audio-card,prefix : see routing - simple-audio-card,prefix : see routing
- simple-audio-card,widgets : Please refer to widgets.txt.
- simple-audio-card,routing : A list of the connections between audio components. - simple-audio-card,routing : A list of the connections between audio components.
Each entry is a pair of strings, the first being the connection's sink, Each entry is a pair of strings, the first being the connection's sink,
the second being the connection's source. Valid names for sources. the second being the connection's source. Valid names for sources.
......
...@@ -8,6 +8,7 @@ Required properties: ...@@ -8,6 +8,7 @@ Required properties:
- compatible: should be one of the following: - compatible: should be one of the following:
- "allwinner,sun4i-a10-i2s" - "allwinner,sun4i-a10-i2s"
- "allwinner,sun6i-a31-i2s" - "allwinner,sun6i-a31-i2s"
- "allwinner,sun8i-h3-i2s"
- reg: physical base address of the controller and length of memory mapped - reg: physical base address of the controller and length of memory mapped
region. region.
- interrupts: should contain the I2S interrupt. - interrupts: should contain the I2S interrupt.
...@@ -22,6 +23,7 @@ Required properties: ...@@ -22,6 +23,7 @@ Required properties:
Required properties for the following compatibles: Required properties for the following compatibles:
- "allwinner,sun6i-a31-i2s" - "allwinner,sun6i-a31-i2s"
- "allwinner,sun8i-h3-i2s"
- resets: phandle to the reset line for this codec - resets: phandle to the reset line for this codec
Example: Example:
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
struct asoc_simple_dai { struct asoc_simple_dai {
const char *name; const char *name;
unsigned int sysclk; unsigned int sysclk;
int clk_direction;
int slots; int slots;
int slot_width; int slot_width;
unsigned int tx_slot_mask; unsigned int tx_slot_mask;
......
...@@ -847,7 +847,6 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, ...@@ -847,7 +847,6 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
msleep(300); msleep(300);
sta32x_watchdog_stop(sta32x); sta32x_watchdog_stop(sta32x);
if (sta32x->gpiod_nreset)
gpiod_set_value(sta32x->gpiod_nreset, 0); gpiod_set_value(sta32x->gpiod_nreset, 0);
regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies),
......
...@@ -325,6 +325,7 @@ MODULE_DEVICE_TABLE(of, asoc_graph_of_match); ...@@ -325,6 +325,7 @@ MODULE_DEVICE_TABLE(of, asoc_graph_of_match);
static struct platform_driver asoc_graph_card = { static struct platform_driver asoc_graph_card = {
.driver = { .driver = {
.name = "asoc-audio-graph-card", .name = "asoc-audio-graph-card",
.pm = &snd_soc_pm_ops,
.of_match_table = asoc_graph_of_match, .of_match_table = asoc_graph_of_match,
}, },
.probe = asoc_graph_card_probe, .probe = asoc_graph_card_probe,
......
...@@ -401,6 +401,7 @@ MODULE_DEVICE_TABLE(of, asoc_graph_of_match); ...@@ -401,6 +401,7 @@ MODULE_DEVICE_TABLE(of, asoc_graph_of_match);
static struct platform_driver asoc_graph_card = { static struct platform_driver asoc_graph_card = {
.driver = { .driver = {
.name = "asoc-audio-graph-scu-card", .name = "asoc-audio-graph-scu-card",
.pm = &snd_soc_pm_ops,
.of_match_table = asoc_graph_of_match, .of_match_table = asoc_graph_of_match,
}, },
.probe = asoc_graph_card_probe, .probe = asoc_graph_card_probe,
......
...@@ -196,7 +196,11 @@ int asoc_simple_card_parse_clk(struct device *dev, ...@@ -196,7 +196,11 @@ int asoc_simple_card_parse_clk(struct device *dev,
simple_dai->sysclk = clk_get_rate(clk); simple_dai->sysclk = clk_get_rate(clk);
} }
dev_dbg(dev, "%s : sysclk = %d\n", name, simple_dai->sysclk); if (of_property_read_bool(node, "system-clock-direction-out"))
simple_dai->clk_direction = SND_SOC_CLOCK_OUT;
dev_dbg(dev, "%s : sysclk = %d, direction %d\n", name,
simple_dai->sysclk, simple_dai->clk_direction);
return 0; return 0;
} }
...@@ -308,7 +312,8 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai, ...@@ -308,7 +312,8 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
int ret; int ret;
if (simple_dai->sysclk) { if (simple_dai->sysclk) {
ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0); ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk,
simple_dai->clk_direction);
if (ret && ret != -ENOTSUPP) { if (ret && ret != -ENOTSUPP) {
dev_err(dai->dev, "simple-card: set_sysclk error\n"); dev_err(dai->dev, "simple-card: set_sysclk error\n");
return ret; return ret;
......
...@@ -191,6 +191,10 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv) ...@@ -191,6 +191,10 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
if (!node) if (!node)
return -EINVAL; return -EINVAL;
ret = asoc_simple_card_of_parse_widgets(card, PREFIX);
if (ret < 0)
return ret;
ret = asoc_simple_card_of_parse_routing(card, PREFIX, 0); ret = asoc_simple_card_of_parse_routing(card, PREFIX, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -296,6 +300,7 @@ MODULE_DEVICE_TABLE(of, asoc_simple_of_match); ...@@ -296,6 +300,7 @@ MODULE_DEVICE_TABLE(of, asoc_simple_of_match);
static struct platform_driver asoc_simple_card = { static struct platform_driver asoc_simple_card = {
.driver = { .driver = {
.name = "simple-scu-audio-card", .name = "simple-scu-audio-card",
.pm = &snd_soc_pm_ops,
.of_match_table = asoc_simple_of_match, .of_match_table = asoc_simple_of_match,
}, },
.probe = asoc_simple_card_probe, .probe = asoc_simple_card_probe,
......
...@@ -151,7 +151,7 @@ static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -151,7 +151,7 @@ static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd,
return ret; return ret;
} }
static struct snd_soc_dai_ops spdif_in_dai_ops = { static const struct snd_soc_dai_ops spdif_in_dai_ops = {
.shutdown = spdif_in_shutdown, .shutdown = spdif_in_shutdown,
.trigger = spdif_in_trigger, .trigger = spdif_in_trigger,
.hw_params = spdif_in_hw_params, .hw_params = spdif_in_hw_params,
...@@ -216,15 +216,15 @@ static int spdif_in_probe(struct platform_device *pdev) ...@@ -216,15 +216,15 @@ static int spdif_in_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
if (!host) { if (!host)
dev_warn(&pdev->dev, "kzalloc fail\n");
return -ENOMEM; return -ENOMEM;
}
host->io_base = io_base; host->io_base = io_base;
host->irq = platform_get_irq(pdev, 0); host->irq = platform_get_irq(pdev, 0);
if (host->irq < 0) if (host->irq < 0) {
return -EINVAL; dev_warn(&pdev->dev, "failed to get IRQ: %d\n", host->irq);
return host->irq;
}
host->clk = devm_clk_get(&pdev->dev, NULL); host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) if (IS_ERR(host->clk))
......
...@@ -282,10 +282,8 @@ static int spdif_out_probe(struct platform_device *pdev) ...@@ -282,10 +282,8 @@ static int spdif_out_probe(struct platform_device *pdev)
int ret; int ret;
host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
if (!host) { if (!host)
dev_warn(&pdev->dev, "kzalloc fail\n");
return -ENOMEM; return -ENOMEM;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->io_base = devm_ioremap_resource(&pdev->dev, res); host->io_base = devm_ioremap_resource(&pdev->dev, res);
......
...@@ -840,7 +840,7 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev, ...@@ -840,7 +840,7 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
} }
/* Reset */ /* Reset */
rst = devm_reset_control_get(&pdev->dev, NULL); rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
if (!IS_ERR(rst)) { if (!IS_ERR(rst)) {
reset_control_assert(rst); reset_control_assert(rst);
udelay(2); udelay(2);
......
...@@ -85,7 +85,7 @@ static int stm32_sai_probe(struct platform_device *pdev) ...@@ -85,7 +85,7 @@ static int stm32_sai_probe(struct platform_device *pdev)
} }
/* reset */ /* reset */
rst = reset_control_get(&pdev->dev, NULL); rst = reset_control_get_exclusive(&pdev->dev, NULL);
if (!IS_ERR(rst)) { if (!IS_ERR(rst)) {
reset_control_assert(rst); reset_control_assert(rst);
udelay(2); udelay(2);
......
...@@ -930,7 +930,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) ...@@ -930,7 +930,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev)
return ret; return ret;
} }
rst = devm_reset_control_get(&pdev->dev, NULL); rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
if (!IS_ERR(rst)) { if (!IS_ERR(rst)) {
reset_control_assert(rst); reset_control_assert(rst);
udelay(2); udelay(2);
......
...@@ -762,7 +762,7 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = { ...@@ -762,7 +762,7 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = {
{ "Mic1", NULL, "VMIC" }, { "Mic1", NULL, "VMIC" },
}; };
static struct snd_soc_codec_driver sun4i_codec_codec = { static const struct snd_soc_codec_driver sun4i_codec_codec = {
.component_driver = { .component_driver = {
.controls = sun4i_codec_controls, .controls = sun4i_codec_controls,
.num_controls = ARRAY_SIZE(sun4i_codec_controls), .num_controls = ARRAY_SIZE(sun4i_codec_controls),
...@@ -1068,7 +1068,7 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = { ...@@ -1068,7 +1068,7 @@ static const struct snd_soc_dapm_route sun6i_codec_codec_dapm_routes[] = {
{ "Right ADC", NULL, "Right ADC Mixer" }, { "Right ADC", NULL, "Right ADC Mixer" },
}; };
static struct snd_soc_codec_driver sun6i_codec_codec = { static const struct snd_soc_codec_driver sun6i_codec_codec = {
.component_driver = { .component_driver = {
.controls = sun6i_codec_codec_widgets, .controls = sun6i_codec_codec_widgets,
.num_controls = ARRAY_SIZE(sun6i_codec_codec_widgets), .num_controls = ARRAY_SIZE(sun6i_codec_codec_widgets),
...@@ -1096,7 +1096,7 @@ static const struct snd_soc_dapm_widget sun8i_a23_codec_codec_widgets[] = { ...@@ -1096,7 +1096,7 @@ static const struct snd_soc_dapm_widget sun8i_a23_codec_codec_widgets[] = {
}; };
static struct snd_soc_codec_driver sun8i_a23_codec_codec = { static const struct snd_soc_codec_driver sun8i_a23_codec_codec = {
.component_driver = { .component_driver = {
.controls = sun8i_a23_codec_codec_controls, .controls = sun8i_a23_codec_codec_controls,
.num_controls = ARRAY_SIZE(sun8i_a23_codec_codec_controls), .num_controls = ARRAY_SIZE(sun8i_a23_codec_codec_controls),
...@@ -1171,7 +1171,6 @@ static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w, ...@@ -1171,7 +1171,6 @@ static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
{ {
struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card); struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card);
if (scodec->gpio_pa)
gpiod_set_value_cansleep(scodec->gpio_pa, gpiod_set_value_cansleep(scodec->gpio_pa,
!!SND_SOC_DAPM_EVENT_ON(event)); !!SND_SOC_DAPM_EVENT_ON(event));
...@@ -1574,7 +1573,8 @@ static int sun4i_codec_probe(struct platform_device *pdev) ...@@ -1574,7 +1573,8 @@ static int sun4i_codec_probe(struct platform_device *pdev)
} }
if (quirks->has_reset) { if (quirks->has_reset) {
scodec->rst = devm_reset_control_get(&pdev->dev, NULL); scodec->rst = devm_reset_control_get_exclusive(&pdev->dev,
NULL);
if (IS_ERR(scodec->rst)) { if (IS_ERR(scodec->rst)) {
dev_err(&pdev->dev, "Failed to get reset control\n"); dev_err(&pdev->dev, "Failed to get reset control\n");
return PTR_ERR(scodec->rst); return PTR_ERR(scodec->rst);
...@@ -1655,7 +1655,6 @@ static int sun4i_codec_probe(struct platform_device *pdev) ...@@ -1655,7 +1655,6 @@ static int sun4i_codec_probe(struct platform_device *pdev)
goto err_unregister_codec; goto err_unregister_codec;
} }
platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, scodec); snd_soc_card_set_drvdata(card, scodec);
ret = snd_soc_register_card(card); ret = snd_soc_register_card(card);
......
This diff is collapsed.
...@@ -458,11 +458,16 @@ static int sun4i_spdif_runtime_suspend(struct device *dev) ...@@ -458,11 +458,16 @@ static int sun4i_spdif_runtime_suspend(struct device *dev)
static int sun4i_spdif_runtime_resume(struct device *dev) static int sun4i_spdif_runtime_resume(struct device *dev)
{ {
struct sun4i_spdif_dev *host = dev_get_drvdata(dev); struct sun4i_spdif_dev *host = dev_get_drvdata(dev);
int ret;
clk_prepare_enable(host->spdif_clk); ret = clk_prepare_enable(host->spdif_clk);
clk_prepare_enable(host->apb_clk); if (ret)
return ret;
ret = clk_prepare_enable(host->apb_clk);
if (ret)
clk_disable_unprepare(host->spdif_clk);
return 0; return ret;
} }
static int sun4i_spdif_probe(struct platform_device *pdev) static int sun4i_spdif_probe(struct platform_device *pdev)
...@@ -520,7 +525,8 @@ static int sun4i_spdif_probe(struct platform_device *pdev) ...@@ -520,7 +525,8 @@ static int sun4i_spdif_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host); platform_set_drvdata(pdev, host);
if (quirks->has_reset) { if (quirks->has_reset) {
host->rst = devm_reset_control_get_optional(&pdev->dev, NULL); host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
NULL);
if (IS_ERR(host->rst) && PTR_ERR(host->rst) == -EPROBE_DEFER) { if (IS_ERR(host->rst) && PTR_ERR(host->rst) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
dev_err(&pdev->dev, "Failed to get reset: %d\n", ret); dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
......
...@@ -341,7 +341,7 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = { ...@@ -341,7 +341,7 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
"AIF1 Slot 0 Right"}, "AIF1 Slot 0 Right"},
}; };
static struct snd_soc_dai_ops sun8i_codec_dai_ops = { static const struct snd_soc_dai_ops sun8i_codec_dai_ops = {
.hw_params = sun8i_codec_hw_params, .hw_params = sun8i_codec_hw_params,
.set_fmt = sun8i_set_fmt, .set_fmt = sun8i_set_fmt,
}; };
...@@ -360,7 +360,7 @@ static struct snd_soc_dai_driver sun8i_codec_dai = { ...@@ -360,7 +360,7 @@ static struct snd_soc_dai_driver sun8i_codec_dai = {
.ops = &sun8i_codec_dai_ops, .ops = &sun8i_codec_dai_ops,
}; };
static struct snd_soc_codec_driver sun8i_soc_codec = { static const struct snd_soc_codec_driver sun8i_soc_codec = {
.component_driver = { .component_driver = {
.dapm_widgets = sun8i_codec_dapm_widgets, .dapm_widgets = sun8i_codec_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sun8i_codec_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(sun8i_codec_dapm_widgets),
......
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