Skip to content

Commit f99fad3

Browse files
Anil kumar mamidalaDivya Sharma
authored andcommitted
msm:pm: add support for gimli-2.0 platform
Add support for gimli-2.0 platform with external buck. If external buck id detected from the DT, send the sleep votes for toqqling the GPIO to ON and OFF the external buck when the system is going PC. CRs-fixed: 568380 Change-Id: I173c52c4d24932b5c17af2ad2c9e19fc47b61ad9 Signed-off-by: Anil kumar mamidala <[email protected]> Signed-off-by: Divya Sharma <[email protected]>
1 parent ed2b265 commit f99fad3

4 files changed

Lines changed: 165 additions & 5 deletions

File tree

arch/arm/mach-msm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ obj-$(CONFIG_ARCH_MSM8610) += acpuclock-8226.o acpuclock-cortex.o
297297
obj-$(CONFIG_ARCH_MSM8610) += clock-dsi-8610.o
298298
obj-$(CONFIG_ARCH_MSMKRYPTON) += clock-local2.o clock-pll.o clock-krypton.o clock-rpm.o clock-voter.o
299299

300-
obj-$(CONFIG_MSM_PM) += msm-pm.o pm-data.o
300+
obj-$(CONFIG_MSM_PM) += msm-pm.o pm-data.o ext-buck-support.o
301301

302302
obj-$(CONFIG_MACH_SAPPHIRE) += board-sapphire.o board-sapphire-gpio.o
303303
obj-$(CONFIG_MACH_SAPPHIRE) += board-sapphire-keypad.o board-sapphire-panel.o
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
2+
*
3+
* This program is free software; you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License version 2 and
5+
* only version 2 as published by the Free Software Foundation.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
* GNU General Public License for more details.
11+
*
12+
*/
13+
14+
#include <linux/module.h>
15+
#include <linux/kernel.h>
16+
#include <linux/init.h>
17+
#include <linux/io.h>
18+
#include <linux/platform_device.h>
19+
#include <linux/of_platform.h>
20+
#include <mach/rpm-smd.h>
21+
#include "ext-buck-support.h"
22+
23+
static bool msm_ext_buck;
24+
25+
#define RPM_REQUEST_TYPE_GPIO 0x6F697067
26+
#define RPM_GPIO_NUMB_KEY 0x626d756e
27+
#define RPM_GPIO_STAT_KEY 0x74617473
28+
#define RPM_GPIO_SETT_KEY 0x74746573
29+
#define RPM_GPIO_RESOURCE_ID 3
30+
#define GPIO_SET 1
31+
#define GPIO_RESET 0
32+
33+
static void msm_send_ext_buck_votes(int gpio_num, int settling_time)
34+
{
35+
int rc;
36+
int gpio_status_sleep = GPIO_RESET;
37+
int gpio_status_active = GPIO_SET;
38+
39+
struct msm_rpm_kvp kvp_sleep[] = {
40+
{
41+
.key = RPM_GPIO_NUMB_KEY,
42+
.data = (void *)&gpio_num,
43+
.length = sizeof(gpio_num),
44+
},
45+
{
46+
.key = RPM_GPIO_STAT_KEY,
47+
.data = (void *)&gpio_status_sleep,
48+
.length = sizeof(gpio_status_sleep),
49+
},
50+
{
51+
.key = RPM_GPIO_SETT_KEY,
52+
.data = (void *)&settling_time,
53+
.length = sizeof(settling_time),
54+
},
55+
};
56+
57+
struct msm_rpm_kvp kvp_active[] = {
58+
{
59+
.key = RPM_GPIO_NUMB_KEY,
60+
.data = (void *)&gpio_num,
61+
.length = sizeof(gpio_num),
62+
},
63+
{
64+
.key = RPM_GPIO_STAT_KEY,
65+
.data = (void *)&gpio_status_active,
66+
.length = sizeof(gpio_status_active),
67+
},
68+
{
69+
.key = RPM_GPIO_SETT_KEY,
70+
.data = (void *)&settling_time,
71+
.length = sizeof(settling_time),
72+
},
73+
};
74+
75+
rc = msm_rpm_send_message(MSM_RPM_CTX_SLEEP_SET,
76+
RPM_REQUEST_TYPE_GPIO, RPM_GPIO_RESOURCE_ID, kvp_sleep, 3);
77+
WARN(rc < 0, "RPM GPIO toggling (sleep set) did not enable!\n");
78+
79+
rc = msm_rpm_send_message(MSM_RPM_CTX_ACTIVE_SET,
80+
RPM_REQUEST_TYPE_GPIO, RPM_GPIO_RESOURCE_ID, kvp_active, 3);
81+
WARN(rc < 0, "RPM GPIO toggling (active set) did not enable!\n");
82+
}
83+
84+
int msm_get_ext_buck_presence(void)
85+
{
86+
return msm_ext_buck;
87+
}
88+
EXPORT_SYMBOL(msm_get_ext_buck_presence);
89+
90+
static int msm_ext_buck_probe(struct platform_device *pdev)
91+
{
92+
char *key = NULL;
93+
94+
key = "qcom,ext-buck";
95+
msm_ext_buck = of_property_read_bool(pdev->dev.of_node, key);
96+
if (msm_ext_buck) {
97+
int gpio_num;
98+
int settling_time;
99+
100+
key = "qcom,gpio-num";
101+
of_property_read_u32(pdev->dev.of_node, key,
102+
&gpio_num);
103+
104+
key = "qcom,sett-time";
105+
of_property_read_u32(pdev->dev.of_node, key,
106+
&settling_time);
107+
108+
msm_send_ext_buck_votes(gpio_num, settling_time);
109+
}
110+
111+
return 0;
112+
}
113+
114+
static struct of_device_id msm_ext_buck_table[] = {
115+
{.compatible = "qcom,ext-buck-support"},
116+
{},
117+
};
118+
119+
static struct platform_driver msm_ext_buck_driver = {
120+
.probe = msm_ext_buck_probe,
121+
.driver = {
122+
.name = "ext-buck-support",
123+
.owner = THIS_MODULE,
124+
.of_match_table = msm_ext_buck_table,
125+
},
126+
};
127+
128+
static int __init msm_ext_buck_init(void)
129+
{
130+
return platform_driver_register(&msm_ext_buck_driver);
131+
}
132+
device_initcall(msm_ext_buck_init);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* arm/mach-msm/ext-buck-support.h
2+
*
3+
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
4+
*
5+
* This software is licensed under the terms of the GNU General Public
6+
* License version 2, as published by the Free Software Foundation, and
7+
* may be copied, distributed, and modified under those terms.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
*/
15+
16+
#ifndef __ARCH_ARM_MACH_MSM_EXT_BUCK_SUPPORT_H
17+
#define __ARCH_ARM_MACH_MSM_EXT_BUCK_SUPPORT_H
18+
19+
#include <linux/types.h>
20+
21+
int msm_get_ext_buck_presence(void);
22+
23+
#endif /* __ARCH_ARM_MACH_MSM_EXT_BUCK_SUPPORT_H */

arch/arm/mach-msm/lpm_levels.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <mach/cpuidle.h>
3030
#include <mach/event_timer.h>
3131
#include "pm.h"
32+
#include "ext-buck-support.h"
3233
#include "rpm-notifier.h"
3334
#include "spm.h"
3435
#include "idle.h"
@@ -940,6 +941,7 @@ static int lpm_system_probe(struct platform_device *pdev)
940941
int num_levels = 0;
941942
struct device_node *node;
942943
char *key;
944+
bool ext_buck;
943945
int ret;
944946

945947
for_each_child_of_node(pdev->dev.of_node, node)
@@ -950,7 +952,7 @@ static int lpm_system_probe(struct platform_device *pdev)
950952

951953
if (!level)
952954
return -ENOMEM;
953-
955+
ext_buck = msm_get_ext_buck_presence();
954956
l = &level[0];
955957
for_each_child_of_node(pdev->dev.of_node, node) {
956958

@@ -969,10 +971,13 @@ static int lpm_system_probe(struct platform_device *pdev)
969971
goto fail;
970972
}
971973

972-
if (l->l2_mode == MSM_SPM_L2_MODE_GDHS ||
973-
l->l2_mode == MSM_SPM_L2_MODE_POWER_COLLAPSE)
974+
if (ext_buck && l->l2_mode ==
975+
MSM_SPM_L2_MODE_POWER_COLLAPSE) {
974976
l->notify_rpm = true;
975-
977+
} else if (l->l2_mode == MSM_SPM_L2_MODE_GDHS ||
978+
l->l2_mode == MSM_SPM_L2_MODE_POWER_COLLAPSE) {
979+
l->notify_rpm = true;
980+
}
976981
if (l->l2_mode >= MSM_SPM_L2_MODE_GDHS)
977982
l->sync = true;
978983

0 commit comments

Comments
 (0)