Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *  Driver for Freescale MC44S803 Low Power CMOS Broadband Tuner
0004  *
0005  *  Copyright (c) 2009 Jochen Friedrich <jochen@scram.de>
0006  */
0007 
0008 #ifndef MC44S803_PRIV_H
0009 #define MC44S803_PRIV_H
0010 
0011 /* This driver is based on the information available in the datasheet
0012    http://www.freescale.com/files/rf_if/doc/data_sheet/MC44S803.pdf
0013 
0014    SPI or I2C Address : 0xc0-0xc6
0015 
0016    Reg.No | Function
0017    -------------------------------------------
0018        00 | Power Down
0019        01 | Reference Oszillator
0020        02 | Reference Dividers
0021        03 | Mixer and Reference Buffer
0022        04 | Reset/Serial Out
0023        05 | LO 1
0024        06 | LO 2
0025        07 | Circuit Adjust
0026        08 | Test
0027        09 | Digital Tune
0028        0A | LNA AGC
0029        0B | Data Register Address
0030        0C | Regulator Test
0031        0D | VCO Test
0032        0E | LNA Gain/Input Power
0033        0F | ID Bits
0034 
0035 */
0036 
0037 #define MC44S803_OSC 26000000   /* 26 MHz */
0038 #define MC44S803_IF1 1086000000 /* 1086 MHz */
0039 #define MC44S803_IF2 36125000   /* 36.125 MHz */
0040 
0041 #define MC44S803_REG_POWER  0
0042 #define MC44S803_REG_REFOSC 1
0043 #define MC44S803_REG_REFDIV 2
0044 #define MC44S803_REG_MIXER  3
0045 #define MC44S803_REG_RESET  4
0046 #define MC44S803_REG_LO1    5
0047 #define MC44S803_REG_LO2    6
0048 #define MC44S803_REG_CIRCADJ    7
0049 #define MC44S803_REG_TEST   8
0050 #define MC44S803_REG_DIGTUNE    9
0051 #define MC44S803_REG_LNAAGC 0x0A
0052 #define MC44S803_REG_DATAREG    0x0B
0053 #define MC44S803_REG_REGTEST    0x0C
0054 #define MC44S803_REG_VCOTEST    0x0D
0055 #define MC44S803_REG_LNAGAIN    0x0E
0056 #define MC44S803_REG_ID     0x0F
0057 
0058 /* Register definitions */
0059 #define MC44S803_ADDR       0x0F
0060 #define MC44S803_ADDR_S     0
0061 /* REG_POWER */
0062 #define MC44S803_POWER      0xFFFFF0
0063 #define MC44S803_POWER_S    4
0064 /* REG_REFOSC */
0065 #define MC44S803_REFOSC     0x1FF0
0066 #define MC44S803_REFOSC_S   4
0067 #define MC44S803_OSCSEL     0x2000
0068 #define MC44S803_OSCSEL_S   13
0069 /* REG_REFDIV */
0070 #define MC44S803_R2     0x1FF0
0071 #define MC44S803_R2_S       4
0072 #define MC44S803_REFBUF_EN  0x2000
0073 #define MC44S803_REFBUF_EN_S    13
0074 #define MC44S803_R1     0x7C000
0075 #define MC44S803_R1_S       14
0076 /* REG_MIXER */
0077 #define MC44S803_R3     0x70
0078 #define MC44S803_R3_S       4
0079 #define MC44S803_MUX3       0x80
0080 #define MC44S803_MUX3_S     7
0081 #define MC44S803_MUX4       0x100
0082 #define MC44S803_MUX4_S     8
0083 #define MC44S803_OSC_SCR    0x200
0084 #define MC44S803_OSC_SCR_S  9
0085 #define MC44S803_TRI_STATE  0x400
0086 #define MC44S803_TRI_STATE_S    10
0087 #define MC44S803_BUF_GAIN   0x800
0088 #define MC44S803_BUF_GAIN_S 11
0089 #define MC44S803_BUF_IO     0x1000
0090 #define MC44S803_BUF_IO_S   12
0091 #define MC44S803_MIXER_RES  0xFE000
0092 #define MC44S803_MIXER_RES_S    13
0093 /* REG_RESET */
0094 #define MC44S803_RS     0x10
0095 #define MC44S803_RS_S       4
0096 #define MC44S803_SO     0x20
0097 #define MC44S803_SO_S       5
0098 /* REG_LO1 */
0099 #define MC44S803_LO1        0xFFF0
0100 #define MC44S803_LO1_S      4
0101 /* REG_LO2 */
0102 #define MC44S803_LO2        0x7FFF0
0103 #define MC44S803_LO2_S      4
0104 /* REG_CIRCADJ */
0105 #define MC44S803_G1     0x20
0106 #define MC44S803_G1_S       5
0107 #define MC44S803_G3     0x80
0108 #define MC44S803_G3_S       7
0109 #define MC44S803_CIRCADJ_RES    0x300
0110 #define MC44S803_CIRCADJ_RES_S  8
0111 #define MC44S803_G6     0x400
0112 #define MC44S803_G6_S       10
0113 #define MC44S803_G7     0x800
0114 #define MC44S803_G7_S       11
0115 #define MC44S803_S1     0x1000
0116 #define MC44S803_S1_S       12
0117 #define MC44S803_LP     0x7E000
0118 #define MC44S803_LP_S       13
0119 #define MC44S803_CLRF       0x80000
0120 #define MC44S803_CLRF_S     19
0121 #define MC44S803_CLIF       0x100000
0122 #define MC44S803_CLIF_S     20
0123 /* REG_TEST */
0124 /* REG_DIGTUNE */
0125 #define MC44S803_DA     0xF0
0126 #define MC44S803_DA_S       4
0127 #define MC44S803_XOD        0x300
0128 #define MC44S803_XOD_S      8
0129 #define MC44S803_RST        0x10000
0130 #define MC44S803_RST_S      16
0131 #define MC44S803_LO_REF     0x1FFF00
0132 #define MC44S803_LO_REF_S   8
0133 #define MC44S803_AT     0x200000
0134 #define MC44S803_AT_S       21
0135 #define MC44S803_MT     0x400000
0136 #define MC44S803_MT_S       22
0137 /* REG_LNAAGC */
0138 #define MC44S803_G      0x3F0
0139 #define MC44S803_G_S        4
0140 #define MC44S803_AT1        0x400
0141 #define MC44S803_AT1_S      10
0142 #define MC44S803_AT2        0x800
0143 #define MC44S803_AT2_S      11
0144 #define MC44S803_HL_GR_EN   0x8000
0145 #define MC44S803_HL_GR_EN_S 15
0146 #define MC44S803_AGC_AN_DIG 0x10000
0147 #define MC44S803_AGC_AN_DIG_S   16
0148 #define MC44S803_ATTEN_EN   0x20000
0149 #define MC44S803_ATTEN_EN_S 17
0150 #define MC44S803_AGC_READ_EN    0x40000
0151 #define MC44S803_AGC_READ_EN_S  18
0152 #define MC44S803_LNA0       0x80000
0153 #define MC44S803_LNA0_S     19
0154 #define MC44S803_AGC_SEL    0x100000
0155 #define MC44S803_AGC_SEL_S  20
0156 #define MC44S803_AT0        0x200000
0157 #define MC44S803_AT0_S      21
0158 #define MC44S803_B      0xC00000
0159 #define MC44S803_B_S        22
0160 /* REG_DATAREG */
0161 #define MC44S803_D      0xF0
0162 #define MC44S803_D_S        4
0163 /* REG_REGTEST */
0164 /* REG_VCOTEST */
0165 /* REG_LNAGAIN */
0166 #define MC44S803_IF_PWR     0x700
0167 #define MC44S803_IF_PWR_S   8
0168 #define MC44S803_RF_PWR     0x3800
0169 #define MC44S803_RF_PWR_S   11
0170 #define MC44S803_LNA_GAIN   0xFC000
0171 #define MC44S803_LNA_GAIN_S 14
0172 /* REG_ID */
0173 #define MC44S803_ID     0x3E00
0174 #define MC44S803_ID_S       9
0175 
0176 /* Some macros to read/write fields */
0177 
0178 /* First shift, then mask */
0179 #define MC44S803_REG_SM(_val, _reg)                 \
0180     (((_val) << _reg##_S) & (_reg))
0181 
0182 /* First mask, then shift */
0183 #define MC44S803_REG_MS(_val, _reg)                 \
0184     (((_val) & (_reg)) >> _reg##_S)
0185 
0186 struct mc44s803_priv {
0187     struct mc44s803_config *cfg;
0188     struct i2c_adapter *i2c;
0189     struct dvb_frontend *fe;
0190 
0191     u32 frequency;
0192 };
0193 
0194 #endif