• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	struct dvb_frontend		*frontend;
19 
20 	struct stv6110x_devctl* (*get_devctl)(struct i2c_client *i2c);
21 };
22 
23 enum tuner_mode {
24 	TUNER_SLEEP = 1,
25 	TUNER_WAKE,
26 };
27 
28 enum tuner_status {
29 	TUNER_PHASELOCKED = 1,
30 };
31 
32 struct stv6110x_devctl {
33 	int (*tuner_init) (struct dvb_frontend *fe);
34 	int (*tuner_sleep) (struct dvb_frontend *fe);
35 	int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode);
36 	int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency);
37 	int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency);
38 	int (*tuner_set_bandwidth) (struct dvb_frontend *fe, u32 bandwidth);
39 	int (*tuner_get_bandwidth) (struct dvb_frontend *fe, u32 *bandwidth);
40 	int (*tuner_set_bbgain) (struct dvb_frontend *fe, u32 gain);
41 	int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain);
42 	int (*tuner_set_refclk)  (struct dvb_frontend *fe, u32 refclk);
43 	int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status);
44 };
45 
46 
47 #if IS_REACHABLE(CONFIG_DVB_STV6110x)
48 
49 extern const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
50 					       const struct stv6110x_config *config,
51 					       struct i2c_adapter *i2c);
52 
53 #else
stv6110x_attach(struct dvb_frontend * fe,const struct stv6110x_config * config,struct i2c_adapter * i2c)54 static inline const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
55 						      const struct stv6110x_config *config,
56 						      struct i2c_adapter *i2c)
57 {
58 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
59 	return NULL;
60 }
61 
62 #endif /* CONFIG_DVB_STV6110x */
63 
64 #endif /* __STV6110x_H */
65