1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Sony CXD2820R demodulator driver
5 * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
12 #include <linux/dvb/frontend.h>
14 #define CXD2820R_GPIO_D (0 << 0) /* disable */
15 #define CXD2820R_GPIO_E (1 << 0) /* enable */
16 #define CXD2820R_GPIO_O (0 << 1) /* output */
17 #define CXD2820R_GPIO_I (1 << 1) /* input */
18 #define CXD2820R_GPIO_L (0 << 2) /* output low */
19 #define CXD2820R_GPIO_H (1 << 2) /* output high */
21 #define CXD2820R_TS_SERIAL 0x08
22 #define CXD2820R_TS_SERIAL_MSB 0x28
23 #define CXD2820R_TS_PARALLEL 0x30
24 #define CXD2820R_TS_PARALLEL_MSB 0x70
27 * I2C address: 0x6c, 0x6d
31 * struct cxd2820r_platform_data - Platform data for the cxd2820r driver
33 * @ts_clk_inv: TS clock inverted.
34 * @if_agc_polarity: IF AGC polarity.
35 * @spec_inv: Input spectrum inverted.
36 * @gpio_chip_base: GPIO.
37 * @get_dvb_frontend: Get DVB frontend.
39 struct cxd2820r_platform_data
{
46 struct dvb_frontend
* (*get_dvb_frontend
)(struct i2c_client
*);
47 /* private: For legacy media attach wrapper. Do not set value. */
52 * struct cxd2820r_config - configuration for cxd2020r demod
54 * @i2c_address: Demodulator I2C address. Driver determines DVB-C slave I2C
55 * address automatically from master address.
56 * Default: none, must set. Values: 0x6c, 0x6d.
57 * @ts_mode: TS output mode. Default: none, must set. Values: FIXME?
58 * @ts_clock_inv: TS clock inverted. Default: 0. Values: 0, 1.
59 * @if_agc_polarity: Default: 0. Values: 0, 1
60 * @spec_inv: Spectrum inversion. Default: 0. Values: 0, 1.
62 struct cxd2820r_config
{
63 /* Demodulator I2C address.
64 * Driver determines DVB-C slave I2C address automatically from master
66 * Default: none, must set
72 * Default: none, must set.
89 /* Spectrum inversion.
97 #if IS_REACHABLE(CONFIG_DVB_CXD2820R)
99 * Attach a cxd2820r demod
101 * @config: pointer to &struct cxd2820r_config with demod configuration.
102 * @i2c: i2c adapter to use.
103 * @gpio_chip_base: if zero, disables GPIO setting. Otherwise, if
104 * CONFIG_GPIOLIB is set dynamically allocate
105 * gpio base; if is not set, use its value to
106 * setup the GPIO pins.
108 * return: FE pointer on success, NULL on failure.
110 extern struct dvb_frontend
*cxd2820r_attach(
111 const struct cxd2820r_config
*config
,
112 struct i2c_adapter
*i2c
,
116 static inline struct dvb_frontend
*cxd2820r_attach(
117 const struct cxd2820r_config
*config
,
118 struct i2c_adapter
*i2c
,
122 printk(KERN_WARNING
"%s: driver disabled by Kconfig\n", __func__
);
128 #endif /* CXD2820R_H */