Skip to content

Commit 843372d

Browse files
committed
Merge branches 'pm-cpuidle', 'pm-sleep' and 'pm-domains'
* pm-cpuidle: cpuidle: qcom: Add SPM register data for MSM8226 dt-bindings: arm: msm: Add SAW2 for MSM8226 * pm-sleep: PM: sleep: Use ktime_us_delta() in initcall_debug_report() * pm-domains: PM: domains: Shrink locking area of the gpd_list_lock
4 parents 5ddbecb + ad6b010 + 75674eb + 40ba55e commit 843372d

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

Documentation/devicetree/bindings/arm/msm/qcom,saw2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ PROPERTIES
2525
"qcom,saw2"
2626
A more specific value could be one of:
2727
"qcom,apq8064-saw2-v1.1-cpu"
28+
"qcom,msm8226-saw2-v2.1-cpu"
2829
"qcom,msm8974-saw2-v2.1-cpu"
2930
"qcom,apq8084-saw2-v2.1-cpu"
3031

drivers/base/power/domain.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,8 +2018,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
20182018

20192019
mutex_lock(&gpd_list_lock);
20202020
list_add(&genpd->gpd_list_node, &gpd_list);
2021-
genpd_debug_add(genpd);
20222021
mutex_unlock(&gpd_list_lock);
2022+
genpd_debug_add(genpd);
20232023

20242024
return 0;
20252025
}
@@ -2206,12 +2206,19 @@ static int genpd_add_provider(struct device_node *np, genpd_xlate_t xlate,
22062206

22072207
static bool genpd_present(const struct generic_pm_domain *genpd)
22082208
{
2209+
bool ret = false;
22092210
const struct generic_pm_domain *gpd;
22102211

2211-
list_for_each_entry(gpd, &gpd_list, gpd_list_node)
2212-
if (gpd == genpd)
2213-
return true;
2214-
return false;
2212+
mutex_lock(&gpd_list_lock);
2213+
list_for_each_entry(gpd, &gpd_list, gpd_list_node) {
2214+
if (gpd == genpd) {
2215+
ret = true;
2216+
break;
2217+
}
2218+
}
2219+
mutex_unlock(&gpd_list_lock);
2220+
2221+
return ret;
22152222
}
22162223

22172224
/**
@@ -2222,15 +2229,13 @@ static bool genpd_present(const struct generic_pm_domain *genpd)
22222229
int of_genpd_add_provider_simple(struct device_node *np,
22232230
struct generic_pm_domain *genpd)
22242231
{
2225-
int ret = -EINVAL;
2232+
int ret;
22262233

22272234
if (!np || !genpd)
22282235
return -EINVAL;
22292236

2230-
mutex_lock(&gpd_list_lock);
2231-
22322237
if (!genpd_present(genpd))
2233-
goto unlock;
2238+
return -EINVAL;
22342239

22352240
genpd->dev.of_node = np;
22362241

@@ -2241,7 +2246,7 @@ int of_genpd_add_provider_simple(struct device_node *np,
22412246
if (ret != -EPROBE_DEFER)
22422247
dev_err(&genpd->dev, "Failed to add OPP table: %d\n",
22432248
ret);
2244-
goto unlock;
2249+
return ret;
22452250
}
22462251

22472252
/*
@@ -2259,16 +2264,13 @@ int of_genpd_add_provider_simple(struct device_node *np,
22592264
dev_pm_opp_of_remove_table(&genpd->dev);
22602265
}
22612266

2262-
goto unlock;
2267+
return ret;
22632268
}
22642269

22652270
genpd->provider = &np->fwnode;
22662271
genpd->has_provider = true;
22672272

2268-
unlock:
2269-
mutex_unlock(&gpd_list_lock);
2270-
2271-
return ret;
2273+
return 0;
22722274
}
22732275
EXPORT_SYMBOL_GPL(of_genpd_add_provider_simple);
22742276

@@ -2287,8 +2289,6 @@ int of_genpd_add_provider_onecell(struct device_node *np,
22872289
if (!np || !data)
22882290
return -EINVAL;
22892291

2290-
mutex_lock(&gpd_list_lock);
2291-
22922292
if (!data->xlate)
22932293
data->xlate = genpd_xlate_onecell;
22942294

@@ -2328,8 +2328,6 @@ int of_genpd_add_provider_onecell(struct device_node *np,
23282328
if (ret < 0)
23292329
goto error;
23302330

2331-
mutex_unlock(&gpd_list_lock);
2332-
23332331
return 0;
23342332

23352333
error:
@@ -2348,8 +2346,6 @@ int of_genpd_add_provider_onecell(struct device_node *np,
23482346
}
23492347
}
23502348

2351-
mutex_unlock(&gpd_list_lock);
2352-
23532349
return ret;
23542350
}
23552351
EXPORT_SYMBOL_GPL(of_genpd_add_provider_onecell);

drivers/base/power/main.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,13 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime,
220220
void *cb, int error)
221221
{
222222
ktime_t rettime;
223-
s64 nsecs;
224223

225224
if (!pm_print_times_enabled)
226225
return;
227226

228227
rettime = ktime_get();
229-
nsecs = (s64) ktime_to_ns(ktime_sub(rettime, calltime));
230-
231228
dev_info(dev, "%pS returned %d after %Ld usecs\n", cb, error,
232-
(unsigned long long)nsecs >> 10);
229+
(unsigned long long)ktime_us_delta(rettime, calltime));
233230
}
234231

235232
/**

drivers/cpuidle/cpuidle-qcom-spm.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ static const struct spm_reg_data spm_reg_8974_8084_cpu = {
8787
.start_index[PM_SLEEP_MODE_SPC] = 3,
8888
};
8989

90+
/* SPM register data for 8226 */
91+
static const struct spm_reg_data spm_reg_8226_cpu = {
92+
.reg_offset = spm_reg_offset_v2_1,
93+
.spm_cfg = 0x0,
94+
.spm_dly = 0x3C102800,
95+
.seq = { 0x60, 0x03, 0x60, 0x0B, 0x0F, 0x20, 0x10, 0x80, 0x30, 0x90,
96+
0x5B, 0x60, 0x03, 0x60, 0x3B, 0x76, 0x76, 0x0B, 0x94, 0x5B,
97+
0x80, 0x10, 0x26, 0x30, 0x0F },
98+
.start_index[PM_SLEEP_MODE_STBY] = 0,
99+
.start_index[PM_SLEEP_MODE_SPC] = 5,
100+
};
101+
90102
static const u8 spm_reg_offset_v1_1[SPM_REG_NR] = {
91103
[SPM_REG_CFG] = 0x08,
92104
[SPM_REG_SPM_CTL] = 0x20,
@@ -259,6 +271,8 @@ static struct spm_driver_data *spm_get_drv(struct platform_device *pdev,
259271
}
260272

261273
static const struct of_device_id spm_match_table[] = {
274+
{ .compatible = "qcom,msm8226-saw2-v2.1-cpu",
275+
.data = &spm_reg_8226_cpu },
262276
{ .compatible = "qcom,msm8974-saw2-v2.1-cpu",
263277
.data = &spm_reg_8974_8084_cpu },
264278
{ .compatible = "qcom,apq8084-saw2-v2.1-cpu",

0 commit comments

Comments
 (0)