18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci STV0900/0903 Multistandard Broadcast Frontend driver 48c2ecf20Sopenharmony_ci Copyright (C) Manu Abraham <abraham.manu@gmail.com> 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci Copyright (C) ST Microelectronics 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci*/ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef __STV090x_H 118c2ecf20Sopenharmony_ci#define __STV090x_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cienum stv090x_demodulator { 148c2ecf20Sopenharmony_ci STV090x_DEMODULATOR_0 = 1, 158c2ecf20Sopenharmony_ci STV090x_DEMODULATOR_1 168c2ecf20Sopenharmony_ci}; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cienum stv090x_device { 198c2ecf20Sopenharmony_ci STV0903 = 0, 208c2ecf20Sopenharmony_ci STV0900, 218c2ecf20Sopenharmony_ci}; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_cienum stv090x_mode { 248c2ecf20Sopenharmony_ci STV090x_DUAL = 0, 258c2ecf20Sopenharmony_ci STV090x_SINGLE 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cienum stv090x_tsmode { 298c2ecf20Sopenharmony_ci STV090x_TSMODE_SERIAL_PUNCTURED = 1, 308c2ecf20Sopenharmony_ci STV090x_TSMODE_SERIAL_CONTINUOUS, 318c2ecf20Sopenharmony_ci STV090x_TSMODE_PARALLEL_PUNCTURED, 328c2ecf20Sopenharmony_ci STV090x_TSMODE_DVBCI 338c2ecf20Sopenharmony_ci}; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cienum stv090x_clkmode { 368c2ecf20Sopenharmony_ci STV090x_CLK_INT = 0, /* Clk i/p = CLKI */ 378c2ecf20Sopenharmony_ci STV090x_CLK_EXT = 2 /* Clk i/p = XTALI */ 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cienum stv090x_i2crpt { 418c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_256 = 0, 428c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_128 = 1, 438c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_64 = 2, 448c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_32 = 3, 458c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_16 = 4, 468c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_8 = 5, 478c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_4 = 6, 488c2ecf20Sopenharmony_ci STV090x_RPTLEVEL_2 = 7, 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cienum stv090x_adc_range { 528c2ecf20Sopenharmony_ci STV090x_ADC_2Vpp = 0, 538c2ecf20Sopenharmony_ci STV090x_ADC_1Vpp = 1 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cistruct stv090x_config { 578c2ecf20Sopenharmony_ci enum stv090x_device device; 588c2ecf20Sopenharmony_ci enum stv090x_mode demod_mode; 598c2ecf20Sopenharmony_ci enum stv090x_clkmode clk_mode; 608c2ecf20Sopenharmony_ci enum stv090x_demodulator demod; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci u32 xtal; /* default: 8000000 */ 638c2ecf20Sopenharmony_ci u8 address; /* default: 0x68 */ 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci u8 ts1_mode; 668c2ecf20Sopenharmony_ci u8 ts2_mode; 678c2ecf20Sopenharmony_ci u32 ts1_clk; 688c2ecf20Sopenharmony_ci u32 ts2_clk; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci u8 ts1_tei : 1; 718c2ecf20Sopenharmony_ci u8 ts2_tei : 1; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci enum stv090x_i2crpt repeater_level; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci u8 tuner_bbgain; /* default: 10db */ 768c2ecf20Sopenharmony_ci enum stv090x_adc_range adc1_range; /* default: 2Vpp */ 778c2ecf20Sopenharmony_ci enum stv090x_adc_range adc2_range; /* default: 2Vpp */ 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci bool diseqc_envelope_mode; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci int (*tuner_init)(struct dvb_frontend *fe); 828c2ecf20Sopenharmony_ci int (*tuner_sleep)(struct dvb_frontend *fe); 838c2ecf20Sopenharmony_ci int (*tuner_set_mode)(struct dvb_frontend *fe, enum tuner_mode mode); 848c2ecf20Sopenharmony_ci int (*tuner_set_frequency)(struct dvb_frontend *fe, u32 frequency); 858c2ecf20Sopenharmony_ci int (*tuner_get_frequency)(struct dvb_frontend *fe, u32 *frequency); 868c2ecf20Sopenharmony_ci int (*tuner_set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth); 878c2ecf20Sopenharmony_ci int (*tuner_get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); 888c2ecf20Sopenharmony_ci int (*tuner_set_bbgain)(struct dvb_frontend *fe, u32 gain); 898c2ecf20Sopenharmony_ci int (*tuner_get_bbgain)(struct dvb_frontend *fe, u32 *gain); 908c2ecf20Sopenharmony_ci int (*tuner_set_refclk)(struct dvb_frontend *fe, u32 refclk); 918c2ecf20Sopenharmony_ci int (*tuner_get_status)(struct dvb_frontend *fe, u32 *status); 928c2ecf20Sopenharmony_ci void (*tuner_i2c_lock)(struct dvb_frontend *fe, int lock); 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci /* dir = 0 -> output, dir = 1 -> input/open-drain */ 958c2ecf20Sopenharmony_ci int (*set_gpio)(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value, 968c2ecf20Sopenharmony_ci u8 xor_value); 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *i2c); 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_STV090x) 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cistruct dvb_frontend *stv090x_attach(struct stv090x_config *config, 1048c2ecf20Sopenharmony_ci struct i2c_adapter *i2c, 1058c2ecf20Sopenharmony_ci enum stv090x_demodulator demod); 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#else 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, 1108c2ecf20Sopenharmony_ci struct i2c_adapter *i2c, 1118c2ecf20Sopenharmony_ci enum stv090x_demodulator demod) 1128c2ecf20Sopenharmony_ci{ 1138c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 1148c2ecf20Sopenharmony_ci return NULL; 1158c2ecf20Sopenharmony_ci} 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci#endif /* CONFIG_DVB_STV090x */ 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#endif /* __STV090x_H */ 120