1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 	Driver for ST STV0288 demodulator
4 
5 	Copyright (C) 2006 Georg Acher, BayCom GmbH, acher (at) baycom (dot) de
6 		for Reel Multimedia
7 	Copyright (C) 2008 TurboSight.com, <bob@turbosight.com>
8 	Copyright (C) 2008 Igor M. Liplianin <liplianin@me.by>
9 		Removed stb6000 specific tuner code and revised some
10 		procedures.
11 
12 
13 */
14 
15 #ifndef STV0288_H
16 #define STV0288_H
17 
18 #include <linux/dvb/frontend.h>
19 #include <media/dvb_frontend.h>
20 
21 struct stv0288_config {
22 	/* the demodulator's i2c address */
23 	u8 demod_address;
24 
25 	u8* inittab;
26 
27 	/* minimum delay before retuning */
28 	int min_delay_ms;
29 
30 	int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
31 };
32 
33 #if IS_REACHABLE(CONFIG_DVB_STV0288)
34 extern struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
35 					   struct i2c_adapter *i2c);
36 #else
stv0288_attach(const struct stv0288_config * config,struct i2c_adapter * i2c)37 static inline struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
38 					   struct i2c_adapter *i2c)
39 {
40 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
41 	return NULL;
42 }
43 #endif /* CONFIG_DVB_STV0288 */
44 
stv0288_writereg(struct dvb_frontend * fe,u8 reg,u8 val)45 static inline int stv0288_writereg(struct dvb_frontend *fe, u8 reg, u8 val)
46 {
47 	int r = 0;
48 	u8 buf[] = { reg, val };
49 	if (fe->ops.write)
50 		r = fe->ops.write(fe, buf, 2);
51 	return r;
52 }
53 
54 #endif /* STV0288_H */
55