1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 */
4 
5 #ifndef __TEA5767_H__
6 #define __TEA5767_H__
7 
8 #include <linux/i2c.h>
9 #include <media/dvb_frontend.h>
10 
11 enum tea5767_xtal {
12 	TEA5767_LOW_LO_32768    = 0,
13 	TEA5767_HIGH_LO_32768   = 1,
14 	TEA5767_LOW_LO_13MHz    = 2,
15 	TEA5767_HIGH_LO_13MHz   = 3,
16 };
17 
18 struct tea5767_ctrl {
19 	unsigned int		port1:1;
20 	unsigned int		port2:1;
21 	unsigned int		high_cut:1;
22 	unsigned int		st_noise:1;
23 	unsigned int		soft_mute:1;
24 	unsigned int		japan_band:1;
25 	unsigned int		deemph_75:1;
26 	unsigned int		pllref:1;
27 	enum tea5767_xtal	xtal_freq;
28 };
29 
30 #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TEA5767)
31 extern int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr);
32 
33 extern struct dvb_frontend *tea5767_attach(struct dvb_frontend *fe,
34 					   struct i2c_adapter* i2c_adap,
35 					   u8 i2c_addr);
36 #else
tea5767_autodetection(struct i2c_adapter * i2c_adap,u8 i2c_addr)37 static inline int tea5767_autodetection(struct i2c_adapter* i2c_adap,
38 					u8 i2c_addr)
39 {
40 	printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n",
41 	       __func__);
42 	return -EINVAL;
43 }
44 
tea5767_attach(struct dvb_frontend * fe,struct i2c_adapter * i2c_adap,u8 i2c_addr)45 static inline struct dvb_frontend *tea5767_attach(struct dvb_frontend *fe,
46 						   struct i2c_adapter* i2c_adap,
47 						   u8 i2c_addr)
48 {
49 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
50 	return NULL;
51 }
52 #endif
53 
54 #endif /* __TEA5767_H__ */
55