xref: /kernel/linux/linux-6.6/sound/soc/meson/aiu.h (revision 62306a36)
162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2018 BayLibre, SAS.
462306a36Sopenharmony_ci * Author: Jerome Brunet <jbrunet@baylibre.com>
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef _MESON_AIU_H
862306a36Sopenharmony_ci#define _MESON_AIU_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct clk;
1162306a36Sopenharmony_cistruct clk_bulk_data;
1262306a36Sopenharmony_cistruct device;
1362306a36Sopenharmony_cistruct of_phandle_args;
1462306a36Sopenharmony_cistruct snd_soc_dai;
1562306a36Sopenharmony_cistruct snd_soc_dai_ops;
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cienum aiu_clk_ids {
1862306a36Sopenharmony_ci	PCLK = 0,
1962306a36Sopenharmony_ci	AOCLK,
2062306a36Sopenharmony_ci	MCLK,
2162306a36Sopenharmony_ci	MIXER
2262306a36Sopenharmony_ci};
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct aiu_interface {
2562306a36Sopenharmony_ci	struct clk_bulk_data *clks;
2662306a36Sopenharmony_ci	unsigned int clk_num;
2762306a36Sopenharmony_ci	int irq;
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistruct aiu_platform_data {
3162306a36Sopenharmony_ci	bool has_acodec;
3262306a36Sopenharmony_ci	bool has_clk_ctrl_more_i2s_div;
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cistruct aiu {
3662306a36Sopenharmony_ci	struct clk *spdif_mclk;
3762306a36Sopenharmony_ci	struct aiu_interface i2s;
3862306a36Sopenharmony_ci	struct aiu_interface spdif;
3962306a36Sopenharmony_ci	const struct aiu_platform_data *platform;
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define AIU_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |	\
4362306a36Sopenharmony_ci		     SNDRV_PCM_FMTBIT_S20_LE |	\
4462306a36Sopenharmony_ci		     SNDRV_PCM_FMTBIT_S24_LE)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciint aiu_of_xlate_dai_name(struct snd_soc_component *component,
4762306a36Sopenharmony_ci			  const struct of_phandle_args *args,
4862306a36Sopenharmony_ci			  const char **dai_name,
4962306a36Sopenharmony_ci			  unsigned int component_id);
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciint aiu_hdmi_ctrl_register_component(struct device *dev);
5262306a36Sopenharmony_ciint aiu_acodec_ctrl_register_component(struct device *dev);
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciint aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai);
5562306a36Sopenharmony_ciint aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai);
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciextern const struct snd_soc_dai_ops aiu_fifo_i2s_dai_ops;
5862306a36Sopenharmony_ciextern const struct snd_soc_dai_ops aiu_fifo_spdif_dai_ops;
5962306a36Sopenharmony_ciextern const struct snd_soc_dai_ops aiu_encoder_i2s_dai_ops;
6062306a36Sopenharmony_ciextern const struct snd_soc_dai_ops aiu_encoder_spdif_dai_ops;
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define AIU_IEC958_BPF			0x000
6362306a36Sopenharmony_ci#define AIU_958_MISC			0x010
6462306a36Sopenharmony_ci#define AIU_IEC958_DCU_FF_CTRL		0x01c
6562306a36Sopenharmony_ci#define AIU_958_CHSTAT_L0		0x020
6662306a36Sopenharmony_ci#define AIU_958_CHSTAT_L1		0x024
6762306a36Sopenharmony_ci#define AIU_958_CTRL			0x028
6862306a36Sopenharmony_ci#define AIU_I2S_SOURCE_DESC		0x034
6962306a36Sopenharmony_ci#define AIU_I2S_DAC_CFG			0x040
7062306a36Sopenharmony_ci#define AIU_I2S_SYNC			0x044
7162306a36Sopenharmony_ci#define AIU_I2S_MISC			0x048
7262306a36Sopenharmony_ci#define AIU_RST_SOFT			0x054
7362306a36Sopenharmony_ci#define AIU_CLK_CTRL			0x058
7462306a36Sopenharmony_ci#define AIU_CLK_CTRL_MORE		0x064
7562306a36Sopenharmony_ci#define AIU_CODEC_DAC_LRCLK_CTRL	0x0a0
7662306a36Sopenharmony_ci#define AIU_HDMI_CLK_DATA_CTRL		0x0a8
7762306a36Sopenharmony_ci#define AIU_ACODEC_CTRL			0x0b0
7862306a36Sopenharmony_ci#define AIU_958_CHSTAT_R0		0x0c0
7962306a36Sopenharmony_ci#define AIU_958_CHSTAT_R1		0x0c4
8062306a36Sopenharmony_ci#define AIU_MEM_I2S_START		0x180
8162306a36Sopenharmony_ci#define AIU_MEM_I2S_MASKS		0x18c
8262306a36Sopenharmony_ci#define AIU_MEM_I2S_CONTROL		0x190
8362306a36Sopenharmony_ci#define AIU_MEM_IEC958_START		0x194
8462306a36Sopenharmony_ci#define AIU_MEM_IEC958_CONTROL		0x1a4
8562306a36Sopenharmony_ci#define AIU_MEM_I2S_BUF_CNTL		0x1d8
8662306a36Sopenharmony_ci#define AIU_MEM_IEC958_BUF_CNTL		0x1fc
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci#endif /* _MESON_AIU_H */
89