Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Sony CXD2820R demodulator driver
0004  *
0005  * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
0006  */
0007 
0008 
0009 #ifndef CXD2820R_PRIV_H
0010 #define CXD2820R_PRIV_H
0011 
0012 #include <linux/dvb/version.h>
0013 #include <media/dvb_frontend.h>
0014 #include <media/dvb_math.h>
0015 #include "cxd2820r.h"
0016 #include <linux/gpio/driver.h> /* For gpio_chip */
0017 #include <linux/math64.h>
0018 #include <linux/regmap.h>
0019 
0020 struct reg_val_mask {
0021     u32 reg;
0022     u8  val;
0023     u8  mask;
0024 };
0025 
0026 #define CXD2820R_CLK 41000000
0027 
0028 struct cxd2820r_priv {
0029     struct i2c_client *client[2];
0030     struct regmap *regmap[2];
0031     struct i2c_adapter *i2c;
0032     struct dvb_frontend fe;
0033     u8 ts_mode;
0034     bool ts_clk_inv;
0035     bool if_agc_polarity;
0036     bool spec_inv;
0037 
0038     u64 post_bit_error_prev_dvbv3;
0039     u64 post_bit_error;
0040 
0041     bool ber_running;
0042 
0043 #define GPIO_COUNT 3
0044     u8 gpio[GPIO_COUNT];
0045 #ifdef CONFIG_GPIOLIB
0046     struct gpio_chip gpio_chip;
0047 #endif
0048 
0049     enum fe_delivery_system delivery_system;
0050     bool last_tune_failed; /* for switch between T and T2 tune */
0051 };
0052 
0053 /* cxd2820r_core.c */
0054 
0055 extern int cxd2820r_debug;
0056 
0057 int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio);
0058 
0059 int cxd2820r_wr_reg_val_mask_tab(struct cxd2820r_priv *priv,
0060                  const struct reg_val_mask *tab, int tab_len);
0061 
0062 int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
0063     u8 mask);
0064 
0065 int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
0066     int len);
0067 
0068 int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
0069     int len);
0070 
0071 int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
0072     int len);
0073 
0074 int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val);
0075 
0076 int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);
0077 
0078 /* cxd2820r_c.c */
0079 
0080 int cxd2820r_get_frontend_c(struct dvb_frontend *fe,
0081                 struct dtv_frontend_properties *p);
0082 
0083 int cxd2820r_set_frontend_c(struct dvb_frontend *fe);
0084 
0085 int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status);
0086 
0087 int cxd2820r_init_c(struct dvb_frontend *fe);
0088 
0089 int cxd2820r_sleep_c(struct dvb_frontend *fe);
0090 
0091 int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,
0092     struct dvb_frontend_tune_settings *s);
0093 
0094 /* cxd2820r_t.c */
0095 
0096 int cxd2820r_get_frontend_t(struct dvb_frontend *fe,
0097                 struct dtv_frontend_properties *p);
0098 
0099 int cxd2820r_set_frontend_t(struct dvb_frontend *fe);
0100 
0101 int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status);
0102 
0103 int cxd2820r_init_t(struct dvb_frontend *fe);
0104 
0105 int cxd2820r_sleep_t(struct dvb_frontend *fe);
0106 
0107 int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,
0108     struct dvb_frontend_tune_settings *s);
0109 
0110 /* cxd2820r_t2.c */
0111 
0112 int cxd2820r_get_frontend_t2(struct dvb_frontend *fe,
0113                  struct dtv_frontend_properties *p);
0114 
0115 int cxd2820r_set_frontend_t2(struct dvb_frontend *fe);
0116 
0117 int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status);
0118 
0119 int cxd2820r_init_t2(struct dvb_frontend *fe);
0120 
0121 int cxd2820r_sleep_t2(struct dvb_frontend *fe);
0122 
0123 int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,
0124     struct dvb_frontend_tune_settings *s);
0125 
0126 #endif /* CXD2820R_PRIV_H */