tda18271.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. tda18271.h - header for the Philips / NXP TDA18271 silicon tuner
  3. Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef __TDA18271_H__
  17. #define __TDA18271_H__
  18. #include <linux/i2c.h>
  19. #include "dvb_frontend.h"
  20. struct tda18271_std_map_item {
  21. u16 if_freq;
  22. /* EP3[4:3] */
  23. unsigned int agc_mode:2;
  24. /* EP3[2:0] */
  25. unsigned int std:3;
  26. /* EP4[7] */
  27. unsigned int fm_rfn:1;
  28. /* EP4[4:2] */
  29. unsigned int if_lvl:3;
  30. /* EB22[6:0] */
  31. unsigned int rfagc_top:7;
  32. };
  33. struct tda18271_std_map {
  34. struct tda18271_std_map_item fm_radio;
  35. struct tda18271_std_map_item atv_b;
  36. struct tda18271_std_map_item atv_dk;
  37. struct tda18271_std_map_item atv_gh;
  38. struct tda18271_std_map_item atv_i;
  39. struct tda18271_std_map_item atv_l;
  40. struct tda18271_std_map_item atv_lc;
  41. struct tda18271_std_map_item atv_mn;
  42. struct tda18271_std_map_item atsc_6;
  43. struct tda18271_std_map_item dvbt_6;
  44. struct tda18271_std_map_item dvbt_7;
  45. struct tda18271_std_map_item dvbt_8;
  46. struct tda18271_std_map_item qam_6;
  47. struct tda18271_std_map_item qam_8;
  48. };
  49. enum tda18271_role {
  50. TDA18271_MASTER = 0,
  51. TDA18271_SLAVE,
  52. };
  53. enum tda18271_i2c_gate {
  54. TDA18271_GATE_AUTO = 0,
  55. TDA18271_GATE_ANALOG,
  56. TDA18271_GATE_DIGITAL,
  57. };
  58. enum tda18271_standby_mode {
  59. /* slave tuner output & loop thru & xtal oscillator on */
  60. TDA18271_STANDBY_LT_XT_ON = 0,
  61. /* xtal oscillator on */
  62. TDA18271_STANDBY_XT_ON,
  63. /* slave tuner output / loop thru on */
  64. TDA18271_STANDBY_LT_ON,
  65. /* power off */
  66. TDA18271_STANDBY_POWER_OFF,
  67. };
  68. struct tda18271_config {
  69. /* override default if freq / std settings (optional) */
  70. struct tda18271_std_map *std_map;
  71. /* master / slave tuner: master uses main pll, slave uses cal pll */
  72. enum tda18271_role role;
  73. /* use i2c gate provided by analog or digital demod */
  74. enum tda18271_i2c_gate gate;
  75. /* allow lower power standby modes */
  76. enum tda18271_standby_mode standby_mode;
  77. /* force rf tracking filter calibration on startup */
  78. unsigned int rf_cal_on_startup:1;
  79. /* some i2c providers cant write all 39 registers at once */
  80. unsigned int small_i2c:1;
  81. /* interface to saa713x / tda829x */
  82. unsigned int config;
  83. };
  84. #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0
  85. enum tda18271_mode {
  86. TDA18271_ANALOG = 0,
  87. TDA18271_DIGITAL,
  88. };
  89. #if defined(CONFIG_MEDIA_TUNER_TDA18271) || (defined(CONFIG_MEDIA_TUNER_TDA18271_MODULE) && defined(MODULE))
  90. extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
  91. struct i2c_adapter *i2c,
  92. struct tda18271_config *cfg);
  93. #else
  94. static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
  95. u8 addr,
  96. struct i2c_adapter *i2c,
  97. struct tda18271_config *cfg)
  98. {
  99. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  100. return NULL;
  101. }
  102. #endif
  103. #endif /* __TDA18271_H__ */