1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun DVB Driver for Philips tda827x / tda827xa Silicon tuners
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun (c) 2005 Hartmut Hackmann
6*4882a593Smuzhiyun (c) 2007 Michael Krufky
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun */
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun #ifndef __DVB_TDA827X_H__
12*4882a593Smuzhiyun #define __DVB_TDA827X_H__
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun #include <linux/i2c.h>
15*4882a593Smuzhiyun #include <media/dvb_frontend.h>
16*4882a593Smuzhiyun #include "tda8290.h"
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun struct tda827x_config
19*4882a593Smuzhiyun {
20*4882a593Smuzhiyun /* saa7134 - provided callbacks */
21*4882a593Smuzhiyun int (*init) (struct dvb_frontend *fe);
22*4882a593Smuzhiyun int (*sleep) (struct dvb_frontend *fe);
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun /* interface to tda829x driver */
25*4882a593Smuzhiyun enum tda8290_lna config;
26*4882a593Smuzhiyun int switch_addr;
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun void (*agcf)(struct dvb_frontend *fe);
29*4882a593Smuzhiyun };
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun /**
33*4882a593Smuzhiyun * Attach a tda827x tuner to the supplied frontend structure.
34*4882a593Smuzhiyun *
35*4882a593Smuzhiyun * @param fe Frontend to attach to.
36*4882a593Smuzhiyun * @param addr i2c address of the tuner.
37*4882a593Smuzhiyun * @param i2c i2c adapter to use.
38*4882a593Smuzhiyun * @param cfg optional callback function pointers.
39*4882a593Smuzhiyun * @return FE pointer on success, NULL on failure.
40*4882a593Smuzhiyun */
41*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA827X)
42*4882a593Smuzhiyun extern struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe, int addr,
43*4882a593Smuzhiyun struct i2c_adapter *i2c,
44*4882a593Smuzhiyun struct tda827x_config *cfg);
45*4882a593Smuzhiyun #else
tda827x_attach(struct dvb_frontend * fe,int addr,struct i2c_adapter * i2c,struct tda827x_config * cfg)46*4882a593Smuzhiyun static inline struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe,
47*4882a593Smuzhiyun int addr,
48*4882a593Smuzhiyun struct i2c_adapter *i2c,
49*4882a593Smuzhiyun struct tda827x_config *cfg)
50*4882a593Smuzhiyun {
51*4882a593Smuzhiyun printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
52*4882a593Smuzhiyun return NULL;
53*4882a593Smuzhiyun }
54*4882a593Smuzhiyun #endif // CONFIG_MEDIA_TUNER_TDA827X
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun #endif // __DVB_TDA827X_H__
57