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

Merge tag '1672656511-1931-1-git-send-email-quic_akhilpo@quicinc.com' into clk-for-6.3

v6.2-rc1 + 1672656511-1931-1-git-send-email-quic_akhilpo@quicinc.com

+37 -5
+26
drivers/base/power/domain.c
··· 519 519 } 520 520 EXPORT_SYMBOL_GPL(dev_pm_genpd_get_next_hrtimer); 521 521 522 + /* 523 + * dev_pm_genpd_synced_poweroff - Next power off should be synchronous 524 + * 525 + * @dev: A device that is attached to the genpd. 526 + * 527 + * Allows a consumer of the genpd to notify the provider that the next power off 528 + * should be synchronous. 529 + * 530 + * It is assumed that the users guarantee that the genpd wouldn't be detached 531 + * while this routine is getting called. 532 + */ 533 + void dev_pm_genpd_synced_poweroff(struct device *dev) 534 + { 535 + struct generic_pm_domain *genpd; 536 + 537 + genpd = dev_to_genpd_safe(dev); 538 + if (!genpd) 539 + return; 540 + 541 + genpd_lock(genpd); 542 + genpd->synced_poweroff = true; 543 + genpd_unlock(genpd); 544 + } 545 + EXPORT_SYMBOL_GPL(dev_pm_genpd_synced_poweroff); 546 + 522 547 static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed) 523 548 { 524 549 unsigned int state_idx = genpd->state_idx; ··· 587 562 588 563 out: 589 564 raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, NULL); 565 + genpd->synced_poweroff = false; 590 566 return 0; 591 567 err: 592 568 raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_OFF,
+6 -5
drivers/clk/qcom/gdsc.c
··· 136 136 return 0; 137 137 } 138 138 139 - static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status) 139 + static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status, 140 + bool wait) 140 141 { 141 142 int ret; 142 143 ··· 150 149 ret = gdsc_update_collapse_bit(sc, status == GDSC_OFF); 151 150 152 151 /* If disabling votable gdscs, don't poll on status */ 153 - if ((sc->flags & VOTABLE) && status == GDSC_OFF) { 152 + if ((sc->flags & VOTABLE) && status == GDSC_OFF && !wait) { 154 153 /* 155 154 * Add a short delay here to ensure that an enable 156 155 * right after it was disabled does not put it in an ··· 276 275 gdsc_deassert_clamp_io(sc); 277 276 } 278 277 279 - ret = gdsc_toggle_logic(sc, GDSC_ON); 278 + ret = gdsc_toggle_logic(sc, GDSC_ON, false); 280 279 if (ret) 281 280 return ret; 282 281 ··· 353 352 if (sc->pwrsts == PWRSTS_RET_ON) 354 353 return 0; 355 354 356 - ret = gdsc_toggle_logic(sc, GDSC_OFF); 355 + ret = gdsc_toggle_logic(sc, GDSC_OFF, domain->synced_poweroff); 357 356 if (ret) 358 357 return ret; 359 358 ··· 393 392 394 393 /* Force gdsc ON if only ON state is supported */ 395 394 if (sc->pwrsts == PWRSTS_ON) { 396 - ret = gdsc_toggle_logic(sc, GDSC_ON); 395 + ret = gdsc_toggle_logic(sc, GDSC_ON, false); 397 396 if (ret) 398 397 return ret; 399 398 }
+5
include/linux/pm_domain.h
··· 136 136 unsigned int prepared_count; /* Suspend counter of prepared devices */ 137 137 unsigned int performance_state; /* Aggregated max performance state */ 138 138 cpumask_var_t cpus; /* A cpumask of the attached CPUs */ 139 + bool synced_poweroff; /* A consumer needs a synced poweroff */ 139 140 int (*power_off)(struct generic_pm_domain *domain); 140 141 int (*power_on)(struct generic_pm_domain *domain); 141 142 struct raw_notifier_head power_notifiers; /* Power on/off notifiers */ ··· 236 235 int dev_pm_genpd_remove_notifier(struct device *dev); 237 236 void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next); 238 237 ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev); 238 + void dev_pm_genpd_synced_poweroff(struct device *dev); 239 239 240 240 extern struct dev_power_governor simple_qos_governor; 241 241 extern struct dev_power_governor pm_domain_always_on_gov; ··· 302 300 { 303 301 return KTIME_MAX; 304 302 } 303 + static inline void dev_pm_genpd_synced_poweroff(struct device *dev) 304 + { } 305 + 305 306 #define simple_qos_governor (*(struct dev_power_governor *)(NULL)) 306 307 #define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL)) 307 308 #endif