tda18271.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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_7;
  48. struct tda18271_std_map_item qam_8;
  49. };
  50. enum tda18271_role {
  51. TDA18271_MASTER = 0,
  52. TDA18271_SLAVE,
  53. };
  54. enum tda18271_i2c_gate {
  55. TDA18271_GATE_AUTO = 0,
  56. TDA18271_GATE_ANALOG,
  57. TDA18271_GATE_DIGITAL,
  58. };
  59. enum tda18271_output_options {
  60. /* slave tuner output & loop thru & xtal oscillator always on */
  61. TDA18271_OUTPUT_LT_XT_ON = 0,
  62. /* slave tuner output loop thru off */
  63. TDA18271_OUTPUT_LT_OFF = 1,
  64. /* xtal oscillator off */
  65. TDA18271_OUTPUT_XT_OFF = 2,
  66. };
  67. enum tda18271_small_i2c {
  68. TDA18271_39_BYTE_CHUNK_INIT = 0,
  69. TDA18271_16_BYTE_CHUNK_INIT = 16,
  70. TDA18271_08_BYTE_CHUNK_INIT = 8,
  71. TDA18271_03_BYTE_CHUNK_INIT = 3,
  72. };
  73. struct tda18271_config {
  74. /* override default if freq / std settings (optional) */
  75. struct tda18271_std_map *std_map;
  76. /* master / slave tuner: master uses main pll, slave uses cal pll */
  77. enum tda18271_role role;
  78. /* use i2c gate provided by analog or digital demod */
  79. enum tda18271_i2c_gate gate;
  80. /* output options that can be disabled */
  81. enum tda18271_output_options output_opt;
  82. /* some i2c providers can't write all 39 registers at once */
  83. enum tda18271_small_i2c small_i2c;
  84. /* force rf tracking filter calibration on startup */
  85. unsigned int rf_cal_on_startup:1;
  86. /* prevent any register access during attach(),
  87. * delaying both IR & RF calibration until init()
  88. * module option 'cal' overrides this delay */
  89. unsigned int delay_cal:1;
  90. /* interface to saa713x / tda829x */
  91. unsigned int config;
  92. };
  93. #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0
  94. enum tda18271_mode {
  95. TDA18271_ANALOG = 0,
  96. TDA18271_DIGITAL,
  97. };
  98. #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18271)
  99. extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
  100. struct i2c_adapter *i2c,
  101. struct tda18271_config *cfg);
  102. #else
  103. static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
  104. u8 addr,
  105. struct i2c_adapter *i2c,
  106. struct tda18271_config *cfg)
  107. {
  108. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  109. return NULL;
  110. }
  111. #endif
  112. #endif /* __TDA18271_H__ */