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