1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
29a0bf528SMauro Carvalho Chehab #ifndef _DRXK_H_
39a0bf528SMauro Carvalho Chehab #define _DRXK_H_
49a0bf528SMauro Carvalho Chehab 
59a0bf528SMauro Carvalho Chehab #include <linux/types.h>
69a0bf528SMauro Carvalho Chehab #include <linux/i2c.h>
79a0bf528SMauro Carvalho Chehab 
89a0bf528SMauro Carvalho Chehab /**
99a0bf528SMauro Carvalho Chehab  * struct drxk_config - Configure the initial parameters for DRX-K
109a0bf528SMauro Carvalho Chehab  *
11cd7a67a4SMauro Carvalho Chehab  * @adr:		I2C address of the DRX-K
129a0bf528SMauro Carvalho Chehab  * @parallel_ts:	True means that the device uses parallel TS,
139a0bf528SMauro Carvalho Chehab  * 			Serial otherwise.
149a0bf528SMauro Carvalho Chehab  * @dynamic_clk:	True means that the clock will be dynamically
159a0bf528SMauro Carvalho Chehab  *			adjusted. Static clock otherwise.
169a0bf528SMauro Carvalho Chehab  * @enable_merr_cfg:	Enable SIO_PDR_PERR_CFG/SIO_PDR_MVAL_CFG.
179a0bf528SMauro Carvalho Chehab  * @single_master:	Device is on the single master mode
189a0bf528SMauro Carvalho Chehab  * @no_i2c_bridge:	Don't switch the I2C bridge to talk with tuner
199a0bf528SMauro Carvalho Chehab  * @antenna_gpio:	GPIO bit used to control the antenna
209a0bf528SMauro Carvalho Chehab  * @antenna_dvbt:	GPIO bit for changing antenna to DVB-C. A value of 1
219a0bf528SMauro Carvalho Chehab  *			means that 1=DVBC, 0 = DVBT. Zero means the opposite.
229a0bf528SMauro Carvalho Chehab  * @mpeg_out_clk_strength: DRXK Mpeg output clock drive strength.
23b95b0c98SMauro Carvalho Chehab  * @chunk_size:		maximum size for I2C messages
249a0bf528SMauro Carvalho Chehab  * @microcode_name:	Name of the firmware file with the microcode
259a0bf528SMauro Carvalho Chehab  * @qam_demod_parameter_count:	The number of parameters used for the command
269a0bf528SMauro Carvalho Chehab  *				to set the demodulator parameters. All
279a0bf528SMauro Carvalho Chehab  *				firmwares are using the 2-parameter commmand.
28b95b0c98SMauro Carvalho Chehab  *				An exception is the ``drxk_a3.mc`` firmware,
299a0bf528SMauro Carvalho Chehab  *				which uses the 4-parameter command.
309a0bf528SMauro Carvalho Chehab  *				A value of 0 (default) or lower indicates that
319a0bf528SMauro Carvalho Chehab  *				the correct number of parameters will be
329a0bf528SMauro Carvalho Chehab  *				automatically detected.
339a0bf528SMauro Carvalho Chehab  *
34b95b0c98SMauro Carvalho Chehab  * On the ``*_gpio`` vars, bit 0 is UIO-1, bit 1 is UIO-2 and bit 2 is
359a0bf528SMauro Carvalho Chehab  * UIO-3.
369a0bf528SMauro Carvalho Chehab  */
379a0bf528SMauro Carvalho Chehab struct drxk_config {
389a0bf528SMauro Carvalho Chehab 	u8	adr;
399a0bf528SMauro Carvalho Chehab 	bool	single_master;
409a0bf528SMauro Carvalho Chehab 	bool	no_i2c_bridge;
419a0bf528SMauro Carvalho Chehab 	bool	parallel_ts;
429a0bf528SMauro Carvalho Chehab 	bool	dynamic_clk;
439a0bf528SMauro Carvalho Chehab 	bool	enable_merr_cfg;
449a0bf528SMauro Carvalho Chehab 
459a0bf528SMauro Carvalho Chehab 	bool	antenna_dvbt;
469a0bf528SMauro Carvalho Chehab 	u16	antenna_gpio;
479a0bf528SMauro Carvalho Chehab 
489a0bf528SMauro Carvalho Chehab 	u8	mpeg_out_clk_strength;
499a0bf528SMauro Carvalho Chehab 	int	chunk_size;
509a0bf528SMauro Carvalho Chehab 
519a0bf528SMauro Carvalho Chehab 	const char	*microcode_name;
529a0bf528SMauro Carvalho Chehab 	int		 qam_demod_parameter_count;
539a0bf528SMauro Carvalho Chehab };
549a0bf528SMauro Carvalho Chehab 
559b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_DRXK)
56be9b53c8SMauro Carvalho Chehab /**
57be9b53c8SMauro Carvalho Chehab  * Attach a drxk demod
58be9b53c8SMauro Carvalho Chehab  *
59be9b53c8SMauro Carvalho Chehab  * @config: pointer to &struct drxk_config with demod configuration.
60be9b53c8SMauro Carvalho Chehab  * @i2c: i2c adapter to use.
61be9b53c8SMauro Carvalho Chehab  *
62be9b53c8SMauro Carvalho Chehab  * return: FE pointer on success, NULL on failure.
63be9b53c8SMauro Carvalho Chehab  */
649a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
659a0bf528SMauro Carvalho Chehab 					struct i2c_adapter *i2c);
669a0bf528SMauro Carvalho Chehab #else
679a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *drxk_attach(const struct drxk_config *config,
689a0bf528SMauro Carvalho Chehab 					struct i2c_adapter *i2c)
699a0bf528SMauro Carvalho Chehab {
709a0bf528SMauro Carvalho Chehab         printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
719a0bf528SMauro Carvalho Chehab         return NULL;
729a0bf528SMauro Carvalho Chehab }
739a0bf528SMauro Carvalho Chehab #endif
749a0bf528SMauro Carvalho Chehab 
759a0bf528SMauro Carvalho Chehab #endif
76