* [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property
2024-10-28 10:25 [RFC PATCH 00/10] Support simple-framebuffer on imx8m Dario Binacchi
@ 2024-10-28 10:25 ` Dario Binacchi
2024-11-01 17:39 ` Rob Herring
2024-10-28 10:25 ` [RFC PATCH 02/10] pmdomain: imx8m-blk-ctrl: don't turn on a power domain already on Dario Binacchi
` (4 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Dario Binacchi @ 2024-10-28 10:25 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Conor Dooley, Fabio Estevam,
Krzysztof Kozlowski, Lucas Stach, Pengutronix Kernel Team,
Rob Herring, Sascha Hauer, Shawn Guo, devicetree, imx,
linux-arm-kernel
This property lists the state of the power domains, indicating whether
they have been left on or off by the bootloader/firmware.
This information becomes relevant, for example, in the case of supporting
the simple framebuffer.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
.../bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
index eeec9965b091..00aa0b8d8ea9 100644
--- a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
+++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
@@ -56,6 +56,15 @@ properties:
- const: csi-aclk
- const: csi-pclk
+ fsl,power-domains-boot-on:
+ description: |
+ Provide the on/off (1/0) status of the power domains. It allows
+ specifying whether one or more power domains have already been
+ initialized and left powered on by the bootloader.
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 5
+ maxItems: 5
+
required:
- compatible
- reg
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property
2024-10-28 10:25 ` [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property Dario Binacchi
@ 2024-11-01 17:39 ` Rob Herring
2024-11-04 16:32 ` Dario Binacchi
0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2024-11-01 17:39 UTC (permalink / raw)
To: Dario Binacchi
Cc: linux-kernel, linux-amarula, Conor Dooley, Fabio Estevam,
Krzysztof Kozlowski, Lucas Stach, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, devicetree, imx, linux-arm-kernel
On Mon, Oct 28, 2024 at 11:25:24AM +0100, Dario Binacchi wrote:
> This property lists the state of the power domains, indicating whether
> they have been left on or off by the bootloader/firmware.
> This information becomes relevant, for example, in the case of supporting
> the simple framebuffer.
>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>
> .../bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
> index eeec9965b091..00aa0b8d8ea9 100644
> --- a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
> +++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
> @@ -56,6 +56,15 @@ properties:
> - const: csi-aclk
> - const: csi-pclk
>
> + fsl,power-domains-boot-on:
> + description: |
> + Provide the on/off (1/0) status of the power domains. It allows
> + specifying whether one or more power domains have already been
> + initialized and left powered on by the bootloader.
Sounds like a common problem *if* we wanted to fix it in DT.
Why can't you just read the h/w registers to see which domains are
powered on? Perhaps because some are on, but you want to turn them off.
Also, for simple-framebuffer, I think you can list the power-domains to
keep on.
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property
2024-11-01 17:39 ` Rob Herring
@ 2024-11-04 16:32 ` Dario Binacchi
0 siblings, 0 replies; 9+ messages in thread
From: Dario Binacchi @ 2024-11-04 16:32 UTC (permalink / raw)
To: Rob Herring
Cc: linux-kernel, linux-amarula, Conor Dooley, Fabio Estevam,
Krzysztof Kozlowski, Lucas Stach, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, devicetree, imx, linux-arm-kernel
Hello Rob,
On Fri, Nov 1, 2024 at 6:39 PM Rob Herring <robh@kernel.org> wrote:
>
> On Mon, Oct 28, 2024 at 11:25:24AM +0100, Dario Binacchi wrote:
> > This property lists the state of the power domains, indicating whether
> > they have been left on or off by the bootloader/firmware.
> > This information becomes relevant, for example, in the case of supporting
> > the simple framebuffer.
> >
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> > ---
> >
> > .../bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
> > index eeec9965b091..00aa0b8d8ea9 100644
> > --- a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
> > +++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml
> > @@ -56,6 +56,15 @@ properties:
> > - const: csi-aclk
> > - const: csi-pclk
> >
> > + fsl,power-domains-boot-on:
> > + description: |
> > + Provide the on/off (1/0) status of the power domains. It allows
> > + specifying whether one or more power domains have already been
> > + initialized and left powered on by the bootloader.
>
> Sounds like a common problem *if* we wanted to fix it in DT.
>
> Why can't you just read the h/w registers to see which domains are
> powered on? Perhaps because some are on, but you want to turn them off.
I checked, but there is no register on this platform that indicates
the on/off status
of the power domain. So, I cannot readout the power domain state.
>
> Also, for simple-framebuffer, I think you can list the power-domains to
> keep on.
I did it; I added the power domains in the simple-framebuffer node, but this
doesn’t prevent the genpd.power_on() callback from being called. And when
this callback is called, the power domain is re-initialized, which does not
maintain the persistence of the image on the display. Adding this DTS property
prevents re-initialization that has already been performed by the bootloader.
Thanks and regards,
Dario
>
> Rob
>
>
--
Dario Binacchi
Senior Embedded Linux Developer
dario.binacchi@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC PATCH 02/10] pmdomain: imx8m-blk-ctrl: don't turn on a power domain already on
2024-10-28 10:25 [RFC PATCH 00/10] Support simple-framebuffer on imx8m Dario Binacchi
2024-10-28 10:25 ` [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property Dario Binacchi
@ 2024-10-28 10:25 ` Dario Binacchi
2024-10-28 10:25 ` [RFC PATCH 03/10] dt-bindings: power: gpcv2: add 'fsl,boot-on' property Dario Binacchi
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Dario Binacchi @ 2024-10-28 10:25 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Michael Trimarchi, Fabio Estevam,
Marek Vasut, Peng Fan, Pengutronix Kernel Team, Sascha Hauer,
Shawn Guo, Ulf Hansson, Uwe Kleine-König, imx,
linux-arm-kernel, linux-pm
The patch, by informing pm_genpd_init() with the "is_off" parameter that
the power domain is already on, prevents the power_on() callback from being
called, thus avoiding the unnecessary repetition of the hardware power-on
procedure. This feature is crucial when supporting the simple framebuffer,
as the power domains have already been initialized by the bootloader.
Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/pmdomain/imx/imx8m-blk-ctrl.c | 51 ++++++++++++++++++++++++++-
1 file changed, 50 insertions(+), 1 deletion(-)
diff --git a/drivers/pmdomain/imx/imx8m-blk-ctrl.c b/drivers/pmdomain/imx/imx8m-blk-ctrl.c
index ca942d7929c2..8dc1508571dd 100644
--- a/drivers/pmdomain/imx/imx8m-blk-ctrl.c
+++ b/drivers/pmdomain/imx/imx8m-blk-ctrl.c
@@ -166,6 +166,24 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd)
static struct lock_class_key blk_ctrl_genpd_lock_class;
+static bool imx8m_blk_ctrl_is_off(struct device *dev, struct generic_pm_domain *genpd)
+{
+ struct device_node *node = dev->of_node;
+ struct imx8m_blk_ctrl_domain *domain = to_imx8m_blk_ctrl_domain(genpd);
+ const struct imx8m_blk_ctrl_domain_data *data = domain->data;
+ u32 boot_on;
+ int index;
+
+ index = of_property_match_string(node, "power-domain-names",
+ data->gpc_name);
+ if (index < 0 || of_property_read_u32_index(node,
+ "fsl,power-domains-boot-on",
+ index, &boot_on))
+ return true;
+
+ return !boot_on;
+}
+
static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
{
const struct imx8m_blk_ctrl_data *bc_data;
@@ -173,6 +191,8 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
struct imx8m_blk_ctrl *bc;
void __iomem *base;
int i, ret;
+ bool init_off;
+ bool *pm_runtime_cleanup;
struct regmap_config regmap_config = {
.reg_bits = 32,
@@ -221,6 +241,11 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
"failed to attach power domain \"bus\"\n");
}
+ pm_runtime_cleanup = devm_kcalloc(dev, bc_data->num_domains,
+ sizeof(*pm_runtime_cleanup), GFP_KERNEL);
+ if (!pm_runtime_cleanup)
+ return -ENOMEM;
+
for (i = 0; i < bc_data->num_domains; i++) {
const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i];
struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
@@ -274,7 +299,8 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
domain->genpd.power_off = imx8m_blk_ctrl_power_off;
domain->bc = bc;
- ret = pm_genpd_init(&domain->genpd, NULL, true);
+ init_off = imx8m_blk_ctrl_is_off(dev, &domain->genpd);
+ ret = pm_genpd_init(&domain->genpd, NULL, init_off);
if (ret) {
dev_err_probe(dev, ret,
"failed to init power domain \"%s\"\n",
@@ -283,6 +309,24 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
goto cleanup_pds;
}
+ if (!init_off) {
+ ret = pm_runtime_get_sync(bc->bus_power_dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(bc->bus_power_dev);
+ dev_err_probe(dev, ret, "failed to power up bus domain\n");
+ goto cleanup_pds;
+ }
+
+ ret = pm_runtime_get_sync(domain->power_dev);
+ if (ret < 0) {
+ pm_runtime_put(bc->bus_power_dev);
+ dev_err_probe(dev, ret, "failed to power up peripheral domain\n");
+ goto cleanup_pds;
+ }
+
+ pm_runtime_cleanup[i] = true;
+ }
+
/*
* We use runtime PM to trigger power on/off of the upstream GPC
* domain, as a strict hierarchical parent/child power domain
@@ -324,6 +368,11 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev)
of_genpd_del_provider(dev->of_node);
cleanup_pds:
for (i--; i >= 0; i--) {
+ if (pm_runtime_cleanup[i]) {
+ pm_runtime_put(bc->domains[i].power_dev);
+ pm_runtime_put(bc->bus_power_dev);
+ }
+
pm_genpd_remove(&bc->domains[i].genpd);
dev_pm_domain_detach(bc->domains[i].power_dev, true);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [RFC PATCH 03/10] dt-bindings: power: gpcv2: add 'fsl,boot-on' property
2024-10-28 10:25 [RFC PATCH 00/10] Support simple-framebuffer on imx8m Dario Binacchi
2024-10-28 10:25 ` [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property Dario Binacchi
2024-10-28 10:25 ` [RFC PATCH 02/10] pmdomain: imx8m-blk-ctrl: don't turn on a power domain already on Dario Binacchi
@ 2024-10-28 10:25 ` Dario Binacchi
2024-10-28 10:25 ` [RFC PATCH 04/10] pmdomain: imx: gpcv2: don't turn on a power domain already on Dario Binacchi
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Dario Binacchi @ 2024-10-28 10:25 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Andrey Smirnov, Conor Dooley,
Fabio Estevam, Krzysztof Kozlowski, Pengutronix Kernel Team,
Rob Herring, Sascha Hauer, Shawn Guo, devicetree, imx,
linux-arm-kernel
The property states that the power-domain has been initialized and left
on by the bootloader/firmware. This information becomes relevant, for
example, in the case of supporting the simple framebuffer.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml b/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml
index dfdb8dfb6b65..718196f516ad 100644
--- a/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml
+++ b/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml
@@ -94,6 +94,12 @@ properties:
minItems: 1
maxItems: 4
+ fsl,boot-on:
+ description: |
+ The power-domain has been initialized and left on by the
+ bootloader/firmware.
+ type: boolean
+
required:
- '#power-domain-cells'
- reg
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [RFC PATCH 04/10] pmdomain: imx: gpcv2: don't turn on a power domain already on
2024-10-28 10:25 [RFC PATCH 00/10] Support simple-framebuffer on imx8m Dario Binacchi
` (2 preceding siblings ...)
2024-10-28 10:25 ` [RFC PATCH 03/10] dt-bindings: power: gpcv2: add 'fsl,boot-on' property Dario Binacchi
@ 2024-10-28 10:25 ` Dario Binacchi
2024-10-28 10:25 ` [RFC PATCH 10/10] drm/mxsfb: stop controller and drain FIFOs if already initialized Dario Binacchi
2024-10-28 10:49 ` [RFC PATCH 00/10] Support simple-framebuffer on imx8m Maxime Ripard
5 siblings, 0 replies; 9+ messages in thread
From: Dario Binacchi @ 2024-10-28 10:25 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Michael Trimarchi, Fabio Estevam,
Krzysztof Kozlowski, Pengutronix Kernel Team, Sascha Hauer,
Shawn Guo, Shengjiu Wang, Ulf Hansson, Uwe Kleine-König, imx,
linux-arm-kernel, linux-pm
The patch, by informing pm_genpd_init() with the "is_off" parameter that
the power domain is already on, prevents the power_on() callback from being
called, thus avoiding the unnecessary repetition of the hardware power-on
procedure. This feature is crucial when supporting the simple framebuffer,
as the power domains have already been initialized by the bootloader.
Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/pmdomain/imx/gpcv2.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c
index 963d61c5af6d..bf9fe4af03c5 100644
--- a/drivers/pmdomain/imx/gpcv2.c
+++ b/drivers/pmdomain/imx/gpcv2.c
@@ -1324,6 +1324,7 @@ static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = {
static int imx_pgc_domain_probe(struct platform_device *pdev)
{
struct imx_pgc_domain *domain = pdev->dev.platform_data;
+ bool init_off;
int ret;
domain->dev = &pdev->dev;
@@ -1354,12 +1355,33 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
regmap_update_bits(domain->regmap, domain->regs->map,
domain->bits.map, domain->bits.map);
- ret = pm_genpd_init(&domain->genpd, NULL, true);
+ init_off = !of_property_read_bool(domain->dev->of_node,
+ "fsl,boot-on");
+ ret = pm_genpd_init(&domain->genpd, NULL, init_off);
if (ret) {
dev_err(domain->dev, "Failed to init power domain\n");
goto out_domain_unmap;
}
+ if (!init_off) {
+ ret = pm_runtime_get_sync(domain->dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(domain->dev);
+ dev_err_probe(domain->dev, ret, "failed to power up bus domain\n");
+ goto out_genpd_remove;
+ }
+
+ if (domain->keep_clocks) {
+ ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
+ if (ret) {
+ dev_err_probe(domain->dev, ret,
+ "failed to enable clocks for domain: %s\n",
+ domain->genpd.name);
+ goto out_pm_put;
+ }
+ }
+ }
+
if (IS_ENABLED(CONFIG_LOCKDEP) &&
of_property_read_bool(domain->dev->of_node, "power-domains"))
lockdep_set_subclass(&domain->genpd.mlock, 1);
@@ -1368,11 +1390,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
&domain->genpd);
if (ret) {
dev_err(domain->dev, "Failed to add genpd provider\n");
- goto out_genpd_remove;
+ goto out_clk_unprepare;
}
return 0;
+out_clk_unprepare:
+ if (!init_off && domain->keep_clocks)
+ clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
+out_pm_put:
+ if (!init_off)
+ pm_runtime_put(domain->dev);
out_genpd_remove:
pm_genpd_remove(&domain->genpd);
out_domain_unmap:
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [RFC PATCH 10/10] drm/mxsfb: stop controller and drain FIFOs if already initialized
2024-10-28 10:25 [RFC PATCH 00/10] Support simple-framebuffer on imx8m Dario Binacchi
` (3 preceding siblings ...)
2024-10-28 10:25 ` [RFC PATCH 04/10] pmdomain: imx: gpcv2: don't turn on a power domain already on Dario Binacchi
@ 2024-10-28 10:25 ` Dario Binacchi
2024-10-28 10:49 ` [RFC PATCH 00/10] Support simple-framebuffer on imx8m Maxime Ripard
5 siblings, 0 replies; 9+ messages in thread
From: Dario Binacchi @ 2024-10-28 10:25 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, David Airlie, Fabio Estevam,
Maarten Lankhorst, Marek Vasut, Maxime Ripard,
Pengutronix Kernel Team, Sascha Hauer, Shawn Guo, Simona Vetter,
Stefan Agner, Thomas Zimmermann, dri-devel, imx, linux-arm-kernel
You can't re-program the controller if it is still running. This may
lead to shifted pictures, so stop the controller and drain its FIFOs
in case it's already properly setup.
This patch is crucial when supporting the simple framebuffer, as the
controller has already been initialized by the bootloader.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +++
drivers/gpu/drm/mxsfb/mxsfb_drv.h | 1 +
drivers/gpu/drm/mxsfb/mxsfb_kms.c | 14 +++++++++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index cb5ce4e81fc7..38c94cdc8f6c 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/dma-mapping.h>
+#include <linux/of.h>
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
@@ -221,6 +222,8 @@ static int mxsfb_load(struct drm_device *drm,
if (!mxsfb)
return -ENOMEM;
+ mxsfb->enabled =
+ of_property_read_bool(drm->dev->of_node, "fsl,boot-on");
mxsfb->drm = drm;
drm->dev_private = mxsfb;
mxsfb->devdata = devdata;
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
index d160d921b25f..0f9ae4ce450c 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h
@@ -47,6 +47,7 @@ struct mxsfb_drm_private {
struct drm_bridge *bridge;
bool crc_active;
+ bool enabled;
};
static inline struct mxsfb_drm_private *
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
index 7ed2516b6de0..d064a2bb65df 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c
@@ -202,9 +202,11 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
writel(reg, mxsfb->base + LCDC_CTRL1);
writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET);
+
+ mxsfb->enabled = true;
}
-static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
+static void _mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
{
u32 reg;
@@ -221,6 +223,13 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
reg &= ~VDCTRL4_SYNC_SIGNALS_ON;
writel(reg, mxsfb->base + LCDC_VDCTRL4);
+ mxsfb->enabled = false;
+}
+
+static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
+{
+ _mxsfb_disable_controller(mxsfb);
+
clk_disable_unprepare(mxsfb->clk);
if (mxsfb->clk_disp_axi)
clk_disable_unprepare(mxsfb->clk_disp_axi);
@@ -354,6 +363,9 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
u32 bus_format = 0;
dma_addr_t dma_addr;
+ if (mxsfb->enabled)
+ _mxsfb_disable_controller(mxsfb);
+
pm_runtime_get_sync(drm->dev);
mxsfb_enable_axi_clk(mxsfb);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [RFC PATCH 00/10] Support simple-framebuffer on imx8m
2024-10-28 10:25 [RFC PATCH 00/10] Support simple-framebuffer on imx8m Dario Binacchi
` (4 preceding siblings ...)
2024-10-28 10:25 ` [RFC PATCH 10/10] drm/mxsfb: stop controller and drain FIFOs if already initialized Dario Binacchi
@ 2024-10-28 10:49 ` Maxime Ripard
5 siblings, 0 replies; 9+ messages in thread
From: Maxime Ripard @ 2024-10-28 10:49 UTC (permalink / raw)
To: Dario Binacchi
Cc: linux-kernel, linux-amarula, Andrey Smirnov, Andrzej Hajda,
Conor Dooley, David Airlie, Fabio Estevam, Inki Dae, Jagan Teki,
Jernej Skrabec, Jessica Zhang, Jonas Karlman, Krzysztof Kozlowski,
Krzysztof Kozlowski, Laurent Pinchart, Lucas Stach,
Maarten Lankhorst, Marek Szyprowski, Marek Vasut,
Michael Trimarchi, Neil Armstrong, Peng Fan,
Pengutronix Kernel Team, Rob Herring, Robert Foss, Sascha Hauer,
Shawn Guo, Shengjiu Wang, Simona Vetter, Stefan Agner,
Thomas Zimmermann, Ulf Hansson, Uwe Kleine-König, devicetree,
dri-devel, imx, linux-arm-kernel, linux-pm
[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]
Hi,
On Mon, Oct 28, 2024 at 11:25:23AM +0100, Dario Binacchi wrote:
> This series is the Linux counterpart of what was sent to U-Boot [1]
> for the support of the simple-framebuffer for the BSH SMM S2Pro board.
I'm confused. simple-framebuffer is a mechanism for which the entire
point is that the kernel doesn't need the driver for.
Why do you need to have patches for bridges and panels for
simple-framebuffer? They won't be used.
> The need to avoid re-initializing the hardware (power domains,
> controllers, bridges, display panels) that has already been initialized
> and kept powered on by the bootloader has required updating more than
> one YAML file, with the addition of boolean properties to inform the
> driver that the corresponding hardware has been initialized and left
> on by the bootloader. All these properties are added on the fly by the
> bootloader to the various relevant nodes.
So it's not about simple-framebuffer at all, but rather that you don't
want to re-initialize the hardware that has already been setup?
If so, this isn't how you should do it, but rather:
https://lore.kernel.org/all/CAKMK7uHtqHy_oz4W7F+hmp9iqp7W5Ra8CxPvJ=9BwmvfU-O0gg@mail.gmail.com/
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread