Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / Domains: Make it possible to assign names to generic PM domains

Add a name member pointer to struct generic_pm_domain and use it in
diagnostic messages regarding the domain power-off and power-on
latencies. Update the ARM shmobile SH7372 code to assign names to
the PM domains used by it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Magnus Damm <damm@opensource.se>

+25 -6
+12 -4
arch/arm/mach-shmobile/pm-sh7372.c
··· 101 101 } 102 102 103 103 if (!sh7372_pd->no_debug) 104 - pr_debug("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n", 105 - mask, __raw_readl(PSTR)); 104 + pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n", 105 + genpd->name, mask, __raw_readl(PSTR)); 106 106 107 107 return 0; 108 108 } ··· 133 133 ret = -EIO; 134 134 135 135 if (!sh7372_pd->no_debug) 136 - pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n", 137 - mask, __raw_readl(PSTR)); 136 + pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n", 137 + sh7372_pd->genpd.name, mask, __raw_readl(PSTR)); 138 138 139 139 out: 140 140 if (ret == 0 && sh7372_pd->resume && do_resume) ··· 233 233 } 234 234 235 235 struct sh7372_pm_domain sh7372_a4lc = { 236 + .genpd.name = "A4LC", 236 237 .bit_shift = 1, 237 238 }; 238 239 239 240 struct sh7372_pm_domain sh7372_a4mp = { 241 + .genpd.name = "A4MP", 240 242 .bit_shift = 2, 241 243 }; 242 244 243 245 struct sh7372_pm_domain sh7372_d4 = { 246 + .genpd.name = "D4", 244 247 .bit_shift = 3, 245 248 }; 246 249 247 250 struct sh7372_pm_domain sh7372_a4r = { 251 + .genpd.name = "A4R", 248 252 .bit_shift = 5, 249 253 .gov = &sh7372_always_on_gov, 250 254 .suspend = sh7372_a4r_suspend, ··· 257 253 }; 258 254 259 255 struct sh7372_pm_domain sh7372_a3rv = { 256 + .genpd.name = "A3RV", 260 257 .bit_shift = 6, 261 258 }; 262 259 263 260 struct sh7372_pm_domain sh7372_a3ri = { 261 + .genpd.name = "A3RI", 264 262 .bit_shift = 8, 265 263 }; 266 264 267 265 struct sh7372_pm_domain sh7372_a3sp = { 266 + .genpd.name = "A3SP", 268 267 .bit_shift = 11, 269 268 .gov = &sh7372_always_on_gov, 270 269 .no_debug = true, ··· 282 275 } 283 276 284 277 struct sh7372_pm_domain sh7372_a3sg = { 278 + .genpd.name = "A3SG", 285 279 .bit_shift = 13, 286 280 }; 287 281
+12 -2
drivers/base/power/domain.c
··· 209 209 goto err; 210 210 211 211 elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); 212 - if (elapsed_ns > genpd->power_on_latency_ns) 212 + if (elapsed_ns > genpd->power_on_latency_ns) { 213 213 genpd->power_on_latency_ns = elapsed_ns; 214 + if (genpd->name) 215 + pr_warning("%s: Power-on latency exceeded, " 216 + "new value %lld ns\n", genpd->name, 217 + elapsed_ns); 218 + } 214 219 } 215 220 216 221 genpd_set_active(genpd); ··· 433 428 } 434 429 435 430 elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); 436 - if (elapsed_ns > genpd->power_off_latency_ns) 431 + if (elapsed_ns > genpd->power_off_latency_ns) { 437 432 genpd->power_off_latency_ns = elapsed_ns; 433 + if (genpd->name) 434 + pr_warning("%s: Power-off latency exceeded, " 435 + "new value %lld ns\n", genpd->name, 436 + elapsed_ns); 437 + } 438 438 } 439 439 440 440 genpd->status = GPD_STATE_POWER_OFF;
+1
include/linux/pm_domain.h
··· 50 50 struct mutex lock; 51 51 struct dev_power_governor *gov; 52 52 struct work_struct power_off_work; 53 + char *name; 53 54 unsigned int in_progress; /* Number of devices being suspended now */ 54 55 atomic_t sd_count; /* Number of subdomains with power "on" */ 55 56 enum gpd_status status; /* Current state of the domain */