summaryrefstree
path: root/kernel/arch/arm64/mach-exynos/pmu_cal_sys.c
blob: d0a9741616f0fb2ed9abef8b2d4d23c746c92904 (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
/*
 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
 *		http://www.samsung.com/
 *
 * Chip Abstraction Layer for System power down support
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/io.h>
#include <mach/pmu.h>
#include <mach/pmu_cal_sys.h>

#define CHECK_CAL(cal) \
	if (!(cal)) { \
		pr_err("%s: Exynos PMU CAL is not registered\n", __func__); \
		return; \
	}

#define CHECK_CAL_ERR(cal) \
	if (!(cal)) { \
		pr_err("%s: Exynos PMU CAL is not registered\n", __func__); \
		return -1; \
	}

static const struct pmu_cal_sys_ops *cal;

int exynos_pmu_cal_sys_init(void)
{
	register_pmu_cal_sys_ops(&cal);

	CHECK_CAL_ERR(cal);
	cal->sys_init();
	return 0;
}

void exynos_pmu_cal_sys_prepare(enum sys_powerdown mode)
{
	CHECK_CAL(cal);
	cal->sys_prepare(mode);
}

void exynos_pmu_cal_sys_post(enum sys_powerdown mode)
{
	CHECK_CAL(cal);
	cal->sys_post(mode);
}

void exynos_pmu_cal_sys_earlywake(enum sys_powerdown mode)
{
	CHECK_CAL(cal);
	cal->sys_earlywake(mode);
}