stb6100.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. STB6100 Silicon Tuner
  3. Copyright (C) Manu Abraham (abraham.manu@gmail.com)
  4. Copyright (C) ST Microelectronics
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #ifndef __STB_6100_REG_H
  18. #define __STB_6100_REG_H
  19. #include <linux/dvb/frontend.h>
  20. #include "dvb_frontend.h"
  21. #define STB6100_LD 0x00
  22. #define STB6100_LD_LOCK (1 << 0)
  23. #define STB6100_VCO 0x01
  24. #define STB6100_VCO_OSCH (0x01 << 7)
  25. #define STB6100_VCO_OSCH_SHIFT 7
  26. #define STB6100_VCO_OCK (0x03 << 5)
  27. #define STB6100_VCO_OCK_SHIFT 5
  28. #define STB6100_VCO_ODIV (0x01 << 4)
  29. #define STB6100_VCO_ODIV_SHIFT 4
  30. #define STB6100_VCO_OSM (0x0f << 0)
  31. #define STB6100_NI 0x02
  32. #define STB6100_NF_LSB 0x03
  33. #define STB6100_K 0x04
  34. #define STB6100_K_PSD2 (0x01 << 2)
  35. #define STB6100_K_PSD2_SHIFT 2
  36. #define STB6100_K_NF_MSB (0x03 << 0)
  37. #define STB6100_G 0x05
  38. #define STB6100_G_G (0x0f << 0)
  39. #define STB6100_G_GCT (0x07 << 5)
  40. #define STB6100_F 0x06
  41. #define STB6100_F_F (0x1f << 0)
  42. #define STB6100_DLB 0x07
  43. #define STB6100_TEST1 0x08
  44. #define STB6100_FCCK 0x09
  45. #define STB6100_FCCK_FCCK (0x01 << 6)
  46. #define STB6100_LPEN 0x0a
  47. #define STB6100_LPEN_LPEN (0x01 << 4)
  48. #define STB6100_LPEN_SYNP (0x01 << 5)
  49. #define STB6100_LPEN_OSCP (0x01 << 6)
  50. #define STB6100_LPEN_BEN (0x01 << 7)
  51. #define STB6100_TEST3 0x0b
  52. #define STB6100_NUMREGS 0x0c
  53. #define INRANGE(val, x, y) (((x <= val) && (val <= y)) || \
  54. ((y <= val) && (val <= x)) ? 1 : 0)
  55. #define CHKRANGE(val, x, y) (((val >= x) && (val < y)) ? 1 : 0)
  56. struct stb6100_config {
  57. u8 tuner_address;
  58. u32 refclock;
  59. };
  60. struct stb6100_state {
  61. struct i2c_adapter *i2c;
  62. const struct stb6100_config *config;
  63. struct dvb_tuner_ops ops;
  64. struct dvb_frontend *frontend;
  65. struct tuner_state status;
  66. u32 frequency;
  67. u32 srate;
  68. u32 bandwidth;
  69. u32 reference;
  70. };
  71. #if IS_REACHABLE(CONFIG_DVB_STB6100)
  72. extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
  73. const struct stb6100_config *config,
  74. struct i2c_adapter *i2c);
  75. #else
  76. static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
  77. const struct stb6100_config *config,
  78. struct i2c_adapter *i2c)
  79. {
  80. printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
  81. return NULL;
  82. }
  83. #endif //CONFIG_DVB_STB6100
  84. #endif