18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Linux-DVB Driver for DiBcom's DiB0090 base-band RF Tuner. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2005-7 DiBcom (http://www.dibcom.fr/) 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci#ifndef DIB0090_H 88c2ecf20Sopenharmony_ci#define DIB0090_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cistruct dvb_frontend; 118c2ecf20Sopenharmony_cistruct i2c_adapter; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define DEFAULT_DIB0090_I2C_ADDRESS 0x60 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct dib0090_io_config { 168c2ecf20Sopenharmony_ci u32 clock_khz; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci u8 pll_bypass:1; 198c2ecf20Sopenharmony_ci u8 pll_range:1; 208c2ecf20Sopenharmony_ci u8 pll_prediv:6; 218c2ecf20Sopenharmony_ci u8 pll_loopdiv:6; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci u8 adc_clock_ratio; /* valid is 8, 7 ,6 */ 248c2ecf20Sopenharmony_ci u16 pll_int_loop_filt; 258c2ecf20Sopenharmony_ci}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistruct dib0090_wbd_slope { 288c2ecf20Sopenharmony_ci u16 max_freq; /* for every frequency less than or equal to that field: this information is correct */ 298c2ecf20Sopenharmony_ci u16 slope_cold; 308c2ecf20Sopenharmony_ci u16 offset_cold; 318c2ecf20Sopenharmony_ci u16 slope_hot; 328c2ecf20Sopenharmony_ci u16 offset_hot; 338c2ecf20Sopenharmony_ci u8 wbd_gain; 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct dib0090_low_if_offset_table { 378c2ecf20Sopenharmony_ci int std; 388c2ecf20Sopenharmony_ci u32 RF_freq; 398c2ecf20Sopenharmony_ci s32 offset_khz; 408c2ecf20Sopenharmony_ci}; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cistruct dib0090_config { 438c2ecf20Sopenharmony_ci struct dib0090_io_config io; 448c2ecf20Sopenharmony_ci int (*reset) (struct dvb_frontend *, int); 458c2ecf20Sopenharmony_ci int (*sleep) (struct dvb_frontend *, int); 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci /* offset in kHz */ 488c2ecf20Sopenharmony_ci int freq_offset_khz_uhf; 498c2ecf20Sopenharmony_ci int freq_offset_khz_vhf; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci int (*get_adc_power) (struct dvb_frontend *); 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci u8 clkouttobamse:1; /* activate or deactivate clock output */ 548c2ecf20Sopenharmony_ci u8 analog_output; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci u8 i2c_address; 578c2ecf20Sopenharmony_ci /* add drives and other things if necessary */ 588c2ecf20Sopenharmony_ci u16 wbd_vhf_offset; 598c2ecf20Sopenharmony_ci u16 wbd_cband_offset; 608c2ecf20Sopenharmony_ci u8 use_pwm_agc; 618c2ecf20Sopenharmony_ci u8 clkoutdrive; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci u8 ls_cfg_pad_drv; 648c2ecf20Sopenharmony_ci u8 data_tx_drv; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci u8 in_soc; 678c2ecf20Sopenharmony_ci const struct dib0090_low_if_offset_table *low_if; 688c2ecf20Sopenharmony_ci u8 fref_clock_ratio; 698c2ecf20Sopenharmony_ci u16 force_cband_input; 708c2ecf20Sopenharmony_ci struct dib0090_wbd_slope *wbd; 718c2ecf20Sopenharmony_ci u8 is_dib7090e; 728c2ecf20Sopenharmony_ci u8 force_crystal_mode; 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090) 768c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config); 778c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config); 788c2ecf20Sopenharmony_ciextern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast); 798c2ecf20Sopenharmony_ciextern void dib0090_pwm_gain_reset(struct dvb_frontend *fe); 808c2ecf20Sopenharmony_ciextern u16 dib0090_get_wbd_target(struct dvb_frontend *tuner); 818c2ecf20Sopenharmony_ciextern u16 dib0090_get_wbd_offset(struct dvb_frontend *fe); 828c2ecf20Sopenharmony_ciextern int dib0090_gain_control(struct dvb_frontend *fe); 838c2ecf20Sopenharmony_ciextern enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe); 848c2ecf20Sopenharmony_ciextern int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state); 858c2ecf20Sopenharmony_ciextern void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt); 868c2ecf20Sopenharmony_ciextern void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff); 878c2ecf20Sopenharmony_ciextern int dib0090_set_switch(struct dvb_frontend *fe, u8 sw1, u8 sw2, u8 sw3); 888c2ecf20Sopenharmony_ciextern int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff); 898c2ecf20Sopenharmony_ciextern int dib0090_update_rframp_7090(struct dvb_frontend *fe, 908c2ecf20Sopenharmony_ci u8 cfg_sensitivity); 918c2ecf20Sopenharmony_ciextern int dib0090_update_tuning_table_7090(struct dvb_frontend *fe, 928c2ecf20Sopenharmony_ci u8 cfg_sensitivity); 938c2ecf20Sopenharmony_ci#else 948c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config) 958c2ecf20Sopenharmony_ci{ 968c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 978c2ecf20Sopenharmony_ci return NULL; 988c2ecf20Sopenharmony_ci} 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0090_config *config) 1018c2ecf20Sopenharmony_ci{ 1028c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1038c2ecf20Sopenharmony_ci return NULL; 1048c2ecf20Sopenharmony_ci} 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_cistatic inline void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast) 1078c2ecf20Sopenharmony_ci{ 1088c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1098c2ecf20Sopenharmony_ci} 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_cistatic inline void dib0090_pwm_gain_reset(struct dvb_frontend *fe) 1128c2ecf20Sopenharmony_ci{ 1138c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1148c2ecf20Sopenharmony_ci} 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_cistatic inline u16 dib0090_get_wbd_target(struct dvb_frontend *tuner) 1178c2ecf20Sopenharmony_ci{ 1188c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1198c2ecf20Sopenharmony_ci return 0; 1208c2ecf20Sopenharmony_ci} 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_cistatic inline u16 dib0090_get_wbd_offset(struct dvb_frontend *fe) 1238c2ecf20Sopenharmony_ci{ 1248c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1258c2ecf20Sopenharmony_ci return 0; 1268c2ecf20Sopenharmony_ci} 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_cistatic inline int dib0090_gain_control(struct dvb_frontend *fe) 1298c2ecf20Sopenharmony_ci{ 1308c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1318c2ecf20Sopenharmony_ci return -ENODEV; 1328c2ecf20Sopenharmony_ci} 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistatic inline enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe) 1358c2ecf20Sopenharmony_ci{ 1368c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1378c2ecf20Sopenharmony_ci return CT_DONE; 1388c2ecf20Sopenharmony_ci} 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistatic inline int dib0090_set_tune_state(struct dvb_frontend *fe, enum frontend_tune_state tune_state) 1418c2ecf20Sopenharmony_ci{ 1428c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1438c2ecf20Sopenharmony_ci return -ENODEV; 1448c2ecf20Sopenharmony_ci} 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cistatic inline void dib0090_get_current_gain(struct dvb_frontend *fe, u16 * rf, u16 * bb, u16 * rf_gain_limit, u16 * rflt) 1478c2ecf20Sopenharmony_ci{ 1488c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1498c2ecf20Sopenharmony_ci} 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_cistatic inline void dib0090_set_dc_servo(struct dvb_frontend *fe, u8 DC_servo_cutoff) 1528c2ecf20Sopenharmony_ci{ 1538c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1548c2ecf20Sopenharmony_ci} 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_cistatic inline int dib0090_set_switch(struct dvb_frontend *fe, 1578c2ecf20Sopenharmony_ci u8 sw1, u8 sw2, u8 sw3) 1588c2ecf20Sopenharmony_ci{ 1598c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1608c2ecf20Sopenharmony_ci return -ENODEV; 1618c2ecf20Sopenharmony_ci} 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_cistatic inline int dib0090_set_vga(struct dvb_frontend *fe, u8 onoff) 1648c2ecf20Sopenharmony_ci{ 1658c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1668c2ecf20Sopenharmony_ci return -ENODEV; 1678c2ecf20Sopenharmony_ci} 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_cistatic inline int dib0090_update_rframp_7090(struct dvb_frontend *fe, 1708c2ecf20Sopenharmony_ci u8 cfg_sensitivity) 1718c2ecf20Sopenharmony_ci{ 1728c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1738c2ecf20Sopenharmony_ci return -ENODEV; 1748c2ecf20Sopenharmony_ci} 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_cistatic inline int dib0090_update_tuning_table_7090(struct dvb_frontend *fe, 1778c2ecf20Sopenharmony_ci u8 cfg_sensitivity) 1788c2ecf20Sopenharmony_ci{ 1798c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1808c2ecf20Sopenharmony_ci return -ENODEV; 1818c2ecf20Sopenharmony_ci} 1828c2ecf20Sopenharmony_ci#endif 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci#endif 185