cxd2820r_priv.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Sony CXD2820R demodulator driver
  3. *
  4. * Copyright (C) 2010 Antti Palosaari <crope@iki.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. */
  20. #ifndef CXD2820R_PRIV_H
  21. #define CXD2820R_PRIV_H
  22. #include <linux/dvb/version.h>
  23. #include "dvb_frontend.h"
  24. #include "dvb_math.h"
  25. #include "cxd2820r.h"
  26. #include <linux/gpio.h>
  27. struct reg_val_mask {
  28. u32 reg;
  29. u8 val;
  30. u8 mask;
  31. };
  32. struct cxd2820r_priv {
  33. struct i2c_adapter *i2c;
  34. struct dvb_frontend fe;
  35. struct cxd2820r_config cfg;
  36. bool ber_running;
  37. u8 bank[2];
  38. #define GPIO_COUNT 3
  39. u8 gpio[GPIO_COUNT];
  40. #ifdef CONFIG_GPIOLIB
  41. struct gpio_chip gpio_chip;
  42. #endif
  43. enum fe_delivery_system delivery_system;
  44. bool last_tune_failed; /* for switch between T and T2 tune */
  45. };
  46. /* cxd2820r_core.c */
  47. extern int cxd2820r_debug;
  48. int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio);
  49. int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
  50. u8 mask);
  51. int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
  52. int len);
  53. int cxd2820r_wr_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
  54. int len);
  55. int cxd2820r_rd_regs(struct cxd2820r_priv *priv, u32 reginfo, u8 *val,
  56. int len);
  57. int cxd2820r_wr_reg(struct cxd2820r_priv *priv, u32 reg, u8 val);
  58. int cxd2820r_rd_reg(struct cxd2820r_priv *priv, u32 reg, u8 *val);
  59. /* cxd2820r_c.c */
  60. int cxd2820r_get_frontend_c(struct dvb_frontend *fe);
  61. int cxd2820r_set_frontend_c(struct dvb_frontend *fe);
  62. int cxd2820r_read_status_c(struct dvb_frontend *fe, enum fe_status *status);
  63. int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber);
  64. int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe, u16 *strength);
  65. int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr);
  66. int cxd2820r_read_ucblocks_c(struct dvb_frontend *fe, u32 *ucblocks);
  67. int cxd2820r_init_c(struct dvb_frontend *fe);
  68. int cxd2820r_sleep_c(struct dvb_frontend *fe);
  69. int cxd2820r_get_tune_settings_c(struct dvb_frontend *fe,
  70. struct dvb_frontend_tune_settings *s);
  71. /* cxd2820r_t.c */
  72. int cxd2820r_get_frontend_t(struct dvb_frontend *fe);
  73. int cxd2820r_set_frontend_t(struct dvb_frontend *fe);
  74. int cxd2820r_read_status_t(struct dvb_frontend *fe, enum fe_status *status);
  75. int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber);
  76. int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe, u16 *strength);
  77. int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr);
  78. int cxd2820r_read_ucblocks_t(struct dvb_frontend *fe, u32 *ucblocks);
  79. int cxd2820r_init_t(struct dvb_frontend *fe);
  80. int cxd2820r_sleep_t(struct dvb_frontend *fe);
  81. int cxd2820r_get_tune_settings_t(struct dvb_frontend *fe,
  82. struct dvb_frontend_tune_settings *s);
  83. /* cxd2820r_t2.c */
  84. int cxd2820r_get_frontend_t2(struct dvb_frontend *fe);
  85. int cxd2820r_set_frontend_t2(struct dvb_frontend *fe);
  86. int cxd2820r_read_status_t2(struct dvb_frontend *fe, enum fe_status *status);
  87. int cxd2820r_read_ber_t2(struct dvb_frontend *fe, u32 *ber);
  88. int cxd2820r_read_signal_strength_t2(struct dvb_frontend *fe, u16 *strength);
  89. int cxd2820r_read_snr_t2(struct dvb_frontend *fe, u16 *snr);
  90. int cxd2820r_read_ucblocks_t2(struct dvb_frontend *fe, u32 *ucblocks);
  91. int cxd2820r_init_t2(struct dvb_frontend *fe);
  92. int cxd2820r_sleep_t2(struct dvb_frontend *fe);
  93. int cxd2820r_get_tune_settings_t2(struct dvb_frontend *fe,
  94. struct dvb_frontend_tune_settings *s);
  95. #endif /* CXD2820R_PRIV_H */