aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/sm501.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/sm501.c')
-rw-r--r--drivers/mfd/sm501.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index e2530df4d85c..9296b2673b52 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1138,8 +1138,31 @@ static int sm501_plat_probe(struct platform_device *dev)
1138} 1138}
1139 1139
1140#ifdef CONFIG_PM 1140#ifdef CONFIG_PM
1141
1141/* power management support */ 1142/* power management support */
1142 1143
1144static void sm501_set_power(struct sm501_devdata *sm, int on)
1145{
1146 struct sm501_platdata *pd = sm->platdata;
1147
1148 if (pd == NULL)
1149 return;
1150
1151 if (pd->get_power) {
1152 if (pd->get_power(sm->dev) == on) {
1153 dev_dbg(sm->dev, "is already %d\n", on);
1154 return;
1155 }
1156 }
1157
1158 if (pd->set_power) {
1159 dev_dbg(sm->dev, "setting power to %d\n", on);
1160
1161 pd->set_power(sm->dev, on);
1162 sm501_mdelay(sm, 10);
1163 }
1164}
1165
1143static int sm501_plat_suspend(struct platform_device *pdev, pm_message_t state) 1166static int sm501_plat_suspend(struct platform_device *pdev, pm_message_t state)
1144{ 1167{
1145 struct sm501_devdata *sm = platform_get_drvdata(pdev); 1168 struct sm501_devdata *sm = platform_get_drvdata(pdev);
@@ -1148,6 +1171,12 @@ static int sm501_plat_suspend(struct platform_device *pdev, pm_message_t state)
1148 sm->pm_misc = readl(sm->regs + SM501_MISC_CONTROL); 1171 sm->pm_misc = readl(sm->regs + SM501_MISC_CONTROL);
1149 1172
1150 sm501_dump_regs(sm); 1173 sm501_dump_regs(sm);
1174
1175 if (sm->platdata) {
1176 if (sm->platdata->flags & SM501_FLAG_SUSPEND_OFF)
1177 sm501_set_power(sm, 0);
1178 }
1179
1151 return 0; 1180 return 0;
1152} 1181}
1153 1182
@@ -1155,6 +1184,8 @@ static int sm501_plat_resume(struct platform_device *pdev)
1155{ 1184{
1156 struct sm501_devdata *sm = platform_get_drvdata(pdev); 1185 struct sm501_devdata *sm = platform_get_drvdata(pdev);
1157 1186
1187 sm501_set_power(sm, 1);
1188
1158 sm501_dump_regs(sm); 1189 sm501_dump_regs(sm);
1159 sm501_dump_gate(sm); 1190 sm501_dump_gate(sm);
1160 sm501_dump_clk(sm); 1191 sm501_dump_clk(sm);