xref: /openbmc/linux/drivers/media/tuners/tda8290.h (revision 58e16d792a6a8c6b750f637a4649967fcac853dc)
1*74ba9207SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2ccae7af2SMauro Carvalho Chehab /*
3ccae7af2SMauro Carvalho Chehab */
4ccae7af2SMauro Carvalho Chehab 
5ccae7af2SMauro Carvalho Chehab #ifndef __TDA8290_H__
6ccae7af2SMauro Carvalho Chehab #define __TDA8290_H__
7ccae7af2SMauro Carvalho Chehab 
8ccae7af2SMauro Carvalho Chehab #include <linux/i2c.h>
9fada1935SMauro Carvalho Chehab #include <media/dvb_frontend.h>
105b0e5350SOndrej Zary #include "tda18271.h"
11ccae7af2SMauro Carvalho Chehab 
121bacb2dfSOndrej Zary enum tda8290_lna {
131bacb2dfSOndrej Zary 	TDA8290_LNA_OFF = 0,
141bacb2dfSOndrej Zary 	TDA8290_LNA_GP0_HIGH_ON = 1,
151bacb2dfSOndrej Zary 	TDA8290_LNA_GP0_HIGH_OFF = 2,
161bacb2dfSOndrej Zary 	TDA8290_LNA_ON_BRIDGE = 3,
171bacb2dfSOndrej Zary };
181bacb2dfSOndrej Zary 
19ccae7af2SMauro Carvalho Chehab struct tda829x_config {
201bacb2dfSOndrej Zary 	enum tda8290_lna lna_cfg;
21ccae7af2SMauro Carvalho Chehab 
22ccae7af2SMauro Carvalho Chehab 	unsigned int probe_tuner:1;
23ccae7af2SMauro Carvalho Chehab #define TDA829X_PROBE_TUNER 0
24ccae7af2SMauro Carvalho Chehab #define TDA829X_DONT_PROBE  1
252f719f7aSOndrej Zary 	unsigned int no_i2c_gate:1;
265b0e5350SOndrej Zary 	struct tda18271_std_map *tda18271_std_map;
27ccae7af2SMauro Carvalho Chehab };
28ccae7af2SMauro Carvalho Chehab 
299b174527SArnd Bergmann #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA8290)
30ccae7af2SMauro Carvalho Chehab extern int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr);
31ccae7af2SMauro Carvalho Chehab 
32ccae7af2SMauro Carvalho Chehab extern struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
33ccae7af2SMauro Carvalho Chehab 					   struct i2c_adapter *i2c_adap,
34ccae7af2SMauro Carvalho Chehab 					   u8 i2c_addr,
35ccae7af2SMauro Carvalho Chehab 					   struct tda829x_config *cfg);
36ccae7af2SMauro Carvalho Chehab #else
tda829x_probe(struct i2c_adapter * i2c_adap,u8 i2c_addr)37ccae7af2SMauro Carvalho Chehab static inline int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr)
38ccae7af2SMauro Carvalho Chehab {
39ccae7af2SMauro Carvalho Chehab 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
40ccae7af2SMauro Carvalho Chehab 	return -EINVAL;
41ccae7af2SMauro Carvalho Chehab }
42ccae7af2SMauro Carvalho Chehab 
tda829x_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c_adap,u8 i2c_addr,struct tda829x_config * cfg)43ccae7af2SMauro Carvalho Chehab static inline struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
44ccae7af2SMauro Carvalho Chehab 						  struct i2c_adapter *i2c_adap,
45ccae7af2SMauro Carvalho Chehab 						  u8 i2c_addr,
46ccae7af2SMauro Carvalho Chehab 						  struct tda829x_config *cfg)
47ccae7af2SMauro Carvalho Chehab {
48ccae7af2SMauro Carvalho Chehab 	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
49ccae7af2SMauro Carvalho Chehab 	       __func__);
50ccae7af2SMauro Carvalho Chehab 	return NULL;
51ccae7af2SMauro Carvalho Chehab }
52ccae7af2SMauro Carvalho Chehab #endif
53ccae7af2SMauro Carvalho Chehab 
54ccae7af2SMauro Carvalho Chehab #endif /* __TDA8290_H__ */
55