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