1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 277e2c0f5SPatrick Boettcher #ifndef DIB8000_H 377e2c0f5SPatrick Boettcher #define DIB8000_H 477e2c0f5SPatrick Boettcher 577e2c0f5SPatrick Boettcher #include "dibx000_common.h" 677e2c0f5SPatrick Boettcher 777e2c0f5SPatrick Boettcher struct dib8000_config { 877e2c0f5SPatrick Boettcher u8 output_mpeg2_in_188_bytes; 977e2c0f5SPatrick Boettcher u8 hostbus_diversity; 1077e2c0f5SPatrick Boettcher u8 tuner_is_baseband; 1177e2c0f5SPatrick Boettcher int (*update_lna) (struct dvb_frontend *, u16 agc_global); 1277e2c0f5SPatrick Boettcher 1377e2c0f5SPatrick Boettcher u8 agc_config_count; 1477e2c0f5SPatrick Boettcher struct dibx000_agc_config *agc; 1577e2c0f5SPatrick Boettcher struct dibx000_bandwidth_config *pll; 1677e2c0f5SPatrick Boettcher 1777e2c0f5SPatrick Boettcher #define DIB8000_GPIO_DEFAULT_DIRECTIONS 0xffff 1877e2c0f5SPatrick Boettcher u16 gpio_dir; 1977e2c0f5SPatrick Boettcher #define DIB8000_GPIO_DEFAULT_VALUES 0x0000 2077e2c0f5SPatrick Boettcher u16 gpio_val; 2177e2c0f5SPatrick Boettcher #define DIB8000_GPIO_PWM_POS0(v) ((v & 0xf) << 12) 2277e2c0f5SPatrick Boettcher #define DIB8000_GPIO_PWM_POS1(v) ((v & 0xf) << 8 ) 2377e2c0f5SPatrick Boettcher #define DIB8000_GPIO_PWM_POS2(v) ((v & 0xf) << 4 ) 2477e2c0f5SPatrick Boettcher #define DIB8000_GPIO_PWM_POS3(v) (v & 0xf) 2577e2c0f5SPatrick Boettcher #define DIB8000_GPIO_DEFAULT_PWM_POS 0xffff 2677e2c0f5SPatrick Boettcher u16 gpio_pwm_pos; 2777e2c0f5SPatrick Boettcher u16 pwm_freq_div; 2877e2c0f5SPatrick Boettcher 2977e2c0f5SPatrick Boettcher void (*agc_control) (struct dvb_frontend *, u8 before); 3077e2c0f5SPatrick Boettcher 3177e2c0f5SPatrick Boettcher u16 drives; 3277e2c0f5SPatrick Boettcher u16 diversity_delay; 3377e2c0f5SPatrick Boettcher u8 div_cfg; 3477e2c0f5SPatrick Boettcher u8 output_mode; 3577e2c0f5SPatrick Boettcher u8 refclksel; 360c32dbd7SOlivier Grenie u8 enMpegOutput:1; 37173a64cbSPatrick Boettcher 38173a64cbSPatrick Boettcher struct dibx000_bandwidth_config *plltable; 3977e2c0f5SPatrick Boettcher }; 4077e2c0f5SPatrick Boettcher 4177e2c0f5SPatrick Boettcher #define DEFAULT_DIB8000_I2C_ADDRESS 18 4277e2c0f5SPatrick Boettcher 43d44913c1SMauro Carvalho Chehab struct dib8000_ops { 44d44913c1SMauro Carvalho Chehab int (*set_wbd_ref)(struct dvb_frontend *fe, u16 value); 45d44913c1SMauro Carvalho Chehab int (*update_pll)(struct dvb_frontend *fe, 46173a64cbSPatrick Boettcher struct dibx000_bandwidth_config *pll, u32 bw, u8 ratio); 47d44913c1SMauro Carvalho Chehab int (*set_gpio)(struct dvb_frontend *fe, u8 num, u8 dir, u8 val); 48d44913c1SMauro Carvalho Chehab void (*pwm_agc_reset)(struct dvb_frontend *fe); 49d44913c1SMauro Carvalho Chehab struct i2c_adapter *(*get_i2c_tuner)(struct dvb_frontend *fe); 50d44913c1SMauro Carvalho Chehab int (*tuner_sleep)(struct dvb_frontend *fe, int onoff); 51d44913c1SMauro Carvalho Chehab s32 (*get_adc_power)(struct dvb_frontend *fe, u8 mode); 52d44913c1SMauro Carvalho Chehab int (*get_dc_power)(struct dvb_frontend *fe, u8 IQ); 53d44913c1SMauro Carvalho Chehab u32 (*ctrl_timf)(struct dvb_frontend *fe, uint8_t op, uint32_t timf); 54d44913c1SMauro Carvalho Chehab enum frontend_tune_state (*get_tune_state)(struct dvb_frontend *fe); 55d44913c1SMauro Carvalho Chehab int (*set_tune_state)(struct dvb_frontend *fe, enum frontend_tune_state tune_state); 56d44913c1SMauro Carvalho Chehab int (*set_slave_frontend)(struct dvb_frontend *fe, struct dvb_frontend *fe_slave); 57d44913c1SMauro Carvalho Chehab struct dvb_frontend *(*get_slave_frontend)(struct dvb_frontend *fe, int slave_index); 58d44913c1SMauro Carvalho Chehab int (*i2c_enumeration)(struct i2c_adapter *host, int no_of_demods, 59d44913c1SMauro Carvalho Chehab u8 default_addr, u8 first_addr, u8 is_dib8096p); 60d44913c1SMauro Carvalho Chehab struct i2c_adapter *(*get_i2c_master)(struct dvb_frontend *fe, enum dibx000_i2c_interface intf, int gating); 61d44913c1SMauro Carvalho Chehab int (*pid_filter_ctrl)(struct dvb_frontend *fe, u8 onoff); 62d44913c1SMauro Carvalho Chehab int (*pid_filter)(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff); 63d44913c1SMauro Carvalho Chehab struct dvb_frontend *(*init)(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg); 64d44913c1SMauro Carvalho Chehab }; 65d44913c1SMauro Carvalho Chehab 669b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_DIB8000) 67d44913c1SMauro Carvalho Chehab void *dib8000_attach(struct dib8000_ops *ops); 6877e2c0f5SPatrick Boettcher #else 6921de82e3SMauro Carvalho Chehab static inline void *dib8000_attach(struct dib8000_ops *ops) 70b4d6046eSOlivier Grenie { 714c70e074SOlivier Grenie printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 724c70e074SOlivier Grenie return NULL; 734c70e074SOlivier Grenie } 7477e2c0f5SPatrick Boettcher #endif 7577e2c0f5SPatrick Boettcher 7677e2c0f5SPatrick Boettcher #endif 77