stb6100.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. STB6100 Silicon Tuner
  4. Copyright (C) Manu Abraham ([email protected])
  5. Copyright (C) ST Microelectronics
  6. */
  7. #ifndef __STB_6100_REG_H
  8. #define __STB_6100_REG_H
  9. #include <linux/dvb/frontend.h>
  10. #include <media/dvb_frontend.h>
  11. #define STB6100_LD 0x00
  12. #define STB6100_LD_LOCK (1 << 0)
  13. #define STB6100_VCO 0x01
  14. #define STB6100_VCO_OSCH (0x01 << 7)
  15. #define STB6100_VCO_OSCH_SHIFT 7
  16. #define STB6100_VCO_OCK (0x03 << 5)
  17. #define STB6100_VCO_OCK_SHIFT 5
  18. #define STB6100_VCO_ODIV (0x01 << 4)
  19. #define STB6100_VCO_ODIV_SHIFT 4
  20. #define STB6100_VCO_OSM (0x0f << 0)
  21. #define STB6100_NI 0x02
  22. #define STB6100_NF_LSB 0x03
  23. #define STB6100_K 0x04
  24. #define STB6100_K_PSD2 (0x01 << 2)
  25. #define STB6100_K_PSD2_SHIFT 2
  26. #define STB6100_K_NF_MSB (0x03 << 0)
  27. #define STB6100_G 0x05
  28. #define STB6100_G_G (0x0f << 0)
  29. #define STB6100_G_GCT (0x07 << 5)
  30. #define STB6100_F 0x06
  31. #define STB6100_F_F (0x1f << 0)
  32. #define STB6100_DLB 0x07
  33. #define STB6100_TEST1 0x08
  34. #define STB6100_FCCK 0x09
  35. #define STB6100_FCCK_FCCK (0x01 << 6)
  36. #define STB6100_LPEN 0x0a
  37. #define STB6100_LPEN_LPEN (0x01 << 4)
  38. #define STB6100_LPEN_SYNP (0x01 << 5)
  39. #define STB6100_LPEN_OSCP (0x01 << 6)
  40. #define STB6100_LPEN_BEN (0x01 << 7)
  41. #define STB6100_TEST3 0x0b
  42. #define STB6100_NUMREGS 0x0c
  43. #define INRANGE(val, x, y) (((x <= val) && (val <= y)) || \
  44. ((y <= val) && (val <= x)) ? 1 : 0)
  45. #define CHKRANGE(val, x, y) (((val >= x) && (val < y)) ? 1 : 0)
  46. struct stb6100_config {
  47. u8 tuner_address;
  48. u32 refclock;
  49. };
  50. struct stb6100_state {
  51. struct i2c_adapter *i2c;
  52. const struct stb6100_config *config;
  53. struct dvb_tuner_ops ops;
  54. struct dvb_frontend *frontend;
  55. u32 frequency;
  56. u32 srate;
  57. u32 bandwidth;
  58. u32 reference;
  59. };
  60. #if IS_REACHABLE(CONFIG_DVB_STB6100)
  61. extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
  62. const struct stb6100_config *config,
  63. struct i2c_adapter *i2c);
  64. #else
  65. static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
  66. const struct stb6100_config *config,
  67. struct i2c_adapter *i2c)
  68. {
  69. printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
  70. return NULL;
  71. }
  72. #endif //CONFIG_DVB_STB6100
  73. #endif