summaryrefslogtreecommitdiffstats
path: root/sound/soc/mediatek/mt8188/mt8188-afe-clk.h
blob: 084fdfb1d877a42a8e2cb840a90c45eb1615b8fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * mt8188-afe-clk.h  --  MediaTek 8188 afe clock ctrl definition
 *
 * Copyright (c) 2022 MediaTek Inc.
 * Author: Bicycle Tsai <bicycle.tsai@mediatek.com>
 *         Trevor Wu <trevor.wu@mediatek.com>
 *         Chun-Chia Chiu <chun-chia.chiu@mediatek.com>
 */

#ifndef _MT8188_AFE_CLK_H_
#define _MT8188_AFE_CLK_H_

enum {
	/* xtal */
	MT8188_CLK_XTAL_26M,
	/* pll */
	MT8188_CLK_APMIXED_APLL1,
	MT8188_CLK_APMIXED_APLL2,
	/* divider */
	MT8188_CLK_TOP_APLL12_DIV0,
	MT8188_CLK_TOP_APLL12_DIV1,
	MT8188_CLK_TOP_APLL12_DIV2,
	MT8188_CLK_TOP_APLL12_DIV3,
	MT8188_CLK_TOP_APLL12_DIV9,
	/* mux */
	MT8188_CLK_TOP_A1SYS_HP_SEL,
	MT8188_CLK_TOP_AUD_INTBUS_SEL,
	MT8188_CLK_TOP_AUDIO_H_SEL,
	MT8188_CLK_TOP_AUDIO_LOCAL_BUS_SEL,
	MT8188_CLK_TOP_DPTX_M_SEL,
	MT8188_CLK_TOP_I2SO1_M_SEL,
	MT8188_CLK_TOP_I2SO2_M_SEL,
	MT8188_CLK_TOP_I2SI1_M_SEL,
	MT8188_CLK_TOP_I2SI2_M_SEL,
	/* clock gate */
	MT8188_CLK_ADSP_AUDIO_26M,
	MT8188_CLK_AUD_AFE,
	MT8188_CLK_AUD_APLL1_TUNER,
	MT8188_CLK_AUD_APLL2_TUNER,
	MT8188_CLK_AUD_TOP0_SPDF,
	MT8188_CLK_AUD_APLL,
	MT8188_CLK_AUD_APLL2,
	MT8188_CLK_AUD_DAC,
	MT8188_CLK_AUD_ADC,
	MT8188_CLK_AUD_DAC_HIRES,
	MT8188_CLK_AUD_A1SYS_HP,
	MT8188_CLK_AUD_ADC_HIRES,
	MT8188_CLK_AUD_I2SIN,
	MT8188_CLK_AUD_TDM_IN,
	MT8188_CLK_AUD_I2S_OUT,
	MT8188_CLK_AUD_TDM_OUT,
	MT8188_CLK_AUD_HDMI_OUT,
	MT8188_CLK_AUD_ASRC11,
	MT8188_CLK_AUD_ASRC12,
	MT8188_CLK_AUD_A1SYS,
	MT8188_CLK_AUD_A2SYS,
	MT8188_CLK_AUD_PCMIF,
	MT8188_CLK_AUD_MEMIF_UL1,
	MT8188_CLK_AUD_MEMIF_UL2,
	MT8188_CLK_AUD_MEMIF_UL3,
	MT8188_CLK_AUD_MEMIF_UL4,
	MT8188_CLK_AUD_MEMIF_UL5,
	MT8188_CLK_AUD_MEMIF_UL6,
	MT8188_CLK_AUD_MEMIF_UL8,
	MT8188_CLK_AUD_MEMIF_UL9,
	MT8188_CLK_AUD_MEMIF_UL10,
	MT8188_CLK_AUD_MEMIF_DL2,
	MT8188_CLK_AUD_MEMIF_DL3,
	MT8188_CLK_AUD_MEMIF_DL6,
	MT8188_CLK_AUD_MEMIF_DL7,
	MT8188_CLK_AUD_MEMIF_DL8,
	MT8188_CLK_AUD_MEMIF_DL10,
	MT8188_CLK_AUD_MEMIF_DL11,
	MT8188_CLK_NUM,
};

enum {
	MT8188_AUD_PLL1,
	MT8188_AUD_PLL2,
	MT8188_AUD_PLL3,
	MT8188_AUD_PLL4,
	MT8188_AUD_PLL5,
	MT8188_AUD_PLL_NUM,
};

enum {
	MT8188_MCK_SEL_26M,
	MT8188_MCK_SEL_APLL1,
	MT8188_MCK_SEL_APLL2,
	MT8188_MCK_SEL_APLL3,
	MT8188_MCK_SEL_APLL4,
	MT8188_MCK_SEL_APLL5,
	MT8188_MCK_SEL_NUM,
};

struct mtk_base_afe;

int mt8188_afe_get_mclk_source_clk_id(int sel);
int mt8188_afe_get_mclk_source_rate(struct mtk_base_afe *afe, int apll);
int mt8188_afe_get_default_mclk_source_by_rate(int rate);
int mt8188_afe_init_clock(struct mtk_base_afe *afe);
void mt8188_afe_deinit_clock(void *priv);
int mt8188_afe_enable_clk(struct mtk_base_afe *afe, struct clk *clk);
void mt8188_afe_disable_clk(struct mtk_base_afe *afe, struct clk *clk);
int mt8188_afe_set_clk_rate(struct mtk_base_afe *afe, struct clk *clk,
			    unsigned int rate);
int mt8188_afe_set_clk_parent(struct mtk_base_afe *afe, struct clk *clk,
			      struct clk *parent);
int mt8188_afe_enable_main_clock(struct mtk_base_afe *afe);
int mt8188_afe_disable_main_clock(struct mtk_base_afe *afe);
int mt8188_afe_enable_reg_rw_clk(struct mtk_base_afe *afe);
int mt8188_afe_disable_reg_rw_clk(struct mtk_base_afe *afe);

#endif