mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
power: sm1/tm2: add sleep and iso mask function [1/1]
PD#SWPL-6186 Problem: add mask function Solution: add sleep and iso mask function Verify: sm1_skt Change-Id: Ifbb7329fd1eb6e333d0332f53c809e7b2e55181d Signed-off-by: Shunzhou Jiang <shunzhou.jiang@amlogic.com>
This commit is contained in:
committed by
Dongjin Kim
parent
458caba175
commit
dff85ddb0a
@@ -62,6 +62,32 @@ int power_ctrl_sleep(bool power_on, unsigned int shift)
|
||||
}
|
||||
EXPORT_SYMBOL(power_ctrl_sleep);
|
||||
|
||||
int power_ctrl_sleep_mask(bool power_on,
|
||||
unsigned int mask_val, unsigned int shift)
|
||||
{
|
||||
unsigned int val;
|
||||
unsigned long flags;
|
||||
|
||||
if (!probe_done)
|
||||
return -ENXIO;
|
||||
|
||||
if (power_on) {
|
||||
spin_lock_irqsave(&ctrl.sleep_lock, flags);
|
||||
val = readl(ctrl.sleep_addr);
|
||||
val = val & (~(mask_val << shift));
|
||||
writel(val, ctrl.sleep_addr);
|
||||
spin_unlock_irqrestore(&ctrl.sleep_lock, flags);
|
||||
} else {
|
||||
spin_lock_irqsave(&ctrl.sleep_lock, flags);
|
||||
val = readl(ctrl.sleep_addr);
|
||||
val = val | (mask_val << shift);
|
||||
writel(val, ctrl.sleep_addr);
|
||||
spin_unlock_irqrestore(&ctrl.sleep_lock, flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(power_ctrl_sleep_mask);
|
||||
|
||||
int power_ctrl_iso(bool power_on, unsigned int shift)
|
||||
{
|
||||
unsigned int val;
|
||||
@@ -87,6 +113,32 @@ int power_ctrl_iso(bool power_on, unsigned int shift)
|
||||
}
|
||||
EXPORT_SYMBOL(power_ctrl_iso);
|
||||
|
||||
int power_ctrl_iso_mask(bool power_on,
|
||||
unsigned int mask_val, unsigned int shift)
|
||||
{
|
||||
unsigned int val;
|
||||
unsigned long flags;
|
||||
|
||||
if (!probe_done)
|
||||
return -ENXIO;
|
||||
|
||||
if (power_on) {
|
||||
spin_lock_irqsave(&(ctrl.iso_lock), flags);
|
||||
val = readl(ctrl.iso_addr);
|
||||
val = val & (~(mask_val << shift));
|
||||
writel(val, ctrl.iso_addr);
|
||||
spin_unlock_irqrestore(&(ctrl.iso_lock), flags);
|
||||
} else {
|
||||
spin_lock_irqsave((&ctrl.iso_lock), flags);
|
||||
val = readl(ctrl.iso_addr);
|
||||
val = val | (mask_val << shift);
|
||||
writel(val, ctrl.iso_addr);
|
||||
spin_unlock_irqrestore(&(ctrl.iso_lock), flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(power_ctrl_iso_mask);
|
||||
|
||||
int power_ctrl_mempd0(bool power_on, unsigned int mask_val, unsigned int shift)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
@@ -21,7 +21,11 @@
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_POWER
|
||||
int power_ctrl_sleep(bool power_on, unsigned int shift);
|
||||
int power_ctrl_sleep_mask(bool power_on,
|
||||
unsigned int mask_val, unsigned int shift);
|
||||
int power_ctrl_iso(bool power_on, unsigned int shift);
|
||||
int power_ctrl_iso_mask(bool power_on,
|
||||
unsigned int mask_val, unsigned int shift);
|
||||
int power_ctrl_mempd0(bool power_on, unsigned int mask_val, unsigned int shift);
|
||||
#else
|
||||
static inline int power_ctrl_sleep(bool power_on, unsigned int shift)
|
||||
|
||||
Reference in New Issue
Block a user