drm/mipi-dbi: Support separate I/O regulator
authorOtto Pflüger <otto.pflueger@abscue.de>
Thu, 1 Dec 2022 16:02:43 +0000 (17:02 +0100)
committerNoralf Trønnes <noralf@tronnes.org>
Wed, 14 Dec 2022 13:57:09 +0000 (14:57 +0100)
The MIPI DBI specification defines separate vdd (panel power) and
vddi (I/O voltage) supplies. Displays that require different voltages
for the different supplies do exist, so the supplies cannot be
combined into one as they are now. Add a new io_regulator property to
the mipi_dbi_dev struct which can be set by the panel driver along
with the regulator property.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20221201160245.2093816-2-otto.pflueger@abscue.de
drivers/gpu/drm/drm_mipi_dbi.c
include/drm/drm_mipi_dbi.h

index eb27d000bcfb7d5af8e414e1217c46caed3aa2bb..c871d9f096b8ba702b06134403650ad753283ebc 100644 (file)
@@ -417,6 +417,8 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
 
        if (dbidev->regulator)
                regulator_disable(dbidev->regulator);
+       if (dbidev->io_regulator)
+               regulator_disable(dbidev->io_regulator);
 }
 EXPORT_SYMBOL(mipi_dbi_pipe_disable);
 
@@ -726,6 +728,16 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool
                }
        }
 
+       if (dbidev->io_regulator) {
+               ret = regulator_enable(dbidev->io_regulator);
+               if (ret) {
+                       DRM_DEV_ERROR(dev, "Failed to enable I/O regulator (%d)\n", ret);
+                       if (dbidev->regulator)
+                               regulator_disable(dbidev->regulator);
+                       return ret;
+               }
+       }
+
        if (cond && mipi_dbi_display_is_on(dbi))
                return 1;
 
@@ -735,6 +747,8 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool
                DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret);
                if (dbidev->regulator)
                        regulator_disable(dbidev->regulator);
+               if (dbidev->io_regulator)
+                       regulator_disable(dbidev->io_regulator);
                return ret;
        }
 
index 304fbecdc66ad35532e6f7178133275aa05907d9..816f196b3d4c533f3d54f4a6ef4641a3af616436 100644 (file)
@@ -123,10 +123,15 @@ struct mipi_dbi_dev {
        struct backlight_device *backlight;
 
        /**
-        * @regulator: power regulator (optional)
+        * @regulator: power regulator (Vdd) (optional)
         */
        struct regulator *regulator;
 
+       /**
+        * @io_regulator: I/O power regulator (Vddi) (optional)
+        */
+       struct regulator *io_regulator;
+
        /**
         * @dbi: MIPI DBI interface
         */