1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 	STV6110(A) Silicon tuner driver
4 
5 	Copyright (C) Manu Abraham <abraham.manu@gmail.com>
6 
7 	Copyright (C) ST Microelectronics
8 
9 */
10 
11 #ifndef __STV6110x_H
12 #define __STV6110x_H
13 
14 struct stv6110x_config {
15 	u8	addr;
16 	u32	refclk;
17 	u8	clk_div; /* divisor value for the output clock */
18 };
19 
20 enum tuner_mode {
21 	TUNER_SLEEP = 1,
22 	TUNER_WAKE,
23 };
24 
25 enum tuner_status {
26 	TUNER_PHASELOCKED = 1,
27 };
28 
29 struct stv6110x_devctl {
30 	int (*tuner_init) (struct dvb_frontend *fe);
31 	int (*tuner_sleep) (struct dvb_frontend *fe);
32 	int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode);
33 	int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency);
34 	int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency);
35 	int (*tuner_set_bandwidth) (struct dvb_frontend *fe, u32 bandwidth);
36 	int (*tuner_get_bandwidth) (struct dvb_frontend *fe, u32 *bandwidth);
37 	int (*tuner_set_bbgain) (struct dvb_frontend *fe, u32 gain);
38 	int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain);
39 	int (*tuner_set_refclk)  (struct dvb_frontend *fe, u32 refclk);
40 	int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status);
41 };
42 
43 
44 #if IS_REACHABLE(CONFIG_DVB_STV6110x)
45 
46 extern const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
47 					       const struct stv6110x_config *config,
48 					       struct i2c_adapter *i2c);
49 
50 #else
51 static inline const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
52 						      const struct stv6110x_config *config,
53 						      struct i2c_adapter *i2c)
54 {
55 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
56 	return NULL;
57 }
58 
59 #endif /* CONFIG_DVB_STV6110x */
60 
61 #endif /* __STV6110x_H */
62