brintos

brintos / linux-shallow public Read only

0
0
Text · 3.1 KiB · 4aa6cf4 Raw
129 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * Sony CXD2820R demodulator driver4 *5 * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>6 */7 8 9#ifndef CXD2820R_H10#define CXD2820R_H11 12#include <linux/dvb/frontend.h>13 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 */20 21#define CXD2820R_TS_SERIAL        0x0822#define CXD2820R_TS_SERIAL_MSB    0x2823#define CXD2820R_TS_PARALLEL      0x3024#define CXD2820R_TS_PARALLEL_MSB  0x7025 26/*27 * I2C address: 0x6c, 0x6d28 */29 30/**31 * struct cxd2820r_platform_data - Platform data for the cxd2820r driver32 * @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.38 */39struct 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;45 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;49};50 51/**52 * struct cxd2820r_config - configuration for cxd2020r demod53 *54 * @i2c_address: Demodulator I2C address. Driver determines DVB-C slave I2C55 *		 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, 160 * @spec_inv:	Spectrum inversion. Default: 0. Values: 0, 1.61 */62struct cxd2820r_config {63	/* Demodulator I2C address.64	 * Driver determines DVB-C slave I2C address automatically from master65	 * address.66	 * Default: none, must set67	 * Values: 0x6c, 0x6d68	 */69	u8 i2c_address;70 71	/* TS output mode.72	 * Default: none, must set.73	 * Values:74	 */75	u8 ts_mode;76 77	/* TS clock inverted.78	 * Default: 079	 * Values: 0, 180	 */81	bool ts_clock_inv;82 83	/* IF AGC polarity.84	 * Default: 085	 * Values: 0, 186	 */87	bool if_agc_polarity;88 89	/* Spectrum inversion.90	 * Default: 091	 * Values: 0, 192	 */93	bool spec_inv;94};95 96 97#if IS_REACHABLE(CONFIG_DVB_CXD2820R)98/**99 * cxd2820r_attach - Attach a cxd2820r demod100 *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, if104 *		    CONFIG_GPIOLIB is set dynamically allocate105 *		    gpio base; if is not set, use its value to106 *		    setup the GPIO pins.107 *108 * return: FE pointer on success, NULL on failure.109 */110extern struct dvb_frontend *cxd2820r_attach(111	const struct cxd2820r_config *config,112	struct i2c_adapter *i2c,113	int *gpio_chip_base114);115#else116static inline struct dvb_frontend *cxd2820r_attach(117	const struct cxd2820r_config *config,118	struct i2c_adapter *i2c,119	int *gpio_chip_base120)121{122	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);123	return NULL;124}125 126#endif127 128#endif /* CXD2820R_H */129