162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * ALSA SoC Audio Layer - Rockchip SPDIF transceiver driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2015 Collabora Ltd.
662306a36Sopenharmony_ci * Author: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef _ROCKCHIP_SPDIF_H
1062306a36Sopenharmony_ci#define _ROCKCHIP_SPDIF_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * CFGR
1462306a36Sopenharmony_ci * transfer configuration register
1562306a36Sopenharmony_ci*/
1662306a36Sopenharmony_ci#define SPDIF_CFGR_CLK_DIV_SHIFT	(16)
1762306a36Sopenharmony_ci#define SPDIF_CFGR_CLK_DIV_MASK		(0xff << SPDIF_CFGR_CLK_DIV_SHIFT)
1862306a36Sopenharmony_ci#define SPDIF_CFGR_CLK_DIV(x)		(x << SPDIF_CFGR_CLK_DIV_SHIFT)
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define SPDIF_CFGR_HALFWORD_SHIFT	2
2162306a36Sopenharmony_ci#define SPDIF_CFGR_HALFWORD_DISABLE	(0 << SPDIF_CFGR_HALFWORD_SHIFT)
2262306a36Sopenharmony_ci#define SPDIF_CFGR_HALFWORD_ENABLE	(1 << SPDIF_CFGR_HALFWORD_SHIFT)
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define SPDIF_CFGR_VDW_SHIFT	0
2562306a36Sopenharmony_ci#define SPDIF_CFGR_VDW(x)	(x << SPDIF_CFGR_VDW_SHIFT)
2662306a36Sopenharmony_ci#define SDPIF_CFGR_VDW_MASK	(0xf << SPDIF_CFGR_VDW_SHIFT)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define SPDIF_CFGR_VDW_16	SPDIF_CFGR_VDW(0x0)
2962306a36Sopenharmony_ci#define SPDIF_CFGR_VDW_20	SPDIF_CFGR_VDW(0x1)
3062306a36Sopenharmony_ci#define SPDIF_CFGR_VDW_24	SPDIF_CFGR_VDW(0x2)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci/*
3362306a36Sopenharmony_ci * DMACR
3462306a36Sopenharmony_ci * DMA control register
3562306a36Sopenharmony_ci*/
3662306a36Sopenharmony_ci#define SPDIF_DMACR_TDE_SHIFT	5
3762306a36Sopenharmony_ci#define SPDIF_DMACR_TDE_DISABLE	(0 << SPDIF_DMACR_TDE_SHIFT)
3862306a36Sopenharmony_ci#define SPDIF_DMACR_TDE_ENABLE	(1 << SPDIF_DMACR_TDE_SHIFT)
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define SPDIF_DMACR_TDL_SHIFT	0
4162306a36Sopenharmony_ci#define SPDIF_DMACR_TDL(x)	((x) << SPDIF_DMACR_TDL_SHIFT)
4262306a36Sopenharmony_ci#define SPDIF_DMACR_TDL_MASK	(0x1f << SPDIF_DMACR_TDL_SHIFT)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/*
4562306a36Sopenharmony_ci * XFER
4662306a36Sopenharmony_ci * Transfer control register
4762306a36Sopenharmony_ci*/
4862306a36Sopenharmony_ci#define SPDIF_XFER_TXS_SHIFT	0
4962306a36Sopenharmony_ci#define SPDIF_XFER_TXS_STOP	(0 << SPDIF_XFER_TXS_SHIFT)
5062306a36Sopenharmony_ci#define SPDIF_XFER_TXS_START	(1 << SPDIF_XFER_TXS_SHIFT)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define SPDIF_CFGR	(0x0000)
5362306a36Sopenharmony_ci#define SPDIF_SDBLR	(0x0004)
5462306a36Sopenharmony_ci#define SPDIF_DMACR	(0x0008)
5562306a36Sopenharmony_ci#define SPDIF_INTCR	(0x000c)
5662306a36Sopenharmony_ci#define SPDIF_INTSR	(0x0010)
5762306a36Sopenharmony_ci#define SPDIF_XFER	(0x0018)
5862306a36Sopenharmony_ci#define SPDIF_SMPDR	(0x0020)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#endif /* _ROCKCHIP_SPDIF_H */
61