xref: /linux/drivers/media/common/siano/smsdvb.h (revision b8265621f4888af9494e1d685620871ec81bc33d)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /***********************************************************************
3  *
4  ***********************************************************************/
5 
6 struct smsdvb_debugfs;
7 struct smsdvb_client_t;
8 
9 typedef void (*sms_prt_dvb_stats_t)(struct smsdvb_debugfs *debug_data,
10 				    struct sms_stats *p);
11 
12 typedef void (*sms_prt_isdb_stats_t)(struct smsdvb_debugfs *debug_data,
13 				     struct sms_isdbt_stats *p);
14 
15 typedef void (*sms_prt_isdb_stats_ex_t)
16 			(struct smsdvb_debugfs *debug_data,
17 			 struct sms_isdbt_stats_ex *p);
18 
19 
20 struct smsdvb_client_t {
21 	struct list_head entry;
22 
23 	struct smscore_device_t *coredev;
24 	struct smscore_client_t *smsclient;
25 
26 	struct dvb_adapter      adapter;
27 	struct dvb_demux        demux;
28 	struct dmxdev           dmxdev;
29 	struct dvb_frontend     frontend;
30 
31 	enum fe_status          fe_status;
32 
33 	struct completion       tune_done;
34 	struct completion       stats_done;
35 
36 	int last_per;
37 
38 	int legacy_ber, legacy_per;
39 
40 	int event_fe_state;
41 	int event_unc_state;
42 
43 	unsigned long		get_stats_jiffies;
44 
45 	int			feed_users;
46 	bool			has_tuned;
47 
48 	/* stats debugfs data */
49 	struct dentry		*debugfs;
50 
51 	struct smsdvb_debugfs	*debug_data;
52 
53 	sms_prt_dvb_stats_t	prt_dvb_stats;
54 	sms_prt_isdb_stats_t	prt_isdb_stats;
55 	sms_prt_isdb_stats_ex_t	prt_isdb_stats_ex;
56 };
57 
58 /*
59  * This struct is a mix of struct sms_rx_stats_ex and
60  * struct sms_srvm_signal_status.
61  * It was obtained by comparing the way it was filled by the original code
62  */
63 struct RECEPTION_STATISTICS_PER_SLICES_S {
64 	u32 result;
65 	u32 snr;
66 	s32 in_band_power;
67 	u32 ts_packets;
68 	u32 ets_packets;
69 	u32 constellation;
70 	u32 hp_code;
71 	u32 tps_srv_ind_lp;
72 	u32 tps_srv_ind_hp;
73 	u32 cell_id;
74 	u32 reason;
75 	u32 request_id;
76 	u32 modem_state;		/* from SMSHOSTLIB_DVB_MODEM_STATE_ET */
77 
78 	u32 ber;		/* Post Viterbi BER [1E-5] */
79 	s32 RSSI;		/* dBm */
80 	s32 carrier_offset;	/* Carrier Offset in bin/1024 */
81 
82 	u32 is_rf_locked;		/* 0 - not locked, 1 - locked */
83 	u32 is_demod_locked;	/* 0 - not locked, 1 - locked */
84 
85 	u32 ber_bit_count;	/* Total number of SYNC bits. */
86 	u32 ber_error_count;	/* Number of erroneous SYNC bits. */
87 
88 	s32 MRC_SNR;		/* dB */
89 	s32 mrc_in_band_pwr;	/* In band power in dBM */
90 	s32 MRC_RSSI;		/* dBm */
91 };
92 
93 /* From smsdvb-debugfs.c */
94 #ifdef CONFIG_SMS_SIANO_DEBUGFS
95 
96 int smsdvb_debugfs_create(struct smsdvb_client_t *client);
97 void smsdvb_debugfs_release(struct smsdvb_client_t *client);
98 void smsdvb_debugfs_register(void);
99 void smsdvb_debugfs_unregister(void);
100 
101 #else
102 
103 static inline int smsdvb_debugfs_create(struct smsdvb_client_t *client)
104 {
105 	return 0;
106 }
107 
108 static inline void smsdvb_debugfs_release(struct smsdvb_client_t *client) {}
109 
110 static inline void smsdvb_debugfs_register(void) {}
111 
112 static inline void smsdvb_debugfs_unregister(void) {};
113 
114 #endif
115 
116