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