xref: /linux/drivers/media/dvb-frontends/stv0299.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*74ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
29a0bf528SMauro Carvalho Chehab /*
39a0bf528SMauro Carvalho Chehab     Driver for ST STV0299 demodulator
49a0bf528SMauro Carvalho Chehab 
59a0bf528SMauro Carvalho Chehab     Copyright (C) 2001-2002 Convergence Integrated Media GmbH
69a0bf528SMauro Carvalho Chehab 	<ralph@convergence.de>,
79a0bf528SMauro Carvalho Chehab 	<holger@convergence.de>,
89a0bf528SMauro Carvalho Chehab 	<js@convergence.de>
99a0bf528SMauro Carvalho Chehab 
109a0bf528SMauro Carvalho Chehab 
119a0bf528SMauro Carvalho Chehab     Philips SU1278/SH
129a0bf528SMauro Carvalho Chehab 
139a0bf528SMauro Carvalho Chehab     Copyright (C) 2002 by Peter Schildmann <peter.schildmann@web.de>
149a0bf528SMauro Carvalho Chehab 
159a0bf528SMauro Carvalho Chehab 
169a0bf528SMauro Carvalho Chehab     LG TDQF-S001F
179a0bf528SMauro Carvalho Chehab 
189a0bf528SMauro Carvalho Chehab     Copyright (C) 2002 Felix Domke <tmbinc@elitedvb.net>
199a0bf528SMauro Carvalho Chehab 		     & Andreas Oberritter <obi@linuxtv.org>
209a0bf528SMauro Carvalho Chehab 
219a0bf528SMauro Carvalho Chehab 
229a0bf528SMauro Carvalho Chehab     Support for Samsung TBMU24112IMB used on Technisat SkyStar2 rev. 2.6B
239a0bf528SMauro Carvalho Chehab 
249a0bf528SMauro Carvalho Chehab     Copyright (C) 2003 Vadim Catana <skystar@moldova.cc>:
259a0bf528SMauro Carvalho Chehab 
269a0bf528SMauro Carvalho Chehab     Support for Philips SU1278 on Technotrend hardware
279a0bf528SMauro Carvalho Chehab 
289a0bf528SMauro Carvalho Chehab     Copyright (C) 2004 Andrew de Quincey <adq_dvb@lidskialf.net>
299a0bf528SMauro Carvalho Chehab 
309a0bf528SMauro Carvalho Chehab 
319a0bf528SMauro Carvalho Chehab */
329a0bf528SMauro Carvalho Chehab 
339a0bf528SMauro Carvalho Chehab #ifndef STV0299_H
349a0bf528SMauro Carvalho Chehab #define STV0299_H
359a0bf528SMauro Carvalho Chehab 
369a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h>
37fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
389a0bf528SMauro Carvalho Chehab 
399a0bf528SMauro Carvalho Chehab #define STV0299_LOCKOUTPUT_0  0
409a0bf528SMauro Carvalho Chehab #define STV0299_LOCKOUTPUT_1  1
419a0bf528SMauro Carvalho Chehab #define STV0299_LOCKOUTPUT_CF 2
429a0bf528SMauro Carvalho Chehab #define STV0299_LOCKOUTPUT_LK 3
439a0bf528SMauro Carvalho Chehab 
449a0bf528SMauro Carvalho Chehab #define STV0299_VOLT13_OP0 0
459a0bf528SMauro Carvalho Chehab #define STV0299_VOLT13_OP1 1
469a0bf528SMauro Carvalho Chehab 
479a0bf528SMauro Carvalho Chehab struct stv0299_config
489a0bf528SMauro Carvalho Chehab {
499a0bf528SMauro Carvalho Chehab 	/* the demodulator's i2c address */
509a0bf528SMauro Carvalho Chehab 	u8 demod_address;
519a0bf528SMauro Carvalho Chehab 
529a0bf528SMauro Carvalho Chehab 	/* inittab - array of pairs of values.
539a0bf528SMauro Carvalho Chehab 	 * First of each pair is the register, second is the value.
549a0bf528SMauro Carvalho Chehab 	 * List should be terminated with an 0xff, 0xff pair.
559a0bf528SMauro Carvalho Chehab 	 */
569a0bf528SMauro Carvalho Chehab 	const u8* inittab;
579a0bf528SMauro Carvalho Chehab 
589a0bf528SMauro Carvalho Chehab 	/* master clock to use */
599a0bf528SMauro Carvalho Chehab 	u32 mclk;
609a0bf528SMauro Carvalho Chehab 
619a0bf528SMauro Carvalho Chehab 	/* does the inversion require inversion? */
629a0bf528SMauro Carvalho Chehab 	u8 invert:1;
639a0bf528SMauro Carvalho Chehab 
649a0bf528SMauro Carvalho Chehab 	/* Skip reinitialisation? */
659a0bf528SMauro Carvalho Chehab 	u8 skip_reinit:1;
669a0bf528SMauro Carvalho Chehab 
679a0bf528SMauro Carvalho Chehab 	/* LOCK OUTPUT setting */
689a0bf528SMauro Carvalho Chehab 	u8 lock_output:2;
699a0bf528SMauro Carvalho Chehab 
709a0bf528SMauro Carvalho Chehab 	/* Is 13v controlled by OP0 or OP1? */
719a0bf528SMauro Carvalho Chehab 	u8 volt13_op0_op1:1;
729a0bf528SMauro Carvalho Chehab 
739a0bf528SMauro Carvalho Chehab 	/* Turn-off OP0? */
749a0bf528SMauro Carvalho Chehab 	u8 op0_off:1;
759a0bf528SMauro Carvalho Chehab 
769a0bf528SMauro Carvalho Chehab 	/* minimum delay before retuning */
779a0bf528SMauro Carvalho Chehab 	int min_delay_ms;
789a0bf528SMauro Carvalho Chehab 
799a0bf528SMauro Carvalho Chehab 	/* Set the symbol rate */
809a0bf528SMauro Carvalho Chehab 	int (*set_symbol_rate)(struct dvb_frontend *fe, u32 srate, u32 ratio);
819a0bf528SMauro Carvalho Chehab 
829a0bf528SMauro Carvalho Chehab 	/* Set device param to start dma */
839a0bf528SMauro Carvalho Chehab 	int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
849a0bf528SMauro Carvalho Chehab };
859a0bf528SMauro Carvalho Chehab 
869b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_STV0299)
879a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
889a0bf528SMauro Carvalho Chehab 					   struct i2c_adapter *i2c);
899a0bf528SMauro Carvalho Chehab #else
stv0299_attach(const struct stv0299_config * config,struct i2c_adapter * i2c)909a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
919a0bf528SMauro Carvalho Chehab 					   struct i2c_adapter *i2c)
929a0bf528SMauro Carvalho Chehab {
939a0bf528SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
949a0bf528SMauro Carvalho Chehab 	return NULL;
959a0bf528SMauro Carvalho Chehab }
969a0bf528SMauro Carvalho Chehab #endif // CONFIG_DVB_STV0299
979a0bf528SMauro Carvalho Chehab 
stv0299_writereg(struct dvb_frontend * fe,u8 reg,u8 val)989a0bf528SMauro Carvalho Chehab static inline int stv0299_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
999a0bf528SMauro Carvalho Chehab 	int r = 0;
1009a0bf528SMauro Carvalho Chehab 	u8 buf[] = {reg, val};
1019a0bf528SMauro Carvalho Chehab 	if (fe->ops.write)
1029a0bf528SMauro Carvalho Chehab 		r = fe->ops.write(fe, buf, 2);
1039a0bf528SMauro Carvalho Chehab 	return r;
1049a0bf528SMauro Carvalho Chehab }
1059a0bf528SMauro Carvalho Chehab 
1069a0bf528SMauro Carvalho Chehab #endif // STV0299_H
107