2 * Sony CXD2820R demodulator driver
4 * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
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.
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.
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.
22 #ifndef CXD2820R_PRIV_H
23 #define CXD2820R_PRIV_H
25 #include <linux/dvb/version.h>
26 #include "dvb_frontend.h"
30 #define LOG_PREFIX "cxd2820r"
33 #define dbg(f, arg...) \
35 printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
37 #define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
39 #define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
41 #define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
49 struct cxd2820r_priv {
50 struct i2c_adapter *i2c;
51 struct dvb_frontend fe[2];
52 struct cxd2820r_config cfg;
54 struct mutex fe_lock; /* FE lock */
55 int active_fe:2; /* FE lock, -1=NONE, 0=DVB-T/T2, 1=DVB-C */
62 fe_delivery_system_t delivery_system;
63 bool last_tune_failed; /* for switch between T and T2 tune */
68 extern int cxd2820r_debug;
70 int cxd2820r_gpio(struct dvb_frontend *fe);
72 int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
75 int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
78 u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor);
80 int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
83 int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
86 int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val);
88 int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);
92 int cxd2820r_get_frontend_c(struct dvb_frontend *fe,
93 struct dvb_frontend_parameters *p);
95 int cxd2820r_set_frontend_c(struct dvb_frontend *fe,
96 struct dvb_frontend_parameters *params);
98 int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status);
100 int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber);
102 int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength);
104 int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr);
106 int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks);
108 int cxd2820r_init_c(struct dvb_frontend *fe);
110 int cxd2820r_sleep_c(struct dvb_frontend *fe);
112 int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,
113 struct dvb_frontend_tune_settings *s);
117 int cxd2820r_get_frontend_t(struct dvb_frontend *fe,
118 struct dvb_frontend_parameters *p);
120 int cxd2820r_set_frontend_t(struct dvb_frontend *fe,
121 struct dvb_frontend_parameters *params);
123 int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status);
125 int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber);
127 int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength);
129 int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr);
131 int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks);
133 int cxd2820r_init_t(struct dvb_frontend *fe);
135 int cxd2820r_sleep_t(struct dvb_frontend *fe);
137 int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,
138 struct dvb_frontend_tune_settings *s);
142 int cxd2820r_get_frontend_t2(struct dvb_frontend *fe,
143 struct dvb_frontend_parameters *p);
145 int cxd2820r_set_frontend_t2(struct dvb_frontend *fe,
146 struct dvb_frontend_parameters *params);
148 int cxd2820r_read_status_t2(struct dvb_frontend *fe, fe_status_t *status);
150 int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber);
152 int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength);
154 int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr);
156 int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks);
158 int cxd2820r_init_t2(struct dvb_frontend *fe);
160 int cxd2820r_sleep_t2(struct dvb_frontend *fe);
162 int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,
163 struct dvb_frontend_tune_settings *s);
165 #endif /* CXD2820R_PRIV_H */