18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Linux-DVB Driver for DiBcom's DiB0070 base-band RF Tuner.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef DIB0070_H
88c2ecf20Sopenharmony_ci#define DIB0070_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct dvb_frontend;
118c2ecf20Sopenharmony_cistruct i2c_adapter;
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define DEFAULT_DIB0070_I2C_ADDRESS 0x60
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct dib0070_wbd_gain_cfg {
168c2ecf20Sopenharmony_ci	u16 freq;
178c2ecf20Sopenharmony_ci	u16 wbd_gain_val;
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct dib0070_config {
218c2ecf20Sopenharmony_ci	u8 i2c_address;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	/* tuner pins controlled externally */
248c2ecf20Sopenharmony_ci	int (*reset) (struct dvb_frontend *, int);
258c2ecf20Sopenharmony_ci	int (*sleep) (struct dvb_frontend *, int);
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	/*  offset in kHz */
288c2ecf20Sopenharmony_ci	int freq_offset_khz_uhf;
298c2ecf20Sopenharmony_ci	int freq_offset_khz_vhf;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	u8 osc_buffer_state;	/* 0= normal, 1= tri-state */
328c2ecf20Sopenharmony_ci	u32 clock_khz;
338c2ecf20Sopenharmony_ci	u8 clock_pad_drive;	/* (Drive + 1) * 2mA */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	u8 invert_iq;		/* invert Q - in case I or Q is inverted on the board */
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	u8 force_crystal_mode;	/* if == 0 -> decision is made in the driver default: <24 -> 2, >=24 -> 1 */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	u8 flip_chip;
408c2ecf20Sopenharmony_ci	u8 enable_third_order_filter;
418c2ecf20Sopenharmony_ci	u8 charge_pump;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	const struct dib0070_wbd_gain_cfg *wbd_gain;
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci	u8 vga_filter;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0070)
498c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg);
508c2ecf20Sopenharmony_ciextern u16 dib0070_wbd_offset(struct dvb_frontend *);
518c2ecf20Sopenharmony_ciextern void dib0070_ctrl_agc_filter(struct dvb_frontend *, u8 open);
528c2ecf20Sopenharmony_ciextern u8 dib0070_get_rf_output(struct dvb_frontend *fe);
538c2ecf20Sopenharmony_ciextern int dib0070_set_rf_output(struct dvb_frontend *fe, u8 no);
548c2ecf20Sopenharmony_ci#else
558c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
588c2ecf20Sopenharmony_ci	return NULL;
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistatic inline u16 dib0070_wbd_offset(struct dvb_frontend *fe)
628c2ecf20Sopenharmony_ci{
638c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
648c2ecf20Sopenharmony_ci	return 0;
658c2ecf20Sopenharmony_ci}
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistatic inline void dib0070_ctrl_agc_filter(struct dvb_frontend *fe, u8 open)
688c2ecf20Sopenharmony_ci{
698c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
708c2ecf20Sopenharmony_ci}
718c2ecf20Sopenharmony_ci#endif
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#endif
74