tda18271.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. struct tda18271_config {
  59. /* override default if freq / std settings (optional) */
  60. struct tda18271_std_map *std_map;
  61. /* master / slave tuner: master uses main pll, slave uses cal pll */
  62. enum tda18271_role role;
  63. /* use i2c gate provided by analog or digital demod */
  64. enum tda18271_i2c_gate gate;
  65. /* some i2c providers cant write all 39 registers at once */
  66. unsigned int small_i2c:1;
  67. };
  68. #if defined(CONFIG_MEDIA_TUNER_TDA18271) || (defined(CONFIG_MEDIA_TUNER_TDA18271_MODULE) && defined(MODULE))
  69. extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
  70. struct i2c_adapter *i2c,
  71. struct tda18271_config *cfg);
  72. #else
  73. static inline struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe,
  74. u8 addr,
  75. struct i2c_adapter *i2c,
  76. struct tda18271_config *cfg)
  77. {
  78. printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
  79. return NULL;
  80. }
  81. #endif
  82. #endif /* __TDA18271_H__ */