1a10e763bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
29a0bf528SMauro Carvalho Chehab /*
39a0bf528SMauro Carvalho Chehab * Linux-DVB Driver for DiBcom's DiB0070 base-band RF Tuner.
49a0bf528SMauro Carvalho Chehab *
59a0bf528SMauro Carvalho Chehab * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
69a0bf528SMauro Carvalho Chehab */
79a0bf528SMauro Carvalho Chehab #ifndef DIB0070_H
89a0bf528SMauro Carvalho Chehab #define DIB0070_H
99a0bf528SMauro Carvalho Chehab
109a0bf528SMauro Carvalho Chehab struct dvb_frontend;
119a0bf528SMauro Carvalho Chehab struct i2c_adapter;
129a0bf528SMauro Carvalho Chehab
139a0bf528SMauro Carvalho Chehab #define DEFAULT_DIB0070_I2C_ADDRESS 0x60
149a0bf528SMauro Carvalho Chehab
159a0bf528SMauro Carvalho Chehab struct dib0070_wbd_gain_cfg {
169a0bf528SMauro Carvalho Chehab u16 freq;
179a0bf528SMauro Carvalho Chehab u16 wbd_gain_val;
189a0bf528SMauro Carvalho Chehab };
199a0bf528SMauro Carvalho Chehab
209a0bf528SMauro Carvalho Chehab struct dib0070_config {
219a0bf528SMauro Carvalho Chehab u8 i2c_address;
229a0bf528SMauro Carvalho Chehab
239a0bf528SMauro Carvalho Chehab /* tuner pins controlled externally */
249a0bf528SMauro Carvalho Chehab int (*reset) (struct dvb_frontend *, int);
259a0bf528SMauro Carvalho Chehab int (*sleep) (struct dvb_frontend *, int);
269a0bf528SMauro Carvalho Chehab
279a0bf528SMauro Carvalho Chehab /* offset in kHz */
289a0bf528SMauro Carvalho Chehab int freq_offset_khz_uhf;
299a0bf528SMauro Carvalho Chehab int freq_offset_khz_vhf;
309a0bf528SMauro Carvalho Chehab
319a0bf528SMauro Carvalho Chehab u8 osc_buffer_state; /* 0= normal, 1= tri-state */
329a0bf528SMauro Carvalho Chehab u32 clock_khz;
339a0bf528SMauro Carvalho Chehab u8 clock_pad_drive; /* (Drive + 1) * 2mA */
349a0bf528SMauro Carvalho Chehab
359a0bf528SMauro Carvalho Chehab u8 invert_iq; /* invert Q - in case I or Q is inverted on the board */
369a0bf528SMauro Carvalho Chehab
379a0bf528SMauro Carvalho Chehab u8 force_crystal_mode; /* if == 0 -> decision is made in the driver default: <24 -> 2, >=24 -> 1 */
389a0bf528SMauro Carvalho Chehab
399a0bf528SMauro Carvalho Chehab u8 flip_chip;
409a0bf528SMauro Carvalho Chehab u8 enable_third_order_filter;
419a0bf528SMauro Carvalho Chehab u8 charge_pump;
429a0bf528SMauro Carvalho Chehab
439a0bf528SMauro Carvalho Chehab const struct dib0070_wbd_gain_cfg *wbd_gain;
449a0bf528SMauro Carvalho Chehab
459a0bf528SMauro Carvalho Chehab u8 vga_filter;
469a0bf528SMauro Carvalho Chehab };
479a0bf528SMauro Carvalho Chehab
489b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0070)
499a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg);
509a0bf528SMauro Carvalho Chehab extern u16 dib0070_wbd_offset(struct dvb_frontend *);
519a0bf528SMauro Carvalho Chehab extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, u8 open);
529a0bf528SMauro Carvalho Chehab extern u8 dib0070_get_rf_output(struct dvb_frontend *fe);
539a0bf528SMauro Carvalho Chehab extern int dib0070_set_rf_output(struct dvb_frontend *fe, u8 no);
549a0bf528SMauro Carvalho Chehab #else
dib0070_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c,struct dib0070_config * cfg)559a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg)
569a0bf528SMauro Carvalho Chehab {
579a0bf528SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
589a0bf528SMauro Carvalho Chehab return NULL;
599a0bf528SMauro Carvalho Chehab }
609a0bf528SMauro Carvalho Chehab
dib0070_wbd_offset(struct dvb_frontend * fe)619a0bf528SMauro Carvalho Chehab static inline u16 dib0070_wbd_offset(struct dvb_frontend *fe)
629a0bf528SMauro Carvalho Chehab {
639a0bf528SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
649a0bf528SMauro Carvalho Chehab return 0;
659a0bf528SMauro Carvalho Chehab }
669a0bf528SMauro Carvalho Chehab
dib0070_ctrl_agc_filter(struct dvb_frontend * fe,u8 open)679a0bf528SMauro Carvalho Chehab static inline void dib0070_ctrl_agc_filter(struct dvb_frontend *fe, u8 open)
689a0bf528SMauro Carvalho Chehab {
699a0bf528SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
709a0bf528SMauro Carvalho Chehab }
719a0bf528SMauro Carvalho Chehab #endif
729a0bf528SMauro Carvalho Chehab
739a0bf528SMauro Carvalho Chehab #endif
74