162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2020 NXP
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _FSL_AUD2HTX_H
762306a36Sopenharmony_ci#define _FSL_AUD2HTX_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define FSL_AUD2HTX_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | \
1062306a36Sopenharmony_ci			     SNDRV_PCM_FMTBIT_S32_LE)
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* AUD2HTX Register Map */
1362306a36Sopenharmony_ci#define AUD2HTX_CTRL          0x0   /* AUD2HTX Control Register */
1462306a36Sopenharmony_ci#define AUD2HTX_CTRL_EXT      0x4   /* AUD2HTX Control Extended Register */
1562306a36Sopenharmony_ci#define AUD2HTX_WR            0x8   /* AUD2HTX Write Register */
1662306a36Sopenharmony_ci#define AUD2HTX_STATUS        0xC   /* AUD2HTX Status Register */
1762306a36Sopenharmony_ci#define AUD2HTX_IRQ_NOMASK    0x10  /* AUD2HTX Nonmasked Interrupt Flags Register */
1862306a36Sopenharmony_ci#define AUD2HTX_IRQ_MASKED    0x14  /* AUD2HTX Masked Interrupt Flags Register */
1962306a36Sopenharmony_ci#define AUD2HTX_IRQ_MASK      0x18  /* AUD2HTX IRQ Masks Register */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* AUD2HTX Control Register */
2262306a36Sopenharmony_ci#define AUD2HTX_CTRL_EN          BIT(0)
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/* AUD2HTX Control Extended Register */
2562306a36Sopenharmony_ci#define AUD2HTX_CTRE_DE          BIT(0)
2662306a36Sopenharmony_ci#define AUD2HTX_CTRE_DT_SHIFT    0x1
2762306a36Sopenharmony_ci#define AUD2HTX_CTRE_DT_WIDTH    0x2
2862306a36Sopenharmony_ci#define AUD2HTX_CTRE_DT_MASK     ((BIT(AUD2HTX_CTRE_DT_WIDTH) - 1) \
2962306a36Sopenharmony_ci				 << AUD2HTX_CTRE_DT_SHIFT)
3062306a36Sopenharmony_ci#define AUD2HTX_CTRE_WL_SHIFT    16
3162306a36Sopenharmony_ci#define AUD2HTX_CTRE_WL_WIDTH    5
3262306a36Sopenharmony_ci#define AUD2HTX_CTRE_WL_MASK     ((BIT(AUD2HTX_CTRE_WL_WIDTH) - 1) \
3362306a36Sopenharmony_ci				 << AUD2HTX_CTRE_WL_SHIFT)
3462306a36Sopenharmony_ci#define AUD2HTX_CTRE_WH_SHIFT    24
3562306a36Sopenharmony_ci#define AUD2HTX_CTRE_WH_WIDTH    5
3662306a36Sopenharmony_ci#define AUD2HTX_CTRE_WH_MASK     ((BIT(AUD2HTX_CTRE_WH_WIDTH) - 1) \
3762306a36Sopenharmony_ci				 << AUD2HTX_CTRE_WH_SHIFT)
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci/* AUD2HTX IRQ Masks Register */
4062306a36Sopenharmony_ci#define AUD2HTX_WM_HIGH_IRQ_MASK BIT(2)
4162306a36Sopenharmony_ci#define AUD2HTX_WM_LOW_IRQ_MASK  BIT(1)
4262306a36Sopenharmony_ci#define AUD2HTX_OVF_MASK         BIT(0)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define AUD2HTX_FIFO_DEPTH       0x20
4562306a36Sopenharmony_ci#define AUD2HTX_WTMK_LOW         0x10
4662306a36Sopenharmony_ci#define AUD2HTX_WTMK_HIGH        0x10
4762306a36Sopenharmony_ci#define AUD2HTX_MAXBURST         0x10
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/**
5062306a36Sopenharmony_ci * fsl_aud2htx: AUD2HTX private data
5162306a36Sopenharmony_ci *
5262306a36Sopenharmony_ci * @pdev: platform device pointer
5362306a36Sopenharmony_ci * @regmap: regmap handler
5462306a36Sopenharmony_ci * @bus_clk: clock source to access register
5562306a36Sopenharmony_ci * @dma_params_rx: DMA parameters for receive channel
5662306a36Sopenharmony_ci * @dma_params_tx: DMA parameters for transmit channel
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_cistruct fsl_aud2htx {
5962306a36Sopenharmony_ci	struct platform_device *pdev;
6062306a36Sopenharmony_ci	struct regmap *regmap;
6162306a36Sopenharmony_ci	struct clk *bus_clk;
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci	struct snd_dmaengine_dai_dma_data dma_params_rx;
6462306a36Sopenharmony_ci	struct snd_dmaengine_dai_dma_data dma_params_tx;
6562306a36Sopenharmony_ci};
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#endif /* _FSL_AUD2HTX_H */
68