md-cluster: Fix potential error pointer dereference in resize_bitmaps()
[linux/fpc-iii.git] / drivers / media / dvb-frontends / cxd2820r.h
bloba28b8754932b4ec104886447bd2c500f0cf5021c
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Sony CXD2820R demodulator driver
5 * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
6 */
9 #ifndef CXD2820R_H
10 #define CXD2820R_H
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
30 /**
31 * struct cxd2820r_platform_data - Platform data for the cxd2820r driver
32 * @ts_mode: TS mode.
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 {
40 u8 ts_mode;
41 bool ts_clk_inv;
42 bool if_agc_polarity;
43 bool spec_inv;
44 int **gpio_chip_base;
46 struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
47 /* private: For legacy media attach wrapper. Do not set value. */
48 bool attach_in_use;
51 /**
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
65 * address.
66 * Default: none, must set
67 * Values: 0x6c, 0x6d
69 u8 i2c_address;
71 /* TS output mode.
72 * Default: none, must set.
73 * Values:
75 u8 ts_mode;
77 /* TS clock inverted.
78 * Default: 0
79 * Values: 0, 1
81 bool ts_clock_inv;
83 /* IF AGC polarity.
84 * Default: 0
85 * Values: 0, 1
87 bool if_agc_polarity;
89 /* Spectrum inversion.
90 * Default: 0
91 * Values: 0, 1
93 bool spec_inv;
97 #if IS_REACHABLE(CONFIG_DVB_CXD2820R)
98 /**
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,
113 int *gpio_chip_base
115 #else
116 static inline struct dvb_frontend *cxd2820r_attach(
117 const struct cxd2820r_config *config,
118 struct i2c_adapter *i2c,
119 int *gpio_chip_base
122 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
123 return NULL;
126 #endif
128 #endif /* CXD2820R_H */