* [PATCH v1 1/3] drm/bridge: lt8912b: Add suspend/resume support
2023-11-15 12:13 [PATCH v1 0/3] drm/bridge: lt8912b: Add power supplies Francesco Dolcini
@ 2023-11-15 12:13 ` Francesco Dolcini
2023-12-04 12:59 ` Robert Foss
2023-11-15 12:13 ` [PATCH v1 2/3] dt-bindings: display: bridge: lt8912b: Add power supplies Francesco Dolcini
2023-11-15 12:13 ` [PATCH v1 3/3] drm/bridge: " Francesco Dolcini
2 siblings, 1 reply; 7+ messages in thread
From: Francesco Dolcini @ 2023-11-15 12:13 UTC (permalink / raw)
To: Adrien Grassein, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter
Cc: Stefan Eichenberger, dri-devel, linux-kernel, Francesco Dolcini
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Add support for suspend and resume. The lt8912b will power off when
going into suspend and power on when resuming.
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 28 ++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 03532efb893b..097ab04234b7 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -634,6 +634,33 @@ static const struct drm_bridge_funcs lt8912_bridge_funcs = {
.get_edid = lt8912_bridge_get_edid,
};
+static int lt8912_bridge_resume(struct device *dev)
+{
+ struct lt8912 *lt = dev_get_drvdata(dev);
+ int ret;
+
+ ret = lt8912_hard_power_on(lt);
+ if (ret)
+ return ret;
+
+ ret = lt8912_soft_power_on(lt);
+ if (ret)
+ return ret;
+
+ return lt8912_video_on(lt);
+}
+
+static int lt8912_bridge_suspend(struct device *dev)
+{
+ struct lt8912 *lt = dev_get_drvdata(dev);
+
+ lt8912_hard_power_off(lt);
+
+ return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
+
static int lt8912_parse_dt(struct lt8912 *lt)
{
struct gpio_desc *gp_reset;
@@ -770,6 +797,7 @@ static struct i2c_driver lt8912_i2c_driver = {
.driver = {
.name = "lt8912",
.of_match_table = lt8912_dt_match,
+ .pm = pm_sleep_ptr(<8912_bridge_pm_ops),
},
.probe = lt8912_probe,
.remove = lt8912_remove,
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v1 1/3] drm/bridge: lt8912b: Add suspend/resume support
2023-11-15 12:13 ` [PATCH v1 1/3] drm/bridge: lt8912b: Add suspend/resume support Francesco Dolcini
@ 2023-12-04 12:59 ` Robert Foss
0 siblings, 0 replies; 7+ messages in thread
From: Robert Foss @ 2023-12-04 12:59 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Adrien Grassein, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Stefan Eichenberger, linux-kernel, dri-devel, Francesco Dolcini
On Wed, Nov 15, 2023 at 1:14 PM Francesco Dolcini <francesco@dolcini.it> wrote:
>
> From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
>
> Add support for suspend and resume. The lt8912b will power off when
> going into suspend and power on when resuming.
>
> Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> ---
> drivers/gpu/drm/bridge/lontium-lt8912b.c | 28 ++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 03532efb893b..097ab04234b7 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -634,6 +634,33 @@ static const struct drm_bridge_funcs lt8912_bridge_funcs = {
> .get_edid = lt8912_bridge_get_edid,
> };
>
> +static int lt8912_bridge_resume(struct device *dev)
> +{
> + struct lt8912 *lt = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = lt8912_hard_power_on(lt);
> + if (ret)
> + return ret;
> +
> + ret = lt8912_soft_power_on(lt);
> + if (ret)
> + return ret;
> +
> + return lt8912_video_on(lt);
> +}
> +
> +static int lt8912_bridge_suspend(struct device *dev)
> +{
> + struct lt8912 *lt = dev_get_drvdata(dev);
> +
> + lt8912_hard_power_off(lt);
> +
> + return 0;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
> +
> static int lt8912_parse_dt(struct lt8912 *lt)
> {
> struct gpio_desc *gp_reset;
> @@ -770,6 +797,7 @@ static struct i2c_driver lt8912_i2c_driver = {
> .driver = {
> .name = "lt8912",
> .of_match_table = lt8912_dt_match,
> + .pm = pm_sleep_ptr(<8912_bridge_pm_ops),
> },
> .probe = lt8912_probe,
> .remove = lt8912_remove,
> --
> 2.25.1
>
Reviewed-by: Robert Foss <rfoss@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 2/3] dt-bindings: display: bridge: lt8912b: Add power supplies
2023-11-15 12:13 [PATCH v1 0/3] drm/bridge: lt8912b: Add power supplies Francesco Dolcini
2023-11-15 12:13 ` [PATCH v1 1/3] drm/bridge: lt8912b: Add suspend/resume support Francesco Dolcini
@ 2023-11-15 12:13 ` Francesco Dolcini
2023-11-15 14:40 ` Conor Dooley
2023-11-15 12:13 ` [PATCH v1 3/3] drm/bridge: " Francesco Dolcini
2 siblings, 1 reply; 7+ messages in thread
From: Francesco Dolcini @ 2023-11-15 12:13 UTC (permalink / raw)
To: Adrien Grassein, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, David Airlie,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Stefan Eichenberger, dri-devel, devicetree, linux-kernel,
Francesco Dolcini
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Add Lontium lt8912b power supplies.
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
.../display/bridge/lontium,lt8912b.yaml | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
index f201ae4af4fb..2cef25215798 100644
--- a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
@@ -55,6 +55,27 @@ properties:
- port@0
- port@1
+ vcchdmipll-supply:
+ description: A 1.8V supply that powers the HDMI PLL.
+
+ vcchdmitx-supply:
+ description: A 1.8V supply that powers the HDMI TX part.
+
+ vcclvdspll-supply:
+ description: A 1.8V supply that powers the LVDS PLL.
+
+ vcclvdstx-supply:
+ description: A 1.8V supply that powers the LVDS TX part.
+
+ vccmipirx-supply:
+ description: A 1.8V supply that powers the MIPI RX part.
+
+ vccsysclk-supply:
+ description: A 1.8V supply that powers the SYSCLK.
+
+ vdd-supply:
+ description: A 1.8V supply that powers the digital part.
+
required:
- compatible
- reg
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v1 2/3] dt-bindings: display: bridge: lt8912b: Add power supplies
2023-11-15 12:13 ` [PATCH v1 2/3] dt-bindings: display: bridge: lt8912b: Add power supplies Francesco Dolcini
@ 2023-11-15 14:40 ` Conor Dooley
0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2023-11-15 14:40 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Adrien Grassein, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec, David Airlie,
Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Stefan Eichenberger, dri-devel, devicetree,
linux-kernel, Francesco Dolcini
[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]
On Wed, Nov 15, 2023 at 01:13:37PM +0100, Francesco Dolcini wrote:
> From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
>
> Add Lontium lt8912b power supplies.
>
> Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Cheers,
Conor,
> ---
> .../display/bridge/lontium,lt8912b.yaml | 21 +++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
> index f201ae4af4fb..2cef25215798 100644
> --- a/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
> +++ b/Documentation/devicetree/bindings/display/bridge/lontium,lt8912b.yaml
> @@ -55,6 +55,27 @@ properties:
> - port@0
> - port@1
>
> + vcchdmipll-supply:
> + description: A 1.8V supply that powers the HDMI PLL.
> +
> + vcchdmitx-supply:
> + description: A 1.8V supply that powers the HDMI TX part.
> +
> + vcclvdspll-supply:
> + description: A 1.8V supply that powers the LVDS PLL.
> +
> + vcclvdstx-supply:
> + description: A 1.8V supply that powers the LVDS TX part.
> +
> + vccmipirx-supply:
> + description: A 1.8V supply that powers the MIPI RX part.
> +
> + vccsysclk-supply:
> + description: A 1.8V supply that powers the SYSCLK.
> +
> + vdd-supply:
> + description: A 1.8V supply that powers the digital part.
> +
> required:
> - compatible
> - reg
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 3/3] drm/bridge: lt8912b: Add power supplies
2023-11-15 12:13 [PATCH v1 0/3] drm/bridge: lt8912b: Add power supplies Francesco Dolcini
2023-11-15 12:13 ` [PATCH v1 1/3] drm/bridge: lt8912b: Add suspend/resume support Francesco Dolcini
2023-11-15 12:13 ` [PATCH v1 2/3] dt-bindings: display: bridge: lt8912b: Add power supplies Francesco Dolcini
@ 2023-11-15 12:13 ` Francesco Dolcini
2023-12-04 12:58 ` Robert Foss
2 siblings, 1 reply; 7+ messages in thread
From: Francesco Dolcini @ 2023-11-15 12:13 UTC (permalink / raw)
To: Adrien Grassein, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter
Cc: Stefan Eichenberger, dri-devel, linux-kernel, Francesco Dolcini
From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Add supplies to the driver that can be used to turn the Lontium lt8912b
on and off. It can have up to 7 independent supplies, we add them all
and enable/disable them with bulk_enable/disable.
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
drivers/gpu/drm/bridge/lontium-lt8912b.c | 30 ++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
index 097ab04234b7..273157428c82 100644
--- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
+++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
@@ -43,6 +43,8 @@ struct lt8912 {
struct videomode mode;
+ struct regulator_bulk_data supplies[7];
+
u8 data_lanes;
bool is_power_on;
};
@@ -257,6 +259,12 @@ static int lt8912_free_i2c(struct lt8912 *lt)
static int lt8912_hard_power_on(struct lt8912 *lt)
{
+ int ret;
+
+ ret = regulator_bulk_enable(ARRAY_SIZE(lt->supplies), lt->supplies);
+ if (ret)
+ return ret;
+
gpiod_set_value_cansleep(lt->gp_reset, 0);
msleep(20);
@@ -267,6 +275,9 @@ static void lt8912_hard_power_off(struct lt8912 *lt)
{
gpiod_set_value_cansleep(lt->gp_reset, 1);
msleep(20);
+
+ regulator_bulk_disable(ARRAY_SIZE(lt->supplies), lt->supplies);
+
lt->is_power_on = false;
}
@@ -661,6 +672,21 @@ static int lt8912_bridge_suspend(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
+static int lt8912_get_regulators(struct lt8912 *lt)
+{
+ unsigned int i;
+ const char * const supply_names[] = {
+ "vdd", "vccmipirx", "vccsysclk", "vcclvdstx",
+ "vcchdmitx", "vcclvdspll", "vcchdmipll"
+ };
+
+ for (i = 0; i < ARRAY_SIZE(lt->supplies); i++)
+ lt->supplies[i].supply = supply_names[i];
+
+ return devm_regulator_bulk_get(lt->dev, ARRAY_SIZE(lt->supplies),
+ lt->supplies);
+}
+
static int lt8912_parse_dt(struct lt8912 *lt)
{
struct gpio_desc *gp_reset;
@@ -712,6 +738,10 @@ static int lt8912_parse_dt(struct lt8912 *lt)
goto err_free_host_node;
}
+ ret = lt8912_get_regulators(lt);
+ if (ret)
+ goto err_free_host_node;
+
of_node_put(port_node);
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v1 3/3] drm/bridge: lt8912b: Add power supplies
2023-11-15 12:13 ` [PATCH v1 3/3] drm/bridge: " Francesco Dolcini
@ 2023-12-04 12:58 ` Robert Foss
0 siblings, 0 replies; 7+ messages in thread
From: Robert Foss @ 2023-12-04 12:58 UTC (permalink / raw)
To: Francesco Dolcini
Cc: Adrien Grassein, Andrzej Hajda, Neil Armstrong, Laurent Pinchart,
Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Daniel Vetter,
Stefan Eichenberger, dri-devel, linux-kernel, Francesco Dolcini
On Wed, Nov 15, 2023 at 1:14 PM Francesco Dolcini <francesco@dolcini.it> wrote:
>
> From: Stefan Eichenberger <stefan.eichenberger@toradex.com>
>
> Add supplies to the driver that can be used to turn the Lontium lt8912b
> on and off. It can have up to 7 independent supplies, we add them all
> and enable/disable them with bulk_enable/disable.
>
> Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> ---
> drivers/gpu/drm/bridge/lontium-lt8912b.c | 30 ++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 097ab04234b7..273157428c82 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -43,6 +43,8 @@ struct lt8912 {
>
> struct videomode mode;
>
> + struct regulator_bulk_data supplies[7];
> +
> u8 data_lanes;
> bool is_power_on;
> };
> @@ -257,6 +259,12 @@ static int lt8912_free_i2c(struct lt8912 *lt)
>
> static int lt8912_hard_power_on(struct lt8912 *lt)
> {
> + int ret;
> +
> + ret = regulator_bulk_enable(ARRAY_SIZE(lt->supplies), lt->supplies);
> + if (ret)
> + return ret;
> +
> gpiod_set_value_cansleep(lt->gp_reset, 0);
> msleep(20);
>
> @@ -267,6 +275,9 @@ static void lt8912_hard_power_off(struct lt8912 *lt)
> {
> gpiod_set_value_cansleep(lt->gp_reset, 1);
> msleep(20);
> +
> + regulator_bulk_disable(ARRAY_SIZE(lt->supplies), lt->supplies);
> +
> lt->is_power_on = false;
> }
>
> @@ -661,6 +672,21 @@ static int lt8912_bridge_suspend(struct device *dev)
>
> static DEFINE_SIMPLE_DEV_PM_OPS(lt8912_bridge_pm_ops, lt8912_bridge_suspend, lt8912_bridge_resume);
>
> +static int lt8912_get_regulators(struct lt8912 *lt)
> +{
> + unsigned int i;
> + const char * const supply_names[] = {
> + "vdd", "vccmipirx", "vccsysclk", "vcclvdstx",
> + "vcchdmitx", "vcclvdspll", "vcchdmipll"
> + };
> +
> + for (i = 0; i < ARRAY_SIZE(lt->supplies); i++)
> + lt->supplies[i].supply = supply_names[i];
> +
> + return devm_regulator_bulk_get(lt->dev, ARRAY_SIZE(lt->supplies),
> + lt->supplies);
> +}
> +
> static int lt8912_parse_dt(struct lt8912 *lt)
> {
> struct gpio_desc *gp_reset;
> @@ -712,6 +738,10 @@ static int lt8912_parse_dt(struct lt8912 *lt)
> goto err_free_host_node;
> }
>
> + ret = lt8912_get_regulators(lt);
> + if (ret)
> + goto err_free_host_node;
> +
> of_node_put(port_node);
> return 0;
>
> --
> 2.25.1
>
Reviewed-by: Robert Foss <rfoss@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread