|
11 | 11 | #include <linux/kernel.h> |
12 | 12 | #include <linux/ktime.h> |
13 | 13 | #include <linux/pm_domain.h> |
14 | | -#include <linux/pm_runtime.h> |
15 | 14 | #include <linux/regmap.h> |
16 | 15 | #include <linux/regulator/consumer.h> |
17 | 16 | #include <linux/reset-controller.h> |
@@ -56,22 +55,6 @@ enum gdsc_status { |
56 | 55 | GDSC_ON |
57 | 56 | }; |
58 | 57 |
|
59 | | -static int gdsc_pm_runtime_get(struct gdsc *sc) |
60 | | -{ |
61 | | - if (!sc->dev) |
62 | | - return 0; |
63 | | - |
64 | | - return pm_runtime_resume_and_get(sc->dev); |
65 | | -} |
66 | | - |
67 | | -static int gdsc_pm_runtime_put(struct gdsc *sc) |
68 | | -{ |
69 | | - if (!sc->dev) |
70 | | - return 0; |
71 | | - |
72 | | - return pm_runtime_put_sync(sc->dev); |
73 | | -} |
74 | | - |
75 | 58 | /* Returns 1 if GDSC status is status, 0 if not, and < 0 on error */ |
76 | 59 | static int gdsc_check_status(struct gdsc *sc, enum gdsc_status status) |
77 | 60 | { |
@@ -271,8 +254,9 @@ static void gdsc_retain_ff_on(struct gdsc *sc) |
271 | 254 | regmap_update_bits(sc->regmap, sc->gdscr, mask, mask); |
272 | 255 | } |
273 | 256 |
|
274 | | -static int _gdsc_enable(struct gdsc *sc) |
| 257 | +static int gdsc_enable(struct generic_pm_domain *domain) |
275 | 258 | { |
| 259 | + struct gdsc *sc = domain_to_gdsc(domain); |
276 | 260 | int ret; |
277 | 261 |
|
278 | 262 | if (sc->pwrsts == PWRSTS_ON) |
@@ -328,22 +312,11 @@ static int _gdsc_enable(struct gdsc *sc) |
328 | 312 | return 0; |
329 | 313 | } |
330 | 314 |
|
331 | | -static int gdsc_enable(struct generic_pm_domain *domain) |
| 315 | +static int gdsc_disable(struct generic_pm_domain *domain) |
332 | 316 | { |
333 | 317 | struct gdsc *sc = domain_to_gdsc(domain); |
334 | 318 | int ret; |
335 | 319 |
|
336 | | - ret = gdsc_pm_runtime_get(sc); |
337 | | - if (ret) |
338 | | - return ret; |
339 | | - |
340 | | - return _gdsc_enable(sc); |
341 | | -} |
342 | | - |
343 | | -static int _gdsc_disable(struct gdsc *sc) |
344 | | -{ |
345 | | - int ret; |
346 | | - |
347 | 320 | if (sc->pwrsts == PWRSTS_ON) |
348 | 321 | return gdsc_assert_reset(sc); |
349 | 322 |
|
@@ -388,18 +361,6 @@ static int _gdsc_disable(struct gdsc *sc) |
388 | 361 | return 0; |
389 | 362 | } |
390 | 363 |
|
391 | | -static int gdsc_disable(struct generic_pm_domain *domain) |
392 | | -{ |
393 | | - struct gdsc *sc = domain_to_gdsc(domain); |
394 | | - int ret; |
395 | | - |
396 | | - ret = _gdsc_disable(sc); |
397 | | - |
398 | | - gdsc_pm_runtime_put(sc); |
399 | | - |
400 | | - return ret; |
401 | | -} |
402 | | - |
403 | 364 | static int gdsc_init(struct gdsc *sc) |
404 | 365 | { |
405 | 366 | u32 mask, val; |
@@ -447,26 +408,21 @@ static int gdsc_init(struct gdsc *sc) |
447 | 408 | return ret; |
448 | 409 | } |
449 | 410 |
|
450 | | - /* ...and the power-domain */ |
451 | | - ret = gdsc_pm_runtime_get(sc); |
452 | | - if (ret) |
453 | | - goto err_disable_supply; |
454 | | - |
455 | 411 | /* |
456 | 412 | * Votable GDSCs can be ON due to Vote from other masters. |
457 | 413 | * If a Votable GDSC is ON, make sure we have a Vote. |
458 | 414 | */ |
459 | 415 | if (sc->flags & VOTABLE) { |
460 | 416 | ret = gdsc_update_collapse_bit(sc, false); |
461 | 417 | if (ret) |
462 | | - goto err_put_rpm; |
| 418 | + goto err_disable_supply; |
463 | 419 | } |
464 | 420 |
|
465 | 421 | /* Turn on HW trigger mode if supported */ |
466 | 422 | if (sc->flags & HW_CTRL) { |
467 | 423 | ret = gdsc_hwctrl(sc, true); |
468 | 424 | if (ret < 0) |
469 | | - goto err_put_rpm; |
| 425 | + goto err_disable_supply; |
470 | 426 | } |
471 | 427 |
|
472 | 428 | /* |
@@ -496,13 +452,10 @@ static int gdsc_init(struct gdsc *sc) |
496 | 452 |
|
497 | 453 | ret = pm_genpd_init(&sc->pd, NULL, !on); |
498 | 454 | if (ret) |
499 | | - goto err_put_rpm; |
| 455 | + goto err_disable_supply; |
500 | 456 |
|
501 | 457 | return 0; |
502 | 458 |
|
503 | | -err_put_rpm: |
504 | | - if (on) |
505 | | - gdsc_pm_runtime_put(sc); |
506 | 459 | err_disable_supply: |
507 | 460 | if (on && sc->rsupply) |
508 | 461 | regulator_disable(sc->rsupply); |
@@ -541,8 +494,6 @@ int gdsc_register(struct gdsc_desc *desc, |
541 | 494 | for (i = 0; i < num; i++) { |
542 | 495 | if (!scs[i]) |
543 | 496 | continue; |
544 | | - if (pm_runtime_enabled(dev)) |
545 | | - scs[i]->dev = dev; |
546 | 497 | scs[i]->regmap = regmap; |
547 | 498 | scs[i]->rcdev = rcdev; |
548 | 499 | ret = gdsc_init(scs[i]); |
|
0 commit comments