ch7006_mode.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. /*
  2. * Copyright (C) 2009 Francisco Jerez.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial
  15. * portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. */
  26. #include "ch7006_priv.h"
  27. const char * const ch7006_tv_norm_names[] = {
  28. [TV_NORM_PAL] = "PAL",
  29. [TV_NORM_PAL_M] = "PAL-M",
  30. [TV_NORM_PAL_N] = "PAL-N",
  31. [TV_NORM_PAL_NC] = "PAL-Nc",
  32. [TV_NORM_PAL_60] = "PAL-60",
  33. [TV_NORM_NTSC_M] = "NTSC-M",
  34. [TV_NORM_NTSC_J] = "NTSC-J",
  35. };
  36. #define NTSC_LIKE_TIMINGS .vrefresh = 60 * fixed1/1.001, \
  37. .vdisplay = 480, \
  38. .vtotal = 525, \
  39. .hvirtual = 660
  40. #define PAL_LIKE_TIMINGS .vrefresh = 50 * fixed1, \
  41. .vdisplay = 576, \
  42. .vtotal = 625, \
  43. .hvirtual = 810
  44. const struct ch7006_tv_norm_info ch7006_tv_norms[] = {
  45. [TV_NORM_NTSC_M] = {
  46. NTSC_LIKE_TIMINGS,
  47. .black_level = 0.339 * fixed1,
  48. .subc_freq = 3579545 * fixed1,
  49. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, NTSC),
  50. .voffset = 0,
  51. },
  52. [TV_NORM_NTSC_J] = {
  53. NTSC_LIKE_TIMINGS,
  54. .black_level = 0.286 * fixed1,
  55. .subc_freq = 3579545 * fixed1,
  56. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, NTSC_J),
  57. .voffset = 0,
  58. },
  59. [TV_NORM_PAL] = {
  60. PAL_LIKE_TIMINGS,
  61. .black_level = 0.3 * fixed1,
  62. .subc_freq = 4433618.75 * fixed1,
  63. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, PAL),
  64. .voffset = 0,
  65. },
  66. [TV_NORM_PAL_M] = {
  67. NTSC_LIKE_TIMINGS,
  68. .black_level = 0.339 * fixed1,
  69. .subc_freq = 3575611.433 * fixed1,
  70. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, PAL_M),
  71. .voffset = 16,
  72. },
  73. /* The following modes seem to work right but they're
  74. * undocumented */
  75. [TV_NORM_PAL_N] = {
  76. PAL_LIKE_TIMINGS,
  77. .black_level = 0.339 * fixed1,
  78. .subc_freq = 4433618.75 * fixed1,
  79. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, PAL),
  80. .voffset = 0,
  81. },
  82. [TV_NORM_PAL_NC] = {
  83. PAL_LIKE_TIMINGS,
  84. .black_level = 0.3 * fixed1,
  85. .subc_freq = 3582056.25 * fixed1,
  86. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, PAL),
  87. .voffset = 0,
  88. },
  89. [TV_NORM_PAL_60] = {
  90. NTSC_LIKE_TIMINGS,
  91. .black_level = 0.3 * fixed1,
  92. .subc_freq = 4433618.75 * fixed1,
  93. .dispmode = bitfs(CH7006_DISPMODE_OUTPUT_STD, PAL_M),
  94. .voffset = 16,
  95. },
  96. };
  97. #define __MODE(f, hd, vd, ht, vt, hsynp, vsynp, \
  98. subc, scale, scale_mask, norm_mask, e_hd, e_vd) { \
  99. .mode = { \
  100. .name = #hd "x" #vd, \
  101. .status = 0, \
  102. .type = DRM_MODE_TYPE_DRIVER, \
  103. .clock = f, \
  104. .hdisplay = hd, \
  105. .hsync_start = e_hd + 16, \
  106. .hsync_end = e_hd + 80, \
  107. .htotal = ht, \
  108. .hskew = 0, \
  109. .vdisplay = vd, \
  110. .vsync_start = vd + 10, \
  111. .vsync_end = vd + 26, \
  112. .vtotal = vt, \
  113. .vscan = 0, \
  114. .flags = DRM_MODE_FLAG_##hsynp##HSYNC | \
  115. DRM_MODE_FLAG_##vsynp##VSYNC, \
  116. .vrefresh = 0, \
  117. }, \
  118. .enc_hdisp = e_hd, \
  119. .enc_vdisp = e_vd, \
  120. .subc_coeff = subc * fixed1, \
  121. .dispmode = bitfs(CH7006_DISPMODE_SCALING_RATIO, scale) | \
  122. bitfs(CH7006_DISPMODE_INPUT_RES, e_hd##x##e_vd), \
  123. .valid_scales = scale_mask, \
  124. .valid_norms = norm_mask \
  125. }
  126. #define MODE(f, hd, vd, ht, vt, hsynp, vsynp, \
  127. subc, scale, scale_mask, norm_mask) \
  128. __MODE(f, hd, vd, ht, vt, hsynp, vsynp, subc, scale, \
  129. scale_mask, norm_mask, hd, vd)
  130. #define NTSC_LIKE (1 << TV_NORM_NTSC_M | 1 << TV_NORM_NTSC_J | \
  131. 1 << TV_NORM_PAL_M | 1 << TV_NORM_PAL_60)
  132. #define PAL_LIKE (1 << TV_NORM_PAL | 1 << TV_NORM_PAL_N | 1 << TV_NORM_PAL_NC)
  133. const struct ch7006_mode ch7006_modes[] = {
  134. MODE(21000, 512, 384, 840, 500, N, N, 181.797557582, 5_4, 0x6, PAL_LIKE),
  135. MODE(26250, 512, 384, 840, 625, N, N, 145.438046066, 1_1, 0x1, PAL_LIKE),
  136. MODE(20140, 512, 384, 800, 420, N, N, 213.257083791, 5_4, 0x4, NTSC_LIKE),
  137. MODE(24671, 512, 384, 784, 525, N, N, 174.0874153, 1_1, 0x3, NTSC_LIKE),
  138. MODE(28125, 720, 400, 1125, 500, N, N, 135.742176298, 5_4, 0x6, PAL_LIKE),
  139. MODE(34875, 720, 400, 1116, 625, N, N, 109.469496898, 1_1, 0x1, PAL_LIKE),
  140. MODE(23790, 720, 400, 945, 420, N, N, 160.475642016, 5_4, 0x4, NTSC_LIKE),
  141. MODE(29455, 720, 400, 936, 525, N, N, 129.614941843, 1_1, 0x3, NTSC_LIKE),
  142. MODE(25000, 640, 400, 1000, 500, N, N, 152.709948279, 5_4, 0x6, PAL_LIKE),
  143. MODE(31500, 640, 400, 1008, 625, N, N, 121.198371646, 1_1, 0x1, PAL_LIKE),
  144. MODE(21147, 640, 400, 840, 420, N, N, 180.535097338, 5_4, 0x4, NTSC_LIKE),
  145. MODE(26434, 640, 400, 840, 525, N, N, 144.42807787, 1_1, 0x2, NTSC_LIKE),
  146. MODE(30210, 640, 400, 840, 600, N, N, 126.374568276, 7_8, 0x1, NTSC_LIKE),
  147. MODE(21000, 640, 480, 840, 500, N, N, 181.797557582, 5_4, 0x4, PAL_LIKE),
  148. MODE(26250, 640, 480, 840, 625, N, N, 145.438046066, 1_1, 0x2, PAL_LIKE),
  149. MODE(31500, 640, 480, 840, 750, N, N, 121.198371646, 5_6, 0x1, PAL_LIKE),
  150. MODE(24671, 640, 480, 784, 525, N, N, 174.0874153, 1_1, 0x4, NTSC_LIKE),
  151. MODE(28196, 640, 480, 784, 600, N, N, 152.326488422, 7_8, 0x2, NTSC_LIKE),
  152. MODE(30210, 640, 480, 800, 630, N, N, 142.171389101, 5_6, 0x1, NTSC_LIKE),
  153. __MODE(29500, 720, 576, 944, 625, P, P, 145.592111636, 1_1, 0x7, PAL_LIKE, 800, 600),
  154. MODE(36000, 800, 600, 960, 750, P, P, 119.304647022, 5_6, 0x6, PAL_LIKE),
  155. MODE(39000, 800, 600, 936, 836, P, P, 110.127366499, 3_4, 0x1, PAL_LIKE),
  156. MODE(39273, 800, 600, 1040, 630, P, P, 145.816809399, 5_6, 0x4, NTSC_LIKE),
  157. MODE(43636, 800, 600, 1040, 700, P, P, 131.235128487, 3_4, 0x2, NTSC_LIKE),
  158. MODE(47832, 800, 600, 1064, 750, P, P, 119.723275165, 7_10, 0x1, NTSC_LIKE),
  159. {}
  160. };
  161. const struct ch7006_mode *ch7006_lookup_mode(struct drm_encoder *encoder,
  162. const struct drm_display_mode *drm_mode)
  163. {
  164. struct ch7006_priv *priv = to_ch7006_priv(encoder);
  165. const struct ch7006_mode *mode;
  166. for (mode = ch7006_modes; mode->mode.clock; mode++) {
  167. if (~mode->valid_norms & 1<<priv->norm)
  168. continue;
  169. if (mode->mode.hdisplay != drm_mode->hdisplay ||
  170. mode->mode.vdisplay != drm_mode->vdisplay ||
  171. mode->mode.vtotal != drm_mode->vtotal ||
  172. mode->mode.htotal != drm_mode->htotal ||
  173. mode->mode.clock != drm_mode->clock)
  174. continue;
  175. return mode;
  176. }
  177. return NULL;
  178. }
  179. /* Some common HW state calculation code */
  180. void ch7006_setup_levels(struct drm_encoder *encoder)
  181. {
  182. struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
  183. struct ch7006_priv *priv = to_ch7006_priv(encoder);
  184. uint8_t *regs = priv->state.regs;
  185. const struct ch7006_tv_norm_info *norm = &ch7006_tv_norms[priv->norm];
  186. int gain;
  187. int black_level;
  188. /* Set DAC_GAIN if the voltage drop between white and black is
  189. * high enough. */
  190. if (norm->black_level < 339*fixed1/1000) {
  191. gain = 76;
  192. regs[CH7006_INPUT_FORMAT] |= CH7006_INPUT_FORMAT_DAC_GAIN;
  193. } else {
  194. gain = 71;
  195. regs[CH7006_INPUT_FORMAT] &= ~CH7006_INPUT_FORMAT_DAC_GAIN;
  196. }
  197. black_level = round_fixed(norm->black_level*26625)/gain;
  198. /* Correct it with the specified brightness. */
  199. black_level = interpolate(90, black_level, 208, priv->brightness);
  200. regs[CH7006_BLACK_LEVEL] = bitf(CH7006_BLACK_LEVEL_0, black_level);
  201. ch7006_dbg(client, "black level: %d\n", black_level);
  202. }
  203. void ch7006_setup_subcarrier(struct drm_encoder *encoder)
  204. {
  205. struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
  206. struct ch7006_priv *priv = to_ch7006_priv(encoder);
  207. struct ch7006_state *state = &priv->state;
  208. const struct ch7006_tv_norm_info *norm = &ch7006_tv_norms[priv->norm];
  209. const struct ch7006_mode *mode = priv->mode;
  210. uint32_t subc_inc;
  211. subc_inc = round_fixed((mode->subc_coeff >> 8)
  212. * (norm->subc_freq >> 24));
  213. setbitf(state, CH7006_SUBC_INC0, 28, subc_inc);
  214. setbitf(state, CH7006_SUBC_INC1, 24, subc_inc);
  215. setbitf(state, CH7006_SUBC_INC2, 20, subc_inc);
  216. setbitf(state, CH7006_SUBC_INC3, 16, subc_inc);
  217. setbitf(state, CH7006_SUBC_INC4, 12, subc_inc);
  218. setbitf(state, CH7006_SUBC_INC5, 8, subc_inc);
  219. setbitf(state, CH7006_SUBC_INC6, 4, subc_inc);
  220. setbitf(state, CH7006_SUBC_INC7, 0, subc_inc);
  221. ch7006_dbg(client, "subcarrier inc: %u\n", subc_inc);
  222. }
  223. void ch7006_setup_pll(struct drm_encoder *encoder)
  224. {
  225. struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
  226. struct ch7006_priv *priv = to_ch7006_priv(encoder);
  227. uint8_t *regs = priv->state.regs;
  228. const struct ch7006_mode *mode = priv->mode;
  229. int n, best_n = 0;
  230. int m, best_m = 0;
  231. int freq, best_freq = 0;
  232. for (n = 0; n < CH7006_MAXN; n++) {
  233. for (m = 0; m < CH7006_MAXM; m++) {
  234. freq = CH7006_FREQ0*(n+2)/(m+2);
  235. if (abs(freq - mode->mode.clock) <
  236. abs(best_freq - mode->mode.clock)) {
  237. best_freq = freq;
  238. best_n = n;
  239. best_m = m;
  240. }
  241. }
  242. }
  243. regs[CH7006_PLLOV] = bitf(CH7006_PLLOV_N_8, best_n) |
  244. bitf(CH7006_PLLOV_M_8, best_m);
  245. regs[CH7006_PLLM] = bitf(CH7006_PLLM_0, best_m);
  246. regs[CH7006_PLLN] = bitf(CH7006_PLLN_0, best_n);
  247. if (best_n < 108)
  248. regs[CH7006_PLL_CONTROL] |= CH7006_PLL_CONTROL_CAPACITOR;
  249. else
  250. regs[CH7006_PLL_CONTROL] &= ~CH7006_PLL_CONTROL_CAPACITOR;
  251. ch7006_dbg(client, "n=%d m=%d f=%d c=%d\n",
  252. best_n, best_m, best_freq, best_n < 108);
  253. }
  254. void ch7006_setup_power_state(struct drm_encoder *encoder)
  255. {
  256. struct ch7006_priv *priv = to_ch7006_priv(encoder);
  257. uint8_t *power = &priv->state.regs[CH7006_POWER];
  258. int subconnector;
  259. subconnector = priv->select_subconnector ? priv->select_subconnector :
  260. priv->subconnector;
  261. *power = CH7006_POWER_RESET;
  262. if (priv->last_dpms == DRM_MODE_DPMS_ON) {
  263. switch (subconnector) {
  264. case DRM_MODE_SUBCONNECTOR_SVIDEO:
  265. *power |= bitfs(CH7006_POWER_LEVEL, CVBS_OFF);
  266. break;
  267. case DRM_MODE_SUBCONNECTOR_Composite:
  268. *power |= bitfs(CH7006_POWER_LEVEL, SVIDEO_OFF);
  269. break;
  270. case DRM_MODE_SUBCONNECTOR_SCART:
  271. *power |= bitfs(CH7006_POWER_LEVEL, NORMAL) |
  272. CH7006_POWER_SCART;
  273. break;
  274. }
  275. } else {
  276. if (priv->chip_version >= 0x20)
  277. *power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF);
  278. else
  279. *power |= bitfs(CH7006_POWER_LEVEL, POWER_OFF);
  280. }
  281. }
  282. void ch7006_setup_properties(struct drm_encoder *encoder)
  283. {
  284. struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
  285. struct ch7006_priv *priv = to_ch7006_priv(encoder);
  286. struct ch7006_state *state = &priv->state;
  287. const struct ch7006_tv_norm_info *norm = &ch7006_tv_norms[priv->norm];
  288. const struct ch7006_mode *ch_mode = priv->mode;
  289. const struct drm_display_mode *mode = &ch_mode->mode;
  290. uint8_t *regs = state->regs;
  291. int flicker, contrast, hpos, vpos;
  292. uint64_t scale, aspect;
  293. flicker = interpolate(0, 2, 3, priv->flicker);
  294. regs[CH7006_FFILTER] = bitf(CH7006_FFILTER_TEXT, flicker) |
  295. bitf(CH7006_FFILTER_LUMA, flicker) |
  296. bitf(CH7006_FFILTER_CHROMA, 1);
  297. contrast = interpolate(0, 5, 7, priv->contrast);
  298. regs[CH7006_CONTRAST] = bitf(CH7006_CONTRAST_0, contrast);
  299. scale = norm->vtotal*fixed1;
  300. do_div(scale, mode->vtotal);
  301. aspect = ch_mode->enc_hdisp*fixed1;
  302. do_div(aspect, ch_mode->enc_vdisp);
  303. hpos = round_fixed((norm->hvirtual * aspect - mode->hdisplay * scale)
  304. * priv->hmargin * mode->vtotal) / norm->vtotal / 100 / 4;
  305. setbitf(state, CH7006_POV, HPOS_8, hpos);
  306. setbitf(state, CH7006_HPOS, 0, hpos);
  307. vpos = max(0, norm->vdisplay - round_fixed(mode->vdisplay*scale)
  308. + norm->voffset) * priv->vmargin / 100 / 2;
  309. setbitf(state, CH7006_POV, VPOS_8, vpos);
  310. setbitf(state, CH7006_VPOS, 0, vpos);
  311. ch7006_dbg(client, "hpos: %d, vpos: %d\n", hpos, vpos);
  312. }
  313. /* HW access functions */
  314. void ch7006_write(struct i2c_client *client, uint8_t addr, uint8_t val)
  315. {
  316. uint8_t buf[] = {addr, val};
  317. int ret;
  318. ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
  319. if (ret < 0)
  320. ch7006_err(client, "Error %d writing to subaddress 0x%x\n",
  321. ret, addr);
  322. }
  323. uint8_t ch7006_read(struct i2c_client *client, uint8_t addr)
  324. {
  325. uint8_t val;
  326. int ret;
  327. ret = i2c_master_send(client, &addr, sizeof(addr));
  328. if (ret < 0)
  329. goto fail;
  330. ret = i2c_master_recv(client, &val, sizeof(val));
  331. if (ret < 0)
  332. goto fail;
  333. return val;
  334. fail:
  335. ch7006_err(client, "Error %d reading from subaddress 0x%x\n",
  336. ret, addr);
  337. return 0;
  338. }
  339. void ch7006_state_load(struct i2c_client *client,
  340. struct ch7006_state *state)
  341. {
  342. ch7006_load_reg(client, state, CH7006_POWER);
  343. ch7006_load_reg(client, state, CH7006_DISPMODE);
  344. ch7006_load_reg(client, state, CH7006_FFILTER);
  345. ch7006_load_reg(client, state, CH7006_BWIDTH);
  346. ch7006_load_reg(client, state, CH7006_INPUT_FORMAT);
  347. ch7006_load_reg(client, state, CH7006_CLKMODE);
  348. ch7006_load_reg(client, state, CH7006_START_ACTIVE);
  349. ch7006_load_reg(client, state, CH7006_POV);
  350. ch7006_load_reg(client, state, CH7006_BLACK_LEVEL);
  351. ch7006_load_reg(client, state, CH7006_HPOS);
  352. ch7006_load_reg(client, state, CH7006_VPOS);
  353. ch7006_load_reg(client, state, CH7006_INPUT_SYNC);
  354. ch7006_load_reg(client, state, CH7006_DETECT);
  355. ch7006_load_reg(client, state, CH7006_CONTRAST);
  356. ch7006_load_reg(client, state, CH7006_PLLOV);
  357. ch7006_load_reg(client, state, CH7006_PLLM);
  358. ch7006_load_reg(client, state, CH7006_PLLN);
  359. ch7006_load_reg(client, state, CH7006_BCLKOUT);
  360. ch7006_load_reg(client, state, CH7006_SUBC_INC0);
  361. ch7006_load_reg(client, state, CH7006_SUBC_INC1);
  362. ch7006_load_reg(client, state, CH7006_SUBC_INC2);
  363. ch7006_load_reg(client, state, CH7006_SUBC_INC3);
  364. ch7006_load_reg(client, state, CH7006_SUBC_INC4);
  365. ch7006_load_reg(client, state, CH7006_SUBC_INC5);
  366. ch7006_load_reg(client, state, CH7006_SUBC_INC6);
  367. ch7006_load_reg(client, state, CH7006_SUBC_INC7);
  368. ch7006_load_reg(client, state, CH7006_PLL_CONTROL);
  369. ch7006_load_reg(client, state, CH7006_CALC_SUBC_INC0);
  370. }
  371. void ch7006_state_save(struct i2c_client *client,
  372. struct ch7006_state *state)
  373. {
  374. ch7006_save_reg(client, state, CH7006_POWER);
  375. ch7006_save_reg(client, state, CH7006_DISPMODE);
  376. ch7006_save_reg(client, state, CH7006_FFILTER);
  377. ch7006_save_reg(client, state, CH7006_BWIDTH);
  378. ch7006_save_reg(client, state, CH7006_INPUT_FORMAT);
  379. ch7006_save_reg(client, state, CH7006_CLKMODE);
  380. ch7006_save_reg(client, state, CH7006_START_ACTIVE);
  381. ch7006_save_reg(client, state, CH7006_POV);
  382. ch7006_save_reg(client, state, CH7006_BLACK_LEVEL);
  383. ch7006_save_reg(client, state, CH7006_HPOS);
  384. ch7006_save_reg(client, state, CH7006_VPOS);
  385. ch7006_save_reg(client, state, CH7006_INPUT_SYNC);
  386. ch7006_save_reg(client, state, CH7006_DETECT);
  387. ch7006_save_reg(client, state, CH7006_CONTRAST);
  388. ch7006_save_reg(client, state, CH7006_PLLOV);
  389. ch7006_save_reg(client, state, CH7006_PLLM);
  390. ch7006_save_reg(client, state, CH7006_PLLN);
  391. ch7006_save_reg(client, state, CH7006_BCLKOUT);
  392. ch7006_save_reg(client, state, CH7006_SUBC_INC0);
  393. ch7006_save_reg(client, state, CH7006_SUBC_INC1);
  394. ch7006_save_reg(client, state, CH7006_SUBC_INC2);
  395. ch7006_save_reg(client, state, CH7006_SUBC_INC3);
  396. ch7006_save_reg(client, state, CH7006_SUBC_INC4);
  397. ch7006_save_reg(client, state, CH7006_SUBC_INC5);
  398. ch7006_save_reg(client, state, CH7006_SUBC_INC6);
  399. ch7006_save_reg(client, state, CH7006_SUBC_INC7);
  400. ch7006_save_reg(client, state, CH7006_PLL_CONTROL);
  401. ch7006_save_reg(client, state, CH7006_CALC_SUBC_INC0);
  402. state->regs[CH7006_FFILTER] = (state->regs[CH7006_FFILTER] & 0xf0) |
  403. (state->regs[CH7006_FFILTER] & 0x0c) >> 2 |
  404. (state->regs[CH7006_FFILTER] & 0x03) << 2;
  405. }