tda18271.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. tda18271.h - header for the Philips / NXP TDA18271 silicon tuner
  4. Copyright (C) 2007, 2008 Michael Krufky <mkrufky@linuxtv.org>
  5. */
  6. #ifndef __TDA18271_H__
  7. #define __TDA18271_H__
  8. #include <linux/i2c.h>
  9. #include <media/dvb_frontend.h>
  10. struct tda18271_std_map_item {
  11. u16 if_freq;
  12. /* EP3[4:3] */
  13. unsigned int agc_mode:2;
  14. /* EP3[2:0] */
  15. unsigned int std:3;
  16. /* EP4[7] */
  17. unsigned int fm_rfn:1;
  18. /* EP4[4:2] */
  19. unsigned int if_lvl:3;
  20. /* EB22[6:0] */
  21. unsigned int rfagc_top:7;
  22. };
  23. struct tda18271_std_map {
  24. struct tda18271_std_map_item fm_radio;
  25. struct tda18271_std_map_item atv_b;
  26. struct tda18271_std_map_item atv_dk;
  27. struct tda18271_std_map_item atv_gh;
  28. struct tda18271_std_map_item atv_i;
  29. struct tda18271_std_map_item atv_l;
  30. struct tda18271_std_map_item atv_lc;
  31. struct tda18271_std_map_item atv_mn;
  32. struct tda18271_std_map_item atsc_6;
  33. struct tda18271_std_map_item dvbt_6;
  34. struct tda18271_std_map_item dvbt_7;
  35. struct tda18271_std_map_item dvbt_8;
  36. struct tda18271_std_map_item qam_6;
  37. struct tda18271_std_map_item qam_7;
  38. struct tda18271_std_map_item qam_8;
  39. };
  40. enum tda18271_role {
  41. TDA18271_MASTER = 0,
  42. TDA18271_SLAVE,
  43. };
  44. enum tda18271_i2c_gate {
  45. TDA18271_GATE_AUTO = 0,
  46. TDA18271_GATE_ANALOG,
  47. TDA18271_GATE_DIGITAL,
  48. };
  49. enum tda18271_output_options {
  50. /* slave tuner output & loop through & xtal oscillator always on */
  51. TDA18271_OUTPUT_LT_XT_ON = 0,
  52. /* slave tuner output loop through off */
  53. TDA18271_OUTPUT_LT_OFF = 1,
  54. /* xtal oscillator off */
  55. TDA18271_OUTPUT_XT_OFF = 2,
  56. };
  57. enum tda18271_small_i2c {
  58. TDA18271_39_BYTE_CHUNK_INIT = 0,
  59. TDA18271_16_BYTE_CHUNK_INIT = 16,
  60. TDA18271_08_BYTE_CHUNK_INIT = 8,
  61. TDA18271_03_BYTE_CHUNK_INIT = 3,
  62. };
  63. struct tda18271_config {
  64. /* override default if freq / std settings (optional) */
  65. struct tda18271_std_map *std_map;
  66. /* master / slave tuner: master uses main pll, slave uses cal pll */
  67. enum tda18271_role role;
  68. /* use i2c gate provided by analog or digital demod */
  69. enum tda18271_i2c_gate gate;
  70. /* output options that can be disabled */
  71. enum tda18271_output_options output_opt;
  72. /* some i2c providers can't write all 39 registers at once */
  73. enum tda18271_small_i2c small_i2c;
  74. /* force rf tracking filter calibration on startup */
  75. unsigned int rf_cal_on_startup:1;
  76. /* prevent any register access during attach(),
  77. * delaying both IR & RF calibration until init()
  78. * module option 'cal' overrides this delay */
  79. unsigned int delay_cal:1;
  80. /* interface to saa713x / tda829x */
  81. unsigned int config;
  82. };
  83. #define TDA18271_CALLBACK_CMD_AGC_ENABLE 0
  84. enum tda18271_mode {
  85. TDA18271_ANALOG = 0,
  86. TDA18271_DIGITAL,
  87. };
  88. #if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18271)
  89. extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
  90. struct i2c_adapter *i2c,
  91. struct tda18271_config *cfg);
  92. #else
  93. static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
  94. u8 addr,
  95. struct i2c_adapter *i2c,
  96. struct tda18271_config *cfg)
  97. {
  98. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  99. return NULL;
  100. }
  101. #endif
  102. #endif /* __TDA18271_H__ */