1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  mxl111sf-tuner.h - driver for the MaxLinear MXL111SF CMOS tuner
4  *
5  *  Copyright (C) 2010-2014 Michael Krufky <mkrufky@linuxtv.org>
6  */
7 
8 #ifndef __MXL111SF_TUNER_H__
9 #define __MXL111SF_TUNER_H__
10 
11 #include <media/dvb_frontend.h>
12 #include "mxl111sf.h"
13 
14 enum mxl_if_freq {
15 #if 0
16 	MXL_IF_LO    = 0x00, /* other IF < 9MHz */
17 #endif
18 	MXL_IF_4_0   = 0x01, /* 4.0   MHz */
19 	MXL_IF_4_5   = 0x02, /* 4.5   MHz */
20 	MXL_IF_4_57  = 0x03, /* 4.57  MHz */
21 	MXL_IF_5_0   = 0x04, /* 5.0   MHz */
22 	MXL_IF_5_38  = 0x05, /* 5.38  MHz */
23 	MXL_IF_6_0   = 0x06, /* 6.0   MHz */
24 	MXL_IF_6_28  = 0x07, /* 6.28  MHz */
25 	MXL_IF_7_2   = 0x08, /* 7.2   MHz */
26 	MXL_IF_35_25 = 0x09, /* 35.25 MHz */
27 	MXL_IF_36    = 0x0a, /* 36    MHz */
28 	MXL_IF_36_15 = 0x0b, /* 36.15 MHz */
29 	MXL_IF_44    = 0x0c, /* 44    MHz */
30 #if 0
31 	MXL_IF_HI    = 0x0f, /* other IF > 35 MHz and < 45 MHz */
32 #endif
33 };
34 
35 struct mxl111sf_tuner_config {
36 	enum mxl_if_freq if_freq;
37 	unsigned int invert_spectrum:1;
38 
39 	int (*read_reg)(struct mxl111sf_state *state, u8 addr, u8 *data);
40 	int (*write_reg)(struct mxl111sf_state *state, u8 addr, u8 data);
41 	int (*program_regs)(struct mxl111sf_state *state,
42 			    struct mxl111sf_reg_ctrl_info *ctrl_reg_info);
43 	int (*top_master_ctrl)(struct mxl111sf_state *state, int onoff);
44 	int (*ant_hunt)(struct dvb_frontend *fe);
45 };
46 
47 /* ------------------------------------------------------------------------ */
48 
49 #if IS_ENABLED(CONFIG_DVB_USB_MXL111SF)
50 extern
51 struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
52 				struct mxl111sf_state *mxl_state,
53 				const struct mxl111sf_tuner_config *cfg);
54 #else
55 static inline
mxl111sf_tuner_attach(struct dvb_frontend * fe,struct mxl111sf_state * mxl_state,const struct mxl111sf_tuner_config * cfg)56 struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe,
57 				struct mxl111sf_state *mxl_state,
58 				const struct mxl111sf_tuner_config *cfg)
59 {
60 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
61 	return NULL;
62 }
63 #endif
64 
65 #endif /* __MXL111SF_TUNER_H__ */
66