blob: 82b3d93718f8923adc428f6e953a4362f8658fc4 [file] [log] [blame]
Antti Palosaari27cfc852011-04-07 16:27:43 -03001/*
2 * Sony CXD2820R demodulator driver
3 *
4 * Copyright (C) 2010 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
22#ifndef CXD2820R_H
23#define CXD2820R_H
24
Mauro Carvalho Chehab782d8b72013-03-21 16:11:54 -030025#include <linux/kconfig.h>
Antti Palosaari27cfc852011-04-07 16:27:43 -030026#include <linux/dvb/frontend.h>
27
28#define CXD2820R_GPIO_D (0 << 0) /* disable */
29#define CXD2820R_GPIO_E (1 << 0) /* enable */
30#define CXD2820R_GPIO_O (0 << 1) /* output */
31#define CXD2820R_GPIO_I (1 << 1) /* input */
32#define CXD2820R_GPIO_L (0 << 2) /* output low */
33#define CXD2820R_GPIO_H (1 << 2) /* output high */
34
35#define CXD2820R_TS_SERIAL 0x08
36#define CXD2820R_TS_SERIAL_MSB 0x28
37#define CXD2820R_TS_PARALLEL 0x30
38#define CXD2820R_TS_PARALLEL_MSB 0x70
39
40struct cxd2820r_config {
41 /* Demodulator I2C address.
42 * Driver determines DVB-C slave I2C address automatically from master
43 * address.
44 * Default: none, must set
45 * Values: 0x6c, 0x6d
46 */
47 u8 i2c_address;
48
49 /* TS output mode.
50 * Default: none, must set.
51 * Values:
52 */
53 u8 ts_mode;
54
55 /* IF AGC polarity.
56 * Default: 0
57 * Values: 0, 1
58 */
Antti Palosaari1d44ccb2011-05-25 12:42:52 -030059 bool if_agc_polarity;
Antti Palosaari27cfc852011-04-07 16:27:43 -030060
61 /* Spectrum inversion.
62 * Default: 0
63 * Values: 0, 1
64 */
Antti Palosaari1d44ccb2011-05-25 12:42:52 -030065 bool spec_inv;
Antti Palosaari27cfc852011-04-07 16:27:43 -030066};
67
68
Mauro Carvalho Chehab782d8b72013-03-21 16:11:54 -030069#if IS_ENABLED(CONFIG_DVB_CXD2820R)
Antti Palosaari27cfc852011-04-07 16:27:43 -030070extern struct dvb_frontend *cxd2820r_attach(
71 const struct cxd2820r_config *config,
Antti Palosaari1e8f31f2012-07-19 21:10:36 -030072 struct i2c_adapter *i2c,
73 int *gpio_chip_base
Antti Palosaari27cfc852011-04-07 16:27:43 -030074);
Antti Palosaari27cfc852011-04-07 16:27:43 -030075#else
76static inline struct dvb_frontend *cxd2820r_attach(
77 const struct cxd2820r_config *config,
Antti Palosaari1e8f31f2012-07-19 21:10:36 -030078 struct i2c_adapter *i2c,
79 int *gpio_chip_base
Antti Palosaari27cfc852011-04-07 16:27:43 -030080)
81{
82 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
83 return NULL;
84}
Antti Palosaari27cfc852011-04-07 16:27:43 -030085
86#endif
87
88#endif /* CXD2820R_H */