18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _DRXK_H_ 38c2ecf20Sopenharmony_ci#define _DRXK_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/types.h> 68c2ecf20Sopenharmony_ci#include <linux/i2c.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/** 98c2ecf20Sopenharmony_ci * struct drxk_config - Configure the initial parameters for DRX-K 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * @adr: I2C address of the DRX-K 128c2ecf20Sopenharmony_ci * @parallel_ts: True means that the device uses parallel TS, 138c2ecf20Sopenharmony_ci * Serial otherwise. 148c2ecf20Sopenharmony_ci * @dynamic_clk: True means that the clock will be dynamically 158c2ecf20Sopenharmony_ci * adjusted. Static clock otherwise. 168c2ecf20Sopenharmony_ci * @enable_merr_cfg: Enable SIO_PDR_PERR_CFG/SIO_PDR_MVAL_CFG. 178c2ecf20Sopenharmony_ci * @single_master: Device is on the single master mode 188c2ecf20Sopenharmony_ci * @no_i2c_bridge: Don't switch the I2C bridge to talk with tuner 198c2ecf20Sopenharmony_ci * @antenna_gpio: GPIO bit used to control the antenna 208c2ecf20Sopenharmony_ci * @antenna_dvbt: GPIO bit for changing antenna to DVB-C. A value of 1 218c2ecf20Sopenharmony_ci * means that 1=DVBC, 0 = DVBT. Zero means the opposite. 228c2ecf20Sopenharmony_ci * @mpeg_out_clk_strength: DRXK Mpeg output clock drive strength. 238c2ecf20Sopenharmony_ci * @chunk_size: maximum size for I2C messages 248c2ecf20Sopenharmony_ci * @microcode_name: Name of the firmware file with the microcode 258c2ecf20Sopenharmony_ci * @qam_demod_parameter_count: The number of parameters used for the command 268c2ecf20Sopenharmony_ci * to set the demodulator parameters. All 278c2ecf20Sopenharmony_ci * firmwares are using the 2-parameter command. 288c2ecf20Sopenharmony_ci * An exception is the ``drxk_a3.mc`` firmware, 298c2ecf20Sopenharmony_ci * which uses the 4-parameter command. 308c2ecf20Sopenharmony_ci * A value of 0 (default) or lower indicates that 318c2ecf20Sopenharmony_ci * the correct number of parameters will be 328c2ecf20Sopenharmony_ci * automatically detected. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * On the ``*_gpio`` vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is 358c2ecf20Sopenharmony_ci * UIO-3. 368c2ecf20Sopenharmony_ci */ 378c2ecf20Sopenharmony_cistruct drxk_config { 388c2ecf20Sopenharmony_ci u8 adr; 398c2ecf20Sopenharmony_ci bool single_master; 408c2ecf20Sopenharmony_ci bool no_i2c_bridge; 418c2ecf20Sopenharmony_ci bool parallel_ts; 428c2ecf20Sopenharmony_ci bool dynamic_clk; 438c2ecf20Sopenharmony_ci bool enable_merr_cfg; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci bool antenna_dvbt; 468c2ecf20Sopenharmony_ci u16 antenna_gpio; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci u8 mpeg_out_clk_strength; 498c2ecf20Sopenharmony_ci int chunk_size; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci const char *microcode_name; 528c2ecf20Sopenharmony_ci int qam_demod_parameter_count; 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#if IS_REACHABLE(CONFIG_DVB_DRXK) 568c2ecf20Sopenharmony_ci/** 578c2ecf20Sopenharmony_ci * Attach a drxk demod 588c2ecf20Sopenharmony_ci * 598c2ecf20Sopenharmony_ci * @config: pointer to &struct drxk_config with demod configuration. 608c2ecf20Sopenharmony_ci * @i2c: i2c adapter to use. 618c2ecf20Sopenharmony_ci * 628c2ecf20Sopenharmony_ci * return: FE pointer on success, NULL on failure. 638c2ecf20Sopenharmony_ci */ 648c2ecf20Sopenharmony_ciextern struct dvb_frontend *drxk_attach(const struct drxk_config *config, 658c2ecf20Sopenharmony_ci struct i2c_adapter *i2c); 668c2ecf20Sopenharmony_ci#else 678c2ecf20Sopenharmony_cistatic inline struct dvb_frontend *drxk_attach(const struct drxk_config *config, 688c2ecf20Sopenharmony_ci struct i2c_adapter *i2c) 698c2ecf20Sopenharmony_ci{ 708c2ecf20Sopenharmony_ci printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 718c2ecf20Sopenharmony_ci return NULL; 728c2ecf20Sopenharmony_ci} 738c2ecf20Sopenharmony_ci#endif 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#endif 76