cxd2820r_priv.h (3045B)
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Sony CXD2820R demodulator driver 4 * 5 * Copyright (C) 2010 Antti Palosaari <crope@iki.fi> 6 */ 7 8 9#ifndef CXD2820R_PRIV_H 10#define CXD2820R_PRIV_H 11 12#include <linux/dvb/version.h> 13#include <media/dvb_frontend.h> 14#include <media/dvb_math.h> 15#include "cxd2820r.h" 16#include <linux/gpio/driver.h> /* For gpio_chip */ 17#include <linux/math64.h> 18#include <linux/regmap.h> 19 20struct reg_val_mask { 21 u32 reg; 22 u8 val; 23 u8 mask; 24}; 25 26#define CXD2820R_CLK 41000000 27 28struct cxd2820r_priv { 29 struct i2c_client *client[2]; 30 struct regmap *regmap[2]; 31 struct i2c_adapter *i2c; 32 struct dvb_frontend fe; 33 u8 ts_mode; 34 bool ts_clk_inv; 35 bool if_agc_polarity; 36 bool spec_inv; 37 38 u64 post_bit_error_prev_dvbv3; 39 u64 post_bit_error; 40 41 bool ber_running; 42 43#define GPIO_COUNT 3 44 u8 gpio[GPIO_COUNT]; 45#ifdef CONFIG_GPIOLIB 46 struct gpio_chip gpio_chip; 47#endif 48 49 enum fe_delivery_system delivery_system; 50 bool last_tune_failed; /* for switch between T and T2 tune */ 51}; 52 53/* cxd2820r_core.c */ 54 55extern int cxd2820r_debug; 56 57int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio); 58 59int cxd2820r_wr_reg_val_mask_tab(struct cxd2820r_priv *priv, 60 const struct reg_val_mask *tab, int tab_len); 61 62int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val, 63 u8 mask); 64 65int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, 66 int len); 67 68int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, 69 int len); 70 71int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val, 72 int len); 73 74int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val); 75 76int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val); 77 78/* cxd2820r_c.c */ 79 80int cxd2820r_get_frontend_c(struct dvb_frontend *fe, 81 struct dtv_frontend_properties *p); 82 83int cxd2820r_set_frontend_c(struct dvb_frontend *fe); 84 85int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status); 86 87int cxd2820r_init_c(struct dvb_frontend *fe); 88 89int cxd2820r_sleep_c(struct dvb_frontend *fe); 90 91int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe, 92 struct dvb_frontend_tune_settings *s); 93 94/* cxd2820r_t.c */ 95 96int cxd2820r_get_frontend_t(struct dvb_frontend *fe, 97 struct dtv_frontend_properties *p); 98 99int cxd2820r_set_frontend_t(struct dvb_frontend *fe); 100 101int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status); 102 103int cxd2820r_init_t(struct dvb_frontend *fe); 104 105int cxd2820r_sleep_t(struct dvb_frontend *fe); 106 107int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe, 108 struct dvb_frontend_tune_settings *s); 109 110/* cxd2820r_t2.c */ 111 112int cxd2820r_get_frontend_t2(struct dvb_frontend *fe, 113 struct dtv_frontend_properties *p); 114 115int cxd2820r_set_frontend_t2(struct dvb_frontend *fe); 116 117int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status); 118 119int cxd2820r_init_t2(struct dvb_frontend *fe); 120 121int cxd2820r_sleep_t2(struct dvb_frontend *fe); 122 123int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe, 124 struct dvb_frontend_tune_settings *s); 125 126#endif /* CXD2820R_PRIV_H */