cxd2820r_priv.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. #ifndef CXD2820R_PRIV_H
  8. #define CXD2820R_PRIV_H
  9. #include <linux/dvb/version.h>
  10. #include <media/dvb_frontend.h>
  11. #include <media/dvb_math.h>
  12. #include "cxd2820r.h"
  13. #include <linux/gpio.h>
  14. #include <linux/math64.h>
  15. #include <linux/regmap.h>
  16. struct reg_val_mask {
  17. u32 reg;
  18. u8 val;
  19. u8 mask;
  20. };
  21. #define CXD2820R_CLK 41000000
  22. struct cxd2820r_priv {
  23. struct i2c_client *client[2];
  24. struct regmap *regmap[2];
  25. struct i2c_adapter *i2c;
  26. struct dvb_frontend fe;
  27. u8 ts_mode;
  28. bool ts_clk_inv;
  29. bool if_agc_polarity;
  30. bool spec_inv;
  31. u64 post_bit_error_prev_dvbv3;
  32. u64 post_bit_error;
  33. bool ber_running;
  34. #define GPIO_COUNT 3
  35. u8 gpio[GPIO_COUNT];
  36. #ifdef CONFIG_GPIOLIB
  37. struct gpio_chip gpio_chip;
  38. #endif
  39. enum fe_delivery_system delivery_system;
  40. bool last_tune_failed; /* for switch between T and T2 tune */
  41. };
  42. /* cxd2820r_core.c */
  43. extern int cxd2820r_debug;
  44. int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio);
  45. int cxd2820r_wr_reg_val_mask_tab(struct cxd2820r_priv *priv,
  46. const struct reg_val_mask *tab, int tab_len);
  47. int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
  48. u8 mask);
  49. int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
  50. int len);
  51. int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
  52. int len);
  53. int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
  54. int len);
  55. int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val);
  56. int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);
  57. /* cxd2820r_c.c */
  58. int cxd2820r_get_frontend_c(struct dvb_frontend *fe,
  59. struct dtv_frontend_properties *p);
  60. int cxd2820r_set_frontend_c(struct dvb_frontend *fe);
  61. int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status);
  62. int cxd2820r_init_c(struct dvb_frontend *fe);
  63. int cxd2820r_sleep_c(struct dvb_frontend *fe);
  64. int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,
  65. struct dvb_frontend_tune_settings *s);
  66. /* cxd2820r_t.c */
  67. int cxd2820r_get_frontend_t(struct dvb_frontend *fe,
  68. struct dtv_frontend_properties *p);
  69. int cxd2820r_set_frontend_t(struct dvb_frontend *fe);
  70. int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status);
  71. int cxd2820r_init_t(struct dvb_frontend *fe);
  72. int cxd2820r_sleep_t(struct dvb_frontend *fe);
  73. int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,
  74. struct dvb_frontend_tune_settings *s);
  75. /* cxd2820r_t2.c */
  76. int cxd2820r_get_frontend_t2(struct dvb_frontend *fe,
  77. struct dtv_frontend_properties *p);
  78. int cxd2820r_set_frontend_t2(struct dvb_frontend *fe);
  79. int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status);
  80. int cxd2820r_init_t2(struct dvb_frontend *fe);
  81. int cxd2820r_sleep_t2(struct dvb_frontend *fe);
  82. int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,
  83. struct dvb_frontend_tune_settings *s);
  84. #endif /* CXD2820R_PRIV_H */