1*a10e763bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
29a0bf528SMauro Carvalho Chehab /*
39a0bf528SMauro Carvalho Chehab * Driver for DiBcom DiB3000MC/P-demodulator.
49a0bf528SMauro Carvalho Chehab *
59a0bf528SMauro Carvalho Chehab * Copyright (C) 2004-6 DiBcom (http://www.dibcom.fr/)
699e44da7SPatrick Boettcher * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
79a0bf528SMauro Carvalho Chehab *
89a0bf528SMauro Carvalho Chehab * This code is partially based on the previous dib3000mc.c .
99a0bf528SMauro Carvalho Chehab */
109a0bf528SMauro Carvalho Chehab #ifndef DIB3000MC_H
119a0bf528SMauro Carvalho Chehab #define DIB3000MC_H
129a0bf528SMauro Carvalho Chehab
139a0bf528SMauro Carvalho Chehab #include "dibx000_common.h"
149a0bf528SMauro Carvalho Chehab
159a0bf528SMauro Carvalho Chehab struct dib3000mc_config {
169a0bf528SMauro Carvalho Chehab struct dibx000_agc_config *agc;
179a0bf528SMauro Carvalho Chehab
189a0bf528SMauro Carvalho Chehab u8 phase_noise_mode;
199a0bf528SMauro Carvalho Chehab u8 impulse_noise_mode;
209a0bf528SMauro Carvalho Chehab
219a0bf528SMauro Carvalho Chehab u8 pwm3_inversion;
229a0bf528SMauro Carvalho Chehab u8 use_pwm3;
239a0bf528SMauro Carvalho Chehab u16 pwm3_value;
249a0bf528SMauro Carvalho Chehab
259a0bf528SMauro Carvalho Chehab u16 max_time;
269a0bf528SMauro Carvalho Chehab u16 ln_adc_level;
279a0bf528SMauro Carvalho Chehab
289a0bf528SMauro Carvalho Chehab u8 agc_command1 :1;
299a0bf528SMauro Carvalho Chehab u8 agc_command2 :1;
309a0bf528SMauro Carvalho Chehab
319a0bf528SMauro Carvalho Chehab u8 mobile_mode;
329a0bf528SMauro Carvalho Chehab
339a0bf528SMauro Carvalho Chehab u8 output_mpeg2_in_188_bytes;
349a0bf528SMauro Carvalho Chehab };
359a0bf528SMauro Carvalho Chehab
369a0bf528SMauro Carvalho Chehab #define DEFAULT_DIB3000MC_I2C_ADDRESS 16
379a0bf528SMauro Carvalho Chehab #define DEFAULT_DIB3000P_I2C_ADDRESS 24
389a0bf528SMauro Carvalho Chehab
399b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_DIB3000MC)
409a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *dib3000mc_attach(struct i2c_adapter *i2c_adap,
419a0bf528SMauro Carvalho Chehab u8 i2c_addr,
429a0bf528SMauro Carvalho Chehab struct dib3000mc_config *cfg);
439a0bf528SMauro Carvalho Chehab extern int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c,
449a0bf528SMauro Carvalho Chehab int no_of_demods, u8 default_addr,
459a0bf528SMauro Carvalho Chehab struct dib3000mc_config cfg[]);
469a0bf528SMauro Carvalho Chehab extern
479a0bf528SMauro Carvalho Chehab struct i2c_adapter *dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod,
489a0bf528SMauro Carvalho Chehab int gating);
499a0bf528SMauro Carvalho Chehab #else
509a0bf528SMauro Carvalho Chehab static inline
dib3000mc_attach(struct i2c_adapter * i2c_adap,u8 i2c_addr,struct dib3000mc_config * cfg)519a0bf528SMauro Carvalho Chehab struct dvb_frontend *dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr,
529a0bf528SMauro Carvalho Chehab struct dib3000mc_config *cfg)
539a0bf528SMauro Carvalho Chehab {
549a0bf528SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
559a0bf528SMauro Carvalho Chehab return NULL;
569a0bf528SMauro Carvalho Chehab }
579a0bf528SMauro Carvalho Chehab
589a0bf528SMauro Carvalho Chehab static inline
dib3000mc_i2c_enumeration(struct i2c_adapter * i2c,int no_of_demods,u8 default_addr,struct dib3000mc_config cfg[])599a0bf528SMauro Carvalho Chehab int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c,
609a0bf528SMauro Carvalho Chehab int no_of_demods, u8 default_addr,
619a0bf528SMauro Carvalho Chehab struct dib3000mc_config cfg[])
629a0bf528SMauro Carvalho Chehab {
639a0bf528SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
649a0bf528SMauro Carvalho Chehab return -ENODEV;
659a0bf528SMauro Carvalho Chehab }
669a0bf528SMauro Carvalho Chehab
679a0bf528SMauro Carvalho Chehab static inline
dib3000mc_get_tuner_i2c_master(struct dvb_frontend * demod,int gating)689a0bf528SMauro Carvalho Chehab struct i2c_adapter *dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod,
699a0bf528SMauro Carvalho Chehab int gating)
709a0bf528SMauro Carvalho Chehab {
719a0bf528SMauro Carvalho Chehab printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
729a0bf528SMauro Carvalho Chehab return NULL;
739a0bf528SMauro Carvalho Chehab }
749a0bf528SMauro Carvalho Chehab #endif // CONFIG_DVB_DIB3000MC
759a0bf528SMauro Carvalho Chehab
769a0bf528SMauro Carvalho Chehab extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff);
779a0bf528SMauro Carvalho Chehab extern int dib3000mc_pid_parse(struct dvb_frontend *fe, int onoff);
789a0bf528SMauro Carvalho Chehab
799a0bf528SMauro Carvalho Chehab extern void dib3000mc_set_config(struct dvb_frontend *, struct dib3000mc_config *);
809a0bf528SMauro Carvalho Chehab
819a0bf528SMauro Carvalho Chehab #endif
82