m88ds3103_priv.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * Montage M88DS3103 demodulator driver
  3. *
  4. * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #ifndef M88DS3103_PRIV_H
  17. #define M88DS3103_PRIV_H
  18. #include "dvb_frontend.h"
  19. #include "m88ds3103.h"
  20. #include "dvb_math.h"
  21. #include <linux/firmware.h>
  22. #include <linux/i2c-mux.h>
  23. #include <linux/math64.h>
  24. #define M88DS3103_FIRMWARE "dvb-demod-m88ds3103.fw"
  25. #define M88DS3103_MCLK_KHZ 96000
  26. struct m88ds3103_priv {
  27. struct i2c_adapter *i2c;
  28. /* mutex needed due to own tuner I2C adapter */
  29. struct mutex i2c_mutex;
  30. const struct m88ds3103_config *cfg;
  31. struct dvb_frontend fe;
  32. fe_delivery_system_t delivery_system;
  33. fe_status_t fe_status;
  34. u32 ber;
  35. bool warm; /* FW running */
  36. struct i2c_adapter *i2c_adapter;
  37. };
  38. struct m88ds3103_reg_val {
  39. u8 reg;
  40. u8 val;
  41. };
  42. static const struct m88ds3103_reg_val m88ds3103_dvbs_init_reg_vals[] = {
  43. {0x23, 0x07},
  44. {0x08, 0x03},
  45. {0x0c, 0x02},
  46. {0x21, 0x54},
  47. {0x25, 0x8a},
  48. {0x27, 0x31},
  49. {0x30, 0x08},
  50. {0x31, 0x40},
  51. {0x32, 0x32},
  52. {0x35, 0xff},
  53. {0x3a, 0x00},
  54. {0x37, 0x10},
  55. {0x38, 0x10},
  56. {0x39, 0x02},
  57. {0x42, 0x60},
  58. {0x4a, 0x80},
  59. {0x4b, 0x04},
  60. {0x4d, 0x91},
  61. {0x5d, 0xc8},
  62. {0x50, 0x36},
  63. {0x51, 0x36},
  64. {0x52, 0x36},
  65. {0x53, 0x36},
  66. {0x56, 0x01},
  67. {0x63, 0x0f},
  68. {0x64, 0x30},
  69. {0x65, 0x40},
  70. {0x68, 0x26},
  71. {0x69, 0x4c},
  72. {0x70, 0x20},
  73. {0x71, 0x70},
  74. {0x72, 0x04},
  75. {0x73, 0x00},
  76. {0x70, 0x40},
  77. {0x71, 0x70},
  78. {0x72, 0x04},
  79. {0x73, 0x00},
  80. {0x70, 0x60},
  81. {0x71, 0x70},
  82. {0x72, 0x04},
  83. {0x73, 0x00},
  84. {0x70, 0x80},
  85. {0x71, 0x70},
  86. {0x72, 0x04},
  87. {0x73, 0x00},
  88. {0x70, 0xa0},
  89. {0x71, 0x70},
  90. {0x72, 0x04},
  91. {0x73, 0x00},
  92. {0x70, 0x1f},
  93. {0x76, 0x38},
  94. {0x77, 0xa6},
  95. {0x78, 0x0c},
  96. {0x79, 0x80},
  97. {0x7f, 0x14},
  98. {0x7c, 0x00},
  99. {0xae, 0x82},
  100. {0x80, 0x64},
  101. {0x81, 0x66},
  102. {0x82, 0x44},
  103. {0x85, 0x04},
  104. {0xcd, 0xf4},
  105. {0x90, 0x33},
  106. {0xa0, 0x44},
  107. {0xc0, 0x08},
  108. {0xc3, 0x10},
  109. {0xc4, 0x08},
  110. {0xc5, 0xf0},
  111. {0xc6, 0xff},
  112. {0xc7, 0x00},
  113. {0xc8, 0x1a},
  114. {0xc9, 0x80},
  115. {0xe0, 0xf8},
  116. {0xe6, 0x8b},
  117. {0xd0, 0x40},
  118. {0xf8, 0x20},
  119. {0xfa, 0x0f},
  120. {0x00, 0x00},
  121. {0xbd, 0x01},
  122. {0xb8, 0x00},
  123. };
  124. static const struct m88ds3103_reg_val m88ds3103_dvbs2_init_reg_vals[] = {
  125. {0x23, 0x07},
  126. {0x08, 0x07},
  127. {0x0c, 0x02},
  128. {0x21, 0x54},
  129. {0x25, 0x8a},
  130. {0x27, 0x31},
  131. {0x30, 0x08},
  132. {0x32, 0x32},
  133. {0x35, 0xff},
  134. {0x3a, 0x00},
  135. {0x37, 0x10},
  136. {0x38, 0x10},
  137. {0x39, 0x02},
  138. {0x42, 0x60},
  139. {0x4a, 0x80},
  140. {0x4b, 0x04},
  141. {0x4d, 0x91},
  142. {0x5d, 0xc8},
  143. {0x50, 0x36},
  144. {0x51, 0x36},
  145. {0x52, 0x36},
  146. {0x53, 0x36},
  147. {0x56, 0x01},
  148. {0x63, 0x0f},
  149. {0x64, 0x10},
  150. {0x65, 0x20},
  151. {0x68, 0x46},
  152. {0x69, 0xcd},
  153. {0x70, 0x20},
  154. {0x71, 0x70},
  155. {0x72, 0x04},
  156. {0x73, 0x00},
  157. {0x70, 0x40},
  158. {0x71, 0x70},
  159. {0x72, 0x04},
  160. {0x73, 0x00},
  161. {0x70, 0x60},
  162. {0x71, 0x70},
  163. {0x72, 0x04},
  164. {0x73, 0x00},
  165. {0x70, 0x80},
  166. {0x71, 0x70},
  167. {0x72, 0x04},
  168. {0x73, 0x00},
  169. {0x70, 0xa0},
  170. {0x71, 0x70},
  171. {0x72, 0x04},
  172. {0x73, 0x00},
  173. {0x70, 0x1f},
  174. {0x76, 0x38},
  175. {0x77, 0xa6},
  176. {0x78, 0x0c},
  177. {0x79, 0x80},
  178. {0x7f, 0x14},
  179. {0x85, 0x08},
  180. {0xcd, 0xf4},
  181. {0x90, 0x33},
  182. {0x86, 0x00},
  183. {0x87, 0x0f},
  184. {0x89, 0x00},
  185. {0x8b, 0x44},
  186. {0x8c, 0x66},
  187. {0x9d, 0xc1},
  188. {0x8a, 0x10},
  189. {0xad, 0x40},
  190. {0xa0, 0x44},
  191. {0xc0, 0x08},
  192. {0xc1, 0x10},
  193. {0xc2, 0x08},
  194. {0xc3, 0x10},
  195. {0xc4, 0x08},
  196. {0xc5, 0xf0},
  197. {0xc6, 0xff},
  198. {0xc7, 0x00},
  199. {0xc8, 0x1a},
  200. {0xc9, 0x80},
  201. {0xca, 0x23},
  202. {0xcb, 0x24},
  203. {0xcc, 0xf4},
  204. {0xce, 0x74},
  205. {0x00, 0x00},
  206. {0xbd, 0x01},
  207. {0xb8, 0x00},
  208. };
  209. #endif