18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * mt2701-afe-common.h -- Mediatek 2701 audio driver definitions 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2016 MediaTek Inc. 68c2ecf20Sopenharmony_ci * Author: Garlic Tseng <garlic.tseng@mediatek.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef _MT_2701_AFE_COMMON_H_ 108c2ecf20Sopenharmony_ci#define _MT_2701_AFE_COMMON_H_ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <sound/soc.h> 138c2ecf20Sopenharmony_ci#include <linux/clk.h> 148c2ecf20Sopenharmony_ci#include <linux/regmap.h> 158c2ecf20Sopenharmony_ci#include "mt2701-reg.h" 168c2ecf20Sopenharmony_ci#include "../common/mtk-base-afe.h" 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define MT2701_PLL_DOMAIN_0_RATE 98304000 198c2ecf20Sopenharmony_ci#define MT2701_PLL_DOMAIN_1_RATE 90316800 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cienum { 228c2ecf20Sopenharmony_ci MT2701_MEMIF_DL1, 238c2ecf20Sopenharmony_ci MT2701_MEMIF_DL2, 248c2ecf20Sopenharmony_ci MT2701_MEMIF_DL3, 258c2ecf20Sopenharmony_ci MT2701_MEMIF_DL4, 268c2ecf20Sopenharmony_ci MT2701_MEMIF_DL5, 278c2ecf20Sopenharmony_ci MT2701_MEMIF_DL_SINGLE_NUM, 288c2ecf20Sopenharmony_ci MT2701_MEMIF_DLM = MT2701_MEMIF_DL_SINGLE_NUM, 298c2ecf20Sopenharmony_ci MT2701_MEMIF_UL1, 308c2ecf20Sopenharmony_ci MT2701_MEMIF_UL2, 318c2ecf20Sopenharmony_ci MT2701_MEMIF_UL3, 328c2ecf20Sopenharmony_ci MT2701_MEMIF_UL4, 338c2ecf20Sopenharmony_ci MT2701_MEMIF_UL5, 348c2ecf20Sopenharmony_ci MT2701_MEMIF_DLBT, 358c2ecf20Sopenharmony_ci MT2701_MEMIF_ULBT, 368c2ecf20Sopenharmony_ci MT2701_MEMIF_NUM, 378c2ecf20Sopenharmony_ci MT2701_IO_I2S = MT2701_MEMIF_NUM, 388c2ecf20Sopenharmony_ci MT2701_IO_2ND_I2S, 398c2ecf20Sopenharmony_ci MT2701_IO_3RD_I2S, 408c2ecf20Sopenharmony_ci MT2701_IO_4TH_I2S, 418c2ecf20Sopenharmony_ci MT2701_IO_5TH_I2S, 428c2ecf20Sopenharmony_ci MT2701_IO_6TH_I2S, 438c2ecf20Sopenharmony_ci MT2701_IO_MRG, 448c2ecf20Sopenharmony_ci}; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cienum { 478c2ecf20Sopenharmony_ci MT2701_IRQ_ASYS_IRQ1, 488c2ecf20Sopenharmony_ci MT2701_IRQ_ASYS_IRQ2, 498c2ecf20Sopenharmony_ci MT2701_IRQ_ASYS_IRQ3, 508c2ecf20Sopenharmony_ci MT2701_IRQ_ASYS_END, 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cienum audio_base_clock { 548c2ecf20Sopenharmony_ci MT2701_INFRA_SYS_AUDIO, 558c2ecf20Sopenharmony_ci MT2701_TOP_AUD_MCLK_SRC0, 568c2ecf20Sopenharmony_ci MT2701_TOP_AUD_MCLK_SRC1, 578c2ecf20Sopenharmony_ci MT2701_TOP_AUD_A1SYS, 588c2ecf20Sopenharmony_ci MT2701_TOP_AUD_A2SYS, 598c2ecf20Sopenharmony_ci MT2701_AUDSYS_AFE, 608c2ecf20Sopenharmony_ci MT2701_AUDSYS_AFE_CONN, 618c2ecf20Sopenharmony_ci MT2701_AUDSYS_A1SYS, 628c2ecf20Sopenharmony_ci MT2701_AUDSYS_A2SYS, 638c2ecf20Sopenharmony_ci MT2701_BASE_CLK_NUM, 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cistruct mt2701_i2s_data { 678c2ecf20Sopenharmony_ci int i2s_ctrl_reg; 688c2ecf20Sopenharmony_ci int i2s_asrc_fs_shift; 698c2ecf20Sopenharmony_ci int i2s_asrc_fs_mask; 708c2ecf20Sopenharmony_ci}; 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_cistruct mt2701_i2s_path { 738c2ecf20Sopenharmony_ci int mclk_rate; 748c2ecf20Sopenharmony_ci int on[MTK_STREAM_NUM]; 758c2ecf20Sopenharmony_ci int occupied[MTK_STREAM_NUM]; 768c2ecf20Sopenharmony_ci const struct mt2701_i2s_data *i2s_data[MTK_STREAM_NUM]; 778c2ecf20Sopenharmony_ci struct clk *hop_ck[MTK_STREAM_NUM]; 788c2ecf20Sopenharmony_ci struct clk *sel_ck; 798c2ecf20Sopenharmony_ci struct clk *div_ck; 808c2ecf20Sopenharmony_ci struct clk *mclk_ck; 818c2ecf20Sopenharmony_ci struct clk *asrco_ck; 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_cistruct mt2701_soc_variants { 858c2ecf20Sopenharmony_ci bool has_one_heart_mode; 868c2ecf20Sopenharmony_ci int i2s_num; 878c2ecf20Sopenharmony_ci}; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_cistruct mt2701_afe_private { 908c2ecf20Sopenharmony_ci struct mt2701_i2s_path *i2s_path; 918c2ecf20Sopenharmony_ci struct clk *base_ck[MT2701_BASE_CLK_NUM]; 928c2ecf20Sopenharmony_ci struct clk *mrgif_ck; 938c2ecf20Sopenharmony_ci bool mrg_enable[MTK_STREAM_NUM]; 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci const struct mt2701_soc_variants *soc; 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci#endif 99