18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * omap-mcpdm.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2009 - 2011 Texas Instruments
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Contact: Misael Lopez Cruz <misael.lopez@ti.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __OMAP_MCPDM_H__
118c2ecf20Sopenharmony_ci#define __OMAP_MCPDM_H__
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define MCPDM_REG_REVISION		0x00
148c2ecf20Sopenharmony_ci#define MCPDM_REG_SYSCONFIG		0x10
158c2ecf20Sopenharmony_ci#define MCPDM_REG_IRQSTATUS_RAW		0x24
168c2ecf20Sopenharmony_ci#define MCPDM_REG_IRQSTATUS		0x28
178c2ecf20Sopenharmony_ci#define MCPDM_REG_IRQENABLE_SET		0x2C
188c2ecf20Sopenharmony_ci#define MCPDM_REG_IRQENABLE_CLR		0x30
198c2ecf20Sopenharmony_ci#define MCPDM_REG_IRQWAKE_EN		0x34
208c2ecf20Sopenharmony_ci#define MCPDM_REG_DMAENABLE_SET		0x38
218c2ecf20Sopenharmony_ci#define MCPDM_REG_DMAENABLE_CLR		0x3C
228c2ecf20Sopenharmony_ci#define MCPDM_REG_DMAWAKEEN		0x40
238c2ecf20Sopenharmony_ci#define MCPDM_REG_CTRL			0x44
248c2ecf20Sopenharmony_ci#define MCPDM_REG_DN_DATA		0x48
258c2ecf20Sopenharmony_ci#define MCPDM_REG_UP_DATA		0x4C
268c2ecf20Sopenharmony_ci#define MCPDM_REG_FIFO_CTRL_DN		0x50
278c2ecf20Sopenharmony_ci#define MCPDM_REG_FIFO_CTRL_UP		0x54
288c2ecf20Sopenharmony_ci#define MCPDM_REG_DN_OFFSET		0x58
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * MCPDM_IRQ bit fields
328c2ecf20Sopenharmony_ci * IRQSTATUS_RAW, IRQSTATUS, IRQENABLE_SET, IRQENABLE_CLR
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define MCPDM_DN_IRQ			(1 << 0)
368c2ecf20Sopenharmony_ci#define MCPDM_DN_IRQ_EMPTY		(1 << 1)
378c2ecf20Sopenharmony_ci#define MCPDM_DN_IRQ_ALMST_EMPTY	(1 << 2)
388c2ecf20Sopenharmony_ci#define MCPDM_DN_IRQ_FULL		(1 << 3)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define MCPDM_UP_IRQ			(1 << 8)
418c2ecf20Sopenharmony_ci#define MCPDM_UP_IRQ_EMPTY		(1 << 9)
428c2ecf20Sopenharmony_ci#define MCPDM_UP_IRQ_ALMST_FULL		(1 << 10)
438c2ecf20Sopenharmony_ci#define MCPDM_UP_IRQ_FULL		(1 << 11)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define MCPDM_DOWNLINK_IRQ_MASK		0x00F
468c2ecf20Sopenharmony_ci#define MCPDM_UPLINK_IRQ_MASK		0xF00
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * MCPDM_DMAENABLE bit fields
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define MCPDM_DMA_DN_ENABLE		(1 << 0)
538c2ecf20Sopenharmony_ci#define MCPDM_DMA_UP_ENABLE		(1 << 1)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci * MCPDM_CTRL bit fields
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define MCPDM_PDM_UPLINK_EN(x)		(1 << (x - 1)) /* ch1 is at bit 0 */
608c2ecf20Sopenharmony_ci#define MCPDM_PDM_DOWNLINK_EN(x)	(1 << (x + 2)) /* ch1 is at bit 3 */
618c2ecf20Sopenharmony_ci#define MCPDM_PDMOUTFORMAT		(1 << 8)
628c2ecf20Sopenharmony_ci#define MCPDM_CMD_INT			(1 << 9)
638c2ecf20Sopenharmony_ci#define MCPDM_STATUS_INT		(1 << 10)
648c2ecf20Sopenharmony_ci#define MCPDM_SW_UP_RST			(1 << 11)
658c2ecf20Sopenharmony_ci#define MCPDM_SW_DN_RST			(1 << 12)
668c2ecf20Sopenharmony_ci#define MCPDM_WD_EN			(1 << 14)
678c2ecf20Sopenharmony_ci#define MCPDM_PDM_UP_MASK		0x7
688c2ecf20Sopenharmony_ci#define MCPDM_PDM_DN_MASK		(0x1f << 3)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define MCPDM_PDMOUTFORMAT_LJUST	(0 << 8)
728c2ecf20Sopenharmony_ci#define MCPDM_PDMOUTFORMAT_RJUST	(1 << 8)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/*
758c2ecf20Sopenharmony_ci * MCPDM_FIFO_CTRL bit fields
768c2ecf20Sopenharmony_ci */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define MCPDM_UP_THRES_MAX		0xF
798c2ecf20Sopenharmony_ci#define MCPDM_DN_THRES_MAX		0xF
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/*
828c2ecf20Sopenharmony_ci * MCPDM_DN_OFFSET bit fields
838c2ecf20Sopenharmony_ci */
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define MCPDM_DN_OFST_RX1_EN		(1 << 0)
868c2ecf20Sopenharmony_ci#define MCPDM_DNOFST_RX1(x)		((x & 0x1f) << 1)
878c2ecf20Sopenharmony_ci#define MCPDM_DN_OFST_RX2_EN		(1 << 8)
888c2ecf20Sopenharmony_ci#define MCPDM_DNOFST_RX2(x)		((x & 0x1f) << 9)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_civoid omap_mcpdm_configure_dn_offsets(struct snd_soc_pcm_runtime *rtd,
918c2ecf20Sopenharmony_ci				    u8 rx1, u8 rx2);
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#endif	/* End of __OMAP_MCPDM_H__ */
94