18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ATMEL_PDMIC_H_
38c2ecf20Sopenharmony_ci#define __ATMEL_PDMIC_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/bitops.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define PDMIC_CR	0x00000000
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define PDMIC_CR_SWRST		0x1
108c2ecf20Sopenharmony_ci#define PDMIC_CR_SWRST_MASK	BIT(0)
118c2ecf20Sopenharmony_ci#define PDMIC_CR_SWRST_SHIFT	(0)
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define PDMIC_CR_ENPDM_DIS	0x0
148c2ecf20Sopenharmony_ci#define PDMIC_CR_ENPDM_EN	0x1
158c2ecf20Sopenharmony_ci#define PDMIC_CR_ENPDM_MASK	BIT(4)
168c2ecf20Sopenharmony_ci#define PDMIC_CR_ENPDM_SHIFT	(4)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define PDMIC_MR	0x00000004
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define PDMIC_MR_CLKS_PCK	0x0
218c2ecf20Sopenharmony_ci#define PDMIC_MR_CLKS_GCK	0x1
228c2ecf20Sopenharmony_ci#define PDMIC_MR_CLKS_MASK	BIT(4)
238c2ecf20Sopenharmony_ci#define PDMIC_MR_CLKS_SHIFT	(4)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define PDMIC_MR_PRESCAL_MASK	GENMASK(14, 8)
268c2ecf20Sopenharmony_ci#define PDMIC_MR_PRESCAL_SHIFT	(8)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define PDMIC_CDR	0x00000014
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define PDMIC_IER	0x00000018
318c2ecf20Sopenharmony_ci#define PDMIC_IER_OVRE			BIT(25)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define PDMIC_IDR	0x0000001c
348c2ecf20Sopenharmony_ci#define PDMIC_IDR_OVRE			BIT(25)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define PDMIC_IMR	0x00000020
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define PDMIC_ISR	0x00000024
398c2ecf20Sopenharmony_ci#define PDMIC_ISR_OVRE			BIT(25)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define PDMIC_DSPR0	0x00000058
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_HPFBYP_DIS		0x1
448c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_HPFBYP_EN		0x0
458c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_HPFBYP_MASK		BIT(1)
468c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_HPFBYP_SHIFT	(1)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SINBYP_DIS		0x1
498c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SINBYP_EN		0x0
508c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SINBYP_MASK		BIT(2)
518c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SINBYP_SHIFT	(2)
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SIZE_16_BITS	0x0
548c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SIZE_32_BITS	0x1
558c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SIZE_MASK		BIT(3)
568c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SIZE_SHIFT		(3)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_OSR_128		0x0
598c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_OSR_64		0x1
608c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_OSR_MASK		GENMASK(6, 4)
618c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_OSR_SHIFT		(4)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SCALE_MASK		GENMASK(11, 8)
648c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SCALE_SHIFT		(8)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SHIFT_MASK		GENMASK(15, 12)
678c2ecf20Sopenharmony_ci#define PDMIC_DSPR0_SHIFT_SHIFT		(12)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define PDMIC_DSPR1	0x0000005c
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define PDMIC_DSPR1_DGAIN_MASK		GENMASK(14, 0)
728c2ecf20Sopenharmony_ci#define PDMIC_DSPR1_DGAIN_SHIFT		(0)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define PDMIC_DSPR1_OFFSET_MASK		GENMASK(31, 16)
758c2ecf20Sopenharmony_ci#define PDMIC_DSPR1_OFFSET_SHIFT	(16)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define PDMIC_WPMR	0x000000e4
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define PDMIC_WPSR	0x000000e8
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#endif
82