18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef DIB7000M_H
38c2ecf20Sopenharmony_ci#define DIB7000M_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include "dibx000_common.h"
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct dib7000m_config {
88c2ecf20Sopenharmony_ci	u8 dvbt_mode;
98c2ecf20Sopenharmony_ci	u8 output_mpeg2_in_188_bytes;
108c2ecf20Sopenharmony_ci	u8 hostbus_diversity;
118c2ecf20Sopenharmony_ci	u8 tuner_is_baseband;
128c2ecf20Sopenharmony_ci	u8 mobile_mode;
138c2ecf20Sopenharmony_ci	int (*update_lna) (struct dvb_frontend *, u16 agc_global);
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci	u8 agc_config_count;
168c2ecf20Sopenharmony_ci	struct dibx000_agc_config *agc;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	struct dibx000_bandwidth_config *bw;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_DEFAULT_DIRECTIONS 0xffff
218c2ecf20Sopenharmony_ci	u16 gpio_dir;
228c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_DEFAULT_VALUES     0x0000
238c2ecf20Sopenharmony_ci	u16 gpio_val;
248c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_PWM_POS0(v)        ((v & 0xf) << 12)
258c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_PWM_POS1(v)        ((v & 0xf) << 8 )
268c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_PWM_POS2(v)        ((v & 0xf) << 4 )
278c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_PWM_POS3(v)         (v & 0xf)
288c2ecf20Sopenharmony_ci#define DIB7000M_GPIO_DEFAULT_PWM_POS    0xffff
298c2ecf20Sopenharmony_ci	u16 gpio_pwm_pos;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	u16 pwm_freq_div;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	u8 quartz_direct;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	u8 input_clk_is_div_2;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	int (*agc_control) (struct dvb_frontend *, u8 before);
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define DEFAULT_DIB7000M_I2C_ADDRESS 18
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_DIB7000M)
438c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap,
448c2ecf20Sopenharmony_ci					    u8 i2c_addr,
458c2ecf20Sopenharmony_ci					    struct dib7000m_config *cfg);
468c2ecf20Sopenharmony_ciextern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *,
478c2ecf20Sopenharmony_ci						   enum dibx000_i2c_interface,
488c2ecf20Sopenharmony_ci						   int);
498c2ecf20Sopenharmony_ciextern int dib7000m_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff);
508c2ecf20Sopenharmony_ciextern int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff);
518c2ecf20Sopenharmony_ci#else
528c2ecf20Sopenharmony_cistatic inline
538c2ecf20Sopenharmony_cistruct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap,
548c2ecf20Sopenharmony_ci				     u8 i2c_addr, struct dib7000m_config *cfg)
558c2ecf20Sopenharmony_ci{
568c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
578c2ecf20Sopenharmony_ci	return NULL;
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistatic inline
618c2ecf20Sopenharmony_cistruct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *demod,
628c2ecf20Sopenharmony_ci					    enum dibx000_i2c_interface intf,
638c2ecf20Sopenharmony_ci					    int gating)
648c2ecf20Sopenharmony_ci{
658c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
668c2ecf20Sopenharmony_ci	return NULL;
678c2ecf20Sopenharmony_ci}
688c2ecf20Sopenharmony_cistatic inline int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id,
698c2ecf20Sopenharmony_ci						u16 pid, u8 onoff)
708c2ecf20Sopenharmony_ci{
718c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
728c2ecf20Sopenharmony_ci	return -ENODEV;
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic inline int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe,
768c2ecf20Sopenharmony_ci						uint8_t onoff)
778c2ecf20Sopenharmony_ci{
788c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
798c2ecf20Sopenharmony_ci	return -ENODEV;
808c2ecf20Sopenharmony_ci}
818c2ecf20Sopenharmony_ci#endif
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* TODO
848c2ecf20Sopenharmony_ciextern INT dib7000m_set_gpio(struct dibDemod *demod, UCHAR num, UCHAR dir, UCHAR val);
858c2ecf20Sopenharmony_ciextern INT dib7000m_enable_vbg_voltage(struct dibDemod *demod);
868c2ecf20Sopenharmony_ciextern void dib7000m_set_hostbus_diversity(struct dibDemod *demod, UCHAR onoff);
878c2ecf20Sopenharmony_ciextern USHORT dib7000m_get_current_agc_global(struct dibDemod *demod);
888c2ecf20Sopenharmony_ci*/
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#endif
91