blob: 0ffbfa5b2dfbdf3564fa55b6b2662b7207c9388e [file] [log] [blame]
Antti Palosaaride8e4202011-08-01 01:07:39 -03001/*
2 * NXP TDA10071 + Conexant CX24118A DVB-S/S2 demodulator + tuner driver
3 *
4 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#ifndef TDA10071_H
22#define TDA10071_H
23
Mauro Carvalho Chehab782d8b72013-03-21 16:11:54 -030024#include <linux/kconfig.h>
Antti Palosaaride8e4202011-08-01 01:07:39 -030025#include <linux/dvb/frontend.h>
26
Antti Palosaarid69abb72015-04-16 11:46:24 -030027/*
28 * I2C address
29 * 0x55,
30 */
31
32/**
33 * struct tda10071_platform_data - Platform data for the tda10071 driver
34 * @clk: Clock frequency.
35 * @i2c_wr_max: Max bytes I2C adapter can write at once.
36 * @ts_mode: TS mode.
37 * @spec_inv: Input spectrum inversion.
38 * @pll_multiplier: PLL multiplier.
39 * @tuner_i2c_addr: CX24118A tuner I2C address (0x14, 0x54, ...).
40 * @get_dvb_frontend: Get DVB frontend.
41 */
42
43struct tda10071_platform_data {
44 u32 clk;
45 u16 i2c_wr_max;
46#define TDA10071_TS_SERIAL 0
47#define TDA10071_TS_PARALLEL 1
48 u8 ts_mode;
49 bool spec_inv;
50 u8 pll_multiplier;
51 u8 tuner_i2c_addr;
52
53 struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
54};
55
Antti Palosaaride8e4202011-08-01 01:07:39 -030056struct tda10071_config {
57 /* Demodulator I2C address.
58 * Default: none, must set
59 * Values: 0x55,
60 */
Michael Krufky41f55d52012-12-16 19:37:11 -030061 u8 demod_i2c_addr;
Antti Palosaaride8e4202011-08-01 01:07:39 -030062
Michael Krufky0176fd42012-12-16 13:24:59 -030063 /* Tuner I2C address.
Michael Krufky41f55d52012-12-16 19:37:11 -030064 * Default: none, must set
Michael Krufky0176fd42012-12-16 13:24:59 -030065 * Values: 0x14, 0x54, ...
66 */
67 u8 tuner_i2c_addr;
68
Antti Palosaaride8e4202011-08-01 01:07:39 -030069 /* Max bytes I2C provider can write at once.
70 * Note: Buffer is taken from the stack currently!
71 * Default: none, must set
72 * Values:
73 */
74 u16 i2c_wr_max;
75
76 /* TS output mode.
77 * Default: TDA10071_TS_SERIAL
78 * Values:
79 */
80#define TDA10071_TS_SERIAL 0
81#define TDA10071_TS_PARALLEL 1
82 u8 ts_mode;
83
84 /* Input spectrum inversion.
85 * Default: 0
86 * Values: 0, 1
87 */
88 bool spec_inv;
89
90 /* Xtal frequency Hz
91 * Default: none, must set
92 * Values:
93 */
94 u32 xtal;
95
96 /* PLL multiplier.
97 * Default: none, must set
98 * Values:
99 */
100 u8 pll_multiplier;
101};
102
103
Arnd Bergmann9b174522015-02-18 14:12:42 -0300104#if IS_REACHABLE(CONFIG_DVB_TDA10071)
Antti Palosaaride8e4202011-08-01 01:07:39 -0300105extern struct dvb_frontend *tda10071_attach(
106 const struct tda10071_config *config, struct i2c_adapter *i2c);
107#else
108static inline struct dvb_frontend *tda10071_attach(
109 const struct tda10071_config *config, struct i2c_adapter *i2c)
110{
Antti Palosaari116802f2014-02-11 15:13:46 -0300111 dev_warn(&i2c->dev, "%s: driver disabled by Kconfig\n", __func__);
Antti Palosaaride8e4202011-08-01 01:07:39 -0300112 return NULL;
113}
114#endif
115
116#endif /* TDA10071_H */