blob: 748016d20e3b535be30bd6b5c80e692d2e1b1a48 [file] [log] [blame]
Soumya Managoli9d627242018-02-24 16:13:25 +05301/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __MSM8952_SLIMBUS_AUDIO
14#define __MSM8952_SLIMBUS_AUDIO
15
16#include <dsp/apr_audio-v2.h>
17
18struct ext_intf_cfg {
19 atomic_t quat_mi2s_clk_ref;
20 atomic_t quin_mi2s_clk_ref;
21 atomic_t auxpcm_mi2s_clk_ref;
22};
23
24enum {
25 PRIM_MI2S = 0,
26 SEC_MI2S,
27 TERT_MI2S,
28 QUAT_MI2S,
29 QUIN_MI2S,
30 MI2S_MAX,
31};
32
33struct msm8952_codec {
34 void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
35 enum afe_config_type config_type);
36};
37
38struct msm8952_asoc_mach_data {
39 int ext_pa;
40 int us_euro_gpio;
41 struct delayed_work hs_detect_dwork;
42 struct snd_soc_codec *codec;
43 struct msm8952_codec msm8952_codec_fn;
44 struct ext_intf_cfg clk_ref;
45 struct snd_info_entry *codec_root;
46 void __iomem *vaddr_gpio_mux_spkr_ctl;
47 void __iomem *vaddr_gpio_mux_mic_ctl;
48 void __iomem *vaddr_gpio_mux_pcm_ctl;
49 void __iomem *vaddr_gpio_mux_quin_ctl;
50 void __iomem *vaddr_gpio_mux_qui_pcm_sec_mode_ctl;
51 void __iomem *vaddr_gpio_mux_mic_ext_clk_ctl;
52 void __iomem *vaddr_gpio_mux_sec_tlmm_ctl;
53 struct device_node *us_euro_gpio_p;
54 struct device_node *mi2s_gpio_p[MI2S_MAX];
55};
56
57int msm_slim_0_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
58 struct snd_pcm_hw_params *params);
59int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
60 struct snd_pcm_hw_params *params);
61int msm_slim_1_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
62 struct snd_pcm_hw_params *params);
63int msm_slim_2_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
64 struct snd_pcm_hw_params *params);
65int msm_slim_4_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
66 struct snd_pcm_hw_params *params);
67int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
68 struct snd_pcm_hw_params *params);
69int msm_slim_5_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
70 struct snd_pcm_hw_params *params);
71int msm_slim_6_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
72 struct snd_pcm_hw_params *params);
73int msm_slim_5_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
74 struct snd_pcm_hw_params *params);
75int msm_snd_hw_params(struct snd_pcm_substream *substream,
76 struct snd_pcm_hw_params *params);
77int msm8952_slimbus_2_hw_params(struct snd_pcm_substream *substream,
78 struct snd_pcm_hw_params *params);
79int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
80 struct snd_pcm_hw_params *params);
81int msm_quin_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
82 struct snd_pcm_hw_params *params);
83int msm_btsco_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
84 struct snd_pcm_hw_params *params);
85int msm_proxy_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
86 struct snd_pcm_hw_params *params);
87int msm_proxy_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
88 struct snd_pcm_hw_params *params);
89int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
90 struct snd_pcm_hw_params *params);
91int msm_audrx_init(struct snd_soc_pcm_runtime *rtd);
92int msm_mi2s_snd_hw_params(struct snd_pcm_substream *substream,
93 struct snd_pcm_hw_params *params);
94int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream,
95 struct snd_pcm_hw_params *params);
96int msm_tdm_snd_hw_params(struct snd_pcm_substream *substream,
97 struct snd_pcm_hw_params *params);
98int msm_quat_mi2s_snd_startup(struct snd_pcm_substream *substream);
99void msm_quat_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
100
101int msm_quin_mi2s_snd_startup(struct snd_pcm_substream *substream);
102void msm_quin_mi2s_snd_shutdown(struct snd_pcm_substream *substream);
103
104int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
105 struct snd_pcm_hw_params *params);
106int msm_prim_auxpcm_startup(struct snd_pcm_substream *substream);
107void msm_prim_auxpcm_shutdown(struct snd_pcm_substream *substream);
108
109int msm_tdm_startup(struct snd_pcm_substream *substream);
110void msm_tdm_shutdown(struct snd_pcm_substream *substream);
111
112struct snd_soc_card *populate_snd_card_dailinks(struct device *dev);
113int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
114 struct snd_pcm_hw_params *params);
115int msm895x_wsa881x_init(struct snd_soc_component *component);
116int msm8952_init_wsa_dev(struct platform_device *pdev,
117 struct snd_soc_card *card);
118void msm895x_free_auxdev_mem(struct platform_device *pdev);
119#endif