lkml.org 
[lkml]   [2020]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] drm/meson: dw-hdmi: Register a callback to disable the regulator
Date
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>
---
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,
--
2.28.0
\
 
 \ /
  Last update: 2020-11-16 21:09    [W:0.133 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site