1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun TDA10021/TDA10023 - Single Chip Cable Channel Receiver driver module
4*4882a593Smuzhiyun used on the the Siemens DVB-C cards
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun Copyright (C) 1999 Convergence Integrated Media GmbH <ralph@convergence.de>
7*4882a593Smuzhiyun Copyright (C) 2004 Markus Schulz <msc@antzsystem.de>
8*4882a593Smuzhiyun Support for TDA10021
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun */
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun #ifndef TDA1002x_H
13*4882a593Smuzhiyun #define TDA1002x_H
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun #include <linux/dvb/frontend.h>
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun struct tda1002x_config {
18*4882a593Smuzhiyun /* the demodulator's i2c address */
19*4882a593Smuzhiyun u8 demod_address;
20*4882a593Smuzhiyun u8 invert;
21*4882a593Smuzhiyun };
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun enum tda10023_output_mode {
24*4882a593Smuzhiyun TDA10023_OUTPUT_MODE_PARALLEL_A = 0xe0,
25*4882a593Smuzhiyun TDA10023_OUTPUT_MODE_PARALLEL_B = 0xa1,
26*4882a593Smuzhiyun TDA10023_OUTPUT_MODE_PARALLEL_C = 0xa0,
27*4882a593Smuzhiyun TDA10023_OUTPUT_MODE_SERIAL, /* TODO: not implemented */
28*4882a593Smuzhiyun };
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun struct tda10023_config {
31*4882a593Smuzhiyun /* the demodulator's i2c address */
32*4882a593Smuzhiyun u8 demod_address;
33*4882a593Smuzhiyun u8 invert;
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun /* clock settings */
36*4882a593Smuzhiyun u32 xtal; /* defaults: 28920000 */
37*4882a593Smuzhiyun u8 pll_m; /* defaults: 8 */
38*4882a593Smuzhiyun u8 pll_p; /* defaults: 4 */
39*4882a593Smuzhiyun u8 pll_n; /* defaults: 1 */
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun /* MPEG2 TS output mode */
42*4882a593Smuzhiyun u8 output_mode;
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun /* input freq offset + baseband conversion type */
45*4882a593Smuzhiyun u16 deltaf;
46*4882a593Smuzhiyun };
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_DVB_TDA10021)
49*4882a593Smuzhiyun extern struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
50*4882a593Smuzhiyun struct i2c_adapter* i2c, u8 pwm);
51*4882a593Smuzhiyun #else
tda10021_attach(const struct tda1002x_config * config,struct i2c_adapter * i2c,u8 pwm)52*4882a593Smuzhiyun static inline struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config,
53*4882a593Smuzhiyun struct i2c_adapter* i2c, u8 pwm)
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
56*4882a593Smuzhiyun return NULL;
57*4882a593Smuzhiyun }
58*4882a593Smuzhiyun #endif // CONFIG_DVB_TDA10021
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun #if IS_REACHABLE(CONFIG_DVB_TDA10023)
61*4882a593Smuzhiyun extern struct dvb_frontend *tda10023_attach(
62*4882a593Smuzhiyun const struct tda10023_config *config,
63*4882a593Smuzhiyun struct i2c_adapter *i2c, u8 pwm);
64*4882a593Smuzhiyun #else
tda10023_attach(const struct tda10023_config * config,struct i2c_adapter * i2c,u8 pwm)65*4882a593Smuzhiyun static inline struct dvb_frontend *tda10023_attach(
66*4882a593Smuzhiyun const struct tda10023_config *config,
67*4882a593Smuzhiyun struct i2c_adapter *i2c, u8 pwm)
68*4882a593Smuzhiyun {
69*4882a593Smuzhiyun printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
70*4882a593Smuzhiyun return NULL;
71*4882a593Smuzhiyun }
72*4882a593Smuzhiyun #endif // CONFIG_DVB_TDA10023
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun #endif // TDA1002x_H
75