1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * include/media/si476x-platform.h -- Definitions of the data formats
4  * returned by debugfs hooks
5  *
6  * Copyright (C) 2013 Andrey Smirnov
7  *
8  * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
9  */
10 
11 #ifndef __SI476X_REPORTS_H__
12 #define __SI476X_REPORTS_H__
13 
14 /**
15  * struct si476x_rsq_status - structure containing received signal
16  * quality
17  * @multhint:   Multipath Detect High.
18  *              true  - Indicatedes that the value is below
19  *                      FM_RSQ_MULTIPATH_HIGH_THRESHOLD
20  *              false - Indicatedes that the value is above
21  *                      FM_RSQ_MULTIPATH_HIGH_THRESHOLD
22  * @multlint:   Multipath Detect Low.
23  *              true  - Indicatedes that the value is below
24  *                      FM_RSQ_MULTIPATH_LOW_THRESHOLD
25  *              false - Indicatedes that the value is above
26  *                      FM_RSQ_MULTIPATH_LOW_THRESHOLD
27  * @snrhint:    SNR Detect High.
28  *              true  - Indicatedes that the value is below
29  *                      FM_RSQ_SNR_HIGH_THRESHOLD
30  *              false - Indicatedes that the value is above
31  *                      FM_RSQ_SNR_HIGH_THRESHOLD
32  * @snrlint:    SNR Detect Low.
33  *              true  - Indicatedes that the value is below
34  *                      FM_RSQ_SNR_LOW_THRESHOLD
35  *              false - Indicatedes that the value is above
36  *                      FM_RSQ_SNR_LOW_THRESHOLD
37  * @rssihint:   RSSI Detect High.
38  *              true  - Indicatedes that the value is below
39  *                      FM_RSQ_RSSI_HIGH_THRESHOLD
40  *              false - Indicatedes that the value is above
41  *                      FM_RSQ_RSSI_HIGH_THRESHOLD
42  * @rssilint:   RSSI Detect Low.
43  *              true  - Indicatedes that the value is below
44  *                      FM_RSQ_RSSI_LOW_THRESHOLD
45  *              false - Indicatedes that the value is above
46  *                      FM_RSQ_RSSI_LOW_THRESHOLD
47  * @bltf:       Band Limit.
48  *              Set if seek command hits the band limit or wrapped to
49  *              the original frequency.
50  * @snr_ready:  SNR measurement in progress.
51  * @rssiready:  RSSI measurement in progress.
52  * @afcrl:      Set if FREQOFF >= MAX_TUNE_ERROR
53  * @valid:      Set if the channel is valid
54  *               rssi < FM_VALID_RSSI_THRESHOLD
55  *               snr  < FM_VALID_SNR_THRESHOLD
56  *               tune_error < FM_VALID_MAX_TUNE_ERROR
57  * @readfreq:   Current tuned frequency.
58  * @freqoff:    Signed frequency offset.
59  * @rssi:       Received Signal Strength Indicator(dBuV).
60  * @snr:        RF SNR Indicator(dB).
61  * @lassi:
62  * @hassi:      Low/High side Adjacent(100 kHz) Channel Strength Indicator
63  * @mult:       Multipath indicator
64  * @dev:        Who knows? But values may vary.
65  * @readantcap: Antenna tuning capacity value.
66  * @assi:       Adjacent Channel(+/- 200kHz) Strength Indicator
67  * @usn:        Ultrasonic Noise Inticator in -DBFS
68  */
69 struct si476x_rsq_status_report {
70 	__u8 multhint, multlint;
71 	__u8 snrhint,  snrlint;
72 	__u8 rssihint, rssilint;
73 	__u8 bltf;
74 	__u8 snr_ready;
75 	__u8 rssiready;
76 	__u8 injside;
77 	__u8 afcrl;
78 	__u8 valid;
79 
80 	__u16 readfreq;
81 	__s8  freqoff;
82 	__s8  rssi;
83 	__s8  snr;
84 	__s8  issi;
85 	__s8  lassi, hassi;
86 	__s8  mult;
87 	__u8  dev;
88 	__u16 readantcap;
89 	__s8  assi;
90 	__s8  usn;
91 
92 	__u8 pilotdev;
93 	__u8 rdsdev;
94 	__u8 assidev;
95 	__u8 strongdev;
96 	__u16 rdspi;
97 } __packed;
98 
99 /**
100  * si476x_acf_status_report - ACF report results
101  *
102  * @blend_int: If set, indicates that stereo separation has crossed
103  * below the blend threshold as set by FM_ACF_BLEND_THRESHOLD
104  * @hblend_int: If set, indicates that HiBlend cutoff frequency is
105  * lower than threshold as set by FM_ACF_HBLEND_THRESHOLD
106  * @hicut_int:  If set, indicates that HiCut cutoff frequency is lower
107  * than the threshold set by ACF_
108 
109  */
110 struct si476x_acf_status_report {
111 	__u8 blend_int;
112 	__u8 hblend_int;
113 	__u8 hicut_int;
114 	__u8 chbw_int;
115 	__u8 softmute_int;
116 	__u8 smute;
117 	__u8 smattn;
118 	__u8 chbw;
119 	__u8 hicut;
120 	__u8 hiblend;
121 	__u8 pilot;
122 	__u8 stblend;
123 } __packed;
124 
125 enum si476x_fmagc {
126 	SI476X_FMAGC_10K_OHM	= 0,
127 	SI476X_FMAGC_800_OHM	= 1,
128 	SI476X_FMAGC_400_OHM	= 2,
129 	SI476X_FMAGC_200_OHM	= 4,
130 	SI476X_FMAGC_100_OHM	= 8,
131 	SI476X_FMAGC_50_OHM	= 16,
132 	SI476X_FMAGC_25_OHM	= 32,
133 	SI476X_FMAGC_12P5_OHM	= 64,
134 	SI476X_FMAGC_6P25_OHM	= 128,
135 };
136 
137 struct si476x_agc_status_report {
138 	__u8 mxhi;
139 	__u8 mxlo;
140 	__u8 lnahi;
141 	__u8 lnalo;
142 	__u8 fmagc1;
143 	__u8 fmagc2;
144 	__u8 pgagain;
145 	__u8 fmwblang;
146 } __packed;
147 
148 struct si476x_rds_blockcount_report {
149 	__u16 expected;
150 	__u16 received;
151 	__u16 uncorrectable;
152 } __packed;
153 
154 #endif  /* __SI476X_REPORTS_H__ */
155