blob: 92c413ba0c7971386f052e2f4c4c00876062a31d [file] [log] [blame]
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -03001/***********************************************************************
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 ***********************************************************************/
17
18struct smsdvb_debugfs;
19struct smsdvb_client_t;
20
21typedef void (*sms_prt_dvb_stats_t)(struct smsdvb_debugfs *debug_data,
Mauro Carvalho Chehabcf0e9cf2013-03-21 09:06:03 -030022 struct sms_stats *p);
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030023
24typedef void (*sms_prt_isdb_stats_t)(struct smsdvb_debugfs *debug_data,
Mauro Carvalho Chehabcf0e9cf2013-03-21 09:06:03 -030025 struct sms_isdbt_stats *p);
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030026
27typedef void (*sms_prt_isdb_stats_ex_t)
28 (struct smsdvb_debugfs *debug_data,
Mauro Carvalho Chehabcf0e9cf2013-03-21 09:06:03 -030029 struct sms_isdbt_stats_ex *p);
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030030
31
32struct smsdvb_client_t {
33 struct list_head entry;
34
35 struct smscore_device_t *coredev;
36 struct smscore_client_t *smsclient;
37
38 struct dvb_adapter adapter;
39 struct dvb_demux demux;
40 struct dmxdev dmxdev;
41 struct dvb_frontend frontend;
42
43 fe_status_t fe_status;
44
45 struct completion tune_done;
46 struct completion stats_done;
47
48 int last_per;
49
50 int legacy_ber, legacy_per;
51
52 int event_fe_state;
53 int event_unc_state;
54
Mauro Carvalho Chehaba9b9fbd2013-03-10 10:51:25 -030055 unsigned long get_stats_jiffies;
56
Mauro Carvalho Chehabe1b2ac42013-03-15 07:22:08 -030057 int feed_users;
58 bool has_tuned;
59
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030060 /* stats debugfs data */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030061 struct dentry *debugfs;
62
63 struct smsdvb_debugfs *debug_data;
64
65 sms_prt_dvb_stats_t prt_dvb_stats;
66 sms_prt_isdb_stats_t prt_isdb_stats;
67 sms_prt_isdb_stats_ex_t prt_isdb_stats_ex;
68};
69
70/*
Mauro Carvalho Chehabcf0e9cf2013-03-21 09:06:03 -030071 * This struct is a mix of struct sms_rx_stats_ex and
72 * struct sms_srvm_signal_status.
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030073 * It was obtained by comparing the way it was filled by the original code
74 */
75struct RECEPTION_STATISTICS_PER_SLICES_S {
76 u32 result;
77 u32 snr;
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030078 s32 in_band_power;
79 u32 ts_packets;
80 u32 ets_packets;
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030081 u32 constellation;
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030082 u32 hp_code;
83 u32 tps_srv_ind_lp;
84 u32 tps_srv_ind_hp;
85 u32 cell_id;
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030086 u32 reason;
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030087 u32 request_id;
88 u32 modem_state; /* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030089
Mauro Carvalho Chehab28a59df2013-03-21 09:27:37 -030090 u32 ber; /* Post Viterbi BER [1E-5] */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030091 s32 RSSI; /* dBm */
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030092 s32 carrier_offset; /* Carrier Offset in bin/1024 */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030093
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030094 u32 is_rf_locked; /* 0 - not locked, 1 - locked */
95 u32 is_demod_locked; /* 0 - not locked, 1 - locked */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030096
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -030097 u32 ber_bit_count; /* Total number of SYNC bits. */
98 u32 ber_error_count; /* Number of erronous SYNC bits. */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -030099
100 s32 MRC_SNR; /* dB */
Mauro Carvalho Chehabdfef84f2013-03-21 08:49:43 -0300101 s32 mrc_in_band_pwr; /* In band power in dBM */
Mauro Carvalho Chehab503efe52013-03-10 09:04:44 -0300102 s32 MRC_RSSI; /* dBm */
103};
104
105/* From smsdvb-debugfs.c */
106#ifdef CONFIG_SMS_SIANO_DEBUGFS
107
108int smsdvb_debugfs_create(struct smsdvb_client_t *client);
109void smsdvb_debugfs_release(struct smsdvb_client_t *client);
110int smsdvb_debugfs_register(void);
111void smsdvb_debugfs_unregister(void);
112
113#else
114
115static inline int smsdvb_debugfs_create(struct smsdvb_client_t *client)
116{
117 return 0;
118}
119
120static inline void smsdvb_debugfs_release(struct smsdvb_client_t *client) {}
121
122static inline int smsdvb_debugfs_register(void)
123{
124 return 0;
125};
126
127static inline void smsdvb_debugfs_unregister(void) {};
128
129#endif
130