| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * wm8994-core.c -- Device access for Wolfson WM8994 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2009 Wolfson Microelectronics PLC. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | 8 | */ |
|---|
| 14 | 9 | |
|---|
| 15 | 10 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 21 | 16 | #include <linux/mfd/core.h> |
|---|
| 22 | 17 | #include <linux/of.h> |
|---|
| 23 | 18 | #include <linux/of_device.h> |
|---|
| 24 | | -#include <linux/of_gpio.h> |
|---|
| 25 | 19 | #include <linux/pm_runtime.h> |
|---|
| 26 | 20 | #include <linux/regmap.h> |
|---|
| 27 | 21 | #include <linux/regulator/consumer.h> |
|---|
| .. | .. |
|---|
| 306 | 300 | |
|---|
| 307 | 301 | pdata->csnaddr_pd = of_property_read_bool(np, "wlf,csnaddr-pd"); |
|---|
| 308 | 302 | |
|---|
| 309 | | - pdata->ldo[0].enable = of_get_named_gpio(np, "wlf,ldo1ena", 0); |
|---|
| 310 | | - if (pdata->ldo[0].enable < 0) |
|---|
| 311 | | - pdata->ldo[0].enable = 0; |
|---|
| 312 | | - |
|---|
| 313 | | - pdata->ldo[1].enable = of_get_named_gpio(np, "wlf,ldo2ena", 0); |
|---|
| 314 | | - if (pdata->ldo[1].enable < 0) |
|---|
| 315 | | - pdata->ldo[1].enable = 0; |
|---|
| 316 | | - |
|---|
| 317 | 303 | return 0; |
|---|
| 318 | 304 | } |
|---|
| 319 | 305 | #else |
|---|
| .. | .. |
|---|
| 407 | 393 | ret = regulator_bulk_get(wm8994->dev, wm8994->num_supplies, |
|---|
| 408 | 394 | wm8994->supplies); |
|---|
| 409 | 395 | if (ret != 0) { |
|---|
| 410 | | - dev_err(wm8994->dev, "Failed to get supplies: %d\n", ret); |
|---|
| 396 | + if (ret != -EPROBE_DEFER) |
|---|
| 397 | + dev_err(wm8994->dev, "Failed to get supplies: %d\n", |
|---|
| 398 | + ret); |
|---|
| 411 | 399 | goto err; |
|---|
| 412 | 400 | } |
|---|
| 413 | 401 | |
|---|
| .. | .. |
|---|
| 598 | 586 | goto err_irq; |
|---|
| 599 | 587 | } |
|---|
| 600 | 588 | |
|---|
| 589 | + pm_runtime_set_active(wm8994->dev); |
|---|
| 601 | 590 | pm_runtime_enable(wm8994->dev); |
|---|
| 602 | 591 | pm_runtime_idle(wm8994->dev); |
|---|
| 603 | 592 | |
|---|
| .. | .. |
|---|
| 617 | 606 | |
|---|
| 618 | 607 | static void wm8994_device_exit(struct wm8994 *wm8994) |
|---|
| 619 | 608 | { |
|---|
| 609 | + pm_runtime_get_sync(wm8994->dev); |
|---|
| 620 | 610 | pm_runtime_disable(wm8994->dev); |
|---|
| 611 | + pm_runtime_put_noidle(wm8994->dev); |
|---|
| 621 | 612 | wm8994_irq_exit(wm8994); |
|---|
| 622 | 613 | regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies); |
|---|
| 623 | 614 | regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); |
|---|