Path: blob/master/drivers/media/dvb/frontends/bcm3510_priv.h
15112 views
/*1* Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC)2*3* Copyright (C) 2001-5, B2C2 inc.4*5* GPL/Linux driver written by Patrick Boettcher <[email protected]>6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*17* You should have received a copy of the GNU General Public License18* along with this program; if not, write to the Free Software19* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20*/21#ifndef __BCM3510_PRIV_H__22#define __BCM3510_PRIV_H__2324#define PACKED __attribute__((packed))2526#undef err27#define err(format, arg...) printk(KERN_ERR "bcm3510: " format "\n" , ## arg)28#undef info29#define info(format, arg...) printk(KERN_INFO "bcm3510: " format "\n" , ## arg)30#undef warn31#define warn(format, arg...) printk(KERN_WARNING "bcm3510: " format "\n" , ## arg)323334#define PANASONIC_FIRST_IF_BASE_IN_KHz 140750035#define BCM3510_SYMBOL_RATE 53810003637typedef union {38u8 raw;3940struct {41u8 CTL :8;42} TSTCTL_2e;4344u8 LDCERC_4e;45u8 LDUERC_4f;46u8 LD_BER0_65;47u8 LD_BER1_66;48u8 LD_BER2_67;49u8 LD_BER3_68;5051struct {52u8 RESET :1;53u8 IDLE :1;54u8 STOP :1;55u8 HIRQ0 :1;56u8 HIRQ1 :1;57u8 na0 :1;58u8 HABAV :1;59u8 na1 :1;60} HCTL1_a0;6162struct {63u8 na0 :1;64u8 IDLMSK :1;65u8 STMSK :1;66u8 I0MSK :1;67u8 I1MSK :1;68u8 na1 :1;69u8 HABMSK :1;70u8 na2 :1;71} HCTLMSK_a1;7273struct {74u8 RESET :1;75u8 IDLE :1;76u8 STOP :1;77u8 RUN :1;78u8 HABAV :1;79u8 MEMAV :1;80u8 ALDONE :1;81u8 REIRQ :1;82} APSTAT1_a2;8384struct {85u8 RSTMSK :1;86u8 IMSK :1;87u8 SMSK :1;88u8 RMSK :1;89u8 HABMSK :1;90u8 MAVMSK :1;91u8 ALDMSK :1;92u8 REMSK :1;93} APMSK1_a3;9495u8 APSTAT2_a4;96u8 APMSK2_a5;9798struct {99u8 HABADR :7;100u8 na :1;101} HABADR_a6;102103u8 HABDATA_a7;104105struct {106u8 HABR :1;107u8 LDHABR :1;108u8 APMSK :1;109u8 HMSK :1;110u8 LDMSK :1;111u8 na :3;112} HABSTAT_a8;113114u8 MADRH_a9;115u8 MADRL_aa;116u8 MDATA_ab;117118struct {119#define JDEC_WAIT_AT_RAM 0x7120#define JDEC_EEPROM_LOAD_WAIT 0x4121u8 JDEC :3;122u8 na :5;123} JDEC_ca;124125struct {126u8 REV :4;127u8 LAYER :4;128} REVID_e0;129130struct {131u8 unk0 :1;132u8 CNTCTL :1;133u8 BITCNT :1;134u8 unk1 :1;135u8 RESYNC :1;136u8 unk2 :3;137} BERCTL_fa;138139struct {140u8 CSEL0 :1;141u8 CLKED0 :1;142u8 CSEL1 :1;143u8 CLKED1 :1;144u8 CLKLEV :1;145u8 SPIVAR :1;146u8 na :2;147} TUNSET_fc;148149struct {150u8 CLK :1;151u8 DATA :1;152u8 CS0 :1;153u8 CS1 :1;154u8 AGCSEL :1;155u8 na0 :1;156u8 TUNSEL :1;157u8 na1 :1;158} TUNCTL_fd;159160u8 TUNSEL0_fe;161u8 TUNSEL1_ff;162163} bcm3510_register_value;164165/* HAB commands */166167/* version */168#define CMD_GET_VERSION_INFO 0x3D169#define MSGID_GET_VERSION_INFO 0x15170struct bcm3510_hab_cmd_get_version_info {171u8 microcode_version;172u8 script_version;173u8 config_version;174u8 demod_version;175} PACKED;176177#define BCM3510_DEF_MICROCODE_VERSION 0x0E178#define BCM3510_DEF_SCRIPT_VERSION 0x06179#define BCM3510_DEF_CONFIG_VERSION 0x01180#define BCM3510_DEF_DEMOD_VERSION 0xB1181182/* acquire */183#define CMD_ACQUIRE 0x38184185#define MSGID_EXT_TUNER_ACQUIRE 0x0A186struct bcm3510_hab_cmd_ext_acquire {187struct {188u8 MODE :4;189u8 BW :1;190u8 FA :1;191u8 NTSCSWEEP :1;192u8 OFFSET :1;193} PACKED ACQUIRE0; /* control_byte */194195struct {196u8 IF_FREQ :3;197u8 zero0 :1;198u8 SYM_RATE :3;199u8 zero1 :1;200} PACKED ACQUIRE1; /* sym_if */201202u8 IF_OFFSET0; /* IF_Offset_10hz */203u8 IF_OFFSET1;204u8 SYM_OFFSET0; /* SymbolRateOffset */205u8 SYM_OFFSET1;206u8 NTSC_OFFSET0; /* NTSC_Offset_10hz */207u8 NTSC_OFFSET1;208} PACKED;209210#define MSGID_INT_TUNER_ACQUIRE 0x0B211struct bcm3510_hab_cmd_int_acquire {212struct {213u8 MODE :4;214u8 BW :1;215u8 FA :1;216u8 NTSCSWEEP :1;217u8 OFFSET :1;218} PACKED ACQUIRE0; /* control_byte */219220struct {221u8 IF_FREQ :3;222u8 zero0 :1;223u8 SYM_RATE :3;224u8 zero1 :1;225} PACKED ACQUIRE1; /* sym_if */226227u8 TUNER_FREQ0;228u8 TUNER_FREQ1;229u8 TUNER_FREQ2;230u8 TUNER_FREQ3;231u8 IF_OFFSET0; /* IF_Offset_10hz */232u8 IF_OFFSET1;233u8 SYM_OFFSET0; /* SymbolRateOffset */234u8 SYM_OFFSET1;235u8 NTSC_OFFSET0; /* NTSC_Offset_10hz */236u8 NTSC_OFFSET1;237} PACKED;238239/* modes */240#define BCM3510_QAM16 = 0x01241#define BCM3510_QAM32 = 0x02242#define BCM3510_QAM64 = 0x03243#define BCM3510_QAM128 = 0x04244#define BCM3510_QAM256 = 0x05245#define BCM3510_8VSB = 0x0B246#define BCM3510_16VSB = 0x0D247248/* IF_FREQS */249#define BCM3510_IF_TERRESTRIAL 0x0250#define BCM3510_IF_CABLE 0x1251#define BCM3510_IF_USE_CMD 0x7252253/* SYM_RATE */254#define BCM3510_SR_8VSB 0x0 /* 5381119 s/sec */255#define BCM3510_SR_256QAM 0x1 /* 5360537 s/sec */256#define BCM3510_SR_16QAM 0x2 /* 5056971 s/sec */257#define BCM3510_SR_MISC 0x3 /* 5000000 s/sec */258#define BCM3510_SR_USE_CMD 0x7259260/* special symbol rate */261#define CMD_SET_VALUE_NOT_LISTED 0x2d262#define MSGID_SET_SYMBOL_RATE_NOT_LISTED 0x0c263struct bcm3510_hab_cmd_set_sr_not_listed {264u8 HOST_SYM_RATE0;265u8 HOST_SYM_RATE1;266u8 HOST_SYM_RATE2;267u8 HOST_SYM_RATE3;268} PACKED;269270/* special IF */271#define MSGID_SET_IF_FREQ_NOT_LISTED 0x0d272struct bcm3510_hab_cmd_set_if_freq_not_listed {273u8 HOST_IF_FREQ0;274u8 HOST_IF_FREQ1;275u8 HOST_IF_FREQ2;276u8 HOST_IF_FREQ3;277} PACKED;278279/* auto reacquire */280#define CMD_AUTO_PARAM 0x2a281#define MSGID_AUTO_REACQUIRE 0x0e282struct bcm3510_hab_cmd_auto_reacquire {283u8 ACQ :1; /* on/off*/284u8 unused :7;285} PACKED;286287#define MSGID_SET_RF_AGC_SEL 0x12288struct bcm3510_hab_cmd_set_agc {289u8 LVL :1;290u8 unused :6;291u8 SEL :1;292} PACKED;293294#define MSGID_SET_AUTO_INVERSION 0x14295struct bcm3510_hab_cmd_auto_inversion {296u8 AI :1;297u8 unused :7;298} PACKED;299300301/* bert control */302#define CMD_STATE_CONTROL 0x12303#define MSGID_BERT_CONTROL 0x0e304#define MSGID_BERT_SET 0xfa305struct bcm3510_hab_cmd_bert_control {306u8 BE :1;307u8 unused :7;308} PACKED;309310#define MSGID_TRI_STATE 0x2e311struct bcm3510_hab_cmd_tri_state {312u8 RE :1; /* a/d ram port pins */313u8 PE :1; /* baud clock pin */314u8 AC :1; /* a/d clock pin */315u8 BE :1; /* baud clock pin */316u8 unused :4;317} PACKED;318319320/* tune */321#define CMD_TUNE 0x38322#define MSGID_TUNE 0x16323struct bcm3510_hab_cmd_tune_ctrl_data_pair {324struct {325#define BITS_8 0x07326#define BITS_7 0x06327#define BITS_6 0x05328#define BITS_5 0x04329#define BITS_4 0x03330#define BITS_3 0x02331#define BITS_2 0x01332#define BITS_1 0x00333u8 size :3;334u8 unk :2;335u8 clk_off :1;336u8 cs0 :1;337u8 cs1 :1;338339} PACKED ctrl;340341u8 data;342} PACKED;343344struct bcm3510_hab_cmd_tune {345u8 length;346u8 clock_width;347u8 misc;348u8 TUNCTL_state;349350struct bcm3510_hab_cmd_tune_ctrl_data_pair ctl_dat[16];351} PACKED;352353#define CMD_STATUS 0x38354#define MSGID_STATUS1 0x08355struct bcm3510_hab_cmd_status1 {356struct {357u8 EQ_MODE :4;358u8 reserved :2;359u8 QRE :1; /* if QSE and the spectrum is inversed */360u8 QSE :1; /* automatic spectral inversion */361} PACKED STATUS0;362363struct {364u8 RECEIVER_LOCK :1;365u8 FEC_LOCK :1;366u8 OUT_PLL_LOCK :1;367u8 reserved :5;368} PACKED STATUS1;369370struct {371u8 reserved :2;372u8 BW :1;373u8 NTE :1; /* NTSC filter sweep enabled */374u8 AQI :1; /* currently acquiring */375u8 FA :1; /* fast acquisition */376u8 ARI :1; /* auto reacquire */377u8 TI :1; /* programming the tuner */378} PACKED STATUS2;379u8 STATUS3;380u8 SNR_EST0;381u8 SNR_EST1;382u8 TUNER_FREQ0;383u8 TUNER_FREQ1;384u8 TUNER_FREQ2;385u8 TUNER_FREQ3;386u8 SYM_RATE0;387u8 SYM_RATE1;388u8 SYM_RATE2;389u8 SYM_RATE3;390u8 SYM_OFFSET0;391u8 SYM_OFFSET1;392u8 SYM_ERROR0;393u8 SYM_ERROR1;394u8 IF_FREQ0;395u8 IF_FREQ1;396u8 IF_FREQ2;397u8 IF_FREQ3;398u8 IF_OFFSET0;399u8 IF_OFFSET1;400u8 IF_ERROR0;401u8 IF_ERROR1;402u8 NTSC_FILTER0;403u8 NTSC_FILTER1;404u8 NTSC_FILTER2;405u8 NTSC_FILTER3;406u8 NTSC_OFFSET0;407u8 NTSC_OFFSET1;408u8 NTSC_ERROR0;409u8 NTSC_ERROR1;410u8 INT_AGC_LEVEL0;411u8 INT_AGC_LEVEL1;412u8 EXT_AGC_LEVEL0;413u8 EXT_AGC_LEVEL1;414} PACKED;415416#define MSGID_STATUS2 0x14417struct bcm3510_hab_cmd_status2 {418struct {419u8 EQ_MODE :4;420u8 reserved :2;421u8 QRE :1;422u8 QSR :1;423} PACKED STATUS0;424struct {425u8 RL :1;426u8 FL :1;427u8 OL :1;428u8 reserved :5;429} PACKED STATUS1;430u8 SYMBOL_RATE0;431u8 SYMBOL_RATE1;432u8 SYMBOL_RATE2;433u8 SYMBOL_RATE3;434u8 LDCERC0;435u8 LDCERC1;436u8 LDCERC2;437u8 LDCERC3;438u8 LDUERC0;439u8 LDUERC1;440u8 LDUERC2;441u8 LDUERC3;442u8 LDBER0;443u8 LDBER1;444u8 LDBER2;445u8 LDBER3;446struct {447u8 MODE_TYPE :4; /* acquire mode 0 */448u8 reservd :4;449} MODE_TYPE;450u8 SNR_EST0;451u8 SNR_EST1;452u8 SIGNAL;453} PACKED;454455#define CMD_SET_RF_BW_NOT_LISTED 0x3f456#define MSGID_SET_RF_BW_NOT_LISTED 0x11457/* TODO */458459#endif460461462