dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Marc Zyngier <maz@kernel.org>, Kevin Hilman <khilman@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org, kernel-team@android.com,
	linux-arm-kernel@lists.infradead.org,
	Jerome Brunet <jbrunet@baylibre.com>
Subject: Re: [PATCH 3/4] drm/meson: dw-hdmi: Register a callback to disable the regulator
Date: Tue, 17 Nov 2020 09:55:04 +0100	[thread overview]
Message-ID: <35fc622c-bebb-6111-9d08-e6b5433e75c5@baylibre.com> (raw)
In-Reply-To: <20201116200744.495826-4-maz@kernel.org>

On 16/11/2020 21:07, Marc Zyngier wrote:
> Removing the meson-dw-hdmi module results in the following splat:
> 
> i[   43.340509] WARNING: CPU: 0 PID: 572 at drivers/regulator/core.c:2125 _regulator_put.part.0+0x16c/0x174
> [...]
> [   43.454870] CPU: 0 PID: 572 Comm: modprobe Tainted: G        W   E     5.10.0-rc4-00049-gd274813a4de3-dirty #2147
> [   43.465042] Hardware name:  , BIOS 2021.01-rc2-00012-gde865f7ee1 11/16/2020
> [   43.471945] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--)
> [   43.477896] pc : _regulator_put.part.0+0x16c/0x174
> [   43.482638] lr : regulator_put+0x44/0x60
> [...]
> [   43.568715] Call trace:
> [   43.571132]  _regulator_put.part.0+0x16c/0x174
> [   43.575529]  regulator_put+0x44/0x60
> [   43.579067]  devm_regulator_release+0x20/0x2c
> [   43.583380]  release_nodes+0x1c8/0x2b4
> [   43.587087]  devres_release_all+0x44/0x6c
> [   43.591056]  __device_release_driver+0x1a0/0x23c
> [   43.595626]  driver_detach+0xcc/0x160
> [   43.599249]  bus_remove_driver+0x68/0xe0
> [   43.603130]  driver_unregister+0x3c/0x6c
> [   43.607011]  platform_driver_unregister+0x20/0x2c
> [   43.611678]  meson_dw_hdmi_platform_driver_exit+0x18/0x4a8 [meson_dw_hdmi]
> [   43.618485]  __arm64_sys_delete_module+0x1bc/0x294
> 
> as the HDMI regulator is still enabled on release.
> 
> In order to address this, register a callback that will deal with
> the disabling when the driver is unbound, solving the problem.
> 
> Signed-off-by: Marc Zyngier <maz@kernel.org>

Fixes: 161a803fe32d ("drm/meson: dw_hdmi: Add support for an optional external 5V regulator")

> ---
>  drivers/gpu/drm/meson/meson_dw_hdmi.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 29a8ff41595d..68826cf9993f 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> @@ -941,6 +941,11 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
>  
>  }
>  
> +static void meson_disable_regulator(void *data)
> +{
> +	regulator_disable(data);
> +}
> +
>  static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  				void *data)
>  {
> @@ -989,6 +994,10 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
>  		ret = regulator_enable(meson_dw_hdmi->hdmi_supply);
>  		if (ret)
>  			return ret;
> +		ret = devm_add_action_or_reset(dev, meson_disable_regulator,
> +					       meson_dw_hdmi->hdmi_supply);
> +		if (ret)
> +			return ret;
>  	}
>  
>  	meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev,
> 

Acked-by: Neil Armstrong <narmstrong@baylibre.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-11-17  8:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 20:07 [PATCH 0/4] drm/meson: Module removal fixes Marc Zyngier
2020-11-16 20:07 ` [PATCH 1/4] drm/meson: Free RDMA resources after tearing down DRM Marc Zyngier
2020-11-17  8:51   ` Neil Armstrong
2020-11-16 20:07 ` [PATCH 2/4] drm/meson: Unbind all connectors on module removal Marc Zyngier
2020-11-17  8:53   ` Neil Armstrong
2020-11-16 20:07 ` [PATCH 3/4] drm/meson: dw-hdmi: Register a callback to disable the regulator Marc Zyngier
2020-11-17  8:55   ` Neil Armstrong [this message]
2020-11-16 20:07 ` [PATCH 4/4] drm/meson: dw-hdmi: Ensure that clocks are enabled before touching the TOP registers Marc Zyngier
2020-11-17  8:56   ` Neil Armstrong
2020-11-17  8:49 ` [PATCH 0/4] drm/meson: Module removal fixes Neil Armstrong
2020-11-17  9:19   ` Marc Zyngier
2020-11-17  9:46     ` Neil Armstrong

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=35fc622c-bebb-6111-9d08-e6b5433e75c5@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jbrunet@baylibre.com \
    --cc=kernel-team@android.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=maz@kernel.org \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).