Linux 4.16.11
[linux/fpc-iii.git] / sound / soc / mediatek / common / mtk-base-afe.h
blob3a78f6f171958f911e43f73db934c76d6a5449e6
1 /*
2 * mtk-base-afe.h -- Mediatek base afe structure
4 * Copyright (c) 2016 MediaTek Inc.
5 * Author: Garlic Tseng <garlic.tseng@mediatek.com>
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.
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.
17 #ifndef _MTK_BASE_AFE_H_
18 #define _MTK_BASE_AFE_H_
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;
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;
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;
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 */
67 unsigned int const *reg_back_up_list;
68 unsigned int *reg_back_up;
69 unsigned int reg_back_up_list_num;
71 int (*runtime_suspend)(struct device *dev);
72 int (*runtime_resume)(struct device *dev);
73 bool suspended;
75 struct mtk_base_afe_memif *memif;
76 int memif_size;
77 struct mtk_base_afe_irq *irqs;
78 int irqs_size;
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);
86 void *platform_priv;
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;
98 struct mtk_base_afe_irq {
99 const struct mtk_base_irq_data *irq_data;
100 int irq_occupyed;
103 #endif