18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * ALSA SoC Audio Layer - Rockchip SPDIF transceiver driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2015 Collabora Ltd.
68c2ecf20Sopenharmony_ci * Author: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef _ROCKCHIP_SPDIF_H
108c2ecf20Sopenharmony_ci#define _ROCKCHIP_SPDIF_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * CFGR
148c2ecf20Sopenharmony_ci * transfer configuration register
158c2ecf20Sopenharmony_ci*/
168c2ecf20Sopenharmony_ci#define SPDIF_CFGR_CLK_DIV_SHIFT	(16)
178c2ecf20Sopenharmony_ci#define SPDIF_CFGR_CLK_DIV_MASK		(0xff << SPDIF_CFGR_CLK_DIV_SHIFT)
188c2ecf20Sopenharmony_ci#define SPDIF_CFGR_CLK_DIV(x)		(x << SPDIF_CFGR_CLK_DIV_SHIFT)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define SPDIF_CFGR_HALFWORD_SHIFT	2
218c2ecf20Sopenharmony_ci#define SPDIF_CFGR_HALFWORD_DISABLE	(0 << SPDIF_CFGR_HALFWORD_SHIFT)
228c2ecf20Sopenharmony_ci#define SPDIF_CFGR_HALFWORD_ENABLE	(1 << SPDIF_CFGR_HALFWORD_SHIFT)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define SPDIF_CFGR_VDW_SHIFT	0
258c2ecf20Sopenharmony_ci#define SPDIF_CFGR_VDW(x)	(x << SPDIF_CFGR_VDW_SHIFT)
268c2ecf20Sopenharmony_ci#define SDPIF_CFGR_VDW_MASK	(0xf << SPDIF_CFGR_VDW_SHIFT)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define SPDIF_CFGR_VDW_16	SPDIF_CFGR_VDW(0x0)
298c2ecf20Sopenharmony_ci#define SPDIF_CFGR_VDW_20	SPDIF_CFGR_VDW(0x1)
308c2ecf20Sopenharmony_ci#define SPDIF_CFGR_VDW_24	SPDIF_CFGR_VDW(0x2)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/*
338c2ecf20Sopenharmony_ci * DMACR
348c2ecf20Sopenharmony_ci * DMA control register
358c2ecf20Sopenharmony_ci*/
368c2ecf20Sopenharmony_ci#define SPDIF_DMACR_TDE_SHIFT	5
378c2ecf20Sopenharmony_ci#define SPDIF_DMACR_TDE_DISABLE	(0 << SPDIF_DMACR_TDE_SHIFT)
388c2ecf20Sopenharmony_ci#define SPDIF_DMACR_TDE_ENABLE	(1 << SPDIF_DMACR_TDE_SHIFT)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define SPDIF_DMACR_TDL_SHIFT	0
418c2ecf20Sopenharmony_ci#define SPDIF_DMACR_TDL(x)	((x) << SPDIF_DMACR_TDL_SHIFT)
428c2ecf20Sopenharmony_ci#define SPDIF_DMACR_TDL_MASK	(0x1f << SPDIF_DMACR_TDL_SHIFT)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * XFER
468c2ecf20Sopenharmony_ci * Transfer control register
478c2ecf20Sopenharmony_ci*/
488c2ecf20Sopenharmony_ci#define SPDIF_XFER_TXS_SHIFT	0
498c2ecf20Sopenharmony_ci#define SPDIF_XFER_TXS_STOP	(0 << SPDIF_XFER_TXS_SHIFT)
508c2ecf20Sopenharmony_ci#define SPDIF_XFER_TXS_START	(1 << SPDIF_XFER_TXS_SHIFT)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define SPDIF_CFGR	(0x0000)
538c2ecf20Sopenharmony_ci#define SPDIF_SDBLR	(0x0004)
548c2ecf20Sopenharmony_ci#define SPDIF_DMACR	(0x0008)
558c2ecf20Sopenharmony_ci#define SPDIF_INTCR	(0x000c)
568c2ecf20Sopenharmony_ci#define SPDIF_INTSR	(0x0010)
578c2ecf20Sopenharmony_ci#define SPDIF_XFER	(0x0018)
588c2ecf20Sopenharmony_ci#define SPDIF_SMPDR	(0x0020)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif /* _ROCKCHIP_SPDIF_H */
61