From: Marek Szyprowski <m.szyprowski@samsung.com> To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski <m.szyprowski@samsung.com>, Mark Brown <broonie@kernel.org>, Sylwester Nawrocki <s.nawrocki@samsung.com>, Lee Jones <lee.jones@linaro.org>, Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Subject: [PATCH v2 2/2] mfd: wm8994: Fix unbalanced calls to regulator_bulk_disable() Date: Wed, 26 Feb 2020 11:08:02 +0100 [thread overview] Message-ID: <20200226100802.16384-2-m.szyprowski@samsung.com> (raw) In-Reply-To: <20200226100802.16384-1-m.szyprowski@samsung.com> When runtime PM is enabled, regulators are being controlled by the driver's suspend and resume callbacks. They are also unconditionally enabled at driver's probe(), and disabled in remove() functions. Add more calls to runtime PM framework to ensure that the device's runtime PM state matches the regulators state: 1. at the end of probe() function: set runtime PM state to active, so there will be no spurious call to resume(); 2. in remove(), ensure that resume() is called before disabling runtime PM management and unconditionally disabling the regulators. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/mfd/wm8994-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 737dede4a95c..69d973ec42bf 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -584,6 +584,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) goto err_irq; } + pm_runtime_set_active(wm8994->dev); pm_runtime_enable(wm8994->dev); pm_runtime_idle(wm8994->dev); @@ -603,7 +604,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) static void wm8994_device_exit(struct wm8994 *wm8994) { + pm_runtime_get_sync(wm8994->dev); pm_runtime_disable(wm8994->dev); + pm_runtime_put_noidle(wm8994->dev); wm8994_irq_exit(wm8994); regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies); regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Marek Szyprowski <m.szyprowski@samsung.com> To: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>, Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>, Sylwester Nawrocki <s.nawrocki@samsung.com>, Marek Szyprowski <m.szyprowski@samsung.com> Subject: [PATCH v2 2/2] mfd: wm8994: Fix unbalanced calls to regulator_bulk_disable() Date: Wed, 26 Feb 2020 11:08:02 +0100 [thread overview] Message-ID: <20200226100802.16384-2-m.szyprowski@samsung.com> (raw) In-Reply-To: <20200226100802.16384-1-m.szyprowski@samsung.com> When runtime PM is enabled, regulators are being controlled by the driver's suspend and resume callbacks. They are also unconditionally enabled at driver's probe(), and disabled in remove() functions. Add more calls to runtime PM framework to ensure that the device's runtime PM state matches the regulators state: 1. at the end of probe() function: set runtime PM state to active, so there will be no spurious call to resume(); 2. in remove(), ensure that resume() is called before disabling runtime PM management and unconditionally disabling the regulators. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/mfd/wm8994-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 737dede4a95c..69d973ec42bf 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -584,6 +584,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) goto err_irq; } + pm_runtime_set_active(wm8994->dev); pm_runtime_enable(wm8994->dev); pm_runtime_idle(wm8994->dev); @@ -603,7 +604,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) static void wm8994_device_exit(struct wm8994 *wm8994) { + pm_runtime_get_sync(wm8994->dev); pm_runtime_disable(wm8994->dev); + pm_runtime_put_noidle(wm8994->dev); wm8994_irq_exit(wm8994); regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies); regulator_bulk_free(wm8994->num_supplies, wm8994->supplies); -- 2.17.1
next prev parent reply other threads:[~2020-02-26 10:08 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20200226100814eucas1p1ef5e4d5eb763f37bcd4eceffc798792d@eucas1p1.samsung.com> 2020-02-26 10:08 ` [PATCH v2 1/2] mfd: wm8994: Fix driver operation if loaded as modules Marek Szyprowski 2020-02-26 10:08 ` Marek Szyprowski [not found] ` <CGME20200226100815eucas1p2f4448e3dea078bfc58a8acdc70340c11@eucas1p2.samsung.com> 2020-02-26 10:08 ` Marek Szyprowski [this message] 2020-02-26 10:08 ` [PATCH v2 2/2] mfd: wm8994: Fix unbalanced calls to regulator_bulk_disable() Marek Szyprowski 2020-02-27 13:56 ` Charles Keepax 2020-02-27 13:56 ` Charles Keepax 2020-02-27 13:52 ` [PATCH v2 1/2] mfd: wm8994: Fix driver operation if loaded as modules Charles Keepax 2020-02-27 13:52 ` Charles Keepax
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200226100802.16384-2-m.szyprowski@samsung.com \ --to=m.szyprowski@samsung.com \ --cc=alsa-devel@alsa-project.org \ --cc=b.zolnierkie@samsung.com \ --cc=broonie@kernel.org \ --cc=lee.jones@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=s.nawrocki@samsung.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.