brintos

brintos / linux-shallow public Read only

0
0
Text · 3.5 KiB · 5a99f0b Raw
150 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3	STB0899 Multistandard Frontend driver4	Copyright (C) Manu Abraham (abraham.manu@gmail.com)5 6	Copyright (C) ST Microelectronics7 8*/9 10#ifndef __STB0899_DRV_H11#define __STB0899_DRV_H12 13#include <linux/kernel.h>14#include <linux/module.h>15 16#include <media/dvb_frontend.h>17 18#define STB0899_TSMODE_SERIAL		119#define STB0899_CLKPOL_FALLING		220#define STB0899_CLKNULL_PARITY		321#define STB0899_SYNC_FORCED		422#define STB0899_FECMODE_DSS		523 24struct stb0899_s1_reg {25	u16	address;26	u8	data;27};28 29struct stb0899_s2_reg {30	u16	offset;31	u32	base_address;32	u32	data;33};34 35enum stb0899_inversion {36	IQ_SWAP_OFF	= +1, /* inversion affects the sign of e. g. */37	IQ_SWAP_ON	= -1, /* the derotator frequency register    */38};39 40#define STB0899_GPIO00				0xf14041#define STB0899_GPIO01				0xf14142#define STB0899_GPIO02				0xf14243#define STB0899_GPIO03				0xf14344#define STB0899_GPIO04				0xf14445#define STB0899_GPIO05				0xf14546#define STB0899_GPIO06				0xf14647#define STB0899_GPIO07				0xf14748#define STB0899_GPIO08				0xf14849#define STB0899_GPIO09				0xf14950#define STB0899_GPIO10				0xf14a51#define STB0899_GPIO11				0xf14b52#define STB0899_GPIO12				0xf14c53#define STB0899_GPIO13				0xf14d54#define STB0899_GPIO14				0xf14e55#define STB0899_GPIO15				0xf14f56#define STB0899_GPIO16				0xf15057#define STB0899_GPIO17				0xf15158#define STB0899_GPIO18				0xf15259#define STB0899_GPIO19				0xf15360#define STB0899_GPIO20				0xf15461 62#define STB0899_GPIOPULLUP			0x01 /* Output device is connected to Vdd */63#define STB0899_GPIOPULLDN			0x00 /* Output device is connected to Vss */64 65#define STB0899_POSTPROC_GPIO_POWER		0x0066#define STB0899_POSTPROC_GPIO_LOCK		0x0167 68/*69 * Post process output configuration control70 * 1. POWER ON/OFF		(index 0)71 * 2. FE_HAS_LOCK/LOCK_LOSS	(index 1)72 *73 * @gpio	= one of the above listed GPIO's74 * @level	= output state: pulled up or low75 */76struct stb0899_postproc {77	u16	gpio;78	u8	level;79};80 81struct stb0899_config {82	const struct stb0899_s1_reg	*init_dev;83	const struct stb0899_s2_reg	*init_s2_demod;84	const struct stb0899_s1_reg	*init_s1_demod;85	const struct stb0899_s2_reg	*init_s2_fec;86	const struct stb0899_s1_reg	*init_tst;87 88	const struct stb0899_postproc	*postproc;89 90	enum stb0899_inversion		inversion;91 92	u32	xtal_freq;93 94	u8	demod_address;95	u8	ts_output_mode;96	u8	block_sync_mode;97	u8	ts_pfbit_toggle;98 99	u8	clock_polarity;100	u8	data_clk_parity;101	u8	fec_mode;102	u8	data_output_ctl;103	u8	data_fifo_mode;104	u8	out_rate_comp;105	u8	i2c_repeater;106//	int	inversion;107	int	lo_clk;108	int	hi_clk;109 110	u32	esno_ave;111	u32	esno_quant;112	u32	avframes_coarse;113	u32	avframes_fine;114	u32	miss_threshold;115	u32	uwp_threshold_acq;116	u32	uwp_threshold_track;117	u32	uwp_threshold_sof;118	u32	sof_search_timeout;119 120	u32	btr_nco_bits;121	u32	btr_gain_shift_offset;122	u32	crl_nco_bits;123	u32	ldpc_max_iter;124 125	int (*tuner_set_frequency)(struct dvb_frontend *fe, u32 frequency);126	int (*tuner_get_frequency)(struct dvb_frontend *fe, u32 *frequency);127	int (*tuner_set_bandwidth)(struct dvb_frontend *fe, u32 bandwidth);128	int (*tuner_get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth);129	int (*tuner_set_rfsiggain)(struct dvb_frontend *fe, u32 rf_gain);130};131 132#if IS_REACHABLE(CONFIG_DVB_STB0899)133 134extern struct dvb_frontend *stb0899_attach(struct stb0899_config *config,135					   struct i2c_adapter *i2c);136 137#else138 139static inline struct dvb_frontend *stb0899_attach(struct stb0899_config *config,140						  struct i2c_adapter *i2c)141{142	printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);143	return NULL;144}145 146#endif //CONFIG_DVB_STB0899147 148 149#endif150