blob: 84c2dc8c3a60472bfed5472a0cec2971e01e9468 [file] [log] [blame]
Thomas Gleixner74ba9202019-05-20 09:19:02 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Konstantin Dimitrov6fef4fc2012-12-23 19:25:27 -03002/*
3 Montage Technology TS2020 - Silicon Tuner driver
4 Copyright (C) 2009-2012 Konstantin Dimitrov <kosio.dimitrov@gmail.com>
5
6 Copyright (C) 2009-2012 TurboSight.com
7
Konstantin Dimitrov6fef4fc2012-12-23 19:25:27 -03008 */
9
10#ifndef TS2020_H
11#define TS2020_H
12
13#include <linux/dvb/frontend.h>
14
15struct ts2020_config {
16 u8 tuner_address;
John Horan03a67272013-08-28 09:37:37 -030017 u32 frequency_div;
Antti Palosaariabd90252015-03-23 14:14:40 -030018
19 /*
20 * RF loop-through
21 */
David Howells0f20baa2015-06-03 08:34:13 -030022 bool loop_through:1;
Antti Palosaariabd90252015-03-23 14:14:40 -030023
24 /*
25 * clock output
26 */
27#define TS2020_CLK_OUT_DISABLED 0
28#define TS2020_CLK_OUT_ENABLED 1
29#define TS2020_CLK_OUT_ENABLED_XTALOUT 2
30 u8 clk_out:2;
31
32 /*
33 * clock output divider
34 * 1 - 31
35 */
36 u8 clk_out_div:5;
37
David Howellsc7275ae2015-06-03 08:35:08 -030038 /* Set to true to suppress stat polling */
39 bool dont_poll:1;
40
Antti Palosaariabd90252015-03-23 14:14:40 -030041 /*
42 * pointer to DVB frontend
43 */
44 struct dvb_frontend *fe;
Antti Palosaarie6ad9ce2015-03-26 20:20:42 -030045
46 /*
47 * driver private, do not set value
48 */
49 u8 attach_in_use:1;
David Howells0f91c9d2015-05-26 12:04:00 -030050
51 /* Operation to be called by the ts2020 driver to get the value of the
52 * AGC PWM tuner input as theoretically output by the demodulator.
53 */
54 int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm);
Konstantin Dimitrov6fef4fc2012-12-23 19:25:27 -030055};
56
Antti Palosaarie6ad9ce2015-03-26 20:20:42 -030057/* Do not add new ts2020_attach() users! Use I2C bindings instead. */
Arnd Bergmann9b174522015-02-18 14:12:42 -030058#if IS_REACHABLE(CONFIG_DVB_TS2020)
Konstantin Dimitrov6fef4fc2012-12-23 19:25:27 -030059extern struct dvb_frontend *ts2020_attach(
60 struct dvb_frontend *fe,
61 const struct ts2020_config *config,
62 struct i2c_adapter *i2c);
63#else
64static inline struct dvb_frontend *ts2020_attach(
65 struct dvb_frontend *fe,
66 const struct ts2020_config *config,
67 struct i2c_adapter *i2c)
68{
69 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
70 return NULL;
71}
72#endif
73
74#endif /* TS2020_H */