Commit | Line | Data |
---|---|---|
27cfc85e AP |
1 | /* |
2 | * Sony CXD2820R demodulator driver | |
3 | * | |
4 | * Copyright (C) 2010 Antti Palosaari <crope@iki.fi> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
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 | * You should have received a copy of the GNU General Public License along | |
17 | * with this program; if not, write to the Free Software Foundation, Inc., | |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 | */ | |
20 | ||
21 | ||
22 | #ifndef CXD2820R_PRIV_H | |
23 | #define CXD2820R_PRIV_H | |
24 | ||
9ac51c5e | 25 | #include <linux/dvb/version.h> |
27cfc85e AP |
26 | #include "dvb_frontend.h" |
27 | #include "dvb_math.h" | |
28 | #include "cxd2820r.h" | |
1e8f31f3 | 29 | #include <linux/gpio.h> |
27cfc85e | 30 | |
27cfc85e AP |
31 | struct reg_val_mask { |
32 | u32 reg; | |
33 | u8 val; | |
34 | u8 mask; | |
35 | }; | |
36 | ||
37 | struct cxd2820r_priv { | |
38 | struct i2c_adapter *i2c; | |
14c03862 | 39 | struct dvb_frontend fe; |
27cfc85e | 40 | struct cxd2820r_config cfg; |
27cfc85e | 41 | |
1d44ccb9 | 42 | bool ber_running; |
27cfc85e AP |
43 | |
44 | u8 bank[2]; | |
1e8f31f3 AP |
45 | #define GPIO_COUNT 3 |
46 | u8 gpio[GPIO_COUNT]; | |
47 | #ifdef CONFIG_GPIOLIB | |
48 | struct gpio_chip gpio_chip; | |
49 | #endif | |
2e1ea06e | 50 | |
0df289a2 | 51 | enum fe_delivery_system delivery_system; |
1d44ccb9 | 52 | bool last_tune_failed; /* for switch between T and T2 tune */ |
27cfc85e AP |
53 | }; |
54 | ||
9ac51c5e SK |
55 | /* cxd2820r_core.c */ |
56 | ||
57 | extern int cxd2820r_debug; | |
58 | ||
1e8f31f3 | 59 | int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio); |
9ac51c5e SK |
60 | |
61 | int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, | |
62 | u8 mask); | |
2e1ea06e | 63 | |
9ac51c5e SK |
64 | int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, |
65 | int len); | |
2e1ea06e | 66 | |
9ac51c5e SK |
67 | int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, |
68 | int len); | |
69 | ||
70 | int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, | |
71 | int len); | |
72 | ||
73 | int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val); | |
74 | ||
75 | int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val); | |
76 | ||
77 | /* cxd2820r_c.c */ | |
78 | ||
7e3e68bc MCC |
79 | int cxd2820r_get_frontend_c(struct dvb_frontend *fe, |
80 | struct dtv_frontend_properties *p); | |
9ac51c5e | 81 | |
f311f68a | 82 | int cxd2820r_set_frontend_c(struct dvb_frontend *fe); |
2e1ea06e | 83 | |
0df289a2 | 84 | int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status); |
9ac51c5e SK |
85 | |
86 | int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber); | |
87 | ||
88 | int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength); | |
89 | ||
90 | int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr); | |
91 | ||
92 | int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks); | |
93 | ||
94 | int cxd2820r_init_c(struct dvb_frontend *fe); | |
95 | ||
96 | int cxd2820r_sleep_c(struct dvb_frontend *fe); | |
97 | ||
98 | int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, | |
99 | struct dvb_frontend_tune_settings *s); | |
100 | ||
101 | /* cxd2820r_t.c */ | |
102 | ||
7e3e68bc MCC |
103 | int cxd2820r_get_frontend_t(struct dvb_frontend *fe, |
104 | struct dtv_frontend_properties *p); | |
9ac51c5e | 105 | |
f311f68a | 106 | int cxd2820r_set_frontend_t(struct dvb_frontend *fe); |
2e1ea06e | 107 | |
0df289a2 | 108 | int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status); |
9ac51c5e SK |
109 | |
110 | int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber); | |
111 | ||
112 | int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength); | |
113 | ||
114 | int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr); | |
115 | ||
116 | int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks); | |
117 | ||
118 | int cxd2820r_init_t(struct dvb_frontend *fe); | |
119 | ||
120 | int cxd2820r_sleep_t(struct dvb_frontend *fe); | |
121 | ||
122 | int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, | |
123 | struct dvb_frontend_tune_settings *s); | |
124 | ||
125 | /* cxd2820r_t2.c */ | |
126 | ||
7e3e68bc MCC |
127 | int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, |
128 | struct dtv_frontend_properties *p); | |
9ac51c5e | 129 | |
f311f68a | 130 | int cxd2820r_set_frontend_t2(struct dvb_frontend *fe); |
2e1ea06e | 131 | |
0df289a2 | 132 | int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status); |
9ac51c5e SK |
133 | |
134 | int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber); | |
135 | ||
136 | int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength); | |
137 | ||
138 | int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr); | |
139 | ||
140 | int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks); | |
141 | ||
142 | int cxd2820r_init_t2(struct dvb_frontend *fe); | |
143 | ||
144 | int cxd2820r_sleep_t2(struct dvb_frontend *fe); | |
145 | ||
146 | int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe, | |
147 | struct dvb_frontend_tune_settings *s); | |
2e1ea06e | 148 | |
27cfc85e | 149 | #endif /* CXD2820R_PRIV_H */ |