aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/smi/smi_internal.c
blob: 1fb78696892b6b7362b040ec5e07b0328d81cdb6 (plain) (blame)
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
#include <asm/io.h>
/* Define SMI_INTERNAL_CCF_SUPPORT when CCF needs to be enabled */
#if !defined(CONFIG_MTK_LEGACY)
#define SMI_INTERNAL_CCF_SUPPORT
#endif

#if defined(SMI_INTERNAL_CCF_SUPPORT)
#include <linux/clk.h>
/* for ccf clk CB */
#if defined(SMI_D1)
#include "clk-mt6735-pg.h"
#elif defined(SMI_J)
#include "clk-mt6755-pg.h"
#endif
/* notify clk is enabled/disabled for m4u*/
#include "m4u.h"
#else
#include <mach/mt_clkmgr.h>
#endif				/* defined(SMI_INTERNAL_CCF_SUPPORT) */

#include "smi_configuration.h"
#include "smi_common.h"

int smi_larb_clock_is_on(unsigned int larb_index)
{
	int result = 0;

#if defined(SMI_INTERNAL_CCF_SUPPORT)
	result = 1;
#elif !defined(CONFIG_MTK_FPGA) && !defined(CONFIG_FPGA_EARLY_PORTING)
	switch (larb_index) {
	case 0:
		result = clock_is_on(MT_CG_DISP0_SMI_LARB0);
		break;
	case 1:
#if defined(SMI_R)
		result = clock_is_on(MT_CG_LARB1_SMI_CKPDN);
#else
		result = clock_is_on(MT_CG_VDEC1_LARB);
#endif
		break;
	case 2:
#if !defined(SMI_R)
		result = clock_is_on(MT_CG_IMAGE_LARB2_SMI);
#endif
		break;
	case 3:
#if defined(SMI_D1)
		result = clock_is_on(MT_CG_VENC_LARB);
#elif defined(SMI_D3)
		result = clock_is_on(MT_CG_VENC_VENC);
#endif
		break;
	default:
		result = 0;
		break;
	}
#endif				/* !defined (CONFIG_MTK_FPGA) && !defined (CONFIG_FPGA_EARLY_PORTING) */
	return result;
}