18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * rt5670-dsp.h  --  RT5670 ALSA SoC DSP driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2014 Realtek Microelectronics
68c2ecf20Sopenharmony_ci * Author: Bard Liao <bardliao@realtek.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __RT5670_DSP_H__
108c2ecf20Sopenharmony_ci#define __RT5670_DSP_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define RT5670_DSP_CTRL1		0xe0
138c2ecf20Sopenharmony_ci#define RT5670_DSP_CTRL2		0xe1
148c2ecf20Sopenharmony_ci#define RT5670_DSP_CTRL3		0xe2
158c2ecf20Sopenharmony_ci#define RT5670_DSP_CTRL4		0xe3
168c2ecf20Sopenharmony_ci#define RT5670_DSP_CTRL5		0xe4
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* DSP Control 1 (0xe0) */
198c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_MASK		(0xff << 8)
208c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_PE		(0x0d << 8)	/* Patch Entry */
218c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_MW		(0x3b << 8)	/* Memory Write */
228c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_MR		(0x37 << 8)	/* Memory Read */
238c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_RR		(0x60 << 8)	/* Register Read */
248c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_RW		(0x68 << 8)	/* Register Write */
258c2ecf20Sopenharmony_ci#define RT5670_DSP_REG_DATHI		(0x26 << 8)	/* High Data Addr */
268c2ecf20Sopenharmony_ci#define RT5670_DSP_REG_DATLO		(0x25 << 8)	/* Low Data Addr */
278c2ecf20Sopenharmony_ci#define RT5670_DSP_CLK_MASK		(0x3 << 6)
288c2ecf20Sopenharmony_ci#define RT5670_DSP_CLK_SFT		6
298c2ecf20Sopenharmony_ci#define RT5670_DSP_CLK_768K		(0x0 << 6)
308c2ecf20Sopenharmony_ci#define RT5670_DSP_CLK_384K		(0x1 << 6)
318c2ecf20Sopenharmony_ci#define RT5670_DSP_CLK_192K		(0x2 << 6)
328c2ecf20Sopenharmony_ci#define RT5670_DSP_CLK_96K		(0x3 << 6)
338c2ecf20Sopenharmony_ci#define RT5670_DSP_BUSY_MASK		(0x1 << 5)
348c2ecf20Sopenharmony_ci#define RT5670_DSP_RW_MASK		(0x1 << 4)
358c2ecf20Sopenharmony_ci#define RT5670_DSP_DL_MASK		(0x3 << 2)
368c2ecf20Sopenharmony_ci#define RT5670_DSP_DL_0			(0x0 << 2)
378c2ecf20Sopenharmony_ci#define RT5670_DSP_DL_1			(0x1 << 2)
388c2ecf20Sopenharmony_ci#define RT5670_DSP_DL_2			(0x2 << 2)
398c2ecf20Sopenharmony_ci#define RT5670_DSP_DL_3			(0x3 << 2)
408c2ecf20Sopenharmony_ci#define RT5670_DSP_I2C_AL_16		(0x1 << 1)
418c2ecf20Sopenharmony_ci#define RT5670_DSP_CMD_EN		(0x1)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cistruct rt5670_dsp_param {
448c2ecf20Sopenharmony_ci	u16 cmd_fmt;
458c2ecf20Sopenharmony_ci	u16 addr;
468c2ecf20Sopenharmony_ci	u16 data;
478c2ecf20Sopenharmony_ci	u8 cmd;
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#endif /* __RT5670_DSP_H__ */
518c2ecf20Sopenharmony_ci
52