Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / dvb-frontends / stb6100.h
blob902b851b5160e5174786c557471a0339a00bf1ff
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 STB6100 Silicon Tuner
4 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
6 Copyright (C) ST Microelectronics
8 */
10 #ifndef __STB_6100_REG_H
11 #define __STB_6100_REG_H
13 #include <linux/dvb/frontend.h>
14 #include <media/dvb_frontend.h>
16 #define STB6100_LD 0x00
17 #define STB6100_LD_LOCK (1 << 0)
19 #define STB6100_VCO 0x01
20 #define STB6100_VCO_OSCH (0x01 << 7)
21 #define STB6100_VCO_OSCH_SHIFT 7
22 #define STB6100_VCO_OCK (0x03 << 5)
23 #define STB6100_VCO_OCK_SHIFT 5
24 #define STB6100_VCO_ODIV (0x01 << 4)
25 #define STB6100_VCO_ODIV_SHIFT 4
26 #define STB6100_VCO_OSM (0x0f << 0)
28 #define STB6100_NI 0x02
29 #define STB6100_NF_LSB 0x03
31 #define STB6100_K 0x04
32 #define STB6100_K_PSD2 (0x01 << 2)
33 #define STB6100_K_PSD2_SHIFT 2
34 #define STB6100_K_NF_MSB (0x03 << 0)
36 #define STB6100_G 0x05
37 #define STB6100_G_G (0x0f << 0)
38 #define STB6100_G_GCT (0x07 << 5)
40 #define STB6100_F 0x06
41 #define STB6100_F_F (0x1f << 0)
43 #define STB6100_DLB 0x07
45 #define STB6100_TEST1 0x08
47 #define STB6100_FCCK 0x09
48 #define STB6100_FCCK_FCCK (0x01 << 6)
50 #define STB6100_LPEN 0x0a
51 #define STB6100_LPEN_LPEN (0x01 << 4)
52 #define STB6100_LPEN_SYNP (0x01 << 5)
53 #define STB6100_LPEN_OSCP (0x01 << 6)
54 #define STB6100_LPEN_BEN (0x01 << 7)
56 #define STB6100_TEST3 0x0b
58 #define STB6100_NUMREGS 0x0c
61 #define INRANGE(val, x, y) (((x <= val) && (val <= y)) || \
62 ((y <= val) && (val <= x)) ? 1 : 0)
64 #define CHKRANGE(val, x, y) (((val >= x) && (val < y)) ? 1 : 0)
66 struct stb6100_config {
67 u8 tuner_address;
68 u32 refclock;
71 struct stb6100_state {
72 struct i2c_adapter *i2c;
74 const struct stb6100_config *config;
75 struct dvb_tuner_ops ops;
76 struct dvb_frontend *frontend;
78 u32 frequency;
79 u32 srate;
80 u32 bandwidth;
81 u32 reference;
84 #if IS_REACHABLE(CONFIG_DVB_STB6100)
86 extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
87 const struct stb6100_config *config,
88 struct i2c_adapter *i2c);
90 #else
92 static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
93 const struct stb6100_config *config,
94 struct i2c_adapter *i2c)
96 printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
97 return NULL;
100 #endif //CONFIG_DVB_STB6100
102 #endif