treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / media / dvb-frontends / dib0090.h
blobe5cb311694d9fc413b84c3b92ff6ed07e405bdec
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Linux-DVB Driver for DiBcom's DiB0090 base-band RF Tuner.
5 * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
6 */
7 #ifndef DIB0090_H
8 #define DIB0090_H
10 struct dvb_frontend;
11 struct i2c_adapter;
13 #define DEFAULT_DIB0090_I2C_ADDRESS 0x60
15 struct dib0090_io_config {
16 u32 clock_khz;
18 u8 pll_bypass:1;
19 u8 pll_range:1;
20 u8 pll_prediv:6;
21 u8 pll_loopdiv:6;
23 u8 adc_clock_ratio; /* valid is 8, 7 ,6 */
24 u16 pll_int_loop_filt;
27 struct dib0090_wbd_slope {
28 u16 max_freq; /* for every frequency less than or equal to that field: this information is correct */
29 u16 slope_cold;
30 u16 offset_cold;
31 u16 slope_hot;
32 u16 offset_hot;
33 u8 wbd_gain;
36 struct dib0090_low_if_offset_table {
37 int std;
38 u32 RF_freq;
39 s32 offset_khz;
42 struct dib0090_config {
43 struct dib0090_io_config io;
44 int (*reset) (struct dvb_frontend *, int);
45 int (*sleep) (struct dvb_frontend *, int);
47 /* offset in kHz */
48 int freq_offset_khz_uhf;
49 int freq_offset_khz_vhf;
51 int (*get_adc_power) (struct dvb_frontend *);
53 u8 clkouttobamse:1; /* activate or deactivate clock output */
54 u8 analog_output;
56 u8 i2c_address;
57 /* add drives and other things if necessary */
58 u16 wbd_vhf_offset;
59 u16 wbd_cband_offset;
60 u8 use_pwm_agc;
61 u8 clkoutdrive;
63 u8 ls_cfg_pad_drv;
64 u8 data_tx_drv;
66 u8 in_soc;
67 const struct dib0090_low_if_offset_table *low_if;
68 u8 fref_clock_ratio;
69 u16 force_cband_input;
70 struct dib0090_wbd_slope *wbd;
71 u8 is_dib7090e;
72 u8 force_crystal_mode;
75 #if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090)
76 extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
77 extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
78 extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);
79 extern void dib0090_pwm_gain_reset(struct dvb_frontend *fe);
80 extern u16 dib0090_get_wbd_target(struct dvb_frontend *tuner);
81 extern u16 dib0090_get_wbd_offset(struct dvb_frontend *fe);
82 extern int dib0090_gain_control(struct dvb_frontend *fe);
83 extern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe);
84 extern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state);
85 extern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt);
86 extern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff);
87 extern int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3);
88 extern int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff);
89 extern int dib0090_update_rframp_7090(struct dvb_frontend *fe,
90 u8 cfg_sensitivity);
91 extern int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
92 u8 cfg_sensitivity);
93 #else
94 static inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config)
96 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
97 return NULL;
100 static inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config)
102 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
103 return NULL;
106 static inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast)
108 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
111 static inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
113 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
116 static inline u16 dib0090_get_wbd_target(struct dvb_frontend *tuner)
118 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
119 return 0;
122 static inline u16 dib0090_get_wbd_offset(struct dvb_frontend *fe)
124 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
125 return 0;
128 static inline int dib0090_gain_control(struct dvb_frontend *fe)
130 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
131 return -ENODEV;
134 static inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
136 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
137 return CT_DONE;
140 static inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state)
142 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
143 return -ENODEV;
146 static inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt)
148 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
151 static inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff)
153 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
156 static inline int dib0090_set_switch(struct dvb_frontend *fe,
157 u8 sw1, u8 sw2, u8 sw3)
159 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
160 return -ENODEV;
163 static inline int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff)
165 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
166 return -ENODEV;
169 static inline int dib0090_update_rframp_7090(struct dvb_frontend *fe,
170 u8 cfg_sensitivity)
172 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
173 return -ENODEV;
176 static inline int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
177 u8 cfg_sensitivity)
179 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
180 return -ENODEV;
182 #endif
184 #endif