mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
rk3026 pm.c: fix ctr bits parameter to support help inf,add arm\logic suspend volt parameter
This commit is contained in:
93
arch/arm/mach-rk2928/pm.c
Normal file → Executable file
93
arch/arm/mach-rk2928/pm.c
Normal file → Executable file
@@ -22,6 +22,8 @@
|
||||
#include <mach/iomux.h>
|
||||
#include <mach/cru.h>
|
||||
#include <mach/debug_uart.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
|
||||
|
||||
#define cru_readl(offset) readl_relaxed(RK2928_CRU_BASE + offset)
|
||||
#define cru_writel(v, offset) do { writel_relaxed(v, RK2928_CRU_BASE + offset); dsb(); } while (0)
|
||||
@@ -120,17 +122,29 @@ struct rk_soc_pm_info_st rk_soc_pm_helps[] = {
|
||||
RK_SOC_PM_HELP_(WAKE_UP_KEY, "send a power key to wake up lcd"),
|
||||
};
|
||||
|
||||
ssize_t rk_soc_pm_helps_print(char *buf)
|
||||
ssize_t rk_soc_pm_helps_sprintf(char *buf)
|
||||
{
|
||||
char *s = buf;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(rk_soc_pm_helps); i++) {
|
||||
s += sprintf(s, "bit(%d): %s\n", rk_soc_pm_helps[i].offset, rk_soc_pm_helps[i].name);
|
||||
for(i=0;i<ARRAY_SIZE(rk_soc_pm_helps);i++)
|
||||
{
|
||||
s += sprintf(s, "bit(%d): %s\n", rk_soc_pm_helps[i].offset,rk_soc_pm_helps[i].name);
|
||||
}
|
||||
|
||||
return (s - buf);
|
||||
}
|
||||
return (s-buf);
|
||||
}
|
||||
|
||||
void rk_soc_pm_helps_printk(void)
|
||||
{
|
||||
int i;
|
||||
printk("**************rk_suspend_ctr_bits bits help***********:\n");
|
||||
for(i=0;i<ARRAY_SIZE(rk_soc_pm_helps);i++)
|
||||
{
|
||||
printk("bit(%d): %s\n", rk_soc_pm_helps[i].offset,rk_soc_pm_helps[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// pm enter return directly
|
||||
#define RK_SUSPEND_RET_DIRT_BITS ((1<<RK_PM_CTR_RET_DIRT))
|
||||
@@ -143,14 +157,27 @@ ssize_t rk_soc_pm_helps_print(char *buf)
|
||||
static u32 __sramdata rk_soc_pm_ctr_flags_sram = 0;
|
||||
static u32 rk_soc_pm_ctr_flags = 0;
|
||||
|
||||
static int arm_suspend_volt = 0;
|
||||
static int logic_suspend_volt = 0;
|
||||
|
||||
|
||||
static int __init early_param_rk_soc_pm_ctr(char *str)
|
||||
{
|
||||
get_option(&str, &rk_soc_pm_ctr_flags);
|
||||
printk("early_param_rk_soc_pm_ctr=%x\n", rk_soc_pm_ctr_flags);
|
||||
|
||||
printk("********rk_suspend_ctr_bits information is following:*********\n");
|
||||
printk("rk_suspend_ctr_bits=%x\n",rk_soc_pm_ctr_flags);
|
||||
if(rk_soc_pm_ctr_flags)
|
||||
{
|
||||
rk_soc_pm_helps_printk();
|
||||
}
|
||||
printk("********rk_suspend_ctr_bits information end*********\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
early_param("rk_soc_pm_ctr", early_param_rk_soc_pm_ctr);
|
||||
early_param("rk_suspend_ctr_bits", early_param_rk_soc_pm_ctr);
|
||||
|
||||
|
||||
|
||||
void rk_soc_pm_ctr_bits_set(u32 flags)
|
||||
{
|
||||
@@ -189,6 +216,58 @@ void rk_soc_pm_ctr_bits_prepare(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int __init set_arm_suspend_volt(char *str)
|
||||
{
|
||||
get_option(&str, &arm_suspend_volt);
|
||||
printk("rk_suspend_arm_volt=%dmV\n", arm_suspend_volt);
|
||||
return 0;
|
||||
}
|
||||
early_param("rk_suspend_arm_volt", set_arm_suspend_volt);
|
||||
|
||||
static int __init set_logic_suspend_volt(char *str)
|
||||
{
|
||||
get_option(&str, &logic_suspend_volt);
|
||||
printk("rk_suspend_logic_volt=%dmV\n", logic_suspend_volt);
|
||||
return 0;
|
||||
}
|
||||
early_param("rk_suspend_logic_volt", set_logic_suspend_volt);
|
||||
|
||||
|
||||
|
||||
static int __init pm_suspend_volt_seting(void)
|
||||
{
|
||||
struct regulator *regulator;
|
||||
|
||||
printk("pmic set pm_suspend_volt:\n");
|
||||
if (arm_suspend_volt){
|
||||
regulator = regulator_get(NULL, "vdd_cpu");
|
||||
if (IS_ERR(regulator)){
|
||||
printk("%s:get vdd_cpu regulator err\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
regulator_set_suspend_voltage(regulator, arm_suspend_volt);
|
||||
regulator_put(regulator);
|
||||
}
|
||||
|
||||
if (logic_suspend_volt){
|
||||
regulator = regulator_get(NULL, "vdd_core");
|
||||
if (IS_ERR(regulator)){
|
||||
printk("%s:get vdd_core regulator err\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
regulator_set_suspend_voltage(regulator, logic_suspend_volt);
|
||||
regulator_put(regulator);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall_sync(pm_suspend_volt_seting);
|
||||
|
||||
|
||||
/*********************************pm main function******************************************/
|
||||
__weak void __sramfunc ddr_suspend(void) {}
|
||||
__weak void __sramfunc ddr_resume(void) {}
|
||||
__weak uint32_t __sramfunc ddr_change_freq(uint32_t nMHz)
|
||||
|
||||
Reference in New Issue
Block a user