summaryrefstree
path: root/kernel/drivers/vision/iva/iva_pmu.h
blob: 9849c2cde6ab43510009d32f5ed49d6124e6b839 (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
/*
 * Copyright (C) 2016 Samsung Electronics Co.Ltd
 *
 * This program is free software; you can redistribute	it and/or modify it
 * under  the terms of	the GNU General  Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

#ifndef __IVA_PMU_H__
#define __IVA_PMU_H__

#include "iva_ctrl.h"

enum iva_pmu_q_ch_ctrl {
	pmu_q_ch_vmcu_active	= (0x1 << 0),
	pmu_q_ch_sw_qch		= (0x1 << 1),
	pmu_q_ch_sw_qaccept_n	= (0x1 << 2),
};


enum iva_pmu_ip_id {
	pmu_csc_id	= (0x1 << 0),
	pmu_scl0_id	= (0x1 << 1),
	pmu_scl1_id	= (0x1 << 2),
	pmu_orb_id	= (0x1 << 3),
	pmu_mch_id	= (0x1 << 4),
	pmu_lmd_id	= (0x1 << 5),
	pmu_lkt_id	= (0x1 << 6),
	pmu_wig0_id	= (0x1 << 7),
	pmu_wig1_id	= (0x1 << 8),
	pmu_enf_id	= (0x1 << 9),
	pmu_vdma0_id	= (0x1 << 10),
	pmu_vdma1_id	= (0x1 << 11),
	pmu_vcf_id	= (0x1 << 12),
	pmu_vcm_id	= (0x1 << 13),
	pmu_edil_id	= (0x1 << 14),

	//----------------------------
	pmu_all_ids	= (0x1 << 15) - 1,
};

enum iva_pmu_mcu_ctrl {
	pmu_mcu_reset_n	= (0x1 << 0),
	pmu_boothold	= (0x1 << 1),
	pmu_en_sleep	= (0x1 << 2),
};

extern uint32_t iva_pmu_ctrl_q_channel(struct iva_dev_data *iva,
			enum iva_pmu_q_ch_ctrl q_ctrl, bool set);

extern uint32_t iva_pmu_reset_hwa(struct iva_dev_data *iva,
			enum iva_pmu_ip_id ip, bool release);

extern uint32_t iva_pmu_enable_clk(struct iva_dev_data *iva,
			enum iva_pmu_ip_id ip, bool enable);

/* mcu control */
extern uint32_t iva_pmu_ctrl_mcu(struct iva_dev_data *iva,
			enum iva_pmu_mcu_ctrl mcu_ctrl, bool set);
extern void	iva_pmu_prepare_mcu_sram(struct iva_dev_data *iva);
extern void	iva_pmu_reset_mcu(struct iva_dev_data *iva);

static inline void iva_pmu_reset_all(struct iva_dev_data *iva)
{
	iva_pmu_reset_hwa(iva, pmu_all_ids, false);
}

static inline void iva_pmu_release_all(struct iva_dev_data *iva)
{
	iva_pmu_reset_hwa(iva, pmu_all_ids, true);
}

static inline void iva_pmu_enable_all_clks(struct iva_dev_data *iva)
{
	iva_pmu_enable_clk(iva, pmu_all_ids, true);
}

static inline void iva_pmu_disable_all_clks(struct iva_dev_data *iva)
{
	iva_pmu_enable_clk(iva, pmu_all_ids, false);
}

extern int	iva_pmu_init(struct iva_dev_data *iva, bool en_hwa);
extern void	iva_pmu_deinit(struct iva_dev_data *iva);

extern int	iva_pmu_probe(struct iva_dev_data *iva);
extern void	iva_pmu_remove(struct iva_dev_data *iva);

#endif /* __IVA_MBOX_H */