Commit d4d5a1cd authored by Takashi Iwai's avatar Takashi Iwai

Merge tag 'asoc-v4.18' of...

Merge tag 'asoc-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v4.18

This is a very big update, mainly due to a huge set of new drivers some
of which are individually very large.  We also have a lot of fixes for
the topology stuff, several of the users have stepped up and fixed some
the serious issues there, and continued progress on the transition away
from CODEC specific drivers to generic component drivers.

 - Many fixes for the topology code, including fixes for the half done
   v4 ABI compatibility from Guenter Roeck and other ABI fixes from
   Kirill Marinushkin.
 - Lots of cleanup for Intel platforms based on Realtek CODECs from Hans
   de Goode.
 - More followups on removing legacy CODEC things and transitioning to
   components from Morimoto-san.
 - Conversion of OMAP DMA to the new, more standard SDMA-PCM driver.
 - A series of fixes and updates to the rather elderly Cirrus Logic SoC
   drivers from Alexander Sverdlin.
 - Qualcomm DSP support from Srinivas Kandagatla.
 - New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
   MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306 and
   RT5668 and TI TSCS454
parents 7a6fc28b aac521e8
...@@ -186,6 +186,9 @@ Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> ...@@ -186,6 +186,9 @@ Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Uwe Kleine-König <ukl@pengutronix.de> Uwe Kleine-König <ukl@pengutronix.de>
Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Vinod Koul <vkoul@kernel.org> <vinod.koul@intel.com>
Vinod Koul <vkoul@kernel.org> <vinod.koul@linux.intel.com>
Vinod Koul <vkoul@kernel.org> <vkoul@infradead.org>
Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com> Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com>
Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com> Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com>
Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com> Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com>
......
Qualcomm APR (Asynchronous Packet Router) binding
This binding describes the Qualcomm APR. APR is a IPC protocol for
communication between Application processor and QDSP. APR is mainly
used for audio/voice services on the QDSP.
- compatible:
Usage: required
Value type: <stringlist>
Definition: must be "qcom,apr-v<VERSION-NUMBER>", example "qcom,apr-v2"
- reg
Usage: required
Value type: <u32>
Definition: Destination processor ID.
Possible values are :
1 - APR simulator
2 - PC
3 - MODEM
4 - ADSP
5 - APPS
6 - MODEM2
7 - APPS2
= APR SERVICES
Each subnode of the APR node represents service tied to this apr. The name
of the nodes are not important. The properties of these nodes are defined
by the individual bindings for the specific service
- All APR services MUST contain the following property:
- reg
Usage: required
Value type: <u32>
Definition: APR Service ID
Possible values are :
3 - DSP Core Service
4 - Audio Front End Service.
5 - Voice Stream Manager Service.
6 - Voice processing manager.
7 - Audio Stream Manager Service.
8 - Audio Device Manager Service.
9 - Multimode voice manager.
10 - Core voice stream.
11 - Core voice processor.
12 - Ultrasound stream manager.
13 - Listen stream manager.
= EXAMPLE
The following example represents a QDSP based sound card on a MSM8996 device
which uses apr as communication between Apps and QDSP.
apr@4 {
compatible = "qcom,apr-v2";
reg = <APR_DOMAIN_ADSP>;
q6core@3 {
compatible = "qcom,q6core";
reg = <APR_SVC_ADSP_CORE>;
};
q6afe@4 {
compatible = "qcom,q6afe";
reg = <APR_SVC_AFE>;
dais {
#sound-dai-cells = <1>;
hdmi@1 {
reg = <1>;
};
};
};
q6asm@7 {
compatible = "qcom,q6asm";
reg = <APR_SVC_ASM>;
...
};
q6adm@8 {
compatible = "qcom,q6adm";
reg = <APR_SVC_ADM>;
...
};
};
Analog Devices SSM2305 Speaker Amplifier
========================================
Required properties:
- compatible : "adi,ssm2305"
- shutdown-gpios : The gpio connected to the shutdown pin.
The gpio signal is ACTIVE_LOW.
Example:
ssm2305: analog-amplifier {
compatible = "adi,ssm2305";
shutdown-gpios = <&gpio3 20 GPIO_ACTIVE_LOW>;
};
* Atmel I2S controller
Required properties:
- compatible: Should be "atmel,sama5d2-i2s".
- reg: Should be the physical base address of the controller and the
length of memory mapped region.
- interrupts: Should contain the interrupt for the controller.
- dmas: Should be one per channel name listed in the dma-names property,
as described in atmel-dma.txt and dma.txt files.
- dma-names: Two dmas have to be defined, "tx" and "rx".
This IP also supports one shared channel for both rx and tx;
if this mode is used, one "rx-tx" name must be used.
- clocks: Must contain an entry for each entry in clock-names.
Please refer to clock-bindings.txt.
- clock-names: Should be one of each entry matching the clocks phandles list:
- "pclk" (peripheral clock) Required.
- "gclk" (generated clock) Optional (1).
- "aclk" (Audio PLL clock) Optional (1).
- "muxclk" (I2S mux clock) Optional (1).
Optional properties:
- pinctrl-0: Should specify pin control groups used for this controller.
- princtrl-names: Should contain only one value - "default".
(1) : Only the peripheral clock is required. The generated clock, the Audio
PLL clock adn the I2S mux clock are optional and should only be set
together, when Master Mode is required.
Example:
i2s@f8050000 {
compatible = "atmel,sama5d2-i2s";
reg = <0xf8050000 0x300>;
interrupts = <54 IRQ_TYPE_LEVEL_HIGH 7>;
dmas = <&dma0
(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
AT91_XDMAC_DT_PERID(31))>,
<&dma0
(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
AT91_XDMAC_DT_PERID(32))>;
dma-names = "tx", "rx";
clocks = <&i2s0_clk>, <&i2s0_gclk>, <&audio_pll_pmc>, <&i2s0muxck>;
clock-names = "pclk", "gclk", "aclk", "muxclk";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2s0_default>;
};
...@@ -16,7 +16,7 @@ Required properties: ...@@ -16,7 +16,7 @@ Required properties:
Example: Example:
codec: cs42888@48 { cs42888: codec@48 {
compatible = "cirrus,cs42888"; compatible = "cirrus,cs42888";
reg = <0x48>; reg = <0x48>;
clocks = <&codec_mclk 0>; clocks = <&codec_mclk 0>;
......
...@@ -31,14 +31,16 @@ Required properties: ...@@ -31,14 +31,16 @@ Required properties:
it. This property is optional depending on the SoC it. This property is optional depending on the SoC
design. design.
- big-endian : If this property is absent, the little endian mode
will be in use as default. Otherwise, the big endian
mode will be in use for all the device registers.
- fsl,asrc-rate : Defines a mutual sample rate used by DPCM Back Ends. - fsl,asrc-rate : Defines a mutual sample rate used by DPCM Back Ends.
- fsl,asrc-width : Defines a mutual sample width used by DPCM Back Ends. - fsl,asrc-width : Defines a mutual sample width used by DPCM Back Ends.
Optional properties:
- big-endian : If this property is absent, the little endian mode
will be in use as default. Otherwise, the big endian
mode will be in use for all the device registers.
Example: Example:
asrc: asrc@2034000 { asrc: asrc@2034000 {
......
...@@ -42,6 +42,8 @@ Required properties: ...@@ -42,6 +42,8 @@ Required properties:
means all the settings for Receiving would be means all the settings for Receiving would be
duplicated from Transmition related registers. duplicated from Transmition related registers.
Optional properties:
- big-endian : If this property is absent, the native endian mode - big-endian : If this property is absent, the native endian mode
will be in use as default, or the big endian mode will be in use as default, or the big endian mode
will be in use for all the device registers. will be in use for all the device registers.
......
...@@ -33,6 +33,8 @@ Required properties: ...@@ -33,6 +33,8 @@ Required properties:
it. This property is optional depending on the SoC it. This property is optional depending on the SoC
design. design.
Optional properties:
- big-endian : If this property is absent, the native endian mode - big-endian : If this property is absent, the native endian mode
will be in use as default, or the big endian mode will be in use as default, or the big endian mode
will be in use for all the device registers. will be in use for all the device registers.
......
...@@ -28,9 +28,6 @@ Required properties: ...@@ -28,9 +28,6 @@ Required properties:
pinctrl-names. See ../pinctrl/pinctrl-bindings.txt pinctrl-names. See ../pinctrl/pinctrl-bindings.txt
for details of the property values. for details of the property values.
- big-endian : Boolean property, required if all the FTM_PWM
registers are big-endian rather than little-endian.
- lsb-first : Configures whether the LSB or the MSB is transmitted - lsb-first : Configures whether the LSB or the MSB is transmitted
first for the fifo data. If this property is absent, first for the fifo data. If this property is absent,
the MSB is transmitted first as default, or the LSB the MSB is transmitted first as default, or the LSB
...@@ -48,6 +45,11 @@ Required properties: ...@@ -48,6 +45,11 @@ Required properties:
receive data by following their own bit clocks and receive data by following their own bit clocks and
frame sync clocks separately. frame sync clocks separately.
Optional properties:
- big-endian : Boolean property, required if all the SAI
registers are big-endian rather than little-endian.
Optional properties (for mx6ul): Optional properties (for mx6ul):
- fsl,sai-mclk-direction-output: This is a boolean property. If present, - fsl,sai-mclk-direction-output: This is a boolean property. If present,
......
Mediatek AFE PCM controller for mt2701 Mediatek AFE PCM controller for mt2701
Required properties: Required properties:
- compatible = "mediatek,mt2701-audio"; - compatible: should be one of the followings.
- "mediatek,mt2701-audio"
- "mediatek,mt7622-audio"
- interrupts: should contain AFE and ASYS interrupts - interrupts: should contain AFE and ASYS interrupts
- interrupt-names: should be "afe" and "asys" - interrupt-names: should be "afe" and "asys"
- power-domains: should define the power domain - power-domains: should define the power domain
......
Mediatek MT6351 Audio Codec
The communication between MT6351 and SoC is through Mediatek PMIC wrapper.
For more detail, please visit Mediatek PMIC wrapper documentation.
Must be a child node of PMIC wrapper.
Required properties:
- compatible : "mediatek,mt6351-sound".
Example:
mt6351_snd {
compatible = "mediatek,mt6351-sound";
};
Mediatek AFE PCM controller for mt6797
Required properties:
- compatible = "mediatek,mt6797-audio";
- reg: register location and size
- interrupts: should contain AFE interrupt
- power-domains: should define the power domain
- clocks: Must contain an entry for each entry in clock-names
- clock-names: should have these clock names:
"infra_sys_audio_clk",
"infra_sys_audio_26m",
"mtkaif_26m_clk",
"top_mux_audio",
"top_mux_aud_intbus",
"top_sys_pll3_d4",
"top_sys_pll1_d4",
"top_clk26m_clk";
Example:
afe: mt6797-afe-pcm@11220000 {
compatible = "mediatek,mt6797-audio";
reg = <0 0x11220000 0 0x1000>;
interrupts = <GIC_SPI 151 IRQ_TYPE_LEVEL_LOW>;
power-domains = <&scpsys MT6797_POWER_DOMAIN_AUDIO>;
clocks = <&infrasys CLK_INFRA_AUDIO>,
<&infrasys CLK_INFRA_AUDIO_26M>,
<&infrasys CLK_INFRA_AUDIO_26M_PAD_TOP>,
<&topckgen CLK_TOP_MUX_AUDIO>,
<&topckgen CLK_TOP_MUX_AUD_INTBUS>,
<&topckgen CLK_TOP_SYSPLL3_D4>,
<&topckgen CLK_TOP_SYSPLL1_D4>,
<&clk26m>;
clock-names = "infra_sys_audio_clk",
"infra_sys_audio_26m",
"mtkaif_26m_clk",
"top_mux_audio",
"top_mux_aud_intbus",
"top_sys_pll3_d4",
"top_sys_pll1_d4",
"top_clk26m_clk";
};
MT6797 with MT6351 CODEC
Required properties:
- compatible: "mediatek,mt6797-mt6351-sound"
- mediatek,platform: the phandle of MT6797 ASoC platform
- mediatek,audio-codec: the phandles of MT6351 codec
Example:
sound {
compatible = "mediatek,mt6797-mt6351-sound";
mediatek,audio-codec = <&mt6351_snd>;
mediatek,platform = <&afe>;
};
* Qualcomm Technologies APQ8096 ASoC sound card driver
This binding describes the APQ8096 sound card, which uses qdsp for audio.
- compatible:
Usage: required
Value type: <stringlist>
Definition: must be "qcom,apq8096-sndcard"
- qcom,audio-routing:
Usage: Optional
Value type: <stringlist>
Definition: A list of the connections between audio components.
Each entry is a pair of strings, the first being the
connection's sink, the second being the connection's
source. Valid names could be power supplies, MicBias
of codec and the jacks on the board:
Valid names include:
Board Connectors:
"Headphone Left"
"Headphone Right"
"Earphone"
"Line Out1"
"Line Out2"
"Line Out3"
"Line Out4"
"Analog Mic1"
"Analog Mic2"
"Analog Mic3"
"Analog Mic4"
"Analog Mic5"
"Analog Mic6"
"Digital Mic2"
"Digital Mic3"
Audio pins and MicBias on WCD9335 Codec:
"MIC_BIAS1
"MIC_BIAS2"
"MIC_BIAS3"
"MIC_BIAS4"
"AMIC1"
"AMIC2"
"AMIC3"
"AMIC4"
"AMIC5"
"AMIC6"
"AMIC6"
"DMIC1"
"DMIC2"
"DMIC3"
= dailinks
Each subnode of sndcard represents either a dailink, and subnodes of each
dailinks would be cpu/codec/platform dais.
- link-name:
Usage: required
Value type: <string>
Definition: User friendly name for dai link
= CPU, PLATFORM, CODEC dais subnodes
- cpu:
Usage: required
Value type: <subnode>
Definition: cpu dai sub-node
- codec:
Usage: Optional
Value type: <subnode>
Definition: codec dai sub-node
- platform:
Usage: Optional
Value type: <subnode>
Definition: platform dai sub-node
- sound-dai:
Usage: required
Value type: <phandle with arguments>
Definition: dai phandle/s and port of CPU/CODEC/PLATFORM node.
Example:
audio {
compatible = "qcom,apq8096-sndcard";
qcom,model = "DB820c";
mm1-dai-link {
link-name = "MultiMedia1";
cpu {
sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
};
};
hdmi-dai-link {
link-name = "HDMI Playback";
cpu {
sound-dai = <&q6afe HDMI_RX>;
};
platform {
sound-dai = <&q6adm>;
};
codec {
sound-dai = <&hdmi 0>;
};
};
};
Qualcomm Audio Device Manager (Q6ADM) binding
Q6ADM is one of the APR audio service on Q6DSP.
Please refer to qcom,apr.txt for details of the coommon apr service bindings
used by the apr service device.
- but must contain the following property:
- compatible:
Usage: required
Value type: <stringlist>
Definition: must be "qcom,q6adm-v<MAJOR-NUMBER>.<MINOR-NUMBER>".
Or "qcom,q6adm" where the version number can be queried
from DSP.
example "qcom,q6adm-v2.0"
= ADM routing
"routing" subnode of the ADM node represents adm routing specific configuration
- #sound-dai-cells
Usage: required
Value type: <u32>
Definition: Must be 0
= EXAMPLE
q6adm@8 {
compatible = "qcom,q6adm";
reg = <APR_SVC_ADM>;
q6routing: routing {
#sound-dai-cells = <0>;
};
};
Qualcomm Audio Front End (Q6AFE) binding
AFE is one of the APR audio service on Q6DSP
Please refer to qcom,apr.txt for details of the common apr service bindings
used by all apr services. Must contain the following properties.
- compatible:
Usage: required
Value type: <stringlist>
Definition: must be "qcom,q6afe-v<MAJOR-NUMBER>.<MINOR-NUMBER>"
Or "qcom,q6afe" where the version number can be queried
from DSP.
example "qcom,q6afe"
= AFE DAIs (Digial Audio Interface)
"dais" subnode of the AFE node. It represents afe dais, each afe dai is a
subnode of "dais" representing board specific dai setup.
"dais" node should have following properties followed by dai children.
- #sound-dai-cells
Usage: required
Value type: <u32>
Definition: Must be 1
- #address-cells
Usage: required
Value type: <u32>
Definition: Must be 1
- #size-cells
Usage: required
Value type: <u32>
Definition: Must be 0
== AFE DAI is subnode of "dais" and represent a dai, it includes board specific
configuration of each dai. Must contain the following properties.
- reg
Usage: required
Value type: <u32>
Definition: Must be dai id
- qcom,sd-lines
Usage: required for mi2s interface
Value type: <prop-encoded-array>
Definition: Must be list of serial data lines used by this dai.
should be one or more of the 1-4 sd lines.
- qcom,tdm-sync-mode:
Usage: required for tdm interface
Value type: <prop-encoded-array>
Definition: Synchronization mode.
0 - Short sync bit mode
1 - Long sync mode
2 - Short sync slot mode
- qcom,tdm-sync-src:
Usage: required for tdm interface
Value type: <prop-encoded-array>
Definition: Synchronization source.
0 - External source
1 - Internal source
- qcom,tdm-data-out:
Usage: required for tdm interface
Value type: <prop-encoded-array>
Definition: Data out signal to drive with other masters.
0 - Disable
1 - Enable
- qcom,tdm-invert-sync:
Usage: required for tdm interface
Value type: <prop-encoded-array>
Definition: Invert the sync.
0 - Normal
1 - Invert
- qcom,tdm-data-delay:
Usage: required for tdm interface
Value type: <prop-encoded-array>
Definition: Number of bit clock to delay data
with respect to sync edge.
0 - 0 bit clock cycle
1 - 1 bit clock cycle
2 - 2 bit clock cycle
- qcom,tdm-data-align:
Usage: required for tdm interface
Value type: <prop-encoded-array>
Definition: Indicate how data is packed
within the slot. For example, 32 slot width in case of
sample bit width is 24.
0 - MSB
1 - LSB
= EXAMPLE
q6afe@4 {
compatible = "qcom,q6afe";
reg = <APR_SVC_AFE>;
dais {
#sound-dai-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
hdmi@1 {
reg = <1>;
};
tdm@24 {
reg = <24>;
qcom,tdm-sync-mode = <1>:
qcom,tdm-sync-src = <1>;
qcom,tdm-data-out = <0>;
qcom,tdm-invert-sync = <1>;
qcom,tdm-data-delay = <1>;
qcom,tdm-data-align = <0>;
};
tdm@25 {
reg = <25>;
qcom,tdm-sync-mode = <1>:
qcom,tdm-sync-src = <1>;
qcom,tdm-data-out = <0>;
qcom,tdm-invert-sync = <1>;
qcom,tdm-data-delay <1>:
qcom,tdm-data-align = <0>;
};
prim-mi2s-rx@16 {
reg = <16>;
qcom,sd-lines = <1 3>;
};
prim-mi2s-tx@17 {
reg = <17>;
qcom,sd-lines = <2>;
};
sec-mi2s-rx@18 {
reg = <18>;
qcom,sd-lines = <1 4>;
};
sec-mi2s-tx@19 {
reg = <19>;
qcom,sd-lines = <2>;
};
tert-mi2s-rx@20 {
reg = <20>;
qcom,sd-lines = <2 4>;
};
tert-mi2s-tx@21 {
reg = <21>;
qcom,sd-lines = <1>;
};
quat-mi2s-rx@22 {
reg = <22>;
qcom,sd-lines = <1>;
};
quat-mi2s-tx@23 {
reg = <23>;
qcom,sd-lines = <2>;
};
};
};
Qualcomm Audio Stream Manager (Q6ASM) binding
Q6ASM is one of the APR audio service on Q6DSP.
Please refer to qcom,apr.txt for details of the common apr service bindings
used by the apr service device.
- but must contain the following property:
- compatible:
Usage: required
Value type: <stringlist>
Definition: must be "qcom,q6asm-v<MAJOR-NUMBER>.<MINOR-NUMBER>".
Or "qcom,q6asm" where the version number can be queried
from DSP.
example "qcom,q6asm-v2.0"
= ASM DAIs (Digial Audio Interface)
"dais" subnode of the ASM node represents dai specific configuration
- #sound-dai-cells
Usage: required
Value type: <u32>
Definition: Must be 1
= EXAMPLE
q6asm@7 {
compatible = "qcom,q6asm";
reg = <APR_SVC_ASM>;
q6asmdai: dais {
#sound-dai-cells = <1>;
};
};
Qualcomm ADSP Core service binding
Q6CORE is one of the APR audio service on Q6DSP.
Please refer to qcom,apr.txt for details of the common apr service bindings
used by the apr service device.
- but must contain the following property:
- compatible:
Usage: required
Value type: <stringlist>
Definition: must be "qcom,q6core-v<MAJOR-NUMBER>.<MINOR-NUMBER>".
Or "qcom,q6core" where the version number can be queried
from DSP.
example "qcom,q6core-v2.0"
= EXAMPLE
q6core@3 {
compatible = "qcom,q6core";
reg = <APR_SVC_ADSP_CORE>;
};
...@@ -26,7 +26,7 @@ Pins on the device (for linking into audio routes) for RT274: ...@@ -26,7 +26,7 @@ Pins on the device (for linking into audio routes) for RT274:
Example: Example:
codec: rt274@1c { rt274: codec@1c {
compatible = "realtek,rt274"; compatible = "realtek,rt274";
reg = <0x1c>; reg = <0x1c>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>; interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
......
...@@ -32,7 +32,7 @@ Pins on the device (for linking into audio routes) for I2C: ...@@ -32,7 +32,7 @@ Pins on the device (for linking into audio routes) for I2C:
Example: Example:
codec: rt5514@57 { rt5514: codec@57 {
compatible = "realtek,rt5514"; compatible = "realtek,rt5514";
reg = <0x57>; reg = <0x57>;
}; };
...@@ -26,7 +26,7 @@ Pins on the device (for linking into audio routes) for RT5616: ...@@ -26,7 +26,7 @@ Pins on the device (for linking into audio routes) for RT5616:
Example: Example:
codec: rt5616@1b { rt5616: codec@1b {
compatible = "realtek,rt5616"; compatible = "realtek,rt5616";
reg = <0x1b>; reg = <0x1b>;
}; };
...@@ -22,6 +22,41 @@ Optional properties: ...@@ -22,6 +22,41 @@ Optional properties:
- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin. - realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
- realtek,dmic1-data-pin
0: dmic1 is not used
1: using IN1P pin as dmic1 data pin
2: using GPIO3 pin as dmic1 data pin
- realtek,dmic2-data-pin
0: dmic2 is not used
1: using IN1N pin as dmic2 data pin
2: using GPIO4 pin as dmic2 data pin
- realtek,jack-detect-source
u32. Valid values:
0: jack-detect is not used
1: Use GPIO1 for jack-detect
2: Use JD1_IN4P for jack-detect
3: Use JD2_IN4N for jack-detect
4: Use GPIO2 for jack-detect
5: Use GPIO3 for jack-detect
6: Use GPIO4 for jack-detect
- realtek,jack-detect-not-inverted
bool. Normal jack-detect switches give an inverted signal, set this bool
in the rare case you've a jack-detect switch which is not inverted.
- realtek,over-current-threshold-microamp
u32, micbias over-current detection threshold in µA, valid values are
600, 1500 and 2000µA.
- realtek,over-current-scale-factor
u32, micbias over-current detection scale-factor, valid values are:
0: Scale current by 0.5
1: Scale current by 0.75
2: Scale current by 1.0
3: Scale current by 1.5
Pins on the device (for linking into audio routes) for RT5639/RT5640: Pins on the device (for linking into audio routes) for RT5639/RT5640:
* DMIC1 * DMIC1
......
...@@ -69,4 +69,4 @@ codec: rt5650@1a { ...@@ -69,4 +69,4 @@ codec: rt5650@1a {
realtek,dmic-en = "true"; realtek,dmic-en = "true";
realtek,en-jd-func = "true"; realtek,en-jd-func = "true";
realtek,jd-mode = <3>; realtek,jd-mode = <3>;
}; };
\ No newline at end of file
...@@ -50,7 +50,7 @@ Pins on the device (for linking into audio routes) for RT5651: ...@@ -50,7 +50,7 @@ Pins on the device (for linking into audio routes) for RT5651:
Example: Example:
codec: rt5651@1a { rt5651: codec@1a {
compatible = "realtek,rt5651"; compatible = "realtek,rt5651";
reg = <0x1a>; reg = <0x1a>;
realtek,dmic-en = "true"; realtek,dmic-en = "true";
......
...@@ -47,7 +47,7 @@ Pins on the device (for linking into audio routes) for RT5663: ...@@ -47,7 +47,7 @@ Pins on the device (for linking into audio routes) for RT5663:
Example: Example:
codec: rt5663@12 { rt5663: codec@12 {
compatible = "realtek,rt5663"; compatible = "realtek,rt5663";
reg = <0x12>; reg = <0x12>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>; interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
......
RT5668B audio CODEC
This device supports I2C only.
Required properties:
- compatible : "realtek,rt5668b"
- reg : The I2C address of the device.
Optional properties:
- interrupts : The CODEC's interrupt output.
- realtek,dmic1-data-pin
0: dmic1 is not used
1: using GPIO2 pin as dmic1 data pin
2: using GPIO5 pin as dmic1 data pin
- realtek,dmic1-clk-pin
0: using GPIO1 pin as dmic1 clock pin
1: using GPIO3 pin as dmic1 clock pin
- realtek,jd-src
0: No JD is used
1: using JD1 as JD source
- realtek,ldo1-en-gpios : The GPIO that controls the CODEC's LDO1_EN pin.
Pins on the device (for linking into audio routes) for RT5668B:
* DMIC L1
* DMIC R1
* IN1P
* HPOL
* HPOR
Example:
rt5668 {
compatible = "realtek,rt5668b";
reg = <0x1a>;
interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(U, 6) GPIO_ACTIVE_HIGH>;
realtek,ldo1-en-gpios =
<&gpio TEGRA_GPIO(R, 2) GPIO_ACTIVE_HIGH>;
realtek,dmic1-data-pin = <1>;
realtek,dmic1-clk-pin = <1>;
realtek,jd-src = <1>;
};
...@@ -39,7 +39,7 @@ VDDIO 1.8V 2.5V 3.3V ...@@ -39,7 +39,7 @@ VDDIO 1.8V 2.5V 3.3V
Example: Example:
codec: sgtl5000@a { sgtl5000: codec@a {
compatible = "fsl,sgtl5000"; compatible = "fsl,sgtl5000";
reg = <0x0a>; reg = <0x0a>;
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
......
...@@ -86,6 +86,11 @@ Optional CPU/CODEC subnodes properties: ...@@ -86,6 +86,11 @@ 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().
If a clock is specified and a
multiplication factor is given with
mclk-fs, the clock will be set to the
calculated mclk frequency when the
stream starts.
- system-clock-direction-out : specifies clock direction as 'out' on - system-clock-direction-out : specifies clock direction as 'out' on
initialization. It is useful for some aCPUs with initialization. It is useful for some aCPUs with
fixed clocks. fixed clocks.
......
...@@ -6,6 +6,8 @@ Required properties: ...@@ -6,6 +6,8 @@ Required properties:
- compatible: "ti,tas6424" - TAS6424 - compatible: "ti,tas6424" - TAS6424
- reg: I2C slave address - reg: I2C slave address
- sound-dai-cells: must be equal to 0 - sound-dai-cells: must be equal to 0
- standby-gpios: GPIO used to shut the TAS6424 down.
- mute-gpios: GPIO used to mute all the outputs
Example: Example:
......
...@@ -8,9 +8,15 @@ Required Properties: ...@@ -8,9 +8,15 @@ Required Properties:
- reg : <0x71> for analog mic - reg : <0x71> for analog mic
<0x69> for digital mic <0x69> for digital mic
- clock-names: Must one of the following "mclk1", "xtal", "mclk2"
- clocks: phandle of the clock that provides the codec sysclk
Example: Example:
wookie: codec@69 { wookie: codec@69 {
compatible = "tempo,tscs42A2"; compatible = "tempo,tscs42A2";
reg = <0x69>; reg = <0x69>;
clock-names = "xtal";
clocks = <&audio_xtal>;
}; };
TSCS454 Audio CODEC
Required Properties:
- compatible : "tempo,tscs454"
- reg : <0x69>
- clock-names: Must one of the following "xtal", "mclk1", "mclk2"
- clocks: phandle of the clock that provides the codec sysclk
Note: If clock is not provided then bit clock is assumed
Example:
redwood: codec@69 {
#sound-dai-cells = <1>;
compatible = "tempo,tscs454";
reg = <0x69>;
clock-names = "mclk1";
clocks = <&audio_mclk>;
};
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8510@1a { wm8510: codec@1a {
compatible = "wlf,wm8510"; compatible = "wlf,wm8510";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -10,7 +10,7 @@ Required properties: ...@@ -10,7 +10,7 @@ Required properties:
Example: Example:
codec: wm8523@1a { wm8523: codec@1a {
compatible = "wlf,wm8523"; compatible = "wlf,wm8523";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -10,7 +10,7 @@ Required properties: ...@@ -10,7 +10,7 @@ Required properties:
Example: Example:
codec: wm8524 { wm8524: codec {
compatible = "wlf,wm8524"; compatible = "wlf,wm8524";
wlf,mute-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; wlf,mute-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
}; };
...@@ -10,7 +10,7 @@ Required properties: ...@@ -10,7 +10,7 @@ Required properties:
Example: Example:
codec: wm8580@1a { wm8580: codec@1a {
compatible = "wlf,wm8580"; compatible = "wlf,wm8580";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8711@1a { wm8711: codec@1a {
compatible = "wlf,wm8711"; compatible = "wlf,wm8711";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8728@1a { wm8728: codec@1a {
compatible = "wlf,wm8728"; compatible = "wlf,wm8728";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8731@1a { wm8731: codec@1a {
compatible = "wlf,wm8731"; compatible = "wlf,wm8731";
reg = <0x1a>; reg = <0x1a>;
}; };
......
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8737@1a { wm8737: codec@1a {
compatible = "wlf,wm8737"; compatible = "wlf,wm8737";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -21,7 +21,7 @@ Optional properties: ...@@ -21,7 +21,7 @@ Optional properties:
Example: Example:
codec: wm8741@1a { wm8741: codec@1a {
compatible = "wlf,wm8741"; compatible = "wlf,wm8741";
reg = <0x1a>; reg = <0x1a>;
......
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8750@1a { wm8750: codec@1a {
compatible = "wlf,wm8750"; compatible = "wlf,wm8750";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -34,7 +34,7 @@ Pins on the device (for linking into audio routes): ...@@ -34,7 +34,7 @@ Pins on the device (for linking into audio routes):
Example: Example:
codec: wm8753@1a { wm8753: codec@1a {
compatible = "wlf,wm8753"; compatible = "wlf,wm8753";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -10,7 +10,7 @@ Required properties: ...@@ -10,7 +10,7 @@ Required properties:
Example: Example:
codec: wm8770@1 { wm8770: codec@1 {
compatible = "wlf,wm8770"; compatible = "wlf,wm8770";
reg = <1>; reg = <1>;
}; };
...@@ -12,7 +12,7 @@ Required properties: ...@@ -12,7 +12,7 @@ Required properties:
Example: Example:
codec: wm8776@1a { wm8776: codec@1a {
compatible = "wlf,wm8776"; compatible = "wlf,wm8776";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -19,7 +19,7 @@ Optional properties: ...@@ -19,7 +19,7 @@ Optional properties:
Example: Example:
codec: wm8804@1a { wm8804: codec@1a {
compatible = "wlf,wm8804"; compatible = "wlf,wm8804";
reg = <0x1a>; reg = <0x1a>;
}; };
...@@ -57,7 +57,7 @@ Pins on the device (for linking into audio routes): ...@@ -57,7 +57,7 @@ Pins on the device (for linking into audio routes):
Example: Example:
codec: wm8903@1a { wm8903: codec@1a {
compatible = "wlf,wm8903"; compatible = "wlf,wm8903";
reg = <0x1a>; reg = <0x1a>;
interrupts = < 347 >; interrupts = < 347 >;
......
...@@ -23,7 +23,7 @@ Optional properties: ...@@ -23,7 +23,7 @@ Optional properties:
Example: Example:
codec: wm8960@1a { wm8960: codec@1a {
compatible = "wlf,wm8960"; compatible = "wlf,wm8960";
reg = <0x1a>; reg = <0x1a>;
......
...@@ -24,7 +24,7 @@ Optional properties: ...@@ -24,7 +24,7 @@ Optional properties:
Example: Example:
codec: wm8962@1a { wm8962: codec@1a {
compatible = "wlf,wm8962"; compatible = "wlf,wm8962";
reg = <0x1a>; reg = <0x1a>;
......
...@@ -59,7 +59,7 @@ Optional properties: ...@@ -59,7 +59,7 @@ Optional properties:
Example: Example:
codec: wm8994@1a { wm8994: codec@1a {
compatible = "wlf,wm8994"; compatible = "wlf,wm8994";
reg = <0x1a>; reg = <0x1a>;
......
...@@ -179,12 +179,12 @@ i.e. ...@@ -179,12 +179,12 @@ i.e.
static int wm8974_mute(struct snd_soc_dai *dai, int mute) static int wm8974_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
u16 mute_reg = snd_soc_read(codec, WM8974_DAC) & 0xffbf; u16 mute_reg = snd_soc_component_read32(component, WM8974_DAC) & 0xffbf;
if (mute) if (mute)
snd_soc_write(codec, WM8974_DAC, mute_reg | 0x40); snd_soc_component_write(component, WM8974_DAC, mute_reg | 0x40);
else else
snd_soc_write(codec, WM8974_DAC, mute_reg); snd_soc_component_write(component, WM8974_DAC, mute_reg);
return 0; return 0;
} }
...@@ -23,30 +23,26 @@ The platform DMA driver optionally supports the following ALSA operations:- ...@@ -23,30 +23,26 @@ The platform DMA driver optionally supports the following ALSA operations:-
}; };
The platform driver exports its DMA functionality via struct The platform driver exports its DMA functionality via struct
snd_soc_platform_driver:- snd_soc_component_driver:-
:: ::
struct snd_soc_platform_driver { struct snd_soc_component_driver {
char *name; const char *name;
int (*probe)(struct platform_device *pdev); ...
int (*remove)(struct platform_device *pdev); int (*probe)(struct snd_soc_component *);
int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); void (*remove)(struct snd_soc_component *);
int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); int (*suspend)(struct snd_soc_component *);
int (*resume)(struct snd_soc_component *);
/* pcm creation and destruction */ /* pcm creation and destruction */
int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *); int (*pcm_new)(struct snd_soc_pcm_runtime *);
void (*pcm_free)(struct snd_pcm *); void (*pcm_free)(struct snd_pcm *);
/* ...
* For platform caused delay reporting. const struct snd_pcm_ops *ops;
* Optional. const struct snd_compr_ops *compr_ops;
*/ ...
snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
struct snd_soc_dai *);
/* platform stream ops */
struct snd_pcm_ops *pcm_ops;
}; };
Please refer to the ALSA driver documentation for details of audio DMA. Please refer to the ALSA driver documentation for details of audio DMA.
......
...@@ -7038,14 +7038,13 @@ L: linux-fbdev@vger.kernel.org ...@@ -7038,14 +7038,13 @@ L: linux-fbdev@vger.kernel.org
S: Maintained S: Maintained
F: drivers/video/fbdev/i810/ F: drivers/video/fbdev/i810/
INTEL ASoC BDW/HSW DRIVERS INTEL ASoC DRIVERS
M: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
M: Liam Girdwood <liam.r.girdwood@linux.intel.com>
M: Jie Yang <yang.jie@linux.intel.com> M: Jie Yang <yang.jie@linux.intel.com>
L: alsa-devel@alsa-project.org (moderated for non-subscribers) L: alsa-devel@alsa-project.org (moderated for non-subscribers)
S: Supported S: Supported
F: sound/soc/intel/common/sst-dsp* F: sound/soc/intel/
F: sound/soc/intel/common/sst-firmware.c
F: sound/soc/intel/boards/broadwell.c
F: sound/soc/intel/haswell/
INTEL C600 SERIES SAS CONTROLLER DRIVER INTEL C600 SERIES SAS CONTROLLER DRIVER
M: Intel SCU Linux support <intel-linux-scu@intel.com> M: Intel SCU Linux support <intel-linux-scu@intel.com>
...@@ -13124,7 +13123,7 @@ F: include/uapi/sound/ ...@@ -13124,7 +13123,7 @@ F: include/uapi/sound/
F: sound/ F: sound/
SOUND - COMPRESSED AUDIO SOUND - COMPRESSED AUDIO
M: Vinod Koul <vinod.koul@intel.com> M: Vinod Koul <vkoul@kernel.org>
L: alsa-devel@alsa-project.org (moderated for non-subscribers) L: alsa-devel@alsa-project.org (moderated for non-subscribers)
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
S: Supported S: Supported
......
...@@ -635,6 +635,7 @@ EXPORT_SYMBOL(ep93xx_keypad_release_gpio); ...@@ -635,6 +635,7 @@ EXPORT_SYMBOL(ep93xx_keypad_release_gpio);
*************************************************************************/ *************************************************************************/
static struct resource ep93xx_i2s_resource[] = { static struct resource ep93xx_i2s_resource[] = {
DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100), DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100),
DEFINE_RES_IRQ(IRQ_EP93XX_SAI),
}; };
static struct platform_device ep93xx_i2s_device = { static struct platform_device ep93xx_i2s_device = {
......
...@@ -2444,7 +2444,7 @@ static int tda1997x_pcm_startup(struct snd_pcm_substream *substream, ...@@ -2444,7 +2444,7 @@ static int tda1997x_pcm_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct tda1997x_state *state = snd_soc_dai_get_drvdata(dai); struct tda1997x_state *state = snd_soc_dai_get_drvdata(dai);
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct snd_pcm_runtime *rtd = substream->runtime; struct snd_pcm_runtime *rtd = substream->runtime;
int rate, err; int rate, err;
...@@ -2452,11 +2452,11 @@ static int tda1997x_pcm_startup(struct snd_pcm_substream *substream, ...@@ -2452,11 +2452,11 @@ static int tda1997x_pcm_startup(struct snd_pcm_substream *substream,
err = snd_pcm_hw_constraint_minmax(rtd, SNDRV_PCM_HW_PARAM_RATE, err = snd_pcm_hw_constraint_minmax(rtd, SNDRV_PCM_HW_PARAM_RATE,
rate, rate); rate, rate);
if (err < 0) { if (err < 0) {
dev_err(codec->dev, "failed to constrain samplerate to %dHz\n", dev_err(component->dev, "failed to constrain samplerate to %dHz\n",
rate); rate);
return err; return err;
} }
dev_info(codec->dev, "set samplerate constraint to %dHz\n", rate); dev_info(component->dev, "set samplerate constraint to %dHz\n", rate);
return 0; return 0;
} }
...@@ -2479,20 +2479,22 @@ static struct snd_soc_dai_driver tda1997x_audio_dai = { ...@@ -2479,20 +2479,22 @@ static struct snd_soc_dai_driver tda1997x_audio_dai = {
.ops = &tda1997x_dai_ops, .ops = &tda1997x_dai_ops,
}; };
static int tda1997x_codec_probe(struct snd_soc_codec *codec) static int tda1997x_codec_probe(struct snd_soc_component *component)
{ {
return 0; return 0;
} }
static int tda1997x_codec_remove(struct snd_soc_codec *codec) static void tda1997x_codec_remove(struct snd_soc_component *component)
{ {
return 0;
} }
static struct snd_soc_codec_driver tda1997x_codec_driver = { static struct snd_soc_component_driver tda1997x_codec_driver = {
.probe = tda1997x_codec_probe, .probe = tda1997x_codec_probe,
.remove = tda1997x_codec_remove, .remove = tda1997x_codec_remove,
.reg_word_size = sizeof(u16), .idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int tda1997x_probe(struct i2c_client *client, static int tda1997x_probe(struct i2c_client *client,
...@@ -2737,7 +2739,7 @@ static int tda1997x_probe(struct i2c_client *client, ...@@ -2737,7 +2739,7 @@ static int tda1997x_probe(struct i2c_client *client,
else else
formats = SNDRV_PCM_FMTBIT_S16_LE; formats = SNDRV_PCM_FMTBIT_S16_LE;
tda1997x_audio_dai.capture.formats = formats; tda1997x_audio_dai.capture.formats = formats;
ret = snd_soc_register_codec(&state->client->dev, ret = devm_snd_soc_register_component(&state->client->dev,
&tda1997x_codec_driver, &tda1997x_codec_driver,
&tda1997x_audio_dai, 1); &tda1997x_audio_dai, 1);
if (ret) { if (ret) {
...@@ -2782,7 +2784,6 @@ static int tda1997x_remove(struct i2c_client *client) ...@@ -2782,7 +2784,6 @@ static int tda1997x_remove(struct i2c_client *client)
struct tda1997x_platform_data *pdata = &state->pdata; struct tda1997x_platform_data *pdata = &state->pdata;
if (pdata->audout_format) { if (pdata->audout_format) {
snd_soc_unregister_codec(&client->dev);
mutex_destroy(&state->audio_lock); mutex_destroy(&state->audio_lock);
} }
......
...@@ -108,4 +108,13 @@ config QCOM_WCNSS_CTRL ...@@ -108,4 +108,13 @@ config QCOM_WCNSS_CTRL
Client driver for the WCNSS_CTRL SMD channel, used to download nv Client driver for the WCNSS_CTRL SMD channel, used to download nv
firmware to a newly booted WCNSS chip. firmware to a newly booted WCNSS chip.
config QCOM_APR
tristate "Qualcomm APR Bus (Asynchronous Packet Router)"
depends on ARCH_QCOM
depends on RPMSG
help
Enable APR IPC protocol support between
application processor and QDSP6. APR is
used by audio driver to configure QDSP6
ASM, ADM and AFE modules.
endmenu endmenu
...@@ -12,3 +12,4 @@ obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o ...@@ -12,3 +12,4 @@ obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMP2P) += smp2p.o
obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_SMSM) += smsm.o
obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
obj-$(CONFIG_QCOM_APR) += apr.o
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
// Copyright (c) 2018, Linaro Limited
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/spinlock.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/of_device.h>
#include <linux/soc/qcom/apr.h>
#include <linux/rpmsg.h>
#include <linux/of.h>
struct apr {
struct rpmsg_endpoint *ch;
struct device *dev;
spinlock_t svcs_lock;
struct idr svcs_idr;
int dest_domain_id;
};
/**
* apr_send_pkt() - Send a apr message from apr device
*
* @adev: Pointer to previously registered apr device.
* @pkt: Pointer to apr packet to send
*
* Return: Will be an negative on packet size on success.
*/
int apr_send_pkt(struct apr_device *adev, struct apr_pkt *pkt)
{
struct apr *apr = dev_get_drvdata(adev->dev.parent);
struct apr_hdr *hdr;
unsigned long flags;
int ret;
spin_lock_irqsave(&adev->lock, flags);
hdr = &pkt->hdr;
hdr->src_domain = APR_DOMAIN_APPS;
hdr->src_svc = adev->svc_id;
hdr->dest_domain = adev->domain_id;
hdr->dest_svc = adev->svc_id;
ret = rpmsg_trysend(apr->ch, pkt, hdr->pkt_size);
spin_unlock_irqrestore(&adev->lock, flags);
return ret ? ret : hdr->pkt_size;
}
EXPORT_SYMBOL_GPL(apr_send_pkt);
static void apr_dev_release(struct device *dev)
{
struct apr_device *adev = to_apr_device(dev);
kfree(adev);
}
static int apr_callback(struct rpmsg_device *rpdev, void *buf,
int len, void *priv, u32 addr)
{
struct apr *apr = dev_get_drvdata(&rpdev->dev);
uint16_t hdr_size, msg_type, ver, svc_id;
struct apr_device *svc = NULL;
struct apr_driver *adrv = NULL;
struct apr_resp_pkt resp;
struct apr_hdr *hdr;
unsigned long flags;
if (len <= APR_HDR_SIZE) {
dev_err(apr->dev, "APR: Improper apr pkt received:%p %d\n",
buf, len);
return -EINVAL;
}
hdr = buf;
ver = APR_HDR_FIELD_VER(hdr->hdr_field);
if (ver > APR_PKT_VER + 1)
return -EINVAL;
hdr_size = APR_HDR_FIELD_SIZE_BYTES(hdr->hdr_field);
if (hdr_size < APR_HDR_SIZE) {
dev_err(apr->dev, "APR: Wrong hdr size:%d\n", hdr_size);
return -EINVAL;
}
if (hdr->pkt_size < APR_HDR_SIZE || hdr->pkt_size != len) {
dev_err(apr->dev, "APR: Wrong paket size\n");
return -EINVAL;
}
msg_type = APR_HDR_FIELD_MT(hdr->hdr_field);
if (msg_type >= APR_MSG_TYPE_MAX) {
dev_err(apr->dev, "APR: Wrong message type: %d\n", msg_type);
return -EINVAL;
}
if (hdr->src_domain >= APR_DOMAIN_MAX ||
hdr->dest_domain >= APR_DOMAIN_MAX ||
hdr->src_svc >= APR_SVC_MAX ||
hdr->dest_svc >= APR_SVC_MAX) {
dev_err(apr->dev, "APR: Wrong APR header\n");
return -EINVAL;
}
svc_id = hdr->dest_svc;
spin_lock_irqsave(&apr->svcs_lock, flags);
svc = idr_find(&apr->svcs_idr, svc_id);
if (svc && svc->dev.driver)
adrv = to_apr_driver(svc->dev.driver);
spin_unlock_irqrestore(&apr->svcs_lock, flags);
if (!adrv) {
dev_err(apr->dev, "APR: service is not registered\n");
return -EINVAL;
}
resp.hdr = *hdr;
resp.payload_size = hdr->pkt_size - hdr_size;
/*
* NOTE: hdr_size is not same as APR_HDR_SIZE as remote can include
* optional headers in to apr_hdr which should be ignored
*/
if (resp.payload_size > 0)
resp.payload = buf + hdr_size;
adrv->callback(svc, &resp);
return 0;
}
static int apr_device_match(struct device *dev, struct device_driver *drv)
{
struct apr_device *adev = to_apr_device(dev);
struct apr_driver *adrv = to_apr_driver(drv);
const struct apr_device_id *id = adrv->id_table;
/* Attempt an OF style match first */
if (of_driver_match_device(dev, drv))
return 1;
if (!id)
return 0;
while (id->domain_id != 0 || id->svc_id != 0) {
if (id->domain_id == adev->domain_id &&
id->svc_id == adev->svc_id)
return 1;
id++;
}
return 0;
}
static int apr_device_probe(struct device *dev)
{
struct apr_device *adev = to_apr_device(dev);
struct apr_driver *adrv = to_apr_driver(dev->driver);
return adrv->probe(adev);
}
static int apr_device_remove(struct device *dev)
{
struct apr_device *adev = to_apr_device(dev);
struct apr_driver *adrv;
struct apr *apr = dev_get_drvdata(adev->dev.parent);
if (dev->driver) {
adrv = to_apr_driver(dev->driver);
if (adrv->remove)
adrv->remove(adev);
spin_lock(&apr->svcs_lock);
idr_remove(&apr->svcs_idr, adev->svc_id);
spin_unlock(&apr->svcs_lock);
}
return 0;
}
static int apr_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct apr_device *adev = to_apr_device(dev);
int ret;
ret = of_device_uevent_modalias(dev, env);
if (ret != -ENODEV)
return ret;
return add_uevent_var(env, "MODALIAS=apr:%s", adev->name);
}
struct bus_type aprbus = {
.name = "aprbus",
.match = apr_device_match,
.probe = apr_device_probe,
.uevent = apr_uevent,
.remove = apr_device_remove,
};
EXPORT_SYMBOL_GPL(aprbus);
static int apr_add_device(struct device *dev, struct device_node *np,
const struct apr_device_id *id)
{
struct apr *apr = dev_get_drvdata(dev);
struct apr_device *adev = NULL;
int ret;
adev = kzalloc(sizeof(*adev), GFP_KERNEL);
if (!adev)
return -ENOMEM;
spin_lock_init(&adev->lock);
adev->svc_id = id->svc_id;
adev->domain_id = id->domain_id;
adev->version = id->svc_version;
if (np)
strncpy(adev->name, np->name, APR_NAME_SIZE);
else
strncpy(adev->name, id->name, APR_NAME_SIZE);
dev_set_name(&adev->dev, "aprsvc:%s:%x:%x", adev->name,
id->domain_id, id->svc_id);
adev->dev.bus = &aprbus;
adev->dev.parent = dev;
adev->dev.of_node = np;
adev->dev.release = apr_dev_release;
adev->dev.driver = NULL;
spin_lock(&apr->svcs_lock);
idr_alloc(&apr->svcs_idr, adev, id->svc_id,
id->svc_id + 1, GFP_ATOMIC);
spin_unlock(&apr->svcs_lock);
dev_info(dev, "Adding APR dev: %s\n", dev_name(&adev->dev));
ret = device_register(&adev->dev);
if (ret) {
dev_err(dev, "device_register failed: %d\n", ret);
put_device(&adev->dev);
}
return ret;
}
static void of_register_apr_devices(struct device *dev)
{
struct apr *apr = dev_get_drvdata(dev);
struct device_node *node;
for_each_child_of_node(dev->of_node, node) {
struct apr_device_id id = { {0} };
if (of_property_read_u32(node, "reg", &id.svc_id))
continue;
id.domain_id = apr->dest_domain_id;
if (apr_add_device(dev, node, &id))
dev_err(dev, "Failed to add apr %d svc\n", id.svc_id);
}
}
static int apr_probe(struct rpmsg_device *rpdev)
{
struct device *dev = &rpdev->dev;
struct apr *apr;
int ret;
apr = devm_kzalloc(dev, sizeof(*apr), GFP_KERNEL);
if (!apr)
return -ENOMEM;
ret = of_property_read_u32(dev->of_node, "reg", &apr->dest_domain_id);
if (ret) {
dev_err(dev, "APR Domain ID not specified in DT\n");
return ret;
}
dev_set_drvdata(dev, apr);
apr->ch = rpdev->ept;
apr->dev = dev;
spin_lock_init(&apr->svcs_lock);
idr_init(&apr->svcs_idr);
of_register_apr_devices(dev);
return 0;
}
static int apr_remove_device(struct device *dev, void *null)
{
struct apr_device *adev = to_apr_device(dev);
device_unregister(&adev->dev);
return 0;
}
static void apr_remove(struct rpmsg_device *rpdev)
{
device_for_each_child(&rpdev->dev, NULL, apr_remove_device);
}
/*
* __apr_driver_register() - Client driver registration with aprbus
*
* @drv:Client driver to be associated with client-device.
* @owner: owning module/driver
*
* This API will register the client driver with the aprbus
* It is called from the driver's module-init function.
*/
int __apr_driver_register(struct apr_driver *drv, struct module *owner)
{
drv->driver.bus = &aprbus;
drv->driver.owner = owner;
return driver_register(&drv->driver);
}
EXPORT_SYMBOL_GPL(__apr_driver_register);
/*
* apr_driver_unregister() - Undo effect of apr_driver_register
*
* @drv: Client driver to be unregistered
*/
void apr_driver_unregister(struct apr_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL_GPL(apr_driver_unregister);
static const struct of_device_id apr_of_match[] = {
{ .compatible = "qcom,apr"},
{ .compatible = "qcom,apr-v2"},
{}
};
MODULE_DEVICE_TABLE(of, apr_of_match);
static struct rpmsg_driver apr_driver = {
.probe = apr_probe,
.remove = apr_remove,
.callback = apr_callback,
.drv = {
.name = "qcom,apr",
.of_match_table = apr_of_match,
},
};
static int __init apr_init(void)
{
int ret;
ret = bus_register(&aprbus);
if (!ret)
ret = register_rpmsg_driver(&apr_driver);
else
bus_unregister(&aprbus);
return ret;
}
static void __exit apr_exit(void)
{
bus_unregister(&aprbus);
unregister_rpmsg_driver(&apr_driver);
}
subsys_initcall(apr_init);
module_exit(apr_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Qualcomm APR Bus");
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __DT_BINDINGS_QCOM_APR_H
#define __DT_BINDINGS_QCOM_APR_H
/* Domain IDs */
#define APR_DOMAIN_SIM 0x1
#define APR_DOMAIN_PC 0x2
#define APR_DOMAIN_MODEM 0x3
#define APR_DOMAIN_ADSP 0x4
#define APR_DOMAIN_APPS 0x5
#define APR_DOMAIN_MAX 0x6
/* ADSP service IDs */
#define APR_SVC_ADSP_CORE 0x3
#define APR_SVC_AFE 0x4
#define APR_SVC_VSM 0x5
#define APR_SVC_VPM 0x6
#define APR_SVC_ASM 0x7
#define APR_SVC_ADM 0x8
#define APR_SVC_ADSP_MVM 0x09
#define APR_SVC_ADSP_CVS 0x0A
#define APR_SVC_ADSP_CVP 0x0B
#define APR_SVC_USM 0x0C
#define APR_SVC_LSM 0x0D
#define APR_SVC_VIDC 0x16
#define APR_SVC_MAX 0x17
#endif /* __DT_BINDINGS_QCOM_APR_H */
...@@ -25,6 +25,13 @@ ...@@ -25,6 +25,13 @@
#define MX51_AUDMUX_PORT6 5 #define MX51_AUDMUX_PORT6 5
#define MX51_AUDMUX_PORT7 6 #define MX51_AUDMUX_PORT7 6
/*
* TFCSEL/RFCSEL (i.MX27) or TFSEL/TCSEL/RFSEL/RCSEL (i.MX31/51/53/6Q)
* can be sourced from Rx/Tx.
*/
#define IMX_AUDMUX_RXFS 0x8
#define IMX_AUDMUX_RXCLK 0x8
/* Register definitions for the i.MX21/27 Digital Audio Multiplexer */ /* Register definitions for the i.MX21/27 Digital Audio Multiplexer */
#define IMX_AUDMUX_V1_PCR_INMMASK(x) ((x) & 0xff) #define IMX_AUDMUX_V1_PCR_INMMASK(x) ((x) & 0xff)
#define IMX_AUDMUX_V1_PCR_INMEN (1 << 8) #define IMX_AUDMUX_V1_PCR_INMEN (1 << 8)
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __DT_BINDINGS_Q6_AFE_H__
#define __DT_BINDINGS_Q6_AFE_H__
/* Audio Front End (AFE) virtual ports IDs */
#define HDMI_RX 1
#define SLIMBUS_0_RX 2
#define SLIMBUS_0_TX 3
#define SLIMBUS_1_RX 4
#define SLIMBUS_1_TX 5
#define SLIMBUS_2_RX 6
#define SLIMBUS_2_TX 7
#define SLIMBUS_3_RX 8
#define SLIMBUS_3_TX 9
#define SLIMBUS_4_RX 10
#define SLIMBUS_4_TX 11
#define SLIMBUS_5_RX 12
#define SLIMBUS_5_TX 13
#define SLIMBUS_6_RX 14
#define SLIMBUS_6_TX 15
#define PRIMARY_MI2S_RX 16
#define PRIMARY_MI2S_TX 17
#define SECONDARY_MI2S_RX 18
#define SECONDARY_MI2S_TX 19
#define TERTIARY_MI2S_RX 20
#define TERTIARY_MI2S_TX 21
#define QUATERNARY_MI2S_RX 22
#define QUATERNARY_MI2S_TX 23
#define PRIMARY_TDM_RX_0 24
#define PRIMARY_TDM_TX_0 25
#define PRIMARY_TDM_RX_1 26
#define PRIMARY_TDM_TX_1 27
#define PRIMARY_TDM_RX_2 28
#define PRIMARY_TDM_TX_2 29
#define PRIMARY_TDM_RX_3 30
#define PRIMARY_TDM_TX_3 31
#define PRIMARY_TDM_RX_4 32
#define PRIMARY_TDM_TX_4 33
#define PRIMARY_TDM_RX_5 34
#define PRIMARY_TDM_TX_5 35
#define PRIMARY_TDM_RX_6 36
#define PRIMARY_TDM_TX_6 37
#define PRIMARY_TDM_RX_7 38
#define PRIMARY_TDM_TX_7 39
#define SECONDARY_TDM_RX_0 40
#define SECONDARY_TDM_TX_0 41
#define SECONDARY_TDM_RX_1 42
#define SECONDARY_TDM_TX_1 43
#define SECONDARY_TDM_RX_2 44
#define SECONDARY_TDM_TX_2 45
#define SECONDARY_TDM_RX_3 46
#define SECONDARY_TDM_TX_3 47
#define SECONDARY_TDM_RX_4 48
#define SECONDARY_TDM_TX_4 49
#define SECONDARY_TDM_RX_5 50
#define SECONDARY_TDM_TX_5 51
#define SECONDARY_TDM_RX_6 52
#define SECONDARY_TDM_TX_6 53
#define SECONDARY_TDM_RX_7 54
#define SECONDARY_TDM_TX_7 55
#define TERTIARY_TDM_RX_0 56
#define TERTIARY_TDM_TX_0 57
#define TERTIARY_TDM_RX_1 58
#define TERTIARY_TDM_TX_1 59
#define TERTIARY_TDM_RX_2 60
#define TERTIARY_TDM_TX_2 61
#define TERTIARY_TDM_RX_3 62
#define TERTIARY_TDM_TX_3 63
#define TERTIARY_TDM_RX_4 64
#define TERTIARY_TDM_TX_4 65
#define TERTIARY_TDM_RX_5 66
#define TERTIARY_TDM_TX_5 67
#define TERTIARY_TDM_RX_6 68
#define TERTIARY_TDM_TX_6 69
#define TERTIARY_TDM_RX_7 70
#define TERTIARY_TDM_TX_7 71
#define QUATERNARY_TDM_RX_0 72
#define QUATERNARY_TDM_TX_0 73
#define QUATERNARY_TDM_RX_1 74
#define QUATERNARY_TDM_TX_1 75
#define QUATERNARY_TDM_RX_2 76
#define QUATERNARY_TDM_TX_2 77
#define QUATERNARY_TDM_RX_3 78
#define QUATERNARY_TDM_TX_3 79
#define QUATERNARY_TDM_RX_4 80
#define QUATERNARY_TDM_TX_4 81
#define QUATERNARY_TDM_RX_5 82
#define QUATERNARY_TDM_TX_5 83
#define QUATERNARY_TDM_RX_6 84
#define QUATERNARY_TDM_TX_6 85
#define QUATERNARY_TDM_RX_7 86
#define QUATERNARY_TDM_TX_7 87
#define QUINARY_TDM_RX_0 88
#define QUINARY_TDM_TX_0 89
#define QUINARY_TDM_RX_1 90
#define QUINARY_TDM_TX_1 91
#define QUINARY_TDM_RX_2 92
#define QUINARY_TDM_TX_2 93
#define QUINARY_TDM_RX_3 94
#define QUINARY_TDM_TX_3 95
#define QUINARY_TDM_RX_4 96
#define QUINARY_TDM_TX_4 97
#define QUINARY_TDM_RX_5 98
#define QUINARY_TDM_TX_5 99
#define QUINARY_TDM_RX_6 100
#define QUINARY_TDM_TX_6 101
#define QUINARY_TDM_RX_7 102
#define QUINARY_TDM_TX_7 103
#endif /* __DT_BINDINGS_Q6_AFE_H__ */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __DT_BINDINGS_Q6_ASM_H__
#define __DT_BINDINGS_Q6_ASM_H__
#define MSM_FRONTEND_DAI_MULTIMEDIA1 0
#define MSM_FRONTEND_DAI_MULTIMEDIA2 1
#define MSM_FRONTEND_DAI_MULTIMEDIA3 2
#define MSM_FRONTEND_DAI_MULTIMEDIA4 3
#define MSM_FRONTEND_DAI_MULTIMEDIA5 4
#define MSM_FRONTEND_DAI_MULTIMEDIA6 5
#define MSM_FRONTEND_DAI_MULTIMEDIA7 6
#define MSM_FRONTEND_DAI_MULTIMEDIA8 7
#define MSM_FRONTEND_DAI_MULTIMEDIA9 8
#define MSM_FRONTEND_DAI_MULTIMEDIA10 9
#define MSM_FRONTEND_DAI_MULTIMEDIA11 10
#define MSM_FRONTEND_DAI_MULTIMEDIA12 11
#define MSM_FRONTEND_DAI_MULTIMEDIA13 12
#define MSM_FRONTEND_DAI_MULTIMEDIA14 13
#define MSM_FRONTEND_DAI_MULTIMEDIA15 14
#define MSM_FRONTEND_DAI_MULTIMEDIA16 15
#endif /* __DT_BINDINGS_Q6_ASM_H__ */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __DT_RT5640_H
#define __DT_RT5640_H
#define RT5640_DMIC1_DATA_PIN_NONE 0
#define RT5640_DMIC1_DATA_PIN_IN1P 1
#define RT5640_DMIC1_DATA_PIN_GPIO3 2
#define RT5640_DMIC2_DATA_PIN_NONE 0
#define RT5640_DMIC2_DATA_PIN_IN1N 1
#define RT5640_DMIC2_DATA_PIN_GPIO4 2
#define RT5640_JD_SRC_GPIO1 1
#define RT5640_JD_SRC_JD1_IN4P 2
#define RT5640_JD_SRC_JD2_IN4N 3
#define RT5640_JD_SRC_GPIO2 4
#define RT5640_JD_SRC_GPIO3 5
#define RT5640_JD_SRC_GPIO4 6
#define RT5640_OVCD_SF_0P5 0
#define RT5640_OVCD_SF_0P75 1
#define RT5640_OVCD_SF_1P0 2
#define RT5640_OVCD_SF_1P5 3
#endif /* __DT_RT5640_H */
...@@ -617,11 +617,8 @@ struct wm8350_audio_platform_data { ...@@ -617,11 +617,8 @@ struct wm8350_audio_platform_data {
u32 codec_current_charge:2; /* codec current @ vmid charge */ u32 codec_current_charge:2; /* codec current @ vmid charge */
}; };
struct snd_soc_codec;
struct wm8350_codec { struct wm8350_codec {
struct platform_device *pdev; struct platform_device *pdev;
struct snd_soc_codec *codec;
struct wm8350_audio_platform_data *platform_data; struct wm8350_audio_platform_data *platform_data;
}; };
......
...@@ -471,6 +471,17 @@ struct slim_device_id { ...@@ -471,6 +471,17 @@ struct slim_device_id {
kernel_ulong_t driver_data; kernel_ulong_t driver_data;
}; };
#define APR_NAME_SIZE 32
#define APR_MODULE_PREFIX "apr:"
struct apr_device_id {
char name[APR_NAME_SIZE];
__u32 domain_id;
__u32 svc_id;
__u32 svc_version;
kernel_ulong_t driver_data; /* Data private to the driver */
};
#define SPMI_NAME_SIZE 32 #define SPMI_NAME_SIZE 32
#define SPMI_MODULE_PREFIX "spmi:" #define SPMI_MODULE_PREFIX "spmi:"
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __QCOM_APR_H_
#define __QCOM_APR_H_
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <dt-bindings/soc/qcom,apr.h>
extern struct bus_type aprbus;
#define APR_HDR_LEN(hdr_len) ((hdr_len)/4)
/*
* HEADER field
* version:0:3
* header_size : 4:7
* message_type : 8:9
* reserved: 10:15
*/
#define APR_HDR_FIELD(msg_type, hdr_len, ver)\
(((msg_type & 0x3) << 8) | ((hdr_len & 0xF) << 4) | (ver & 0xF))
#define APR_HDR_SIZE sizeof(struct apr_hdr)
#define APR_SEQ_CMD_HDR_FIELD APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, \
APR_HDR_LEN(APR_HDR_SIZE), \
APR_PKT_VER)
/* Version */
#define APR_PKT_VER 0x0
/* Command and Response Types */
#define APR_MSG_TYPE_EVENT 0x0
#define APR_MSG_TYPE_CMD_RSP 0x1
#define APR_MSG_TYPE_SEQ_CMD 0x2
#define APR_MSG_TYPE_NSEQ_CMD 0x3
#define APR_MSG_TYPE_MAX 0x04
/* APR Basic Response Message */
#define APR_BASIC_RSP_RESULT 0x000110E8
#define APR_RSP_ACCEPTED 0x000100BE
struct aprv2_ibasic_rsp_result_t {
uint32_t opcode;
uint32_t status;
};
/* hdr field Ver [0:3], Size [4:7], Message type [8:10] */
#define APR_HDR_FIELD_VER(h) (h & 0x000F)
#define APR_HDR_FIELD_SIZE(h) ((h & 0x00F0) >> 4)
#define APR_HDR_FIELD_SIZE_BYTES(h) (((h & 0x00F0) >> 4) * 4)
#define APR_HDR_FIELD_MT(h) ((h & 0x0300) >> 8)
struct apr_hdr {
uint16_t hdr_field;
uint16_t pkt_size;
uint8_t src_svc;
uint8_t src_domain;
uint16_t src_port;
uint8_t dest_svc;
uint8_t dest_domain;
uint16_t dest_port;
uint32_t token;
uint32_t opcode;
} __packed;
struct apr_pkt {
struct apr_hdr hdr;
uint8_t payload[];
};
struct apr_resp_pkt {
struct apr_hdr hdr;
void *payload;
int payload_size;
};
/* Bits 0 to 15 -- Minor version, Bits 16 to 31 -- Major version */
#define APR_SVC_MAJOR_VERSION(v) ((v >> 16) & 0xFF)
#define APR_SVC_MINOR_VERSION(v) (v & 0xFF)
struct apr_device {
struct device dev;
uint16_t svc_id;
uint16_t domain_id;
uint32_t version;
char name[APR_NAME_SIZE];
spinlock_t lock;
struct list_head node;
};
#define to_apr_device(d) container_of(d, struct apr_device, dev)
struct apr_driver {
int (*probe)(struct apr_device *sl);
int (*remove)(struct apr_device *sl);
int (*callback)(struct apr_device *a,
struct apr_resp_pkt *d);
struct device_driver driver;
const struct apr_device_id *id_table;
};
#define to_apr_driver(d) container_of(d, struct apr_driver, driver)
/*
* use a macro to avoid include chaining to get THIS_MODULE
*/
#define apr_driver_register(drv) __apr_driver_register(drv, THIS_MODULE)
int __apr_driver_register(struct apr_driver *drv, struct module *owner);
void apr_driver_unregister(struct apr_driver *drv);
/**
* module_apr_driver() - Helper macro for registering a aprbus driver
* @__aprbus_driver: aprbus_driver struct
*
* Helper macro for aprbus drivers which do not do anything special in
* module init/exit. This eliminates a lot of boilerplate. Each module
* may only use this macro once, and calling it replaces module_init()
* and module_exit()
*/
#define module_apr_driver(__apr_driver) \
module_driver(__apr_driver, apr_driver_register, \
apr_driver_unregister)
int apr_send_pkt(struct apr_device *adev, struct apr_pkt *pkt);
#endif /* __QCOM_APR_H_ */
/*
* omap-pcm.h - OMAP PCM driver
*
* Copyright (C) 2014 Texas Instruments, Inc.
*
* Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
*
* 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.
*/
#ifndef __OMAP_PCM_H__
#define __OMAP_PCM_H__
#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
int omap_pcm_platform_register(struct device *dev);
#else
static inline int omap_pcm_platform_register(struct device *dev)
{
return 0;
}
#endif /* CONFIG_SND_OMAP_SOC */
#endif /* __OMAP_PCM_H__ */
/* /*
* linux/sound/rt5640.h -- Platform data for RT5640 * linux/sound/rt5668.h -- Platform data for RT5668
* *
* Copyright 2011 Realtek Microelectronics * Copyright 2018 Realtek Microelectronics
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#ifndef __LINUX_SND_RT5640_H #ifndef __LINUX_SND_RT5668_H
#define __LINUX_SND_RT5640_H #define __LINUX_SND_RT5668_H
struct rt5640_platform_data { enum rt5668_dmic1_data_pin {
/* IN1 & IN2 & IN3 can optionally be differential */ RT5668_DMIC1_NULL,
bool in1_diff; RT5668_DMIC1_DATA_GPIO2,
bool in2_diff; RT5668_DMIC1_DATA_GPIO5,
bool in3_diff; };
enum rt5668_dmic1_clk_pin {
RT5668_DMIC1_CLK_GPIO1,
RT5668_DMIC1_CLK_GPIO3,
};
bool dmic_en; enum rt5668_jd_src {
bool dmic1_data_pin; /* 0 = IN1P; 1 = GPIO3 */ RT5668_JD_NULL,
bool dmic2_data_pin; /* 0 = IN1N; 1 = GPIO4 */ RT5668_JD1,
};
struct rt5668_platform_data {
int ldo1_en; /* GPIO for LDO1_EN */ int ldo1_en; /* GPIO for LDO1_EN */
enum rt5668_dmic1_data_pin dmic1_data_pin;
enum rt5668_dmic1_clk_pin dmic1_clk_pin;
enum rt5668_jd_src jd_src;
}; };
#endif #endif
...@@ -294,8 +294,8 @@ struct snd_soc_dai { ...@@ -294,8 +294,8 @@ struct snd_soc_dai {
struct snd_soc_dai_driver *driver; struct snd_soc_dai_driver *driver;
/* DAI runtime info */ /* DAI runtime info */
unsigned int capture_active:1; /* stream is in use */ unsigned int capture_active; /* stream usage count */
unsigned int playback_active:1; /* stream is in use */ unsigned int playback_active; /* stream usage count */
unsigned int probed:1; unsigned int probed:1;
unsigned int active; unsigned int active;
...@@ -313,7 +313,6 @@ struct snd_soc_dai { ...@@ -313,7 +313,6 @@ struct snd_soc_dai {
unsigned int sample_bits; unsigned int sample_bits;
/* parent platform/codec */ /* parent platform/codec */
struct snd_soc_codec *codec;
struct snd_soc_component *component; struct snd_soc_component *component;
/* CODEC TDM slot masks and params (for fixup) */ /* CODEC TDM slot masks and params (for fixup) */
......
This diff is collapsed.
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#define DAPM_ARROW(dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-") #define DAPM_ARROW(dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
struct snd_soc_jack; struct snd_soc_jack;
struct snd_soc_codec;
struct snd_soc_card; struct snd_soc_card;
struct snd_soc_dapm_widget; struct snd_soc_dapm_widget;
struct snd_soc_dapm_path; struct snd_soc_dapm_path;
......
...@@ -139,6 +139,15 @@ ...@@ -139,6 +139,15 @@
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
/* DAI clock gating */
#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
/* DAI mclk_direction */
#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */
#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */
/* DAI physical PCM data formats. /* DAI physical PCM data formats.
* Add new formats to the end of the list. * Add new formats to the end of the list.
*/ */
...@@ -160,6 +169,18 @@ ...@@ -160,6 +169,18 @@
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
/* DAI topology BCLK parameter
* For the backwards capability, by default codec is bclk master
*/
#define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */
#define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */
/* DAI topology FSYNC parameter
* For the backwards capability, by default codec is fsync master
*/
#define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */
#define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */
/* /*
* Block Header. * Block Header.
* This header precedes all object and object arrays below. * This header precedes all object and object arrays below.
...@@ -312,12 +333,12 @@ struct snd_soc_tplg_hw_config { ...@@ -312,12 +333,12 @@ struct snd_soc_tplg_hw_config {
__le32 size; /* in bytes of this structure */ __le32 size; /* in bytes of this structure */
__le32 id; /* unique ID - - used to match */ __le32 id; /* unique ID - - used to match */
__le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
__u8 clock_gated; /* 1 if clock can be gated to save power */ __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
__u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
__u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
__u8 bclk_master; /* 1 for master of BCLK, 0 for slave */ __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */
__u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */ __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */
__u8 mclk_direction; /* 0 for input, 1 for output */ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
__le16 reserved; /* for 32bit alignment */ __le16 reserved; /* for 32bit alignment */
__le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
__le32 bclk_rate; /* BCLK freqency in Hz */ __le32 bclk_rate; /* BCLK freqency in Hz */
...@@ -552,4 +573,61 @@ struct snd_soc_tplg_dai { ...@@ -552,4 +573,61 @@ struct snd_soc_tplg_dai {
__le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
struct snd_soc_tplg_private priv; struct snd_soc_tplg_private priv;
} __attribute__((packed)); } __attribute__((packed));
/*
* Old version of ABI structs, supported for backward compatibility.
*/
/* Manifest v4 */
struct snd_soc_tplg_manifest_v4 {
__le32 size; /* in bytes of this structure */
__le32 control_elems; /* number of control elements */
__le32 widget_elems; /* number of widget elements */
__le32 graph_elems; /* number of graph elements */
__le32 pcm_elems; /* number of PCM elements */
__le32 dai_link_elems; /* number of DAI link elements */
struct snd_soc_tplg_private priv;
} __packed;
/* Stream Capabilities v4 */
struct snd_soc_tplg_stream_caps_v4 {
__le32 size; /* in bytes of this structure */
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
__le32 rates; /* supported rates SNDRV_PCM_RATE_* */
__le32 rate_min; /* min rate */
__le32 rate_max; /* max rate */
__le32 channels_min; /* min channels */
__le32 channels_max; /* max channels */
__le32 periods_min; /* min number of periods */
__le32 periods_max; /* max number of periods */
__le32 period_size_min; /* min period size bytes */
__le32 period_size_max; /* max period size bytes */
__le32 buffer_size_min; /* min buffer size bytes */
__le32 buffer_size_max; /* max buffer size bytes */
} __packed;
/* PCM v4 */
struct snd_soc_tplg_pcm_v4 {
__le32 size; /* in bytes of this structure */
char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 pcm_id; /* unique ID - used to match with DAI link */
__le32 dai_id; /* unique ID - used to match */
__le32 playback; /* supports playback mode */
__le32 capture; /* supports capture mode */
__le32 compress; /* 1 = compressed; 0 = PCM */
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
__le32 num_streams; /* number of streams */
struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
} __packed;
/* Physical link config v4 */
struct snd_soc_tplg_link_config_v4 {
__le32 size; /* in bytes of this structure */
__le32 id; /* unique ID - used to match */
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
__le32 num_streams; /* number of streams */
} __packed;
#endif #endif
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* skl-tplg-interface.h - Intel DSP FW private data interface * skl-tplg-interface.h - Intel DSP FW private data interface
* *
* Copyright (C) 2015 Intel Corp * Copyright (C) 2015 Intel Corp
* Author: Jeeja KP <jeeja.kp@intel.com> * Author: Jeeja KP <jeeja.kp@intel.com>
* Nilofer, Samreen <samreen.nilofer@intel.com> * Nilofer, Samreen <samreen.nilofer@intel.com>
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as 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.
*/ */
#ifndef __HDA_TPLG_INTERFACE_H__ #ifndef __HDA_TPLG_INTERFACE_H__
...@@ -169,4 +160,78 @@ enum skl_tuple_type { ...@@ -169,4 +160,78 @@ enum skl_tuple_type {
SKL_TYPE_DATA SKL_TYPE_DATA
}; };
/* v4 configuration data */
struct skl_dfw_v4_module_pin {
u16 module_id;
u16 instance_id;
} __packed;
struct skl_dfw_v4_module_fmt {
u32 channels;
u32 freq;
u32 bit_depth;
u32 valid_bit_depth;
u32 ch_cfg;
u32 interleaving_style;
u32 sample_type;
u32 ch_map;
} __packed;
struct skl_dfw_v4_module_caps {
u32 set_params:2;
u32 rsvd:30;
u32 param_id;
u32 caps_size;
u32 caps[HDA_SST_CFG_MAX];
} __packed;
struct skl_dfw_v4_pipe {
u8 pipe_id;
u8 pipe_priority;
u16 conn_type:4;
u16 rsvd:4;
u16 memory_pages:8;
} __packed;
struct skl_dfw_v4_module {
char uuid[SKL_UUID_STR_SZ];
u16 module_id;
u16 instance_id;
u32 max_mcps;
u32 mem_pages;
u32 obs;
u32 ibs;
u32 vbus_id;
u32 max_in_queue:8;
u32 max_out_queue:8;
u32 time_slot:8;
u32 core_id:4;
u32 rsvd1:4;
u32 module_type:8;
u32 conn_type:4;
u32 dev_type:4;
u32 hw_conn_type:4;
u32 rsvd2:12;
u32 params_fixup:8;
u32 converter:8;
u32 input_pin_type:1;
u32 output_pin_type:1;
u32 is_dynamic_in_pin:1;
u32 is_dynamic_out_pin:1;
u32 is_loadable:1;
u32 rsvd3:11;
struct skl_dfw_v4_pipe pipe;
struct skl_dfw_v4_module_fmt in_fmt[MAX_IN_QUEUE];
struct skl_dfw_v4_module_fmt out_fmt[MAX_OUT_QUEUE];
struct skl_dfw_v4_module_pin in_pin[MAX_IN_QUEUE];
struct skl_dfw_v4_module_pin out_pin[MAX_OUT_QUEUE];
struct skl_dfw_v4_module_caps caps;
} __packed;
#endif #endif
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-utils.o
snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o snd-soc-core-objs += soc-pcm.o soc-io.o soc-devres.o soc-ops.o
snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o snd-soc-core-$(CONFIG_SND_SOC_COMPRESS) += soc-compress.o
......
...@@ -33,17 +33,19 @@ ...@@ -33,17 +33,19 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/input.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include "acp.h"
#include "../codecs/da7219.h" #include "../codecs/da7219.h"
#include "../codecs/da7219-aad.h" #include "../codecs/da7219-aad.h"
#define CZ_PLAT_CLK 24000000 #define CZ_PLAT_CLK 25000000
#define MCLK_RATE 24576000
#define DUAL_CHANNEL 2 #define DUAL_CHANNEL 2
static struct snd_soc_jack cz_jack; static struct snd_soc_jack cz_jack;
static struct clk *da7219_dai_clk; static struct clk *da7219_dai_clk;
extern int bt_uart_enable;
static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
{ {
...@@ -62,7 +64,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) ...@@ -62,7 +64,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
} }
ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_PLL, ret = snd_soc_dai_set_pll(codec_dai, 0, DA7219_SYSCLK_PLL,
CZ_PLAT_CLK, MCLK_RATE); CZ_PLAT_CLK, DA7219_PLL_FREQ_OUT_98304);
if (ret < 0) { if (ret < 0) {
dev_err(rtd->dev, "can't set codec pll: %d\n", ret); dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
return ret; return ret;
...@@ -80,13 +82,17 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) ...@@ -80,13 +82,17 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
return ret; return ret;
} }
snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
da7219_aad_jack_det(component, &cz_jack); da7219_aad_jack_det(component, &cz_jack);
return 0; return 0;
} }
static int cz_da7219_hw_params(struct snd_pcm_substream *substream, static int da7219_clk_enable(struct snd_pcm_substream *substream)
struct snd_pcm_hw_params *params)
{ {
int ret = 0; int ret = 0;
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
...@@ -100,11 +106,9 @@ static int cz_da7219_hw_params(struct snd_pcm_substream *substream, ...@@ -100,11 +106,9 @@ static int cz_da7219_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
} }
static int cz_da7219_hw_free(struct snd_pcm_substream *substream) static void da7219_clk_disable(void)
{ {
clk_disable_unprepare(da7219_dai_clk); clk_disable_unprepare(da7219_dai_clk);
return 0;
} }
static const unsigned int channels[] = { static const unsigned int channels[] = {
...@@ -127,9 +131,12 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = { ...@@ -127,9 +131,12 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = {
.mask = 0, .mask = 0,
}; };
static int cz_fe_startup(struct snd_pcm_substream *substream) static int cz_da7219_startup(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_card *card = rtd->card;
struct acp_platform_info *machine = snd_soc_card_get_drvdata(card);
/* /*
* On this platform for PCM device we support stereo * On this platform for PCM device we support stereo
...@@ -141,23 +148,58 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) ...@@ -141,23 +148,58 @@ static int cz_fe_startup(struct snd_pcm_substream *substream)
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
&constraints_rates); &constraints_rates);
return 0; machine->i2s_instance = I2S_BT_INSTANCE;
return da7219_clk_enable(substream);
}
static void cz_da7219_shutdown(struct snd_pcm_substream *substream)
{
da7219_clk_disable();
}
static int cz_max_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_card *card = rtd->card;
struct acp_platform_info *machine = snd_soc_card_get_drvdata(card);
machine->i2s_instance = I2S_SP_INSTANCE;
return da7219_clk_enable(substream);
}
static void cz_max_shutdown(struct snd_pcm_substream *substream)
{
da7219_clk_disable();
}
static int cz_dmic_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_card *card = rtd->card;
struct acp_platform_info *machine = snd_soc_card_get_drvdata(card);
machine->i2s_instance = I2S_SP_INSTANCE;
return da7219_clk_enable(substream);
}
static void cz_dmic_shutdown(struct snd_pcm_substream *substream)
{
da7219_clk_disable();
} }
static struct snd_soc_ops cz_da7219_cap_ops = { static const struct snd_soc_ops cz_da7219_cap_ops = {
.hw_params = cz_da7219_hw_params, .startup = cz_da7219_startup,
.hw_free = cz_da7219_hw_free, .shutdown = cz_da7219_shutdown,
.startup = cz_fe_startup,
}; };
static struct snd_soc_ops cz_max_play_ops = { static const struct snd_soc_ops cz_max_play_ops = {
.hw_params = cz_da7219_hw_params, .startup = cz_max_startup,
.hw_free = cz_da7219_hw_free, .shutdown = cz_max_shutdown,
}; };
static struct snd_soc_ops cz_dmic_cap_ops = { static const struct snd_soc_ops cz_dmic_cap_ops = {
.hw_params = cz_da7219_hw_params, .startup = cz_dmic_startup,
.hw_free = cz_da7219_hw_free, .shutdown = cz_dmic_shutdown,
}; };
static struct snd_soc_dai_link cz_dai_7219_98357[] = { static struct snd_soc_dai_link cz_dai_7219_98357[] = {
...@@ -240,10 +282,16 @@ static int cz_probe(struct platform_device *pdev) ...@@ -240,10 +282,16 @@ static int cz_probe(struct platform_device *pdev)
{ {
int ret; int ret;
struct snd_soc_card *card; struct snd_soc_card *card;
struct acp_platform_info *machine;
machine = devm_kzalloc(&pdev->dev, sizeof(struct acp_platform_info),
GFP_KERNEL);
if (!machine)
return -ENOMEM;
card = &cz_card; card = &cz_card;
cz_card.dev = &pdev->dev; cz_card.dev = &pdev->dev;
platform_set_drvdata(pdev, card); platform_set_drvdata(pdev, card);
snd_soc_card_set_drvdata(card, machine);
ret = devm_snd_soc_register_card(&pdev->dev, &cz_card); ret = devm_snd_soc_register_card(&pdev->dev, &cz_card);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
...@@ -251,6 +299,8 @@ static int cz_probe(struct platform_device *pdev) ...@@ -251,6 +299,8 @@ static int cz_probe(struct platform_device *pdev)
cz_card.name, ret); cz_card.name, ret);
return ret; return ret;
} }
bt_uart_enable = !device_property_read_bool(&pdev->dev,
"bt-pad-enable");
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -10,17 +10,30 @@ ...@@ -10,17 +10,30 @@
#define ACP_PLAYBACK_PTE_OFFSET 10 #define ACP_PLAYBACK_PTE_OFFSET 10
#define ACP_CAPTURE_PTE_OFFSET 0 #define ACP_CAPTURE_PTE_OFFSET 0
/* Playback and Capture Offset for Stoney */
#define ACP_ST_PLAYBACK_PTE_OFFSET 0x04
#define ACP_ST_CAPTURE_PTE_OFFSET 0x00
#define ACP_ST_BT_PLAYBACK_PTE_OFFSET 0x08
#define ACP_ST_BT_CAPTURE_PTE_OFFSET 0x0c
#define ACP_GARLIC_CNTL_DEFAULT 0x00000FB4 #define ACP_GARLIC_CNTL_DEFAULT 0x00000FB4
#define ACP_ONION_CNTL_DEFAULT 0x00000FB4 #define ACP_ONION_CNTL_DEFAULT 0x00000FB4
#define ACP_PHYSICAL_BASE 0x14000 #define ACP_PHYSICAL_BASE 0x14000
/* Playback SRAM address (as a destination in dma descriptor) */ /*
#define ACP_SHARED_RAM_BANK_1_ADDRESS 0x4002000 * In case of I2S SP controller instance, Stoney uses SRAM bank 1 for
* playback and SRAM Bank 2 for capture where as in case of BT I2S
/* Capture SRAM address (as a source in dma descriptor) */ * Instance, Stoney uses SRAM Bank 3 for playback & SRAM Bank 4 will
#define ACP_SHARED_RAM_BANK_5_ADDRESS 0x400A000 * be used for capture. Carrizo uses I2S SP controller instance. SRAM Banks
#define ACP_SHARED_RAM_BANK_3_ADDRESS 0x4006000 * 1, 2, 3, 4 will be used for playback & SRAM Banks 5, 6, 7, 8 will be used
* for capture scenario.
*/
#define ACP_SRAM_BANK_1_ADDRESS 0x4002000
#define ACP_SRAM_BANK_2_ADDRESS 0x4004000
#define ACP_SRAM_BANK_3_ADDRESS 0x4006000
#define ACP_SRAM_BANK_4_ADDRESS 0x4008000
#define ACP_SRAM_BANK_5_ADDRESS 0x400A000
#define ACP_DMA_RESET_TIME 10000 #define ACP_DMA_RESET_TIME 10000
#define ACP_CLOCK_EN_TIME_OUT_VALUE 0x000000FF #define ACP_CLOCK_EN_TIME_OUT_VALUE 0x000000FF
...@@ -35,8 +48,13 @@ ...@@ -35,8 +48,13 @@
#define TO_ACP_I2S_1 0x2 #define TO_ACP_I2S_1 0x2
#define TO_ACP_I2S_2 0x4 #define TO_ACP_I2S_2 0x4
#define TO_BLUETOOTH 0x3
#define FROM_ACP_I2S_1 0xa #define FROM_ACP_I2S_1 0xa
#define FROM_ACP_I2S_2 0xb #define FROM_ACP_I2S_2 0xb
#define FROM_BLUETOOTH 0xb
#define I2S_SP_INSTANCE 0x01
#define I2S_BT_INSTANCE 0x02
#define ACP_TILE_ON_MASK 0x03 #define ACP_TILE_ON_MASK 0x03
#define ACP_TILE_OFF_MASK 0x02 #define ACP_TILE_OFF_MASK 0x02
...@@ -57,6 +75,14 @@ ...@@ -57,6 +75,14 @@
#define ACP_TO_SYSRAM_CH_NUM 14 #define ACP_TO_SYSRAM_CH_NUM 14
#define I2S_TO_ACP_DMA_CH_NUM 15 #define I2S_TO_ACP_DMA_CH_NUM 15
/* Playback DMA Channels for I2S BT instance */
#define SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM 8
#define ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM 9
/* Capture DMA Channels for I2S BT Instance */
#define ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM 10
#define I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM 11
#define NUM_DSCRS_PER_CHANNEL 2 #define NUM_DSCRS_PER_CHANNEL 2
#define PLAYBACK_START_DMA_DESCR_CH12 0 #define PLAYBACK_START_DMA_DESCR_CH12 0
...@@ -69,9 +95,23 @@ ...@@ -69,9 +95,23 @@
#define CAPTURE_START_DMA_DESCR_CH15 6 #define CAPTURE_START_DMA_DESCR_CH15 6
#define CAPTURE_END_DMA_DESCR_CH15 7 #define CAPTURE_END_DMA_DESCR_CH15 7
/* I2S BT Instance DMA Descriptors */
#define PLAYBACK_START_DMA_DESCR_CH8 8
#define PLAYBACK_END_DMA_DESCR_CH8 9
#define PLAYBACK_START_DMA_DESCR_CH9 10
#define PLAYBACK_END_DMA_DESCR_CH9 11
#define CAPTURE_START_DMA_DESCR_CH10 12
#define CAPTURE_END_DMA_DESCR_CH10 13
#define CAPTURE_START_DMA_DESCR_CH11 14
#define CAPTURE_END_DMA_DESCR_CH11 15
#define mmACP_I2S_16BIT_RESOLUTION_EN 0x5209 #define mmACP_I2S_16BIT_RESOLUTION_EN 0x5209
#define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01 #define ACP_I2S_MIC_16BIT_RESOLUTION_EN 0x01
#define ACP_I2S_SP_16BIT_RESOLUTION_EN 0x02 #define ACP_I2S_SP_16BIT_RESOLUTION_EN 0x02
#define ACP_I2S_BT_16BIT_RESOLUTION_EN 0x04
#define ACP_BT_UART_PAD_SELECT_MASK 0x1
enum acp_dma_priority_level { enum acp_dma_priority_level {
/* 0x0 Specifies the DMA channel is given normal priority */ /* 0x0 Specifies the DMA channel is given normal priority */
ACP_DMA_PRIORITY_LEVEL_NORMAL = 0x0, ACP_DMA_PRIORITY_LEVEL_NORMAL = 0x0,
...@@ -84,20 +124,39 @@ struct audio_substream_data { ...@@ -84,20 +124,39 @@ struct audio_substream_data {
struct page *pg; struct page *pg;
unsigned int order; unsigned int order;
u16 num_of_pages; u16 num_of_pages;
u16 i2s_instance;
u16 direction; u16 direction;
u16 ch1;
u16 ch2;
u16 destination;
u16 dma_dscr_idx_1;
u16 dma_dscr_idx_2;
u32 pte_offset;
u32 sram_bank;
u32 byte_cnt_high_reg_offset;
u32 byte_cnt_low_reg_offset;
uint64_t size; uint64_t size;
u64 i2ssp_renderbytescount; u64 bytescount;
u64 i2ssp_capturebytescount;
void __iomem *acp_mmio; void __iomem *acp_mmio;
}; };
struct audio_drv_data { struct audio_drv_data {
struct snd_pcm_substream *play_i2ssp_stream; struct snd_pcm_substream *play_i2ssp_stream;
struct snd_pcm_substream *capture_i2ssp_stream; struct snd_pcm_substream *capture_i2ssp_stream;
struct snd_pcm_substream *play_i2sbt_stream;
struct snd_pcm_substream *capture_i2sbt_stream;
void __iomem *acp_mmio; void __iomem *acp_mmio;
u32 asic_type; u32 asic_type;
}; };
/*
* this structure used for platform data transfer between machine driver
* and dma driver
*/
struct acp_platform_info {
u16 i2s_instance;
};
union acp_dma_count { union acp_dma_count {
struct { struct {
u32 low; u32 low;
...@@ -115,23 +174,25 @@ enum { ...@@ -115,23 +174,25 @@ enum {
}; };
enum { enum {
ACP_DMA_ATTRIBUTES_SHAREDMEM_TO_DAGB_ONION = 0x0, ACP_DMA_ATTR_SHAREDMEM_TO_DAGB_ONION = 0x0,
ACP_DMA_ATTRIBUTES_SHARED_MEM_TO_DAGB_GARLIC = 0x1, ACP_DMA_ATTR_SHARED_MEM_TO_DAGB_GARLIC = 0x1,
ACP_DMA_ATTRIBUTES_DAGB_ONION_TO_SHAREDMEM = 0x8, ACP_DMA_ATTR_DAGB_ONION_TO_SHAREDMEM = 0x8,
ACP_DMA_ATTRIBUTES_DAGB_GARLIC_TO_SHAREDMEM = 0x9, ACP_DMA_ATTR_DAGB_GARLIC_TO_SHAREDMEM = 0x9,
ACP_DMA_ATTRIBUTES_FORCE_SIZE = 0xF ACP_DMA_ATTR_FORCE_SIZE = 0xF
}; };
typedef struct acp_dma_dscr_transfer { typedef struct acp_dma_dscr_transfer {
/* Specifies the source memory location for the DMA data transfer. */ /* Specifies the source memory location for the DMA data transfer. */
u32 src; u32 src;
/* Specifies the destination memory location to where the data will /*
* Specifies the destination memory location to where the data will
* be transferred. * be transferred.
*/ */
u32 dest; u32 dest;
/* Specifies the number of bytes need to be transferred /*
* from source to destination memory.Transfer direction & IOC enable * Specifies the number of bytes need to be transferred
*/ * from source to destination memory.Transfer direction & IOC enable
*/
u32 xfer_val; u32 xfer_val;
/* Reserved for future use */ /* Reserved for future use */
u32 reserved; u32 reserved;
......
...@@ -88,4 +88,13 @@ config SND_ATMEL_SOC_TSE850_PCM5142 ...@@ -88,4 +88,13 @@ config SND_ATMEL_SOC_TSE850_PCM5142
help help
Say Y if you want to add support for the ASoC driver for the Say Y if you want to add support for the ASoC driver for the
Axentia TSE-850 with a PCM5142 codec. Axentia TSE-850 with a PCM5142 codec.
config SND_ATMEL_SOC_I2S
tristate "Atmel ASoC driver for boards using I2S"
depends on OF && (ARCH_AT91 || COMPILE_TEST)
select SND_SOC_GENERIC_DMAENGINE_PCM
select REGMAP_MMIO
help
Say Y or M if you want to add support for Atmel ASoc driver for boards
using I2S.
endif endif
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
snd-soc-atmel-pcm-pdc-objs := atmel-pcm-pdc.o snd-soc-atmel-pcm-pdc-objs := atmel-pcm-pdc.o
snd-soc-atmel-pcm-dma-objs := atmel-pcm-dma.o snd-soc-atmel-pcm-dma-objs := atmel-pcm-dma.o
snd-soc-atmel_ssc_dai-objs := atmel_ssc_dai.o snd-soc-atmel_ssc_dai-objs := atmel_ssc_dai.o
snd-soc-atmel-i2s-objs := atmel-i2s.o
obj-$(CONFIG_SND_ATMEL_SOC_PDC) += snd-soc-atmel-pcm-pdc.o obj-$(CONFIG_SND_ATMEL_SOC_PDC) += snd-soc-atmel-pcm-pdc.o
obj-$(CONFIG_SND_ATMEL_SOC_DMA) += snd-soc-atmel-pcm-dma.o obj-$(CONFIG_SND_ATMEL_SOC_DMA) += snd-soc-atmel-pcm-dma.o
obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
obj-$(CONFIG_SND_ATMEL_SOC_I2S) += snd-soc-atmel-i2s.o
# AT91 Machine Support # AT91 Machine Support
snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
......
This diff is collapsed.
...@@ -820,7 +820,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, ...@@ -820,7 +820,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
if (ret < 0) { if (ret < 0) {
printk(KERN_WARNING printk(KERN_WARNING
"atmel_ssc_dai: request_irq failure\n"); "atmel_ssc_dai: request_irq failure\n");
pr_debug("Atmel_ssc_dai: Stoping clock\n"); pr_debug("Atmel_ssc_dai: Stopping clock\n");
clk_disable(ssc_p->ssc->clk); clk_disable(ssc_p->ssc->clk);
return ret; return ret;
} }
...@@ -1002,8 +1002,7 @@ static const struct snd_soc_component_driver atmel_ssc_component = { ...@@ -1002,8 +1002,7 @@ static const struct snd_soc_component_driver atmel_ssc_component = {
static int asoc_ssc_init(struct device *dev) static int asoc_ssc_init(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct ssc_device *ssc = dev_get_drvdata(dev);
struct ssc_device *ssc = platform_get_drvdata(pdev);
int ret; int ret;
ret = snd_soc_register_component(dev, &atmel_ssc_component, ret = snd_soc_register_component(dev, &atmel_ssc_component,
...@@ -1033,8 +1032,7 @@ static int asoc_ssc_init(struct device *dev) ...@@ -1033,8 +1032,7 @@ static int asoc_ssc_init(struct device *dev)
static void asoc_ssc_exit(struct device *dev) static void asoc_ssc_exit(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct ssc_device *ssc = dev_get_drvdata(dev);
struct ssc_device *ssc = platform_get_drvdata(pdev);
if (ssc->pdata->use_dma) if (ssc->pdata->use_dma)
atmel_pcm_dma_platform_unregister(dev); atmel_pcm_dma_platform_unregister(dev);
......
...@@ -11,9 +11,8 @@ config SND_BCM2835_SOC_I2S ...@@ -11,9 +11,8 @@ config SND_BCM2835_SOC_I2S
config SND_SOC_CYGNUS config SND_SOC_CYGNUS
tristate "SoC platform audio for Broadcom Cygnus chips" tristate "SoC platform audio for Broadcom Cygnus chips"
depends on ARCH_BCM_CYGNUS || COMPILE_TEST depends on ARCH_BCM_CYGNUS || COMPILE_TEST
depends on HAS_DMA
help help
Say Y if you want to add support for ASoC audio on Broadcom Say Y if you want to add support for ASoC audio on Broadcom
Cygnus chips (bcm958300, bcm958305, bcm911360) Cygnus chips (bcm958300, bcm958305, bcm911360)
If you don't know what to do here, say N. If you don't know what to do here, say N.
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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