summaryrefslogtreecommitdiff
path: root/arch/arm/mach-sc/syssleep.c
blob: cd86275f313e305e1e92a530b793c033cb20ea7e (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
/*
 * Copyright (C) 2013 Spreadtrum Communications Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <soc/sprd/hardware.h>
#include <asm/uaccess.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <soc/sprd/sci.h>
#include <soc/sprd/sci_glb_regs.h>

static int syssleep_read_proc(char *page, char **start, off_t off,
			  int count, int *eof, void *data)
{
	return 0;
}

static int syssleep_write_proc(struct file *file, const char __user *buffer,
			   unsigned long count, void *data)
{
#if 0
    sci_glb_write(REG_PMU_APB_PD_CP0_ARM9_0_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_HU3GE_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_GSM_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_L1RAM_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_SYS_CFG, BIT(25) | BIT(28), -1UL);
#else
    sci_glb_write(REG_PMU_APB_PD_CP0_ARM9_0_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_HU3GE_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_GSM_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_TD_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_CEVA_CFG, BIT(24) | BIT(25), -1UL);
    sci_glb_write(REG_PMU_APB_PD_CP0_SYS_CFG, BIT(25) | BIT(28), -1UL);
    sci_glb_write(REG_PMU_APB_SLEEP_CTRL,BIT(12),BIT(12));
#endif
    //sci_glb_write(REG_PMU_APB_CP_SOFT_RST,0x7,-1UL);
    //msleep(1000);
    //sci_glb_write(REG_PMU_APB_CP_SOFT_RST,0x6,-1UL);
    return count;
}

static const struct file_operations syssleep_proc_fops = {
    .owner      = THIS_MODULE,
    .read       = syssleep_read_proc,
    .write      = syssleep_write_proc,
};

static int __init syssleep_init(void)
{
    printk("syssleep_init \n");
    proc_create("syssleep", 0777, NULL, &syssleep_proc_fops);
	return 0;
}

module_init(syssleep_init);