18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef DIB9000_H
38c2ecf20Sopenharmony_ci#define DIB9000_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include "dibx000_common.h"
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct dib9000_config {
88c2ecf20Sopenharmony_ci	u8 dvbt_mode;
98c2ecf20Sopenharmony_ci	u8 output_mpeg2_in_188_bytes;
108c2ecf20Sopenharmony_ci	u8 hostbus_diversity;
118c2ecf20Sopenharmony_ci	struct dibx000_bandwidth_config *bw;
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci	u16 if_drives;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci	u32 timing_frequency;
168c2ecf20Sopenharmony_ci	u32 xtal_clock_khz;
178c2ecf20Sopenharmony_ci	u32 vcxo_timer;
188c2ecf20Sopenharmony_ci	u32 demod_clock_khz;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	const u8 *microcode_B_fe_buffer;
218c2ecf20Sopenharmony_ci	u32 microcode_B_fe_size;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	struct dibGPIOFunction gpio_function[2];
248c2ecf20Sopenharmony_ci	struct dibSubbandSelection subband;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	u8 output_mode;
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define DEFAULT_DIB9000_I2C_ADDRESS 18
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_DIB9000)
328c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, const struct dib9000_config *cfg);
338c2ecf20Sopenharmony_ciextern int dib9000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr);
348c2ecf20Sopenharmony_ciextern struct i2c_adapter *dib9000_get_tuner_interface(struct dvb_frontend *fe);
358c2ecf20Sopenharmony_ciextern struct i2c_adapter *dib9000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface intf, int gating);
368c2ecf20Sopenharmony_ciextern int dib9000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val);
378c2ecf20Sopenharmony_ciextern int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff);
388c2ecf20Sopenharmony_ciextern int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff);
398c2ecf20Sopenharmony_ciextern int dib9000_firmware_post_pll_init(struct dvb_frontend *fe);
408c2ecf20Sopenharmony_ciextern int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave);
418c2ecf20Sopenharmony_ciextern struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index);
428c2ecf20Sopenharmony_ciextern struct i2c_adapter *dib9000_get_component_bus_interface(struct dvb_frontend *fe);
438c2ecf20Sopenharmony_ciextern int dib9000_set_i2c_adapter(struct dvb_frontend *fe, struct i2c_adapter *i2c);
448c2ecf20Sopenharmony_ciextern int dib9000_fw_set_component_bus_speed(struct dvb_frontend *fe, u16 speed);
458c2ecf20Sopenharmony_ci#else
468c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib9000_config *cfg)
478c2ecf20Sopenharmony_ci{
488c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
498c2ecf20Sopenharmony_ci	return NULL;
508c2ecf20Sopenharmony_ci}
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistatic inline struct i2c_adapter *dib9000_get_i2c_master(struct dvb_frontend *fe, enum dibx000_i2c_interface intf, int gating)
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 int dib9000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr)
598c2ecf20Sopenharmony_ci{
608c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
618c2ecf20Sopenharmony_ci	return -ENODEV;
628c2ecf20Sopenharmony_ci}
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistatic inline struct i2c_adapter *dib9000_get_tuner_interface(struct dvb_frontend *fe)
658c2ecf20Sopenharmony_ci{
668c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
678c2ecf20Sopenharmony_ci	return NULL;
688c2ecf20Sopenharmony_ci}
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistatic inline int dib9000_set_gpio(struct dvb_frontend *fe, u8 num, u8 dir, u8 val)
718c2ecf20Sopenharmony_ci{
728c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
738c2ecf20Sopenharmony_ci	return -ENODEV;
748c2ecf20Sopenharmony_ci}
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cistatic inline int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
778c2ecf20Sopenharmony_ci{
788c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
798c2ecf20Sopenharmony_ci	return -ENODEV;
808c2ecf20Sopenharmony_ci}
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistatic inline int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
838c2ecf20Sopenharmony_ci{
848c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
858c2ecf20Sopenharmony_ci	return -ENODEV;
868c2ecf20Sopenharmony_ci}
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_cistatic inline int dib9000_firmware_post_pll_init(struct dvb_frontend *fe)
898c2ecf20Sopenharmony_ci{
908c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
918c2ecf20Sopenharmony_ci	return -ENODEV;
928c2ecf20Sopenharmony_ci}
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistatic inline int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_slave)
958c2ecf20Sopenharmony_ci{
968c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
978c2ecf20Sopenharmony_ci	return -ENODEV;
988c2ecf20Sopenharmony_ci}
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int slave_index)
1018c2ecf20Sopenharmony_ci{
1028c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
1038c2ecf20Sopenharmony_ci	return NULL;
1048c2ecf20Sopenharmony_ci}
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_cistatic inline struct i2c_adapter *dib9000_get_component_bus_interface(struct dvb_frontend *fe)
1078c2ecf20Sopenharmony_ci{
1088c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
1098c2ecf20Sopenharmony_ci	return NULL;
1108c2ecf20Sopenharmony_ci}
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_cistatic inline int dib9000_set_i2c_adapter(struct dvb_frontend *fe, struct i2c_adapter *i2c)
1138c2ecf20Sopenharmony_ci{
1148c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
1158c2ecf20Sopenharmony_ci	return -ENODEV;
1168c2ecf20Sopenharmony_ci}
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_cistatic inline int dib9000_fw_set_component_bus_speed(struct dvb_frontend *fe, u16 speed)
1198c2ecf20Sopenharmony_ci{
1208c2ecf20Sopenharmony_ci	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
1218c2ecf20Sopenharmony_ci	return -ENODEV;
1228c2ecf20Sopenharmony_ci}
1238c2ecf20Sopenharmony_ci#endif
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci#endif
126