cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

stb0899_drv.h (3561B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3	STB0899 Multistandard Frontend driver
      4	Copyright (C) Manu Abraham (abraham.manu@gmail.com)
      5
      6	Copyright (C) ST Microelectronics
      7
      8*/
      9
     10#ifndef __STB0899_DRV_H
     11#define __STB0899_DRV_H
     12
     13#include <linux/kernel.h>
     14#include <linux/module.h>
     15
     16#include <media/dvb_frontend.h>
     17
     18#define STB0899_TSMODE_SERIAL		1
     19#define STB0899_CLKPOL_FALLING		2
     20#define STB0899_CLKNULL_PARITY		3
     21#define STB0899_SYNC_FORCED		4
     22#define STB0899_FECMODE_DSS		5
     23
     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				0xf140
     41#define STB0899_GPIO01				0xf141
     42#define STB0899_GPIO02				0xf142
     43#define STB0899_GPIO03				0xf143
     44#define STB0899_GPIO04				0xf144
     45#define STB0899_GPIO05				0xf145
     46#define STB0899_GPIO06				0xf146
     47#define STB0899_GPIO07				0xf147
     48#define STB0899_GPIO08				0xf148
     49#define STB0899_GPIO09				0xf149
     50#define STB0899_GPIO10				0xf14a
     51#define STB0899_GPIO11				0xf14b
     52#define STB0899_GPIO12				0xf14c
     53#define STB0899_GPIO13				0xf14d
     54#define STB0899_GPIO14				0xf14e
     55#define STB0899_GPIO15				0xf14f
     56#define STB0899_GPIO16				0xf150
     57#define STB0899_GPIO17				0xf151
     58#define STB0899_GPIO18				0xf152
     59#define STB0899_GPIO19				0xf153
     60#define STB0899_GPIO20				0xf154
     61
     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		0x00
     66#define STB0899_POSTPROC_GPIO_LOCK		0x01
     67
     68/*
     69 * Post process output configuration control
     70 * 1. POWER ON/OFF		(index 0)
     71 * 2. FE_HAS_LOCK/LOCK_LOSS	(index 1)
     72 *
     73 * @gpio	= one of the above listed GPIO's
     74 * @level	= output state: pulled up or low
     75 */
     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#else
    138
    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_STB0899
    147
    148
    149#endif