162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (C) 2009 Francisco Jerez.
362306a36Sopenharmony_ci * All Rights Reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining
662306a36Sopenharmony_ci * a copy of this software and associated documentation files (the
762306a36Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
862306a36Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
962306a36Sopenharmony_ci * distribute, sublicense, and/or sell copies of the Software, and to
1062306a36Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
1162306a36Sopenharmony_ci * the following conditions:
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * The above copyright notice and this permission notice (including the
1462306a36Sopenharmony_ci * next paragraph) shall be included in all copies or substantial
1562306a36Sopenharmony_ci * portions of the Software.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1862306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1962306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2062306a36Sopenharmony_ci * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
2162306a36Sopenharmony_ci * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2262306a36Sopenharmony_ci * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2362306a36Sopenharmony_ci * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#ifndef __DRM_I2C_CH7006_PRIV_H__
2862306a36Sopenharmony_ci#define __DRM_I2C_CH7006_PRIV_H__
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#include <drm/drm_encoder_slave.h>
3162306a36Sopenharmony_ci#include <drm/drm_probe_helper.h>
3262306a36Sopenharmony_ci#include <drm/i2c/ch7006.h>
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_citypedef int64_t fixed;
3562306a36Sopenharmony_ci#define fixed1 (1LL << 32)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cienum ch7006_tv_norm {
3862306a36Sopenharmony_ci	TV_NORM_PAL,
3962306a36Sopenharmony_ci	TV_NORM_PAL_M,
4062306a36Sopenharmony_ci	TV_NORM_PAL_N,
4162306a36Sopenharmony_ci	TV_NORM_PAL_NC,
4262306a36Sopenharmony_ci	TV_NORM_PAL_60,
4362306a36Sopenharmony_ci	TV_NORM_NTSC_M,
4462306a36Sopenharmony_ci	TV_NORM_NTSC_J,
4562306a36Sopenharmony_ci	NUM_TV_NORMS
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_cistruct ch7006_tv_norm_info {
4962306a36Sopenharmony_ci	fixed vrefresh;
5062306a36Sopenharmony_ci	int vdisplay;
5162306a36Sopenharmony_ci	int vtotal;
5262306a36Sopenharmony_ci	int hvirtual;
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	fixed subc_freq;
5562306a36Sopenharmony_ci	fixed black_level;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	uint32_t dispmode;
5862306a36Sopenharmony_ci	int voffset;
5962306a36Sopenharmony_ci};
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistruct ch7006_mode {
6262306a36Sopenharmony_ci	struct drm_display_mode mode;
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	int enc_hdisp;
6562306a36Sopenharmony_ci	int enc_vdisp;
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	fixed subc_coeff;
6862306a36Sopenharmony_ci	uint32_t dispmode;
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci	uint32_t valid_scales;
7162306a36Sopenharmony_ci	uint32_t valid_norms;
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cistruct ch7006_state {
7562306a36Sopenharmony_ci	uint8_t regs[0x26];
7662306a36Sopenharmony_ci};
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_cistruct ch7006_priv {
7962306a36Sopenharmony_ci	struct ch7006_encoder_params params;
8062306a36Sopenharmony_ci	const struct ch7006_mode *mode;
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	struct ch7006_state state;
8362306a36Sopenharmony_ci	struct ch7006_state saved_state;
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci	struct drm_property *scale_property;
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci	int select_subconnector;
8862306a36Sopenharmony_ci	int subconnector;
8962306a36Sopenharmony_ci	int hmargin;
9062306a36Sopenharmony_ci	int vmargin;
9162306a36Sopenharmony_ci	enum ch7006_tv_norm norm;
9262306a36Sopenharmony_ci	int brightness;
9362306a36Sopenharmony_ci	int contrast;
9462306a36Sopenharmony_ci	int flicker;
9562306a36Sopenharmony_ci	int scale;
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	int chip_version;
9862306a36Sopenharmony_ci	int last_dpms;
9962306a36Sopenharmony_ci};
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#define to_ch7006_priv(x) \
10262306a36Sopenharmony_ci	((struct ch7006_priv *)to_encoder_slave(x)->slave_priv)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciextern int ch7006_debug;
10562306a36Sopenharmony_ciextern char *ch7006_tv_norm;
10662306a36Sopenharmony_ciextern int ch7006_scale;
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciextern const char * const ch7006_tv_norm_names[];
10962306a36Sopenharmony_ciextern const struct ch7006_tv_norm_info ch7006_tv_norms[];
11062306a36Sopenharmony_ciextern const struct ch7006_mode ch7006_modes[];
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciconst struct ch7006_mode *ch7006_lookup_mode(struct drm_encoder *encoder,
11362306a36Sopenharmony_ci					     const struct drm_display_mode *drm_mode);
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_civoid ch7006_setup_levels(struct drm_encoder *encoder);
11662306a36Sopenharmony_civoid ch7006_setup_subcarrier(struct drm_encoder *encoder);
11762306a36Sopenharmony_civoid ch7006_setup_pll(struct drm_encoder *encoder);
11862306a36Sopenharmony_civoid ch7006_setup_power_state(struct drm_encoder *encoder);
11962306a36Sopenharmony_civoid ch7006_setup_properties(struct drm_encoder *encoder);
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_civoid ch7006_write(struct i2c_client *client, uint8_t addr, uint8_t val);
12262306a36Sopenharmony_ciuint8_t ch7006_read(struct i2c_client *client, uint8_t addr);
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_civoid ch7006_state_load(struct i2c_client *client,
12562306a36Sopenharmony_ci		       struct ch7006_state *state);
12662306a36Sopenharmony_civoid ch7006_state_save(struct i2c_client *client,
12762306a36Sopenharmony_ci		       struct ch7006_state *state);
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci/* Some helper macros */
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define ch7006_dbg(client, format, ...) do {				\
13262306a36Sopenharmony_ci		if (ch7006_debug)					\
13362306a36Sopenharmony_ci			dev_printk(KERN_DEBUG, &client->dev,		\
13462306a36Sopenharmony_ci				   "%s: " format, __func__, ## __VA_ARGS__); \
13562306a36Sopenharmony_ci	} while (0)
13662306a36Sopenharmony_ci#define ch7006_info(client, format, ...) \
13762306a36Sopenharmony_ci				dev_info(&client->dev, format, __VA_ARGS__)
13862306a36Sopenharmony_ci#define ch7006_err(client, format, ...) \
13962306a36Sopenharmony_ci				dev_err(&client->dev, format, __VA_ARGS__)
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci#define __mask(src, bitfield) \
14262306a36Sopenharmony_ci		(((2 << (1 ? bitfield)) - 1) & ~((1 << (0 ? bitfield)) - 1))
14362306a36Sopenharmony_ci#define mask(bitfield) __mask(bitfield)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define __bitf(src, bitfield, x) \
14662306a36Sopenharmony_ci		(((x) >> (src) << (0 ? bitfield)) &  __mask(src, bitfield))
14762306a36Sopenharmony_ci#define bitf(bitfield, x) __bitf(bitfield, x)
14862306a36Sopenharmony_ci#define bitfs(bitfield, s) __bitf(bitfield, bitfield##_##s)
14962306a36Sopenharmony_ci#define setbitf(state, reg, bitfield, x)				\
15062306a36Sopenharmony_ci	state->regs[reg] = (state->regs[reg] & ~mask(reg##_##bitfield))	\
15162306a36Sopenharmony_ci		| bitf(reg##_##bitfield, x)
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci#define __unbitf(src, bitfield, x) \
15462306a36Sopenharmony_ci		((x & __mask(src, bitfield)) >> (0 ? bitfield) << (src))
15562306a36Sopenharmony_ci#define unbitf(bitfield, x) __unbitf(bitfield, x)
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_cistatic inline int interpolate(int y0, int y1, int y2, int x)
15862306a36Sopenharmony_ci{
15962306a36Sopenharmony_ci	return y1 + (x < 50 ? y1 - y0 : y2 - y1) * (x - 50) / 50;
16062306a36Sopenharmony_ci}
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_cistatic inline int32_t round_fixed(fixed x)
16362306a36Sopenharmony_ci{
16462306a36Sopenharmony_ci	return (x + fixed1/2) >> 32;
16562306a36Sopenharmony_ci}
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define ch7006_load_reg(client, state, reg) ch7006_write(client, reg, state->regs[reg])
16862306a36Sopenharmony_ci#define ch7006_save_reg(client, state, reg) state->regs[reg] = ch7006_read(client, reg)
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/* Fixed hardware specs */
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define CH7006_FREQ0				14318
17362306a36Sopenharmony_ci#define CH7006_MAXN				650
17462306a36Sopenharmony_ci#define CH7006_MAXM				315
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci/* Register definitions */
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci#define CH7006_DISPMODE				0x00
17962306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES		0, 7:5
18062306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES_512x384	0x0
18162306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES_720x400	0x1
18262306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES_640x400	0x2
18362306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES_640x480	0x3
18462306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES_800x600	0x4
18562306a36Sopenharmony_ci#define CH7006_DISPMODE_INPUT_RES_NATIVE	0x5
18662306a36Sopenharmony_ci#define CH7006_DISPMODE_OUTPUT_STD		0, 4:3
18762306a36Sopenharmony_ci#define CH7006_DISPMODE_OUTPUT_STD_PAL		0x0
18862306a36Sopenharmony_ci#define CH7006_DISPMODE_OUTPUT_STD_NTSC		0x1
18962306a36Sopenharmony_ci#define CH7006_DISPMODE_OUTPUT_STD_PAL_M	0x2
19062306a36Sopenharmony_ci#define CH7006_DISPMODE_OUTPUT_STD_NTSC_J	0x3
19162306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO		0, 2:0
19262306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO_5_4	0x0
19362306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO_1_1	0x1
19462306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO_7_8	0x2
19562306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO_5_6	0x3
19662306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO_3_4	0x4
19762306a36Sopenharmony_ci#define CH7006_DISPMODE_SCALING_RATIO_7_10	0x5
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci#define CH7006_FFILTER				0x01
20062306a36Sopenharmony_ci#define CH7006_FFILTER_TEXT			0, 5:4
20162306a36Sopenharmony_ci#define CH7006_FFILTER_LUMA			0, 3:2
20262306a36Sopenharmony_ci#define CH7006_FFILTER_CHROMA			0, 1:0
20362306a36Sopenharmony_ci#define CH7006_FFILTER_CHROMA_NO_DCRAWL		0x3
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci#define CH7006_BWIDTH				0x03
20662306a36Sopenharmony_ci#define CH7006_BWIDTH_5L_FFILER			(1 << 7)
20762306a36Sopenharmony_ci#define CH7006_BWIDTH_CVBS_NO_CHROMA		(1 << 6)
20862306a36Sopenharmony_ci#define CH7006_BWIDTH_CHROMA			0, 5:4
20962306a36Sopenharmony_ci#define CH7006_BWIDTH_SVIDEO_YPEAK		(1 << 3)
21062306a36Sopenharmony_ci#define CH7006_BWIDTH_SVIDEO_LUMA		0, 2:1
21162306a36Sopenharmony_ci#define CH7006_BWIDTH_CVBS_LUMA			0, 0:0
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT			0x04
21462306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_DAC_GAIN		(1 << 6)
21562306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_RGB_PASS_THROUGH	(1 << 5)
21662306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT		0, 3:0
21762306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB16	0x0
21862306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_YCrCb24m16	0x1
21962306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB24m16	0x2
22062306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB15	0x3
22162306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB24m12C	0x4
22262306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB24m12I	0x5
22362306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB24m8	0x6
22462306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB16m8	0x7
22562306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_RGB15m8	0x8
22662306a36Sopenharmony_ci#define CH7006_INPUT_FORMAT_FORMAT_YCrCb24m8	0x9
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci#define CH7006_CLKMODE				0x06
22962306a36Sopenharmony_ci#define CH7006_CLKMODE_SUBC_LOCK		(1 << 7)
23062306a36Sopenharmony_ci#define CH7006_CLKMODE_MASTER			(1 << 6)
23162306a36Sopenharmony_ci#define CH7006_CLKMODE_POS_EDGE			(1 << 4)
23262306a36Sopenharmony_ci#define CH7006_CLKMODE_XCM			0, 3:2
23362306a36Sopenharmony_ci#define CH7006_CLKMODE_PCM			0, 1:0
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci#define CH7006_START_ACTIVE			0x07
23662306a36Sopenharmony_ci#define CH7006_START_ACTIVE_0			0, 7:0
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci#define CH7006_POV				0x08
23962306a36Sopenharmony_ci#define CH7006_POV_START_ACTIVE_8		8, 2:2
24062306a36Sopenharmony_ci#define CH7006_POV_HPOS_8			8, 1:1
24162306a36Sopenharmony_ci#define CH7006_POV_VPOS_8			8, 0:0
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci#define CH7006_BLACK_LEVEL			0x09
24462306a36Sopenharmony_ci#define CH7006_BLACK_LEVEL_0			0, 7:0
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci#define CH7006_HPOS				0x0a
24762306a36Sopenharmony_ci#define CH7006_HPOS_0				0, 7:0
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci#define CH7006_VPOS				0x0b
25062306a36Sopenharmony_ci#define CH7006_VPOS_0				0, 7:0
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci#define CH7006_INPUT_SYNC			0x0d
25362306a36Sopenharmony_ci#define CH7006_INPUT_SYNC_EMBEDDED		(1 << 3)
25462306a36Sopenharmony_ci#define CH7006_INPUT_SYNC_OUTPUT		(1 << 2)
25562306a36Sopenharmony_ci#define CH7006_INPUT_SYNC_PVSYNC		(1 << 1)
25662306a36Sopenharmony_ci#define CH7006_INPUT_SYNC_PHSYNC		(1 << 0)
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci#define CH7006_POWER				0x0e
25962306a36Sopenharmony_ci#define CH7006_POWER_SCART			(1 << 4)
26062306a36Sopenharmony_ci#define CH7006_POWER_RESET			(1 << 3)
26162306a36Sopenharmony_ci#define CH7006_POWER_LEVEL			0, 2:0
26262306a36Sopenharmony_ci#define CH7006_POWER_LEVEL_CVBS_OFF		0x0
26362306a36Sopenharmony_ci#define CH7006_POWER_LEVEL_POWER_OFF		0x1
26462306a36Sopenharmony_ci#define CH7006_POWER_LEVEL_SVIDEO_OFF		0x2
26562306a36Sopenharmony_ci#define CH7006_POWER_LEVEL_NORMAL		0x3
26662306a36Sopenharmony_ci#define CH7006_POWER_LEVEL_FULL_POWER_OFF	0x4
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci#define CH7006_DETECT				0x10
26962306a36Sopenharmony_ci#define CH7006_DETECT_SVIDEO_Y_TEST		(1 << 3)
27062306a36Sopenharmony_ci#define CH7006_DETECT_SVIDEO_C_TEST		(1 << 2)
27162306a36Sopenharmony_ci#define CH7006_DETECT_CVBS_TEST			(1 << 1)
27262306a36Sopenharmony_ci#define CH7006_DETECT_SENSE			(1 << 0)
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci#define CH7006_CONTRAST				0x11
27562306a36Sopenharmony_ci#define CH7006_CONTRAST_0			0, 2:0
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci#define CH7006_PLLOV	 			0x13
27862306a36Sopenharmony_ci#define CH7006_PLLOV_N_8	 		8, 2:1
27962306a36Sopenharmony_ci#define CH7006_PLLOV_M_8	 		8, 0:0
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define CH7006_PLLM	 			0x14
28262306a36Sopenharmony_ci#define CH7006_PLLM_0	 			0, 7:0
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci#define CH7006_PLLN	 			0x15
28562306a36Sopenharmony_ci#define CH7006_PLLN_0	 			0, 7:0
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci#define CH7006_BCLKOUT	 			0x17
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci#define CH7006_SUBC_INC0			0x18
29062306a36Sopenharmony_ci#define CH7006_SUBC_INC0_28			28, 3:0
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci#define CH7006_SUBC_INC1			0x19
29362306a36Sopenharmony_ci#define CH7006_SUBC_INC1_24			24, 3:0
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci#define CH7006_SUBC_INC2			0x1a
29662306a36Sopenharmony_ci#define CH7006_SUBC_INC2_20			20, 3:0
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci#define CH7006_SUBC_INC3			0x1b
29962306a36Sopenharmony_ci#define CH7006_SUBC_INC3_GPIO1_VAL		(1 << 7)
30062306a36Sopenharmony_ci#define CH7006_SUBC_INC3_GPIO0_VAL		(1 << 6)
30162306a36Sopenharmony_ci#define CH7006_SUBC_INC3_POUT_3_3V		(1 << 5)
30262306a36Sopenharmony_ci#define CH7006_SUBC_INC3_POUT_INV		(1 << 4)
30362306a36Sopenharmony_ci#define CH7006_SUBC_INC3_16			16, 3:0
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci#define CH7006_SUBC_INC4			0x1c
30662306a36Sopenharmony_ci#define CH7006_SUBC_INC4_GPIO1_IN		(1 << 7)
30762306a36Sopenharmony_ci#define CH7006_SUBC_INC4_GPIO0_IN		(1 << 6)
30862306a36Sopenharmony_ci#define CH7006_SUBC_INC4_DS_INPUT		(1 << 4)
30962306a36Sopenharmony_ci#define CH7006_SUBC_INC4_12			12, 3:0
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci#define CH7006_SUBC_INC5			0x1d
31262306a36Sopenharmony_ci#define CH7006_SUBC_INC5_8			8, 3:0
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci#define CH7006_SUBC_INC6			0x1e
31562306a36Sopenharmony_ci#define CH7006_SUBC_INC6_4			4, 3:0
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci#define CH7006_SUBC_INC7			0x1f
31862306a36Sopenharmony_ci#define CH7006_SUBC_INC7_0			0, 3:0
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci#define CH7006_PLL_CONTROL			0x20
32162306a36Sopenharmony_ci#define CH7006_PLL_CONTROL_CPI			(1 << 5)
32262306a36Sopenharmony_ci#define CH7006_PLL_CONTROL_CAPACITOR		(1 << 4)
32362306a36Sopenharmony_ci#define CH7006_PLL_CONTROL_7STAGES		(1 << 3)
32462306a36Sopenharmony_ci#define CH7006_PLL_CONTROL_DIGITAL_5V		(1 << 2)
32562306a36Sopenharmony_ci#define CH7006_PLL_CONTROL_ANALOG_5V		(1 << 1)
32662306a36Sopenharmony_ci#define CH7006_PLL_CONTROL_MEMORY_5V		(1 << 0)
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC0			0x21
32962306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC0_24		24, 4:3
33062306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC0_HYST		0, 2:1
33162306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC0_AUTO		(1 << 0)
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC1			0x22
33462306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC1_16		16, 7:0
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC2			0x23
33762306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC2_8			8, 7:0
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC3			0x24
34062306a36Sopenharmony_ci#define CH7006_CALC_SUBC_INC3_0			0, 7:0
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci#define CH7006_VERSION_ID			0x25
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci#endif
345