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