xref: /openbmc/linux/drivers/media/dvb-frontends/stv0288.h (revision 9b174527e7b756cda9f5d9e541f87b7fec9cfdf0)
19a0bf528SMauro Carvalho Chehab /*
29a0bf528SMauro Carvalho Chehab 	Driver for ST STV0288 demodulator
39a0bf528SMauro Carvalho Chehab 
49a0bf528SMauro Carvalho Chehab 	Copyright (C) 2006 Georg Acher, BayCom GmbH, acher (at) baycom (dot) de
59a0bf528SMauro Carvalho Chehab 		for Reel Multimedia
69a0bf528SMauro Carvalho Chehab 	Copyright (C) 2008 TurboSight.com, <bob@turbosight.com>
79a0bf528SMauro Carvalho Chehab 	Copyright (C) 2008 Igor M. Liplianin <liplianin@me.by>
89a0bf528SMauro Carvalho Chehab 		Removed stb6000 specific tuner code and revised some
99a0bf528SMauro Carvalho Chehab 		procedures.
109a0bf528SMauro Carvalho Chehab 
119a0bf528SMauro Carvalho Chehab 	This program is free software; you can redistribute it and/or modify
129a0bf528SMauro Carvalho Chehab 	it under the terms of the GNU General Public License as published by
139a0bf528SMauro Carvalho Chehab 	the Free Software Foundation; either version 2 of the License, or
149a0bf528SMauro Carvalho Chehab 	(at your option) any later version.
159a0bf528SMauro Carvalho Chehab 
169a0bf528SMauro Carvalho Chehab 	This program is distributed in the hope that it will be useful,
179a0bf528SMauro Carvalho Chehab 	but WITHOUT ANY WARRANTY; without even the implied warranty of
189a0bf528SMauro Carvalho Chehab 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
199a0bf528SMauro Carvalho Chehab 	GNU General Public License for more details.
209a0bf528SMauro Carvalho Chehab 
219a0bf528SMauro Carvalho Chehab 	You should have received a copy of the GNU General Public License
229a0bf528SMauro Carvalho Chehab 	along with this program; if not, write to the Free Software
239a0bf528SMauro Carvalho Chehab 	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
249a0bf528SMauro Carvalho Chehab 
259a0bf528SMauro Carvalho Chehab */
269a0bf528SMauro Carvalho Chehab 
279a0bf528SMauro Carvalho Chehab #ifndef STV0288_H
289a0bf528SMauro Carvalho Chehab #define STV0288_H
299a0bf528SMauro Carvalho Chehab 
30782d8b74SMauro Carvalho Chehab #include <linux/kconfig.h>
319a0bf528SMauro Carvalho Chehab #include <linux/dvb/frontend.h>
329a0bf528SMauro Carvalho Chehab #include "dvb_frontend.h"
339a0bf528SMauro Carvalho Chehab 
349a0bf528SMauro Carvalho Chehab struct stv0288_config {
359a0bf528SMauro Carvalho Chehab 	/* the demodulator's i2c address */
369a0bf528SMauro Carvalho Chehab 	u8 demod_address;
379a0bf528SMauro Carvalho Chehab 
389a0bf528SMauro Carvalho Chehab 	u8* inittab;
399a0bf528SMauro Carvalho Chehab 
409a0bf528SMauro Carvalho Chehab 	/* minimum delay before retuning */
419a0bf528SMauro Carvalho Chehab 	int min_delay_ms;
429a0bf528SMauro Carvalho Chehab 
439a0bf528SMauro Carvalho Chehab 	int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
449a0bf528SMauro Carvalho Chehab };
459a0bf528SMauro Carvalho Chehab 
46*9b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_DVB_STV0288)
479a0bf528SMauro Carvalho Chehab extern struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
489a0bf528SMauro Carvalho Chehab 					   struct i2c_adapter *i2c);
499a0bf528SMauro Carvalho Chehab #else
509a0bf528SMauro Carvalho Chehab static inline struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
519a0bf528SMauro Carvalho Chehab 					   struct i2c_adapter *i2c)
529a0bf528SMauro Carvalho Chehab {
539a0bf528SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
549a0bf528SMauro Carvalho Chehab 	return NULL;
559a0bf528SMauro Carvalho Chehab }
569a0bf528SMauro Carvalho Chehab #endif /* CONFIG_DVB_STV0288 */
579a0bf528SMauro Carvalho Chehab 
589a0bf528SMauro Carvalho Chehab static inline int stv0288_writereg(struct dvb_frontend *fe, u8 reg, u8 val)
599a0bf528SMauro Carvalho Chehab {
609a0bf528SMauro Carvalho Chehab 	int r = 0;
619a0bf528SMauro Carvalho Chehab 	u8 buf[] = { reg, val };
629a0bf528SMauro Carvalho Chehab 	if (fe->ops.write)
639a0bf528SMauro Carvalho Chehab 		r = fe->ops.write(fe, buf, 2);
649a0bf528SMauro Carvalho Chehab 	return r;
659a0bf528SMauro Carvalho Chehab }
669a0bf528SMauro Carvalho Chehab 
679a0bf528SMauro Carvalho Chehab #endif /* STV0288_H */
68