xref: /linux/drivers/media/tuners/mxl5005s.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*74ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2ccae7af2SMauro Carvalho Chehab /*
3ccae7af2SMauro Carvalho Chehab     MaxLinear MXL5005S VSB/QAM/DVBT tuner driver
4ccae7af2SMauro Carvalho Chehab 
5ccae7af2SMauro Carvalho Chehab     Copyright (C) 2008 MaxLinear
6ccae7af2SMauro Carvalho Chehab     Copyright (C) 2008 Steven Toth <stoth@linuxtv.org>
7ccae7af2SMauro Carvalho Chehab 
8ccae7af2SMauro Carvalho Chehab 
9ccae7af2SMauro Carvalho Chehab */
10ccae7af2SMauro Carvalho Chehab 
11ccae7af2SMauro Carvalho Chehab #ifndef __MXL5005S_H
12ccae7af2SMauro Carvalho Chehab #define __MXL5005S_H
13ccae7af2SMauro Carvalho Chehab 
14ccae7af2SMauro Carvalho Chehab #include <linux/i2c.h>
15fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
16ccae7af2SMauro Carvalho Chehab 
17ccae7af2SMauro Carvalho Chehab struct mxl5005s_config {
18ccae7af2SMauro Carvalho Chehab 
19ccae7af2SMauro Carvalho Chehab 	/* 7 bit i2c address */
20ccae7af2SMauro Carvalho Chehab 	u8 i2c_address;
21ccae7af2SMauro Carvalho Chehab 
22ccae7af2SMauro Carvalho Chehab #define IF_FREQ_4570000HZ    4570000
23ccae7af2SMauro Carvalho Chehab #define IF_FREQ_4571429HZ    4571429
24ccae7af2SMauro Carvalho Chehab #define IF_FREQ_5380000HZ    5380000
25ccae7af2SMauro Carvalho Chehab #define IF_FREQ_36000000HZ  36000000
26ccae7af2SMauro Carvalho Chehab #define IF_FREQ_36125000HZ  36125000
27ccae7af2SMauro Carvalho Chehab #define IF_FREQ_36166667HZ  36166667
28ccae7af2SMauro Carvalho Chehab #define IF_FREQ_44000000HZ  44000000
29ccae7af2SMauro Carvalho Chehab 	u32 if_freq;
30ccae7af2SMauro Carvalho Chehab 
31ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_4000000HZ    4000000
32ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_16000000HZ  16000000
33ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_25000000HZ  25000000
34ccae7af2SMauro Carvalho Chehab #define CRYSTAL_FREQ_28800000HZ  28800000
35ccae7af2SMauro Carvalho Chehab 	u32 xtal_freq;
36ccae7af2SMauro Carvalho Chehab 
37ccae7af2SMauro Carvalho Chehab #define MXL_DUAL_AGC   0
38ccae7af2SMauro Carvalho Chehab #define MXL_SINGLE_AGC 1
39ccae7af2SMauro Carvalho Chehab 	u8 agc_mode;
40ccae7af2SMauro Carvalho Chehab 
41ccae7af2SMauro Carvalho Chehab #define MXL_TF_DEFAULT	0
42ccae7af2SMauro Carvalho Chehab #define MXL_TF_OFF	1
43ccae7af2SMauro Carvalho Chehab #define MXL_TF_C	2
44ccae7af2SMauro Carvalho Chehab #define MXL_TF_C_H	3
45ccae7af2SMauro Carvalho Chehab #define MXL_TF_D	4
46ccae7af2SMauro Carvalho Chehab #define MXL_TF_D_L	5
47ccae7af2SMauro Carvalho Chehab #define MXL_TF_E	6
48ccae7af2SMauro Carvalho Chehab #define MXL_TF_F	7
49ccae7af2SMauro Carvalho Chehab #define MXL_TF_E_2	8
50ccae7af2SMauro Carvalho Chehab #define MXL_TF_E_NA	9
51ccae7af2SMauro Carvalho Chehab #define MXL_TF_G	10
52ccae7af2SMauro Carvalho Chehab 	u8 tracking_filter;
53ccae7af2SMauro Carvalho Chehab 
54ccae7af2SMauro Carvalho Chehab #define MXL_RSSI_DISABLE	0
55ccae7af2SMauro Carvalho Chehab #define MXL_RSSI_ENABLE		1
56ccae7af2SMauro Carvalho Chehab 	u8 rssi_enable;
57ccae7af2SMauro Carvalho Chehab 
58ccae7af2SMauro Carvalho Chehab #define MXL_CAP_SEL_DISABLE	0
59ccae7af2SMauro Carvalho Chehab #define MXL_CAP_SEL_ENABLE	1
60ccae7af2SMauro Carvalho Chehab 	u8 cap_select;
61ccae7af2SMauro Carvalho Chehab 
62ccae7af2SMauro Carvalho Chehab #define MXL_DIV_OUT_1	0
63ccae7af2SMauro Carvalho Chehab #define MXL_DIV_OUT_4	1
64ccae7af2SMauro Carvalho Chehab 	u8 div_out;
65ccae7af2SMauro Carvalho Chehab 
66ccae7af2SMauro Carvalho Chehab #define MXL_CLOCK_OUT_DISABLE	0
67ccae7af2SMauro Carvalho Chehab #define MXL_CLOCK_OUT_ENABLE	1
68ccae7af2SMauro Carvalho Chehab 	u8 clock_out;
69ccae7af2SMauro Carvalho Chehab 
70ccae7af2SMauro Carvalho Chehab #define MXL5005S_IF_OUTPUT_LOAD_200_OHM 200
71ccae7af2SMauro Carvalho Chehab #define MXL5005S_IF_OUTPUT_LOAD_300_OHM 300
72ccae7af2SMauro Carvalho Chehab 	u32 output_load;
73ccae7af2SMauro Carvalho Chehab 
74ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_5P5   55
75ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_7P2   72
76ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_9P2   92
77ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_11P0 110
78ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_12P9 129
79ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_14P7 147
80ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_16P8 168
81ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_19P4 194
82ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_21P2 212
83ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_23P2 232
84ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_25P2 252
85ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_27P1 271
86ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_29P2 292
87ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_31P7 317
88ccae7af2SMauro Carvalho Chehab #define MXL5005S_TOP_34P9 349
89ccae7af2SMauro Carvalho Chehab 	u32 top;
90ccae7af2SMauro Carvalho Chehab 
91ccae7af2SMauro Carvalho Chehab #define MXL_ANALOG_MODE  0
92ccae7af2SMauro Carvalho Chehab #define MXL_DIGITAL_MODE 1
93ccae7af2SMauro Carvalho Chehab 	u8 mod_mode;
94ccae7af2SMauro Carvalho Chehab 
95ccae7af2SMauro Carvalho Chehab #define MXL_ZERO_IF 0
96ccae7af2SMauro Carvalho Chehab #define MXL_LOW_IF  1
97ccae7af2SMauro Carvalho Chehab 	u8 if_mode;
98ccae7af2SMauro Carvalho Chehab 
99ccae7af2SMauro Carvalho Chehab 	/* Some boards need to override the built-in logic for determining
100ccae7af2SMauro Carvalho Chehab 	   the gain when in QAM mode (the HVR-1600 is one such case) */
101ccae7af2SMauro Carvalho Chehab 	u8 qam_gain;
102ccae7af2SMauro Carvalho Chehab 
103ccae7af2SMauro Carvalho Chehab 	/* Stuff I don't know what to do with */
104ccae7af2SMauro Carvalho Chehab 	u8 AgcMasterByte;
105ccae7af2SMauro Carvalho Chehab };
106ccae7af2SMauro Carvalho Chehab 
1079b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_MEDIA_TUNER_MXL5005S)
108ccae7af2SMauro Carvalho Chehab extern struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe,
109ccae7af2SMauro Carvalho Chehab 					    struct i2c_adapter *i2c,
110ccae7af2SMauro Carvalho Chehab 					    struct mxl5005s_config *config);
111ccae7af2SMauro Carvalho Chehab #else
mxl5005s_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c,struct mxl5005s_config * config)112ccae7af2SMauro Carvalho Chehab static inline struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe,
113ccae7af2SMauro Carvalho Chehab 					    struct i2c_adapter *i2c,
114ccae7af2SMauro Carvalho Chehab 					    struct mxl5005s_config *config)
115ccae7af2SMauro Carvalho Chehab {
116ccae7af2SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
117ccae7af2SMauro Carvalho Chehab 	return NULL;
118ccae7af2SMauro Carvalho Chehab }
119ccae7af2SMauro Carvalho Chehab #endif /* CONFIG_DVB_TUNER_MXL5005S */
120ccae7af2SMauro Carvalho Chehab 
121ccae7af2SMauro Carvalho Chehab #endif /* __MXL5005S_H */
122ccae7af2SMauro Carvalho Chehab 
123