af9013.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Afatech AF9013 demodulator driver
  3. *
  4. * Copyright (C) 2007 Antti Palosaari <crope@iki.fi>
  5. *
  6. * Thanks to Afatech who kindly provided information.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. *
  22. */
  23. #ifndef _AF9013_H_
  24. #define _AF9013_H_
  25. #include <linux/dvb/frontend.h>
  26. enum af9013_ts_mode {
  27. AF9013_OUTPUT_MODE_PARALLEL,
  28. AF9013_OUTPUT_MODE_SERIAL,
  29. AF9013_OUTPUT_MODE_USB, /* only for AF9015 */
  30. };
  31. enum af9013_tuner {
  32. AF9013_TUNER_MXL5003D = 3, /* MaxLinear */
  33. AF9013_TUNER_MXL5005D = 13, /* MaxLinear */
  34. AF9013_TUNER_MXL5005R = 30, /* MaxLinear */
  35. AF9013_TUNER_ENV77H11D5 = 129, /* Panasonic */
  36. AF9013_TUNER_MT2060 = 130, /* Microtune */
  37. AF9013_TUNER_MC44S803 = 133, /* Freescale */
  38. AF9013_TUNER_QT1010 = 134, /* Quantek */
  39. AF9013_TUNER_UNKNOWN = 140, /* for can tuners ? */
  40. AF9013_TUNER_MT2060_2 = 147, /* Microtune */
  41. AF9013_TUNER_TDA18271 = 156, /* NXP */
  42. AF9013_TUNER_QT1010A = 162, /* Quantek */
  43. AF9013_TUNER_MXL5007T = 177, /* MaxLinear */
  44. AF9013_TUNER_TDA18218 = 179, /* NXP */
  45. };
  46. /* AF9013/5 GPIOs (mostly guessed)
  47. demod#1-gpio#0 - set demod#2 i2c-addr for dual devices
  48. demod#1-gpio#1 - xtal setting (?)
  49. demod#1-gpio#3 - tuner#1
  50. demod#2-gpio#0 - tuner#2
  51. demod#2-gpio#1 - xtal setting (?)
  52. */
  53. #define AF9013_GPIO_ON (1 << 0)
  54. #define AF9013_GPIO_EN (1 << 1)
  55. #define AF9013_GPIO_O (1 << 2)
  56. #define AF9013_GPIO_I (1 << 3)
  57. #define AF9013_GPIO_LO (AF9013_GPIO_ON|AF9013_GPIO_EN)
  58. #define AF9013_GPIO_HI (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
  59. #define AF9013_GPIO_TUNER_ON (AF9013_GPIO_ON|AF9013_GPIO_EN)
  60. #define AF9013_GPIO_TUNER_OFF (AF9013_GPIO_ON|AF9013_GPIO_EN|AF9013_GPIO_O)
  61. struct af9013_config {
  62. /* demodulator's I2C address */
  63. u8 demod_address;
  64. /* frequencies in kHz */
  65. u32 adc_clock;
  66. /* tuner ID */
  67. u8 tuner;
  68. /* tuner IF */
  69. u16 tuner_if;
  70. /* TS data output mode */
  71. u8 output_mode:2;
  72. /* RF spectrum inversion */
  73. u8 rf_spec_inv:1;
  74. /* API version */
  75. u8 api_version[4];
  76. /* GPIOs */
  77. u8 gpio[4];
  78. };
  79. #if defined(CONFIG_DVB_AF9013) || \
  80. (defined(CONFIG_DVB_AF9013_MODULE) && defined(MODULE))
  81. extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
  82. struct i2c_adapter *i2c);
  83. #else
  84. static inline struct dvb_frontend *af9013_attach(
  85. const struct af9013_config *config, struct i2c_adapter *i2c)
  86. {
  87. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  88. return NULL;
  89. }
  90. #endif /* CONFIG_DVB_AF9013 */
  91. #endif /* _AF9013_H_ */