Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003     STB6100 Silicon Tuner
0004     Copyright (C) Manu Abraham (abraham.manu@gmail.com)
0005 
0006     Copyright (C) ST Microelectronics
0007 
0008 */
0009 
0010 #ifndef __STB_6100_REG_H
0011 #define __STB_6100_REG_H
0012 
0013 #include <linux/dvb/frontend.h>
0014 #include <media/dvb_frontend.h>
0015 
0016 #define STB6100_LD          0x00
0017 #define STB6100_LD_LOCK         (1 << 0)
0018 
0019 #define STB6100_VCO         0x01
0020 #define STB6100_VCO_OSCH        (0x01 << 7)
0021 #define STB6100_VCO_OSCH_SHIFT      7
0022 #define STB6100_VCO_OCK         (0x03 << 5)
0023 #define STB6100_VCO_OCK_SHIFT       5
0024 #define STB6100_VCO_ODIV        (0x01 << 4)
0025 #define STB6100_VCO_ODIV_SHIFT      4
0026 #define STB6100_VCO_OSM         (0x0f << 0)
0027 
0028 #define STB6100_NI          0x02
0029 #define STB6100_NF_LSB          0x03
0030 
0031 #define STB6100_K           0x04
0032 #define STB6100_K_PSD2          (0x01 << 2)
0033 #define STB6100_K_PSD2_SHIFT            2
0034 #define STB6100_K_NF_MSB        (0x03 << 0)
0035 
0036 #define STB6100_G           0x05
0037 #define STB6100_G_G         (0x0f << 0)
0038 #define STB6100_G_GCT           (0x07 << 5)
0039 
0040 #define STB6100_F           0x06
0041 #define STB6100_F_F         (0x1f << 0)
0042 
0043 #define STB6100_DLB         0x07
0044 
0045 #define STB6100_TEST1           0x08
0046 
0047 #define STB6100_FCCK            0x09
0048 #define STB6100_FCCK_FCCK       (0x01 << 6)
0049 
0050 #define STB6100_LPEN            0x0a
0051 #define STB6100_LPEN_LPEN       (0x01 << 4)
0052 #define STB6100_LPEN_SYNP       (0x01 << 5)
0053 #define STB6100_LPEN_OSCP       (0x01 << 6)
0054 #define STB6100_LPEN_BEN        (0x01 << 7)
0055 
0056 #define STB6100_TEST3           0x0b
0057 
0058 #define STB6100_NUMREGS                 0x0c
0059 
0060 
0061 #define INRANGE(val, x, y)      (((x <= val) && (val <= y)) ||      \
0062                      ((y <= val) && (val <= x)) ? 1 : 0)
0063 
0064 #define CHKRANGE(val, x, y)     (((val >= x) && (val < y)) ? 1 : 0)
0065 
0066 struct stb6100_config {
0067     u8  tuner_address;
0068     u32 refclock;
0069 };
0070 
0071 struct stb6100_state {
0072     struct i2c_adapter *i2c;
0073 
0074     const struct stb6100_config *config;
0075     struct dvb_tuner_ops        ops;
0076     struct dvb_frontend     *frontend;
0077 
0078     u32 frequency;
0079     u32 srate;
0080     u32 bandwidth;
0081     u32 reference;
0082 };
0083 
0084 #if IS_REACHABLE(CONFIG_DVB_STB6100)
0085 
0086 extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
0087                        const struct stb6100_config *config,
0088                        struct i2c_adapter *i2c);
0089 
0090 #else
0091 
0092 static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
0093                           const struct stb6100_config *config,
0094                           struct i2c_adapter *i2c)
0095 {
0096     printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
0097     return NULL;
0098 }
0099 
0100 #endif //CONFIG_DVB_STB6100
0101 
0102 #endif