1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  mxl5007t.h - driver for the MaxLinear MxL5007T silicon tuner
4  *
5  *  Copyright (C) 2008 Michael Krufky <mkrufky@linuxtv.org>
6  */
7 
8 #ifndef __MXL5007T_H__
9 #define __MXL5007T_H__
10 
11 #include <media/dvb_frontend.h>
12 
13 /* ------------------------------------------------------------------------- */
14 
15 enum mxl5007t_if_freq {
16 	MxL_IF_4_MHZ,      /*  4000000 */
17 	MxL_IF_4_5_MHZ,    /*  4500000 */
18 	MxL_IF_4_57_MHZ,   /*  4570000 */
19 	MxL_IF_5_MHZ,      /*  5000000 */
20 	MxL_IF_5_38_MHZ,   /*  5380000 */
21 	MxL_IF_6_MHZ,      /*  6000000 */
22 	MxL_IF_6_28_MHZ,   /*  6280000 */
23 	MxL_IF_9_1915_MHZ, /*  9191500 */
24 	MxL_IF_35_25_MHZ,  /* 35250000 */
25 	MxL_IF_36_15_MHZ,  /* 36150000 */
26 	MxL_IF_44_MHZ,     /* 44000000 */
27 };
28 
29 enum mxl5007t_xtal_freq {
30 	MxL_XTAL_16_MHZ,      /* 16000000 */
31 	MxL_XTAL_20_MHZ,      /* 20000000 */
32 	MxL_XTAL_20_25_MHZ,   /* 20250000 */
33 	MxL_XTAL_20_48_MHZ,   /* 20480000 */
34 	MxL_XTAL_24_MHZ,      /* 24000000 */
35 	MxL_XTAL_25_MHZ,      /* 25000000 */
36 	MxL_XTAL_25_14_MHZ,   /* 25140000 */
37 	MxL_XTAL_27_MHZ,      /* 27000000 */
38 	MxL_XTAL_28_8_MHZ,    /* 28800000 */
39 	MxL_XTAL_32_MHZ,      /* 32000000 */
40 	MxL_XTAL_40_MHZ,      /* 40000000 */
41 	MxL_XTAL_44_MHZ,      /* 44000000 */
42 	MxL_XTAL_48_MHZ,      /* 48000000 */
43 	MxL_XTAL_49_3811_MHZ, /* 49381100 */
44 };
45 
46 enum mxl5007t_clkout_amp {
47 	MxL_CLKOUT_AMP_0_94V = 0,
48 	MxL_CLKOUT_AMP_0_53V = 1,
49 	MxL_CLKOUT_AMP_0_37V = 2,
50 	MxL_CLKOUT_AMP_0_28V = 3,
51 	MxL_CLKOUT_AMP_0_23V = 4,
52 	MxL_CLKOUT_AMP_0_20V = 5,
53 	MxL_CLKOUT_AMP_0_17V = 6,
54 	MxL_CLKOUT_AMP_0_15V = 7,
55 };
56 
57 struct mxl5007t_config {
58 	s32 if_diff_out_level;
59 	enum mxl5007t_clkout_amp clk_out_amp;
60 	enum mxl5007t_xtal_freq xtal_freq_hz;
61 	enum mxl5007t_if_freq if_freq_hz;
62 	unsigned int invert_if:1;
63 	unsigned int loop_thru_enable:1;
64 	unsigned int clk_out_enable:1;
65 };
66 
67 #if IS_REACHABLE(CONFIG_MEDIA_TUNER_MXL5007T)
68 extern struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe,
69 					    struct i2c_adapter *i2c, u8 addr,
70 					    struct mxl5007t_config *cfg);
71 #else
mxl5007t_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c,u8 addr,struct mxl5007t_config * cfg)72 static inline struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe,
73 						   struct i2c_adapter *i2c,
74 						   u8 addr,
75 						   struct mxl5007t_config *cfg)
76 {
77 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
78 	return NULL;
79 }
80 #endif
81 
82 #endif /* __MXL5007T_H__ */
83