18e8e69d6SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
29b8e1a5eSAndrey Smirnov /*
39b8e1a5eSAndrey Smirnov  * include/media/si476x-platform.h -- Definitions of the data formats
49b8e1a5eSAndrey Smirnov  * returned by debugfs hooks
59b8e1a5eSAndrey Smirnov  *
69b8e1a5eSAndrey Smirnov  * Copyright (C) 2013 Andrey Smirnov
79b8e1a5eSAndrey Smirnov  *
89b8e1a5eSAndrey Smirnov  * Author: Andrey Smirnov <andrew.smirnov@gmail.com>
99b8e1a5eSAndrey Smirnov  */
109b8e1a5eSAndrey Smirnov 
119b8e1a5eSAndrey Smirnov #ifndef __SI476X_REPORTS_H__
129b8e1a5eSAndrey Smirnov #define __SI476X_REPORTS_H__
139b8e1a5eSAndrey Smirnov 
149b8e1a5eSAndrey Smirnov /**
159b8e1a5eSAndrey Smirnov  * struct si476x_rsq_status - structure containing received signal
169b8e1a5eSAndrey Smirnov  * quality
179b8e1a5eSAndrey Smirnov  * @multhint:   Multipath Detect High.
189b8e1a5eSAndrey Smirnov  *              true  - Indicatedes that the value is below
199b8e1a5eSAndrey Smirnov  *                      FM_RSQ_MULTIPATH_HIGH_THRESHOLD
209b8e1a5eSAndrey Smirnov  *              false - Indicatedes that the value is above
219b8e1a5eSAndrey Smirnov  *                      FM_RSQ_MULTIPATH_HIGH_THRESHOLD
229b8e1a5eSAndrey Smirnov  * @multlint:   Multipath Detect Low.
239b8e1a5eSAndrey Smirnov  *              true  - Indicatedes that the value is below
249b8e1a5eSAndrey Smirnov  *                      FM_RSQ_MULTIPATH_LOW_THRESHOLD
259b8e1a5eSAndrey Smirnov  *              false - Indicatedes that the value is above
269b8e1a5eSAndrey Smirnov  *                      FM_RSQ_MULTIPATH_LOW_THRESHOLD
279b8e1a5eSAndrey Smirnov  * @snrhint:    SNR Detect High.
289b8e1a5eSAndrey Smirnov  *              true  - Indicatedes that the value is below
299b8e1a5eSAndrey Smirnov  *                      FM_RSQ_SNR_HIGH_THRESHOLD
309b8e1a5eSAndrey Smirnov  *              false - Indicatedes that the value is above
319b8e1a5eSAndrey Smirnov  *                      FM_RSQ_SNR_HIGH_THRESHOLD
329b8e1a5eSAndrey Smirnov  * @snrlint:    SNR Detect Low.
339b8e1a5eSAndrey Smirnov  *              true  - Indicatedes that the value is below
349b8e1a5eSAndrey Smirnov  *                      FM_RSQ_SNR_LOW_THRESHOLD
359b8e1a5eSAndrey Smirnov  *              false - Indicatedes that the value is above
369b8e1a5eSAndrey Smirnov  *                      FM_RSQ_SNR_LOW_THRESHOLD
379b8e1a5eSAndrey Smirnov  * @rssihint:   RSSI Detect High.
389b8e1a5eSAndrey Smirnov  *              true  - Indicatedes that the value is below
399b8e1a5eSAndrey Smirnov  *                      FM_RSQ_RSSI_HIGH_THRESHOLD
409b8e1a5eSAndrey Smirnov  *              false - Indicatedes that the value is above
419b8e1a5eSAndrey Smirnov  *                      FM_RSQ_RSSI_HIGH_THRESHOLD
429b8e1a5eSAndrey Smirnov  * @rssilint:   RSSI Detect Low.
439b8e1a5eSAndrey Smirnov  *              true  - Indicatedes that the value is below
449b8e1a5eSAndrey Smirnov  *                      FM_RSQ_RSSI_LOW_THRESHOLD
459b8e1a5eSAndrey Smirnov  *              false - Indicatedes that the value is above
469b8e1a5eSAndrey Smirnov  *                      FM_RSQ_RSSI_LOW_THRESHOLD
479b8e1a5eSAndrey Smirnov  * @bltf:       Band Limit.
489b8e1a5eSAndrey Smirnov  *              Set if seek command hits the band limit or wrapped to
499b8e1a5eSAndrey Smirnov  *              the original frequency.
509b8e1a5eSAndrey Smirnov  * @snr_ready:  SNR measurement in progress.
519b8e1a5eSAndrey Smirnov  * @rssiready:  RSSI measurement in progress.
529b8e1a5eSAndrey Smirnov  * @afcrl:      Set if FREQOFF >= MAX_TUNE_ERROR
539b8e1a5eSAndrey Smirnov  * @valid:      Set if the channel is valid
549b8e1a5eSAndrey Smirnov  *               rssi < FM_VALID_RSSI_THRESHOLD
559b8e1a5eSAndrey Smirnov  *               snr  < FM_VALID_SNR_THRESHOLD
569b8e1a5eSAndrey Smirnov  *               tune_error < FM_VALID_MAX_TUNE_ERROR
579b8e1a5eSAndrey Smirnov  * @readfreq:   Current tuned frequency.
589b8e1a5eSAndrey Smirnov  * @freqoff:    Signed frequency offset.
599b8e1a5eSAndrey Smirnov  * @rssi:       Received Signal Strength Indicator(dBuV).
609b8e1a5eSAndrey Smirnov  * @snr:        RF SNR Indicator(dB).
619b8e1a5eSAndrey Smirnov  * @lassi:
629b8e1a5eSAndrey Smirnov  * @hassi:      Low/High side Adjacent(100 kHz) Channel Strength Indicator
639b8e1a5eSAndrey Smirnov  * @mult:       Multipath indicator
649b8e1a5eSAndrey Smirnov  * @dev:        Who knows? But values may vary.
659b8e1a5eSAndrey Smirnov  * @readantcap: Antenna tuning capacity value.
669b8e1a5eSAndrey Smirnov  * @assi:       Adjacent Channel(+/- 200kHz) Strength Indicator
679b8e1a5eSAndrey Smirnov  * @usn:        Ultrasonic Noise Inticator in -DBFS
689b8e1a5eSAndrey Smirnov  */
699b8e1a5eSAndrey Smirnov struct si476x_rsq_status_report {
709b8e1a5eSAndrey Smirnov 	__u8 multhint, multlint;
719b8e1a5eSAndrey Smirnov 	__u8 snrhint,  snrlint;
729b8e1a5eSAndrey Smirnov 	__u8 rssihint, rssilint;
739b8e1a5eSAndrey Smirnov 	__u8 bltf;
749b8e1a5eSAndrey Smirnov 	__u8 snr_ready;
759b8e1a5eSAndrey Smirnov 	__u8 rssiready;
769b8e1a5eSAndrey Smirnov 	__u8 injside;
779b8e1a5eSAndrey Smirnov 	__u8 afcrl;
789b8e1a5eSAndrey Smirnov 	__u8 valid;
799b8e1a5eSAndrey Smirnov 
809b8e1a5eSAndrey Smirnov 	__u16 readfreq;
819b8e1a5eSAndrey Smirnov 	__s8  freqoff;
829b8e1a5eSAndrey Smirnov 	__s8  rssi;
839b8e1a5eSAndrey Smirnov 	__s8  snr;
849b8e1a5eSAndrey Smirnov 	__s8  issi;
859b8e1a5eSAndrey Smirnov 	__s8  lassi, hassi;
869b8e1a5eSAndrey Smirnov 	__s8  mult;
879b8e1a5eSAndrey Smirnov 	__u8  dev;
889b8e1a5eSAndrey Smirnov 	__u16 readantcap;
899b8e1a5eSAndrey Smirnov 	__s8  assi;
909b8e1a5eSAndrey Smirnov 	__s8  usn;
919b8e1a5eSAndrey Smirnov 
929b8e1a5eSAndrey Smirnov 	__u8 pilotdev;
939b8e1a5eSAndrey Smirnov 	__u8 rdsdev;
949b8e1a5eSAndrey Smirnov 	__u8 assidev;
959b8e1a5eSAndrey Smirnov 	__u8 strongdev;
969b8e1a5eSAndrey Smirnov 	__u16 rdspi;
979b8e1a5eSAndrey Smirnov } __packed;
989b8e1a5eSAndrey Smirnov 
999b8e1a5eSAndrey Smirnov /**
1009b8e1a5eSAndrey Smirnov  * si476x_acf_status_report - ACF report results
1019b8e1a5eSAndrey Smirnov  *
1029b8e1a5eSAndrey Smirnov  * @blend_int: If set, indicates that stereo separation has crossed
1039b8e1a5eSAndrey Smirnov  * below the blend threshold as set by FM_ACF_BLEND_THRESHOLD
1049b8e1a5eSAndrey Smirnov  * @hblend_int: If set, indicates that HiBlend cutoff frequency is
1059b8e1a5eSAndrey Smirnov  * lower than threshold as set by FM_ACF_HBLEND_THRESHOLD
1069b8e1a5eSAndrey Smirnov  * @hicut_int:  If set, indicates that HiCut cutoff frequency is lower
1079b8e1a5eSAndrey Smirnov  * than the threshold set by ACF_
1089b8e1a5eSAndrey Smirnov 
1099b8e1a5eSAndrey Smirnov  */
1109b8e1a5eSAndrey Smirnov struct si476x_acf_status_report {
1119b8e1a5eSAndrey Smirnov 	__u8 blend_int;
1129b8e1a5eSAndrey Smirnov 	__u8 hblend_int;
1139b8e1a5eSAndrey Smirnov 	__u8 hicut_int;
1149b8e1a5eSAndrey Smirnov 	__u8 chbw_int;
1159b8e1a5eSAndrey Smirnov 	__u8 softmute_int;
1169b8e1a5eSAndrey Smirnov 	__u8 smute;
1179b8e1a5eSAndrey Smirnov 	__u8 smattn;
1189b8e1a5eSAndrey Smirnov 	__u8 chbw;
1199b8e1a5eSAndrey Smirnov 	__u8 hicut;
1209b8e1a5eSAndrey Smirnov 	__u8 hiblend;
1219b8e1a5eSAndrey Smirnov 	__u8 pilot;
1229b8e1a5eSAndrey Smirnov 	__u8 stblend;
1239b8e1a5eSAndrey Smirnov } __packed;
1249b8e1a5eSAndrey Smirnov 
1259b8e1a5eSAndrey Smirnov enum si476x_fmagc {
1269b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_10K_OHM	= 0,
1279b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_800_OHM	= 1,
1289b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_400_OHM	= 2,
1299b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_200_OHM	= 4,
1309b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_100_OHM	= 8,
1319b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_50_OHM	= 16,
1329b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_25_OHM	= 32,
1339b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_12P5_OHM	= 64,
1349b8e1a5eSAndrey Smirnov 	SI476X_FMAGC_6P25_OHM	= 128,
1359b8e1a5eSAndrey Smirnov };
1369b8e1a5eSAndrey Smirnov 
1379b8e1a5eSAndrey Smirnov struct si476x_agc_status_report {
1389b8e1a5eSAndrey Smirnov 	__u8 mxhi;
1399b8e1a5eSAndrey Smirnov 	__u8 mxlo;
1409b8e1a5eSAndrey Smirnov 	__u8 lnahi;
1419b8e1a5eSAndrey Smirnov 	__u8 lnalo;
1429b8e1a5eSAndrey Smirnov 	__u8 fmagc1;
1439b8e1a5eSAndrey Smirnov 	__u8 fmagc2;
1449b8e1a5eSAndrey Smirnov 	__u8 pgagain;
1459b8e1a5eSAndrey Smirnov 	__u8 fmwblang;
1469b8e1a5eSAndrey Smirnov } __packed;
1479b8e1a5eSAndrey Smirnov 
1489b8e1a5eSAndrey Smirnov struct si476x_rds_blockcount_report {
1499b8e1a5eSAndrey Smirnov 	__u16 expected;
1509b8e1a5eSAndrey Smirnov 	__u16 received;
1519b8e1a5eSAndrey Smirnov 	__u16 uncorrectable;
1529b8e1a5eSAndrey Smirnov } __packed;
1539b8e1a5eSAndrey Smirnov 
1549b8e1a5eSAndrey Smirnov #endif  /* __SI476X_REPORTS_H__ */
155