162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * mt8195-afe-clk.h -- Mediatek 8195 afe clock ctrl definition 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (c) 2021 MediaTek Inc. 662306a36Sopenharmony_ci * Author: Bicycle Tsai <bicycle.tsai@mediatek.com> 762306a36Sopenharmony_ci * Trevor Wu <trevor.wu@mediatek.com> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef _MT8195_AFE_CLK_H_ 1162306a36Sopenharmony_ci#define _MT8195_AFE_CLK_H_ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cienum { 1462306a36Sopenharmony_ci /* xtal */ 1562306a36Sopenharmony_ci MT8195_CLK_XTAL_26M, 1662306a36Sopenharmony_ci /* divider */ 1762306a36Sopenharmony_ci MT8195_CLK_TOP_APLL1, 1862306a36Sopenharmony_ci MT8195_CLK_TOP_APLL2, 1962306a36Sopenharmony_ci MT8195_CLK_TOP_APLL12_DIV0, 2062306a36Sopenharmony_ci MT8195_CLK_TOP_APLL12_DIV1, 2162306a36Sopenharmony_ci MT8195_CLK_TOP_APLL12_DIV2, 2262306a36Sopenharmony_ci MT8195_CLK_TOP_APLL12_DIV3, 2362306a36Sopenharmony_ci MT8195_CLK_TOP_APLL12_DIV9, 2462306a36Sopenharmony_ci /* mux */ 2562306a36Sopenharmony_ci MT8195_CLK_TOP_A1SYS_HP_SEL, 2662306a36Sopenharmony_ci MT8195_CLK_TOP_AUD_INTBUS_SEL, 2762306a36Sopenharmony_ci MT8195_CLK_TOP_AUDIO_H_SEL, 2862306a36Sopenharmony_ci MT8195_CLK_TOP_AUDIO_LOCAL_BUS_SEL, 2962306a36Sopenharmony_ci MT8195_CLK_TOP_DPTX_M_SEL, 3062306a36Sopenharmony_ci MT8195_CLK_TOP_I2SO1_M_SEL, 3162306a36Sopenharmony_ci MT8195_CLK_TOP_I2SO2_M_SEL, 3262306a36Sopenharmony_ci MT8195_CLK_TOP_I2SI1_M_SEL, 3362306a36Sopenharmony_ci MT8195_CLK_TOP_I2SI2_M_SEL, 3462306a36Sopenharmony_ci /* clock gate */ 3562306a36Sopenharmony_ci MT8195_CLK_INFRA_AO_AUDIO_26M_B, 3662306a36Sopenharmony_ci MT8195_CLK_SCP_ADSP_AUDIODSP, 3762306a36Sopenharmony_ci MT8195_CLK_AUD_AFE, 3862306a36Sopenharmony_ci MT8195_CLK_AUD_APLL1_TUNER, 3962306a36Sopenharmony_ci MT8195_CLK_AUD_APLL2_TUNER, 4062306a36Sopenharmony_ci MT8195_CLK_AUD_APLL, 4162306a36Sopenharmony_ci MT8195_CLK_AUD_APLL2, 4262306a36Sopenharmony_ci MT8195_CLK_AUD_DAC, 4362306a36Sopenharmony_ci MT8195_CLK_AUD_ADC, 4462306a36Sopenharmony_ci MT8195_CLK_AUD_DAC_HIRES, 4562306a36Sopenharmony_ci MT8195_CLK_AUD_A1SYS_HP, 4662306a36Sopenharmony_ci MT8195_CLK_AUD_ADC_HIRES, 4762306a36Sopenharmony_ci MT8195_CLK_AUD_ADDA6_ADC, 4862306a36Sopenharmony_ci MT8195_CLK_AUD_ADDA6_ADC_HIRES, 4962306a36Sopenharmony_ci MT8195_CLK_AUD_I2SIN, 5062306a36Sopenharmony_ci MT8195_CLK_AUD_TDM_IN, 5162306a36Sopenharmony_ci MT8195_CLK_AUD_I2S_OUT, 5262306a36Sopenharmony_ci MT8195_CLK_AUD_TDM_OUT, 5362306a36Sopenharmony_ci MT8195_CLK_AUD_HDMI_OUT, 5462306a36Sopenharmony_ci MT8195_CLK_AUD_ASRC11, 5562306a36Sopenharmony_ci MT8195_CLK_AUD_ASRC12, 5662306a36Sopenharmony_ci MT8195_CLK_AUD_A1SYS, 5762306a36Sopenharmony_ci MT8195_CLK_AUD_A2SYS, 5862306a36Sopenharmony_ci MT8195_CLK_AUD_PCMIF, 5962306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL1, 6062306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL2, 6162306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL3, 6262306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL4, 6362306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL5, 6462306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL6, 6562306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL8, 6662306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL9, 6762306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_UL10, 6862306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL2, 6962306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL3, 7062306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL6, 7162306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL7, 7262306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL8, 7362306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL10, 7462306a36Sopenharmony_ci MT8195_CLK_AUD_MEMIF_DL11, 7562306a36Sopenharmony_ci MT8195_CLK_NUM, 7662306a36Sopenharmony_ci}; 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_cienum { 7962306a36Sopenharmony_ci MT8195_MCK_SEL_26M, 8062306a36Sopenharmony_ci MT8195_MCK_SEL_APLL1, 8162306a36Sopenharmony_ci MT8195_MCK_SEL_APLL2, 8262306a36Sopenharmony_ci MT8195_MCK_SEL_APLL3, 8362306a36Sopenharmony_ci MT8195_MCK_SEL_APLL4, 8462306a36Sopenharmony_ci MT8195_MCK_SEL_APLL5, 8562306a36Sopenharmony_ci MT8195_MCK_SEL_HDMIRX_APLL, 8662306a36Sopenharmony_ci MT8195_MCK_SEL_NUM, 8762306a36Sopenharmony_ci}; 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_cienum { 9062306a36Sopenharmony_ci MT8195_AUD_PLL1, 9162306a36Sopenharmony_ci MT8195_AUD_PLL2, 9262306a36Sopenharmony_ci MT8195_AUD_PLL3, 9362306a36Sopenharmony_ci MT8195_AUD_PLL4, 9462306a36Sopenharmony_ci MT8195_AUD_PLL5, 9562306a36Sopenharmony_ci MT8195_AUD_PLL_NUM, 9662306a36Sopenharmony_ci}; 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_cistruct mtk_base_afe; 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ciint mt8195_afe_get_mclk_source_clk_id(int sel); 10162306a36Sopenharmony_ciint mt8195_afe_get_mclk_source_rate(struct mtk_base_afe *afe, int apll); 10262306a36Sopenharmony_ciint mt8195_afe_get_default_mclk_source_by_rate(int rate); 10362306a36Sopenharmony_ciint mt8195_afe_init_clock(struct mtk_base_afe *afe); 10462306a36Sopenharmony_ciint mt8195_afe_enable_clk(struct mtk_base_afe *afe, struct clk *clk); 10562306a36Sopenharmony_civoid mt8195_afe_disable_clk(struct mtk_base_afe *afe, struct clk *clk); 10662306a36Sopenharmony_ciint mt8195_afe_prepare_clk(struct mtk_base_afe *afe, struct clk *clk); 10762306a36Sopenharmony_civoid mt8195_afe_unprepare_clk(struct mtk_base_afe *afe, struct clk *clk); 10862306a36Sopenharmony_ciint mt8195_afe_enable_clk_atomic(struct mtk_base_afe *afe, struct clk *clk); 10962306a36Sopenharmony_civoid mt8195_afe_disable_clk_atomic(struct mtk_base_afe *afe, struct clk *clk); 11062306a36Sopenharmony_ciint mt8195_afe_set_clk_rate(struct mtk_base_afe *afe, struct clk *clk, 11162306a36Sopenharmony_ci unsigned int rate); 11262306a36Sopenharmony_ciint mt8195_afe_set_clk_parent(struct mtk_base_afe *afe, struct clk *clk, 11362306a36Sopenharmony_ci struct clk *parent); 11462306a36Sopenharmony_ciint mt8195_afe_enable_main_clock(struct mtk_base_afe *afe); 11562306a36Sopenharmony_ciint mt8195_afe_disable_main_clock(struct mtk_base_afe *afe); 11662306a36Sopenharmony_ciint mt8195_afe_enable_reg_rw_clk(struct mtk_base_afe *afe); 11762306a36Sopenharmony_ciint mt8195_afe_disable_reg_rw_clk(struct mtk_base_afe *afe); 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#endif 120