forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branches 'asoc/topic/sta529', 'asoc/topic/sti',…
… 'asoc/topic/stm', 'asoc/topic/sunxi' and 'asoc/topic/tas2552' into asoc-next
- Loading branch information
Showing
14 changed files
with
1,467 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
STMicroelectronics STM32 Serial Audio Interface (SAI). | ||
|
||
The SAI interface (Serial Audio Interface) offers a wide set of audio protocols | ||
as I2S standards, LSB or MSB-justified, PCM/DSP, TDM, and AC'97. | ||
The SAI contains two independent audio sub-blocks. Each sub-block has | ||
its own clock generator and I/O lines controller. | ||
|
||
Required properties: | ||
- compatible: Should be "st,stm32f4-sai" | ||
- reg: Base address and size of SAI common register set. | ||
- clocks: Must contain phandle and clock specifier pairs for each entry | ||
in clock-names. | ||
- clock-names: Must contain "x8k" and "x11k" | ||
"x8k": SAI parent clock for sampling rates multiple of 8kHz. | ||
"x11k": SAI parent clock for sampling rates multiple of 11.025kHz. | ||
- interrupts: cpu DAI interrupt line shared by SAI sub-blocks | ||
|
||
Optional properties: | ||
- resets: Reference to a reset controller asserting the SAI | ||
|
||
SAI subnodes: | ||
Two subnodes corresponding to SAI sub-block instances A et B can be defined. | ||
Subnode can be omitted for unsused sub-block. | ||
|
||
SAI subnodes required properties: | ||
- compatible: Should be "st,stm32-sai-sub-a" or "st,stm32-sai-sub-b" | ||
for SAI sub-block A or B respectively. | ||
- reg: Base address and size of SAI sub-block register set. | ||
- clocks: Must contain one phandle and clock specifier pair | ||
for sai_ck which feeds the internal clock generator. | ||
- clock-names: Must contain "sai_ck". | ||
- dmas: see Documentation/devicetree/bindings/dma/stm32-dma.txt | ||
- dma-names: identifier string for each DMA request line | ||
"tx": if sai sub-block is configured as playback DAI | ||
"rx": if sai sub-block is configured as capture DAI | ||
- pinctrl-names: should contain only value "default" | ||
- pinctrl-0: see Documentation/devicetree/bindings/pinctrl/pinctrl-stm32.txt | ||
|
||
Example: | ||
sound_card { | ||
compatible = "audio-graph-card"; | ||
dais = <&sai1b_port>; | ||
}; | ||
|
||
sai1: sai1@40015800 { | ||
compatible = "st,stm32f4-sai"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
ranges; | ||
reg = <0x40015800 0x4>; | ||
clocks = <&rcc 1 CLK_SAIQ_PDIV>, <&rcc 1 CLK_I2SQ_PDIV>; | ||
clock-names = "x8k", "x11k"; | ||
interrupts = <87>; | ||
|
||
sai1b: audio-controller@40015824 { | ||
#sound-dai-cells = <0>; | ||
compatible = "st,stm32-sai-sub-b"; | ||
reg = <0x40015824 0x1C>; | ||
clocks = <&rcc 1 CLK_SAI2>; | ||
clock-names = "sai_ck"; | ||
dmas = <&dma2 5 0 0x400 0x0>; | ||
dma-names = "tx"; | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&pinctrl_sai1b>; | ||
|
||
ports { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
sai1b_port: port@0 { | ||
reg = <0>; | ||
cpu_endpoint: endpoint { | ||
remote-endpoint = <&codec_endpoint>; | ||
audio-graph-card,format = "i2s"; | ||
audio-graph-card,bitclock-master = <&codec_endpoint>; | ||
audio-graph-card,frame-master = <&codec_endpoint>; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
audio-codec { | ||
codec_port: port { | ||
codec_endpoint: endpoint { | ||
remote-endpoint = <&cpu_endpoint>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
menuconfig SND_SOC_STM32 | ||
tristate "STMicroelectronics STM32 SOC audio support" | ||
depends on ARCH_STM32 || COMPILE_TEST | ||
depends on SND_SOC | ||
select SND_SOC_GENERIC_DMAENGINE_PCM | ||
select REGMAP_MMIO | ||
help | ||
Say Y if you want to enable ASoC-support for STM32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SAI | ||
snd-soc-stm32-sai-sub-objs := stm32_sai_sub.o | ||
obj-$(CONFIG_SND_SOC_STM32) += snd-soc-stm32-sai-sub.o | ||
|
||
snd-soc-stm32-sai-objs := stm32_sai.o | ||
obj-$(CONFIG_SND_SOC_STM32) += snd-soc-stm32-sai.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* STM32 ALSA SoC Digital Audio Interface (SAI) driver. | ||
* | ||
* Copyright (C) 2016, STMicroelectronics - All Rights Reserved | ||
* Author(s): Olivier Moysan <[email protected]> for STMicroelectronics. | ||
* | ||
* License terms: GPL V2.0. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 as published by | ||
* the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
* details. | ||
*/ | ||
|
||
#include <linux/clk.h> | ||
#include <linux/delay.h> | ||
#include <linux/module.h> | ||
#include <linux/of_platform.h> | ||
#include <linux/reset.h> | ||
|
||
#include <sound/dmaengine_pcm.h> | ||
#include <sound/core.h> | ||
|
||
#include "stm32_sai.h" | ||
|
||
static const struct of_device_id stm32_sai_ids[] = { | ||
{ .compatible = "st,stm32f4-sai", .data = (void *)SAI_STM32F4 }, | ||
{} | ||
}; | ||
|
||
static int stm32_sai_probe(struct platform_device *pdev) | ||
{ | ||
struct device_node *np = pdev->dev.of_node; | ||
struct stm32_sai_data *sai; | ||
struct reset_control *rst; | ||
struct resource *res; | ||
void __iomem *base; | ||
const struct of_device_id *of_id; | ||
|
||
sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); | ||
if (!sai) | ||
return -ENOMEM; | ||
|
||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
base = devm_ioremap_resource(&pdev->dev, res); | ||
if (IS_ERR(base)) | ||
return PTR_ERR(base); | ||
|
||
of_id = of_match_device(stm32_sai_ids, &pdev->dev); | ||
if (of_id) | ||
sai->version = (enum stm32_sai_version)of_id->data; | ||
else | ||
return -EINVAL; | ||
|
||
sai->clk_x8k = devm_clk_get(&pdev->dev, "x8k"); | ||
if (IS_ERR(sai->clk_x8k)) { | ||
dev_err(&pdev->dev, "missing x8k parent clock\n"); | ||
return PTR_ERR(sai->clk_x8k); | ||
} | ||
|
||
sai->clk_x11k = devm_clk_get(&pdev->dev, "x11k"); | ||
if (IS_ERR(sai->clk_x11k)) { | ||
dev_err(&pdev->dev, "missing x11k parent clock\n"); | ||
return PTR_ERR(sai->clk_x11k); | ||
} | ||
|
||
/* init irqs */ | ||
sai->irq = platform_get_irq(pdev, 0); | ||
if (sai->irq < 0) { | ||
dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); | ||
return sai->irq; | ||
} | ||
|
||
/* reset */ | ||
rst = reset_control_get(&pdev->dev, NULL); | ||
if (!IS_ERR(rst)) { | ||
reset_control_assert(rst); | ||
udelay(2); | ||
reset_control_deassert(rst); | ||
} | ||
|
||
sai->pdev = pdev; | ||
platform_set_drvdata(pdev, sai); | ||
|
||
return of_platform_populate(np, NULL, NULL, &pdev->dev); | ||
} | ||
|
||
static int stm32_sai_remove(struct platform_device *pdev) | ||
{ | ||
of_platform_depopulate(&pdev->dev); | ||
|
||
return 0; | ||
} | ||
|
||
MODULE_DEVICE_TABLE(of, stm32_sai_ids); | ||
|
||
static struct platform_driver stm32_sai_driver = { | ||
.driver = { | ||
.name = "st,stm32-sai", | ||
.of_match_table = stm32_sai_ids, | ||
}, | ||
.probe = stm32_sai_probe, | ||
.remove = stm32_sai_remove, | ||
}; | ||
|
||
module_platform_driver(stm32_sai_driver); | ||
|
||
MODULE_DESCRIPTION("STM32 Soc SAI Interface"); | ||
MODULE_AUTHOR("Olivier Moysan, <[email protected]>"); | ||
MODULE_ALIAS("platform:st,stm32-sai"); | ||
MODULE_LICENSE("GPL v2"); |
Oops, something went wrong.