18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef DIB7000P_H 38c2ecf20Sopenharmony_ci#define DIB7000P_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include "dibx000_common.h" 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cistruct dib7000p_config { 88c2ecf20Sopenharmony_ci u8 output_mpeg2_in_188_bytes; 98c2ecf20Sopenharmony_ci u8 hostbus_diversity; 108c2ecf20Sopenharmony_ci u8 tuner_is_baseband; 118c2ecf20Sopenharmony_ci int (*update_lna) (struct dvb_frontend *, u16 agc_global); 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci u8 agc_config_count; 148c2ecf20Sopenharmony_ci struct dibx000_agc_config *agc; 158c2ecf20Sopenharmony_ci struct dibx000_bandwidth_config *bw; 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_DEFAULT_DIRECTIONS 0xffff 188c2ecf20Sopenharmony_ci u16 gpio_dir; 198c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_DEFAULT_VALUES 0x0000 208c2ecf20Sopenharmony_ci u16 gpio_val; 218c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_PWM_POS0(v) ((v & 0xf) << 12) 228c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_PWM_POS1(v) ((v & 0xf) << 8 ) 238c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_PWM_POS2(v) ((v & 0xf) << 4 ) 248c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_PWM_POS3(v) (v & 0xf) 258c2ecf20Sopenharmony_ci#define DIB7000P_GPIO_DEFAULT_PWM_POS 0xffff 268c2ecf20Sopenharmony_ci u16 gpio_pwm_pos; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci u16 pwm_freq_div; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci u8 quartz_direct; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci u8 spur_protect; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci int (*agc_control) (struct dvb_frontend *, u8 before); 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci u8 output_mode; 378c2ecf20Sopenharmony_ci u8 disable_sample_and_hold:1; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci u8 enable_current_mirror:1; 408c2ecf20Sopenharmony_ci u16 diversity_delay; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci u8 default_i2c_addr; 438c2ecf20Sopenharmony_ci u8 enMpegOutput:1; 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define DEFAULT_DIB7000P_I2C_ADDRESS 18 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistruct dib7000p_ops { 498c2ecf20Sopenharmony_ci int (*set_wbd_ref)(struct dvb_frontend *demod, u16 value); 508c2ecf20Sopenharmony_ci int (*get_agc_values)(struct dvb_frontend *fe, 518c2ecf20Sopenharmony_ci u16 *agc_global, u16 *agc1, u16 *agc2, u16 *wbd); 528c2ecf20Sopenharmony_ci int (*set_agc1_min)(struct dvb_frontend *fe, u16 v); 538c2ecf20Sopenharmony_ci int (*update_pll)(struct dvb_frontend *fe, struct dibx000_bandwidth_config *bw); 548c2ecf20Sopenharmony_ci int (*set_gpio)(struct dvb_frontend *demod, u8 num, u8 dir, u8 val); 558c2ecf20Sopenharmony_ci u32 (*ctrl_timf)(struct dvb_frontend *fe, u8 op, u32 timf); 568c2ecf20Sopenharmony_ci int (*dib7000pc_detection)(struct i2c_adapter *i2c_adap); 578c2ecf20Sopenharmony_ci struct i2c_adapter *(*get_i2c_master)(struct dvb_frontend *demod, enum dibx000_i2c_interface intf, int gating); 588c2ecf20Sopenharmony_ci int (*pid_filter_ctrl)(struct dvb_frontend *fe, u8 onoff); 598c2ecf20Sopenharmony_ci int (*pid_filter)(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff); 608c2ecf20Sopenharmony_ci int (*i2c_enumeration)(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]); 618c2ecf20Sopenharmony_ci struct i2c_adapter *(*get_i2c_tuner)(struct dvb_frontend *fe); 628c2ecf20Sopenharmony_ci int (*tuner_sleep)(struct dvb_frontend *fe, int onoff); 638c2ecf20Sopenharmony_ci int (*get_adc_power)(struct dvb_frontend *fe); 648c2ecf20Sopenharmony_ci int (*slave_reset)(struct dvb_frontend *fe); 658c2ecf20Sopenharmony_ci struct dvb_frontend *(*init)(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg); 668c2ecf20Sopenharmony_ci}; 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_DIB7000P) 698c2ecf20Sopenharmony_civoid *dib7000p_attach(struct dib7000p_ops *ops); 708c2ecf20Sopenharmony_ci#else 718c2ecf20Sopenharmony_cistatic inline void *dib7000p_attach(struct dib7000p_ops *ops) 728c2ecf20Sopenharmony_ci{ 738c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 748c2ecf20Sopenharmony_ci return NULL; 758c2ecf20Sopenharmony_ci} 768c2ecf20Sopenharmony_ci#endif 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#endif 79