blob: 09273b2cd310d6fcd8cf74c5df9fc8e38a377a5f [file] [log] [blame]
Antti Palosaari825b9672008-09-15 15:01:52 -03001/*
Antti Palosaaric89f66f2010-06-17 21:19:13 -03002 * Afatech AF9013 demodulator driver
Antti Palosaari825b9672008-09-15 15:01:52 -03003 *
4 * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
Antti Palosaarif571e002011-11-28 20:58:11 -03005 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
Antti Palosaari825b9672008-09-15 15:01:52 -03006 *
7 * Thanks to Afatech who kindly provided information.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
Antti Palosaarif571e002011-11-28 20:58:11 -030025#ifndef AF9013_H
26#define AF9013_H
Antti Palosaari825b9672008-09-15 15:01:52 -030027
Mauro Carvalho Chehab782d8b72013-03-21 16:11:54 -030028#include <linux/kconfig.h>
Antti Palosaari825b9672008-09-15 15:01:52 -030029#include <linux/dvb/frontend.h>
30
Antti Palosaari825b9672008-09-15 15:01:52 -030031/* AF9013/5 GPIOs (mostly guessed)
32 demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
33 demod#1-gpio#1 - xtal setting (?)
34 demod#1-gpio#3 - tuner#1
35 demod#2-gpio#0 - tuner#2
36 demod#2-gpio#1 - xtal setting (?)
37*/
Antti Palosaarif571e002011-11-28 20:58:11 -030038
39struct af9013_config {
40 /*
41 * I2C address
42 */
43 u8 i2c_addr;
44
45 /*
46 * clock
47 * 20480000, 25000000, 28000000, 28800000
48 */
49 u32 clock;
50
51 /*
52 * tuner
53 */
54#define AF9013_TUNER_MXL5003D 3 /* MaxLinear */
55#define AF9013_TUNER_MXL5005D 13 /* MaxLinear */
56#define AF9013_TUNER_MXL5005R 30 /* MaxLinear */
57#define AF9013_TUNER_ENV77H11D5 129 /* Panasonic */
58#define AF9013_TUNER_MT2060 130 /* Microtune */
59#define AF9013_TUNER_MC44S803 133 /* Freescale */
60#define AF9013_TUNER_QT1010 134 /* Quantek */
61#define AF9013_TUNER_UNKNOWN 140 /* for can tuners ? */
62#define AF9013_TUNER_MT2060_2 147 /* Microtune */
63#define AF9013_TUNER_TDA18271 156 /* NXP */
64#define AF9013_TUNER_QT1010A 162 /* Quantek */
65#define AF9013_TUNER_MXL5007T 177 /* MaxLinear */
66#define AF9013_TUNER_TDA18218 179 /* NXP */
67 u8 tuner;
68
69 /*
70 * IF frequency
71 */
72 u32 if_frequency;
73
74 /*
75 * TS settings
76 */
77#define AF9013_TS_USB 0
78#define AF9013_TS_PARALLEL 1
79#define AF9013_TS_SERIAL 2
80 u8 ts_mode:2;
81
82 /*
83 * input spectrum inversion
84 */
85 bool spec_inv;
86
87 /*
88 * firmware API version
89 */
90 u8 api_version[4];
91
92 /*
93 * GPIOs
94 */
Antti Palosaari825b9672008-09-15 15:01:52 -030095#define AF9013_GPIO_ON (1 << 0)
96#define AF9013_GPIO_EN (1 << 1)
97#define AF9013_GPIO_O (1 << 2)
98#define AF9013_GPIO_I (1 << 3)
Antti Palosaari825b9672008-09-15 15:01:52 -030099#define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
100#define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
Antti Palosaari825b9672008-09-15 15:01:52 -0300101#define AF9013_GPIO_TUNER_ON (AF9013_GPIO_ON|AF9013_GPIO_EN)
102#define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
Antti Palosaari825b9672008-09-15 15:01:52 -0300103 u8 gpio[4];
104};
105
Mauro Carvalho Chehab782d8b72013-03-21 16:11:54 -0300106#if IS_ENABLED(CONFIG_DVB_AF9013)
Antti Palosaari825b9672008-09-15 15:01:52 -0300107extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
108 struct i2c_adapter *i2c);
109#else
110static inline struct dvb_frontend *af9013_attach(
111const struct af9013_config *config, struct i2c_adapter *i2c)
112{
Antti Palosaari8df379c2012-09-12 20:23:43 -0300113 pr_warn("%s: driver disabled by Kconfig\n", __func__);
Antti Palosaari825b9672008-09-15 15:01:52 -0300114 return NULL;
115}
116#endif /* CONFIG_DVB_AF9013 */
117
Antti Palosaarif571e002011-11-28 20:58:11 -0300118#endif /* AF9013_H */