1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *    Support for LG2160 - ATSC/MH
4  *
5  *    Copyright (C) 2010 Michael Krufky <mkrufky@linuxtv.org>
6  */
7 
8 #ifndef _LG2160_H_
9 #define _LG2160_H_
10 
11 #include <linux/i2c.h>
12 #include <media/dvb_frontend.h>
13 
14 enum lg_chip_type {
15 	LG2160 = 0,
16 	LG2161 = 1,
17 };
18 
19 #define LG2161_1019 LG2161
20 #define LG2161_1040 LG2161
21 
22 enum lg2160_spi_clock {
23 	LG2160_SPI_3_125_MHZ = 0,
24 	LG2160_SPI_6_25_MHZ = 1,
25 	LG2160_SPI_12_5_MHZ = 2,
26 };
27 
28 #if 0
29 enum lg2161_oif {
30 	LG2161_OIF_EBI2_SLA  = 1,
31 	LG2161_OIF_SDIO_SLA  = 2,
32 	LG2161_OIF_SPI_SLA   = 3,
33 	LG2161_OIF_SPI_MAS   = 4,
34 	LG2161_OIF_SERIAL_TS = 7,
35 };
36 #endif
37 
38 struct lg2160_config {
39 	u8 i2c_addr;
40 
41 	/* user defined IF frequency in KHz */
42 	u16 if_khz;
43 
44 	/* disable i2c repeater - 0:repeater enabled 1:repeater disabled */
45 	unsigned int deny_i2c_rptr:1;
46 
47 	/* spectral inversion - 0:disabled 1:enabled */
48 	unsigned int spectral_inversion:1;
49 
50 	unsigned int output_if;
51 	enum lg2160_spi_clock spi_clock;
52 	enum lg_chip_type lg_chip;
53 };
54 
55 #if IS_REACHABLE(CONFIG_DVB_LG2160)
56 extern
57 struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
58 				     struct i2c_adapter *i2c_adap);
59 #else
60 static inline
lg2160_attach(const struct lg2160_config * config,struct i2c_adapter * i2c_adap)61 struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
62 				     struct i2c_adapter *i2c_adap)
63 {
64 	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
65 	return NULL;
66 }
67 #endif /* CONFIG_DVB_LG2160 */
68 
69 #endif /* _LG2160_H_ */
70