xref: /openbmc/linux/drivers/media/tuners/tda8290.h (revision fada1935590f66dc6784981e0d557ca09013c847)
1ccae7af2SMauro Carvalho Chehab /*
2ccae7af2SMauro Carvalho Chehab     This program is free software; you can redistribute it and/or modify
3ccae7af2SMauro Carvalho Chehab     it under the terms of the GNU General Public License as published by
4ccae7af2SMauro Carvalho Chehab     the Free Software Foundation; either version 2 of the License, or
5ccae7af2SMauro Carvalho Chehab     (at your option) any later version.
6ccae7af2SMauro Carvalho Chehab 
7ccae7af2SMauro Carvalho Chehab     This program is distributed in the hope that it will be useful,
8ccae7af2SMauro Carvalho Chehab     but WITHOUT ANY WARRANTY; without even the implied warranty of
9ccae7af2SMauro Carvalho Chehab     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10ccae7af2SMauro Carvalho Chehab     GNU General Public License for more details.
11ccae7af2SMauro Carvalho Chehab 
12ccae7af2SMauro Carvalho Chehab     You should have received a copy of the GNU General Public License
13ccae7af2SMauro Carvalho Chehab     along with this program; if not, write to the Free Software
14ccae7af2SMauro Carvalho Chehab     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15ccae7af2SMauro Carvalho Chehab */
16ccae7af2SMauro Carvalho Chehab 
17ccae7af2SMauro Carvalho Chehab #ifndef __TDA8290_H__
18ccae7af2SMauro Carvalho Chehab #define __TDA8290_H__
19ccae7af2SMauro Carvalho Chehab 
20ccae7af2SMauro Carvalho Chehab #include <linux/i2c.h>
21*fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
225b0e5350SOndrej Zary #include "tda18271.h"
23ccae7af2SMauro Carvalho Chehab 
241bacb2dfSOndrej Zary enum tda8290_lna {
251bacb2dfSOndrej Zary 	TDA8290_LNA_OFF = 0,
261bacb2dfSOndrej Zary 	TDA8290_LNA_GP0_HIGH_ON = 1,
271bacb2dfSOndrej Zary 	TDA8290_LNA_GP0_HIGH_OFF = 2,
281bacb2dfSOndrej Zary 	TDA8290_LNA_ON_BRIDGE = 3,
291bacb2dfSOndrej Zary };
301bacb2dfSOndrej Zary 
31ccae7af2SMauro Carvalho Chehab struct tda829x_config {
321bacb2dfSOndrej Zary 	enum tda8290_lna lna_cfg;
33ccae7af2SMauro Carvalho Chehab 
34ccae7af2SMauro Carvalho Chehab 	unsigned int probe_tuner:1;
35ccae7af2SMauro Carvalho Chehab #define TDA829X_PROBE_TUNER 0
36ccae7af2SMauro Carvalho Chehab #define TDA829X_DONT_PROBE  1
372f719f7aSOndrej Zary 	unsigned int no_i2c_gate:1;
385b0e5350SOndrej Zary 	struct tda18271_std_map *tda18271_std_map;
39ccae7af2SMauro Carvalho Chehab };
40ccae7af2SMauro Carvalho Chehab 
419b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA8290)
42ccae7af2SMauro Carvalho Chehab extern int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr);
43ccae7af2SMauro Carvalho Chehab 
44ccae7af2SMauro Carvalho Chehab extern struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
45ccae7af2SMauro Carvalho Chehab 					   struct i2c_adapter *i2c_adap,
46ccae7af2SMauro Carvalho Chehab 					   u8 i2c_addr,
47ccae7af2SMauro Carvalho Chehab 					   struct tda829x_config *cfg);
48ccae7af2SMauro Carvalho Chehab #else
49ccae7af2SMauro Carvalho Chehab static inline int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr)
50ccae7af2SMauro Carvalho Chehab {
51ccae7af2SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
52ccae7af2SMauro Carvalho Chehab 	return -EINVAL;
53ccae7af2SMauro Carvalho Chehab }
54ccae7af2SMauro Carvalho Chehab 
55ccae7af2SMauro Carvalho Chehab static inline struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
56ccae7af2SMauro Carvalho Chehab 						  struct i2c_adapter *i2c_adap,
57ccae7af2SMauro Carvalho Chehab 						  u8 i2c_addr,
58ccae7af2SMauro Carvalho Chehab 						  struct tda829x_config *cfg)
59ccae7af2SMauro Carvalho Chehab {
60ccae7af2SMauro Carvalho Chehab 	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
61ccae7af2SMauro Carvalho Chehab 	       __func__);
62ccae7af2SMauro Carvalho Chehab 	return NULL;
63ccae7af2SMauro Carvalho Chehab }
64ccae7af2SMauro Carvalho Chehab #endif
65ccae7af2SMauro Carvalho Chehab 
66ccae7af2SMauro Carvalho Chehab #endif /* __TDA8290_H__ */
67