-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaml_fe.h
223 lines (195 loc) · 5.58 KB
/
aml_fe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _AML_FE_H_
#define _AML_FE_H_
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/netdevice.h>
#include <linux/i2c.h>
#include <linux/dvb/video.h>
#include <linux/dvb/audio.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/ca.h>
#include <linux/dvb/osd.h>
#include <linux/dvb/net.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#include "dvbdev.h"
#include "demux.h"
#include "dvb_demux.h"
#include "dmxdev.h"
#include "dvb_filter.h"
#include "dvb_net.h"
#include "dvb_ringbuffer.h"
#include "dvb_frontend.h"
#include "aml_dvb.h"
#include "linux/videodev2.h"
#include <linux/amlogic/aml_gpio_consumer.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/pinctrl/consumer.h>
#include <linux/amlogic/cpu_version.h>
#include <linux/of_reserved_mem.h>
enum aml_fe_mode_t {
AM_FE_UNKNOWN = 0,
AM_FE_QPSK = 1,
AM_FE_QAM = 2,
AM_FE_OFDM = 4,
AM_FE_ATSC = 8,
AM_FE_ANALOG = 16,
AM_FE_DTMB = 32,
AM_FE_ISDBT = 64
};
#define AM_FE_DTV_MASK (AM_FE_QPSK | AM_FE_QAM | AM_FE_OFDM | \
AM_FE_ATSC | AM_FE_DTMB | AM_FE_ISDBT)
enum aml_tuner_type_t {
AM_TUNER_SI2176 = 1,
AM_TUNER_SI2196 = 2,
AM_TUNER_FQ1216 = 3,
AM_TUNER_HTM = 4,
AM_TUNER_CTC703 = 5,
AM_TUNER_SI2177 = 6,
AM_TUNER_R840 = 7,
AM_TUNER_SI2157 = 8,
AM_TUNER_SI2151 = 9,
AM_TUNER_MXL661 = 10
};
enum aml_atv_demod_type_t {
AM_ATV_DEMOD_SI2176 = 1,
AM_ATV_DEMOD_SI2196 = 2,
AM_ATV_DEMOD_FQ1216 = 3,
AM_ATV_DEMOD_HTM = 4,
AM_ATV_DEMOD_CTC703 = 5,
AM_ATV_DEMOD_SI2177 = 6,
AM_ATV_DEMOD_AML = 7,
AM_ATV_DEMOD_R840 = 8
};
enum aml_dtv_demod_type_t {
AM_DTV_DEMOD_M1 = 0,
AM_DTV_DEMOD_SI2176 = 1,
AM_DTV_DEMOD_MXL101 = 2,
AM_DTV_DEMOD_SI2196 = 3,
AM_DTV_DEMOD_AVL6211 = 4,
AM_DTV_DEMOD_SI2168 = 5,
AM_DTV_DEMOD_ITE9133 = 6,
AM_DTV_DEMOD_ITE9173 = 7,
AM_DTV_DEMOD_DIB8096 = 8,
AM_DTV_DEMOD_ATBM8869 = 9,
AM_DTV_DEMOD_MXL241 = 10,
AM_DTV_DEMOD_AVL68xx = 11,
AM_DTV_DEMOD_MXL683 = 12
};
enum aml_fe_dev_type_t {
AM_DEV_TUNER,
AM_DEV_ATV_DEMOD,
AM_DEV_DTV_DEMOD
};
struct aml_fe_dev;
struct aml_fe;
struct aml_fe_drv {
struct module *owner;
struct aml_fe_drv *next;
enum aml_tuner_type_t id;
char *name;
int capability;
int (*init)(struct aml_fe_dev *dev);
int (*release)(struct aml_fe_dev *dev);
int (*resume)(struct aml_fe_dev *dev);
int (*suspend)(struct aml_fe_dev *dev);
int (*get_ops)(struct aml_fe_dev *dev, int mode,
void *ops);
int (*enter_mode)(struct aml_fe *fe, int mode);
int (*leave_mode)(struct aml_fe *fe, int mode);
int ref;
};
struct aml_fe_dev {
/*point to parent aml_fe */
struct aml_fe *fe;
int i2c_adap_id;
int i2c_addr;
struct i2c_adapter *i2c_adap;
int reset_gpio;
int reset_value;
struct aml_fe_drv *drv;
wait_queue_head_t lock_wq;
void *priv_data;
/*for tuner power control */
int tuner_power_gpio;
/*for dtv dvbsx lnb power control */
int lnb_power_gpio;
/*for ant overload control, */
/*it possible in dtv dvbsx and depond on fe hw */
int antoverload_gpio;
/*for mem reserved*/
int mem_start;
int mem_end;
/*for dtv spectrum*/
int spectrum;
};
struct aml_demod_param {
/*for tuner video if to amlatvdemod*/
unsigned int if_freq; /*HZ*/
/*for tuner output*/
unsigned int if_inv;
};
struct aml_fe {
struct dvb_frontend *fe;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend es;
#endif /*CONFIG_HAS_EARLYSUSPEND */
spinlock_t slock;
int init;
int mode;
int dev_id;
int capability;
enum aml_ts_source_t ts;
struct aml_demod_param demod_param;
struct aml_fe_dev *tuner;
struct aml_fe_dev *atv_demod;
struct aml_fe_dev *dtv_demod;
/*struct dvb_frontend_parameters params;*/
struct dtv_frontend_properties params;
};
struct aml_fe_man {
struct aml_fe fe[FE_DEV_COUNT];
struct aml_fe_dev tuner[FE_DEV_COUNT];
struct aml_fe_dev atv_demod[FE_DEV_COUNT];
struct aml_fe_dev dtv_demod[FE_DEV_COUNT];
struct dvb_frontend dev[FE_DEV_COUNT];
struct pinctrl *pinctrl;
struct platform_device *pdev;
};
extern int aml_register_fe_drv(enum aml_fe_dev_type_t type,
struct aml_fe_drv *drv);
extern int aml_unregister_fe_drv(enum aml_fe_dev_type_t type,
struct aml_fe_drv *drv);
extern struct dvb_frontend *get_si2177_tuner(void);
extern const char *soundsys_to_str(unsigned short soundsys);
extern const char *audmode_to_str(unsigned short soundsys);
extern const char *v4l2_std_to_str(v4l2_std_id std);
extern const char *fe_type_to_str(enum fe_type type);
extern int amlogic_gpio_name_map_num(const char *name);
extern int amlogic_gpio_direction_output(unsigned int pin, int value,
const char *owner);
extern int amlogic_gpio_request(unsigned int pin, const char *label);
/* vdac ctrl,adc/dac ref signal,cvbs out signal
* module index: atv demod:0x01; dtv demod:0x02; tvafe:0x4; dac:0x8
*/
extern void vdac_enable(bool on, unsigned int module_sel);
extern void set_aft_thread_enable(int enable);
#endif /*_AML_FE_H_*/