18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Driver for DiBcom DiB3000MC/P-demodulator.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2004-6 DiBcom (http://www.dibcom.fr/)
68c2ecf20Sopenharmony_ci * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This code is partially based on the previous dib3000mc.c .
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef DIB3000MC_H
118c2ecf20Sopenharmony_ci#define DIB3000MC_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include "dibx000_common.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct dib3000mc_config {
168c2ecf20Sopenharmony_ci	struct dibx000_agc_config *agc;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	u8 phase_noise_mode;
198c2ecf20Sopenharmony_ci	u8 impulse_noise_mode;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	u8  pwm3_inversion;
228c2ecf20Sopenharmony_ci	u8  use_pwm3;
238c2ecf20Sopenharmony_ci	u16 pwm3_value;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	u16 max_time;
268c2ecf20Sopenharmony_ci	u16 ln_adc_level;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	u8 agc_command1 :1;
298c2ecf20Sopenharmony_ci	u8 agc_command2 :1;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	u8 mobile_mode;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	u8 output_mpeg2_in_188_bytes;
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define DEFAULT_DIB3000MC_I2C_ADDRESS 16
378c2ecf20Sopenharmony_ci#define DEFAULT_DIB3000P_I2C_ADDRESS  24
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_DIB3000MC)
408c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib3000mc_attach(struct i2c_adapter *i2c_adap,
418c2ecf20Sopenharmony_ci					     u8 i2c_addr,
428c2ecf20Sopenharmony_ci					     struct dib3000mc_config *cfg);
438c2ecf20Sopenharmony_ciextern int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c,
448c2ecf20Sopenharmony_ci				     int no_of_demods, u8 default_addr,
458c2ecf20Sopenharmony_ci				     struct dib3000mc_config cfg[]);
468c2ecf20Sopenharmony_ciextern
478c2ecf20Sopenharmony_cistruct i2c_adapter *dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod,
488c2ecf20Sopenharmony_ci						   int gating);
498c2ecf20Sopenharmony_ci#else
508c2ecf20Sopenharmony_cistatic inline
518c2ecf20Sopenharmony_cistruct dvb_frontend *dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr,
528c2ecf20Sopenharmony_ci				      struct dib3000mc_config *cfg)
538c2ecf20Sopenharmony_ci{
548c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
558c2ecf20Sopenharmony_ci	return NULL;
568c2ecf20Sopenharmony_ci}
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistatic inline
598c2ecf20Sopenharmony_ciint dib3000mc_i2c_enumeration(struct i2c_adapter *i2c,
608c2ecf20Sopenharmony_ci			      int no_of_demods, u8 default_addr,
618c2ecf20Sopenharmony_ci			      struct dib3000mc_config cfg[])
628c2ecf20Sopenharmony_ci{
638c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
648c2ecf20Sopenharmony_ci	return -ENODEV;
658c2ecf20Sopenharmony_ci}
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistatic inline
688c2ecf20Sopenharmony_cistruct i2c_adapter *dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod,
698c2ecf20Sopenharmony_ci						   int gating)
708c2ecf20Sopenharmony_ci{
718c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
728c2ecf20Sopenharmony_ci	return NULL;
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci#endif // CONFIG_DVB_DIB3000MC
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciextern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff);
778c2ecf20Sopenharmony_ciextern int dib3000mc_pid_parse(struct dvb_frontend *fe, int onoff);
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciextern void dib3000mc_set_config(struct dvb_frontend *, struct dib3000mc_config *);
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#endif
82