1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  Samsung s5h1432 VSB/QAM demodulator driver
4  *
5  *  Copyright (C) 2009 Bill Liu <Bill.Liu@Conexant.com>
6  */
7 
8 #ifndef __S5H1432_H__
9 #define __S5H1432_H__
10 
11 #include <linux/dvb/frontend.h>
12 
13 #define S5H1432_I2C_TOP_ADDR (0x02 >> 1)
14 
15 #define TAIWAN_HI_IF_FREQ_44_MHZ 44000000
16 #define EUROPE_HI_IF_FREQ_36_MHZ 36000000
17 #define IF_FREQ_6_MHZ             6000000
18 #define IF_FREQ_3point3_MHZ       3300000
19 #define IF_FREQ_3point5_MHZ       3500000
20 #define IF_FREQ_4_MHZ             4000000
21 
22 struct s5h1432_config {
23 
24 	/* serial/parallel output */
25 #define S5H1432_PARALLEL_OUTPUT 0
26 #define S5H1432_SERIAL_OUTPUT   1
27 	u8 output_mode;
28 
29 	/* GPIO Setting */
30 #define S5H1432_GPIO_OFF 0
31 #define S5H1432_GPIO_ON  1
32 	u8 gpio;
33 
34 	/* MPEG signal timing */
35 #define S5H1432_MPEGTIMING_CONTINUOUS_INVERTING_CLOCK       0
36 #define S5H1432_MPEGTIMING_CONTINUOUS_NONINVERTING_CLOCK    1
37 #define S5H1432_MPEGTIMING_NONCONTINUOUS_INVERTING_CLOCK    2
38 #define S5H1432_MPEGTIMING_NONCONTINUOUS_NONINVERTING_CLOCK 3
39 	u16 mpeg_timing;
40 
41 	/* IF Freq for QAM and VSB in KHz */
42 #define S5H1432_IF_3250  3250
43 #define S5H1432_IF_3500  3500
44 #define S5H1432_IF_4000  4000
45 #define S5H1432_IF_5380  5380
46 #define S5H1432_IF_44000 44000
47 #define S5H1432_VSB_IF_DEFAULT s5h1432_IF_44000
48 #define S5H1432_QAM_IF_DEFAULT s5h1432_IF_44000
49 	u16 qam_if;
50 	u16 vsb_if;
51 
52 	/* Spectral Inversion */
53 #define S5H1432_INVERSION_OFF 0
54 #define S5H1432_INVERSION_ON  1
55 	u8 inversion;
56 
57 	/* Return lock status based on tuner lock, or demod lock */
58 #define S5H1432_TUNERLOCKING 0
59 #define S5H1432_DEMODLOCKING 1
60 	u8 status_mode;
61 };
62 
63 #if IS_REACHABLE(CONFIG_DVB_S5H1432)
64 extern struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config,
65 					   struct i2c_adapter *i2c);
66 #else
s5h1432_attach(const struct s5h1432_config * config,struct i2c_adapter * i2c)67 static inline struct dvb_frontend *s5h1432_attach(const struct s5h1432_config
68 						  *config,
69 						  struct i2c_adapter *i2c)
70 {
71 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
72 	return NULL;
73 }
74 #endif /* CONFIG_DVB_s5h1432 */
75 
76 #endif /* __s5h1432_H__ */
77