1 #ifndef DIB9000_H
2 #define DIB9000_H
3 
4 #include "dibx000_common.h"
5 
6 struct dib9000_config {
7 	u8 dvbt_mode;
8 	u8 output_mpeg2_in_188_bytes;
9 	u8 hostbus_diversity;
10 	struct dibx000_bandwidth_config *bw;
11 
12 	u16 if_drives;
13 
14 	u32 timing_frequency;
15 	u32 xtal_clock_khz;
16 	u32 vcxo_timer;
17 	u32 demod_clock_khz;
18 
19 	const u8 *microcode_B_fe_buffer;
20 	u32 microcode_B_fe_size;
21 
22 	struct dibGPIOFunction gpio_function[2];
23 	struct dibSubbandSelection subband;
24 
25 	u8 output_mode;
26 };
27 
28 #define DEFAULT_DIB9000_I2C_ADDRESS 18
29 
30 #if IS_REACHABLE(CONFIG_DVB_DIB9000)
31 extern struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, const struct dib9000_config *cfg);
32 extern int dib9000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr);
33 extern struct i2c_adapter *dib9000_get_tuner_interface(struct dvb_frontend *fe);
34 extern struct i2c_adapter *dib9000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface intf, int gating);
35 extern int dib9000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val);
36 extern int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff);
37 extern int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff);
38 extern int dib9000_firmware_post_pll_init(struct dvb_frontend *fe);
39 extern int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave);
40 extern struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
41 extern struct i2c_adapter *dib9000_get_component_bus_interface(struct dvb_frontend *fe);
42 extern int dib9000_set_i2c_adapter(struct dvb_frontend *fe, struct i2c_adapter *i2c);
43 extern int dib9000_fw_set_component_bus_speed(struct dvb_frontend *fe, u16 speed);
44 #else
45 static inline struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib9000_config *cfg)
46 {
47 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
48 	return NULL;
49 }
50 
51 static inline struct i2c_adapter *dib9000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface intf, int gating)
52 {
53 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
54 	return NULL;
55 }
56 
57 static inline int dib9000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr)
58 {
59 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
60 	return -ENODEV;
61 }
62 
63 static inline struct i2c_adapter *dib9000_get_tuner_interface(struct dvb_frontend *fe)
64 {
65 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
66 	return NULL;
67 }
68 
69 static inline int dib9000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val)
70 {
71 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
72 	return -ENODEV;
73 }
74 
75 static inline int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
76 {
77 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
78 	return -ENODEV;
79 }
80 
81 static inline int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
82 {
83 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
84 	return -ENODEV;
85 }
86 
87 static inline int dib9000_firmware_post_pll_init(struct dvb_frontend *fe)
88 {
89 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
90 	return -ENODEV;
91 }
92 
93 static inline int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave)
94 {
95 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
96 	return -ENODEV;
97 }
98 
99 static inline struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index)
100 {
101 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
102 	return NULL;
103 }
104 
105 static inline struct i2c_adapter *dib9000_get_component_bus_interface(struct dvb_frontend *fe)
106 {
107 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
108 	return NULL;
109 }
110 
111 static inline int dib9000_set_i2c_adapter(struct dvb_frontend *fe, struct i2c_adapter *i2c)
112 {
113 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
114 	return -ENODEV;
115 }
116 
117 static inline int dib9000_fw_set_component_bus_speed(struct dvb_frontend *fe, u16 speed)
118 {
119 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
120 	return -ENODEV;
121 }
122 #endif
123 
124 #endif
125