xref: /linux/drivers/media/dvb-frontends/af9013.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Afatech AF9013 demodulator driver
4  *
5  * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
6  * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
7  *
8  * Thanks to Afatech who kindly provided information.
9  */
10 
11 #ifndef AF9013_H
12 #define AF9013_H
13 
14 #include <linux/dvb/frontend.h>
15 
16 /*
17  * I2C address: 0x1c, 0x1d
18  */
19 
20 /**
21  * struct af9013_platform_data - Platform data for the af9013 driver
22  * @clk: Clock frequency.
23  * @tuner: Used tuner model.
24  * @if_frequency: IF frequency.
25  * @ts_mode: TS mode.
26  * @ts_output_pin: TS output pin.
27  * @spec_inv: Input spectrum inverted.
28  * @api_version: Firmware API version.
29  * @gpio: GPIOs.
30  * @get_dvb_frontend: Get DVB frontend callback.
31  * @get_i2c_adapter: Get I2C adapter.
32  * @pid_filter_ctrl: Control PID filter.
33  * @pid_filter: Set PID to PID filter.
34  */
35 struct af9013_platform_data {
36 	/*
37 	 * 20480000, 25000000, 28000000, 28800000
38 	 */
39 	u32 clk;
40 #define AF9013_TUNER_MXL5003D      3 /* MaxLinear */
41 #define AF9013_TUNER_MXL5005D     13 /* MaxLinear */
42 #define AF9013_TUNER_MXL5005R     30 /* MaxLinear */
43 #define AF9013_TUNER_ENV77H11D5  129 /* Panasonic */
44 #define AF9013_TUNER_MT2060      130 /* Microtune */
45 #define AF9013_TUNER_MC44S803    133 /* Freescale */
46 #define AF9013_TUNER_QT1010      134 /* Quantek */
47 #define AF9013_TUNER_UNKNOWN     140 /* for can tuners ? */
48 #define AF9013_TUNER_MT2060_2    147 /* Microtune */
49 #define AF9013_TUNER_TDA18271    156 /* NXP */
50 #define AF9013_TUNER_QT1010A     162 /* Quantek */
51 #define AF9013_TUNER_MXL5007T    177 /* MaxLinear */
52 #define AF9013_TUNER_TDA18218    179 /* NXP */
53 	u8 tuner;
54 	u32 if_frequency;
55 #define AF9013_TS_MODE_USB       0
56 #define AF9013_TS_MODE_PARALLEL  1
57 #define AF9013_TS_MODE_SERIAL    2
58 	u8 ts_mode;
59 	u8 ts_output_pin;
60 	bool spec_inv;
61 	u8 api_version[4];
62 #define AF9013_GPIO_ON (1 << 0)
63 #define AF9013_GPIO_EN (1 << 1)
64 #define AF9013_GPIO_O  (1 << 2)
65 #define AF9013_GPIO_I  (1 << 3)
66 #define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
67 #define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
68 #define AF9013_GPIO_TUNER_ON  (AF9013_GPIO_ON|AF9013_GPIO_EN)
69 #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
70 	u8 gpio[4];
71 
72 	struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
73 	struct i2c_adapter* (*get_i2c_adapter)(struct i2c_client *);
74 	int (*pid_filter_ctrl)(struct dvb_frontend *, int);
75 	int (*pid_filter)(struct dvb_frontend *, u8, u16, int);
76 };
77 
78 /*
79  * AF9013/5 GPIOs (mostly guessed)
80  * demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
81  * demod#1-gpio#1 - xtal setting (?)
82  * demod#1-gpio#3 - tuner#1
83  * demod#2-gpio#0 - tuner#2
84  * demod#2-gpio#1 - xtal setting (?)
85  */
86 
87 #endif /* AF9013_H */
88