ASoC: mediatek: implement mediatek common structure
[deliverable/linux.git] / sound / soc / mediatek / common / mtk-base-afe.h
1 /*
2 * mtk-base-afe.h -- Mediatek base afe structure
3 *
4 * Copyright (c) 2016 MediaTek Inc.
5 * Author: Garlic Tseng <garlic.tseng@mediatek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 and
9 * only version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17 #ifndef _MTK_BASE_AFE_H_
18 #define _MTK_BASE_AFE_H_
19
20 struct mtk_base_memif_data {
21 int id;
22 const char *name;
23 int reg_ofs_base;
24 int reg_ofs_cur;
25 int fs_reg;
26 int fs_shift;
27 int fs_maskbit;
28 int mono_reg;
29 int mono_shift;
30 int enable_reg;
31 int enable_shift;
32 int hd_reg;
33 int hd_shift;
34 int msb_reg;
35 int msb_shift;
36 int agent_disable_reg;
37 int agent_disable_shift;
38 };
39
40 struct mtk_base_irq_data {
41 int id;
42 int irq_cnt_reg;
43 int irq_cnt_shift;
44 int irq_cnt_maskbit;
45 int irq_fs_reg;
46 int irq_fs_shift;
47 int irq_fs_maskbit;
48 int irq_en_reg;
49 int irq_en_shift;
50 int irq_clr_reg;
51 int irq_clr_shift;
52 };
53
54 struct device;
55 struct mtk_base_afe_memif;
56 struct mtk_base_afe_irq;
57 struct regmap;
58 struct snd_pcm_substream;
59 struct snd_soc_dai;
60
61 struct mtk_base_afe {
62 void __iomem *base_addr;
63 struct device *dev;
64 struct regmap *regmap;
65 struct mutex irq_alloc_lock; /* dynamic alloc irq lock */
66
67 unsigned int const *reg_back_up_list;
68 unsigned int *reg_back_up;
69 unsigned int reg_back_up_list_num;
70
71 int (*runtime_suspend)(struct device *dev);
72 int (*runtime_resume)(struct device *dev);
73 bool suspended;
74
75 struct mtk_base_afe_memif *memif;
76 int memif_size;
77 struct mtk_base_afe_irq *irqs;
78 int irqs_size;
79
80 const struct snd_pcm_hardware *mtk_afe_hardware;
81 int (*memif_fs)(struct snd_pcm_substream *substream,
82 unsigned int rate);
83 int (*irq_fs)(struct snd_pcm_substream *substream,
84 unsigned int rate);
85
86 void *platform_priv;
87 };
88
89 struct mtk_base_afe_memif {
90 unsigned int phys_buf_addr;
91 int buffer_size;
92 struct snd_pcm_substream *substream;
93 const struct mtk_base_memif_data *data;
94 int irq_usage;
95 int const_irq;
96 };
97
98 struct mtk_base_afe_irq {
99 const struct mtk_base_irq_data *irq_data;
100 int irq_occupyed;
101 };
102
103 #endif
104
This page took 0.058721 seconds and 5 git commands to generate.