]>
Commit | Line | Data |
---|---|---|
16216333 | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
27cfc85e AP |
2 | /* |
3 | * Sony CXD2820R demodulator driver | |
4 | * | |
5 | * Copyright (C) 2010 Antti Palosaari <crope@iki.fi> | |
27cfc85e AP |
6 | */ |
7 | ||
8 | ||
9 | #ifndef CXD2820R_PRIV_H | |
10 | #define CXD2820R_PRIV_H | |
11 | ||
9ac51c5e | 12 | #include <linux/dvb/version.h> |
fada1935 MCC |
13 | #include <media/dvb_frontend.h> |
14 | #include <media/dvb_math.h> | |
27cfc85e | 15 | #include "cxd2820r.h" |
1e8f31f3 | 16 | #include <linux/gpio.h> |
2832fd31 | 17 | #include <linux/math64.h> |
43e2ea63 | 18 | #include <linux/regmap.h> |
27cfc85e | 19 | |
27cfc85e AP |
20 | struct reg_val_mask { |
21 | u32 reg; | |
22 | u8 val; | |
23 | u8 mask; | |
24 | }; | |
25 | ||
fcd09f65 AP |
26 | #define CXD2820R_CLK 41000000 |
27 | ||
27cfc85e | 28 | struct cxd2820r_priv { |
07fdf7d9 | 29 | struct i2c_client *client[2]; |
43e2ea63 | 30 | struct regmap *regmap[2]; |
27cfc85e | 31 | struct i2c_adapter *i2c; |
14c03862 | 32 | struct dvb_frontend fe; |
07fdf7d9 AP |
33 | u8 ts_mode; |
34 | bool ts_clk_inv; | |
35 | bool if_agc_polarity; | |
36 | bool spec_inv; | |
37 | ||
4aa4fd86 | 38 | u64 post_bit_error_prev_dvbv3; |
2832fd31 | 39 | u64 post_bit_error; |
27cfc85e | 40 | |
1d44ccb9 | 41 | bool ber_running; |
27cfc85e | 42 | |
1e8f31f3 AP |
43 | #define GPIO_COUNT 3 |
44 | u8 gpio[GPIO_COUNT]; | |
45 | #ifdef CONFIG_GPIOLIB | |
46 | struct gpio_chip gpio_chip; | |
47 | #endif | |
2e1ea06e | 48 | |
0df289a2 | 49 | enum fe_delivery_system delivery_system; |
1d44ccb9 | 50 | bool last_tune_failed; /* for switch between T and T2 tune */ |
27cfc85e AP |
51 | }; |
52 | ||
9ac51c5e SK |
53 | /* cxd2820r_core.c */ |
54 | ||
55 | extern int cxd2820r_debug; | |
56 | ||
1e8f31f3 | 57 | int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio); |
9ac51c5e | 58 | |
43e2ea63 AP |
59 | int cxd2820r_wr_reg_val_mask_tab(struct cxd2820r_priv *priv, |
60 | const struct reg_val_mask *tab, int tab_len); | |
61 | ||
9ac51c5e SK |
62 | int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, |
63 | u8 mask); | |
2e1ea06e | 64 | |
9ac51c5e SK |
65 | int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, |
66 | int len); | |
2e1ea06e | 67 | |
9ac51c5e SK |
68 | int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, |
69 | int len); | |
70 | ||
71 | int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, | |
72 | int len); | |
73 | ||
74 | int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val); | |
75 | ||
76 | int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val); | |
77 | ||
78 | /* cxd2820r_c.c */ | |
79 | ||
7e3e68bc MCC |
80 | int cxd2820r_get_frontend_c(struct dvb_frontend *fe, |
81 | struct dtv_frontend_properties *p); | |
9ac51c5e | 82 | |
f311f68a | 83 | int cxd2820r_set_frontend_c(struct dvb_frontend *fe); |
2e1ea06e | 84 | |
0df289a2 | 85 | int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status); |
9ac51c5e | 86 | |
9ac51c5e SK |
87 | int cxd2820r_init_c(struct dvb_frontend *fe); |
88 | ||
89 | int cxd2820r_sleep_c(struct dvb_frontend *fe); | |
90 | ||
91 | int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, | |
92 | struct dvb_frontend_tune_settings *s); | |
93 | ||
94 | /* cxd2820r_t.c */ | |
95 | ||
7e3e68bc MCC |
96 | int cxd2820r_get_frontend_t(struct dvb_frontend *fe, |
97 | struct dtv_frontend_properties *p); | |
9ac51c5e | 98 | |
f311f68a | 99 | int cxd2820r_set_frontend_t(struct dvb_frontend *fe); |
2e1ea06e | 100 | |
0df289a2 | 101 | int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status); |
9ac51c5e | 102 | |
9ac51c5e SK |
103 | int cxd2820r_init_t(struct dvb_frontend *fe); |
104 | ||
105 | int cxd2820r_sleep_t(struct dvb_frontend *fe); | |
106 | ||
107 | int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, | |
108 | struct dvb_frontend_tune_settings *s); | |
109 | ||
110 | /* cxd2820r_t2.c */ | |
111 | ||
7e3e68bc MCC |
112 | int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, |
113 | struct dtv_frontend_properties *p); | |
9ac51c5e | 114 | |
f311f68a | 115 | int cxd2820r_set_frontend_t2(struct dvb_frontend *fe); |
2e1ea06e | 116 | |
0df289a2 | 117 | int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status); |
9ac51c5e | 118 | |
9ac51c5e SK |
119 | int cxd2820r_init_t2(struct dvb_frontend *fe); |
120 | ||
121 | int cxd2820r_sleep_t2(struct dvb_frontend *fe); | |
122 | ||
123 | int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe, | |
124 | struct dvb_frontend_tune_settings *s); | |
2e1ea06e | 125 | |
27cfc85e | 126 | #endif /* CXD2820R_PRIV_H */ |