162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * STK1160 driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Ezequiel Garcia
662306a36Sopenharmony_ci * <elezegarcia--a.t--gmail.com>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Based on Easycap driver by R.M. Thomas
962306a36Sopenharmony_ci *	Copyright (C) 2010 R.M. Thomas
1062306a36Sopenharmony_ci *	<rmthomas--a.t--sciolus.org>
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/* GPIO Control */
1462306a36Sopenharmony_ci#define STK1160_GCTRL			0x000
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* Remote Wakeup Control */
1762306a36Sopenharmony_ci#define STK1160_RMCTL			0x00c
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* Power-on Strapping Data */
2062306a36Sopenharmony_ci#define STK1160_POSVA			0x010
2162306a36Sopenharmony_ci#define STK1160_POSV_L			0x010
2262306a36Sopenharmony_ci#define STK1160_POSV_M			0x011
2362306a36Sopenharmony_ci#define STK1160_POSV_H			0x012
2462306a36Sopenharmony_ci#define  STK1160_POSV_L_ACDOUT		BIT(3)
2562306a36Sopenharmony_ci#define  STK1160_POSV_L_ACSYNC		BIT(2)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/*
2862306a36Sopenharmony_ci * Decoder Control Register:
2962306a36Sopenharmony_ci * This byte controls capture start/stop
3062306a36Sopenharmony_ci * with bit #7 (0x?? OR 0x80 to activate).
3162306a36Sopenharmony_ci */
3262306a36Sopenharmony_ci#define STK1160_DCTRL			0x100
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/*
3562306a36Sopenharmony_ci * Decimation Control Register:
3662306a36Sopenharmony_ci * Byte 104: Horizontal Decimation Line Unit Count
3762306a36Sopenharmony_ci * Byte 105: Vertical Decimation Line Unit Count
3862306a36Sopenharmony_ci * Byte 106: Decimation Control
3962306a36Sopenharmony_ci * Bit 0 - Horizontal Decimation Control
4062306a36Sopenharmony_ci *   0 Horizontal decimation is disabled.
4162306a36Sopenharmony_ci *   1 Horizontal decimation is enabled.
4262306a36Sopenharmony_ci * Bit 1 - Decimates Half or More Column
4362306a36Sopenharmony_ci *   0 Decimates less than half from original column,
4462306a36Sopenharmony_ci *     send count unit (0x105) before each unit skipped.
4562306a36Sopenharmony_ci *   1 Decimates half or more from original column,
4662306a36Sopenharmony_ci *     skip count unit (0x105) before each unit sent.
4762306a36Sopenharmony_ci * Bit 2 - Vertical Decimation Control
4862306a36Sopenharmony_ci *   0 Vertical decimation is disabled.
4962306a36Sopenharmony_ci *   1 Vertical decimation is enabled.
5062306a36Sopenharmony_ci * Bit 3 - Vertical Greater or Equal to Half
5162306a36Sopenharmony_ci *   0 Decimates less than half from original row,
5262306a36Sopenharmony_ci *     send count unit (0x105) before each unit skipped.
5362306a36Sopenharmony_ci *   1 Decimates half or more from original row,
5462306a36Sopenharmony_ci *     skip count unit (0x105) before each unit sent.
5562306a36Sopenharmony_ci * Bit 4 - Decimation Unit
5662306a36Sopenharmony_ci *  0 Decimation will work with 2 rows or columns per unit.
5762306a36Sopenharmony_ci *  1 Decimation will work with 4 rows or columns per unit.
5862306a36Sopenharmony_ci */
5962306a36Sopenharmony_ci#define STK1160_DMCTRL_H_UNITS		0x104
6062306a36Sopenharmony_ci#define STK1160_DMCTRL_V_UNITS		0x105
6162306a36Sopenharmony_ci#define STK1160_DMCTRL			0x106
6262306a36Sopenharmony_ci#define  STK1160_H_DEC_EN		BIT(0)
6362306a36Sopenharmony_ci#define  STK1160_H_DEC_MODE		BIT(1)
6462306a36Sopenharmony_ci#define  STK1160_V_DEC_EN		BIT(2)
6562306a36Sopenharmony_ci#define  STK1160_V_DEC_MODE		BIT(3)
6662306a36Sopenharmony_ci#define  STK1160_DEC_UNIT_SIZE		BIT(4)
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/* Capture Frame Start Position */
6962306a36Sopenharmony_ci#define STK116_CFSPO			0x110
7062306a36Sopenharmony_ci#define STK116_CFSPO_STX_L		0x110
7162306a36Sopenharmony_ci#define STK116_CFSPO_STX_H		0x111
7262306a36Sopenharmony_ci#define STK116_CFSPO_STY_L		0x112
7362306a36Sopenharmony_ci#define STK116_CFSPO_STY_H		0x113
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/* Capture Frame End Position */
7662306a36Sopenharmony_ci#define STK116_CFEPO			0x114
7762306a36Sopenharmony_ci#define STK116_CFEPO_ENX_L		0x114
7862306a36Sopenharmony_ci#define STK116_CFEPO_ENX_H		0x115
7962306a36Sopenharmony_ci#define STK116_CFEPO_ENY_L		0x116
8062306a36Sopenharmony_ci#define STK116_CFEPO_ENY_H		0x117
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* Serial Interface Control  */
8362306a36Sopenharmony_ci#define STK1160_SICTL			0x200
8462306a36Sopenharmony_ci#define STK1160_SICTL_CD		0x202
8562306a36Sopenharmony_ci#define STK1160_SICTL_SDA		0x203
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/* Serial Bus Write */
8862306a36Sopenharmony_ci#define STK1160_SBUSW			0x204
8962306a36Sopenharmony_ci#define STK1160_SBUSW_WA		0x204
9062306a36Sopenharmony_ci#define STK1160_SBUSW_WD		0x205
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci/* Serial Bus Read */
9362306a36Sopenharmony_ci#define STK1160_SBUSR			0x208
9462306a36Sopenharmony_ci#define STK1160_SBUSR_RA		0x208
9562306a36Sopenharmony_ci#define STK1160_SBUSR_RD		0x209
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* Alternate Serial Interface Control */
9862306a36Sopenharmony_ci#define STK1160_ASIC			0x2fc
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* PLL Select Options */
10162306a36Sopenharmony_ci#define STK1160_PLLSO			0x018
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci/* PLL Frequency Divider */
10462306a36Sopenharmony_ci#define STK1160_PLLFD			0x01c
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/* Timing Generator */
10762306a36Sopenharmony_ci#define STK1160_TIGEN			0x300
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci/* Timing Control Parameter */
11062306a36Sopenharmony_ci#define STK1160_TICTL			0x350
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* AC97 Audio Control */
11362306a36Sopenharmony_ci#define STK1160_AC97CTL_0		0x500
11462306a36Sopenharmony_ci#define STK1160_AC97CTL_1		0x504
11562306a36Sopenharmony_ci#define  STK1160_AC97CTL_0_CR		BIT(1)
11662306a36Sopenharmony_ci#define  STK1160_AC97CTL_0_CW		BIT(2)
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci/* Use [0:6] bits of register 0x504 to set codec command address */
11962306a36Sopenharmony_ci#define STK1160_AC97_ADDR		0x504
12062306a36Sopenharmony_ci/* Use [16:31] bits of register 0x500 to set codec command data */
12162306a36Sopenharmony_ci#define STK1160_AC97_CMD		0x502
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/* Audio I2S Interface */
12462306a36Sopenharmony_ci#define STK1160_I2SCTL			0x50c
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* EEPROM Interface */
12762306a36Sopenharmony_ci#define STK1160_EEPROM_SZ		0x5f0
128