Commit e2945e6c authored by Fabio Estevam's avatar Fabio Estevam Committed by Neil Armstrong

drm/panel: seiko-43wvf1g: Add the 'enable-gpios' property

Sometimes a GPIO is needed to turn on/off the display.

Add support for this usecase by introducing the optional 'enable-gpios'
property.

Tested on a imx53qsb board.
Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230314111724.1520178-2-festevam@denx.de
parent 1afdbd47
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/media-bus-format.h> #include <linux/media-bus-format.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
...@@ -48,6 +49,7 @@ struct seiko_panel { ...@@ -48,6 +49,7 @@ struct seiko_panel {
const struct seiko_panel_desc *desc; const struct seiko_panel_desc *desc;
struct regulator *dvdd; struct regulator *dvdd;
struct regulator *avdd; struct regulator *avdd;
struct gpio_desc *enable_gpio;
}; };
static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel) static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel)
...@@ -139,6 +141,8 @@ static int seiko_panel_unprepare(struct drm_panel *panel) ...@@ -139,6 +141,8 @@ static int seiko_panel_unprepare(struct drm_panel *panel)
if (!p->prepared) if (!p->prepared)
return 0; return 0;
gpiod_set_value_cansleep(p->enable_gpio, 0);
regulator_disable(p->avdd); regulator_disable(p->avdd);
/* Add a 100ms delay as per the panel datasheet */ /* Add a 100ms delay as per the panel datasheet */
...@@ -174,6 +178,8 @@ static int seiko_panel_prepare(struct drm_panel *panel) ...@@ -174,6 +178,8 @@ static int seiko_panel_prepare(struct drm_panel *panel)
goto disable_dvdd; goto disable_dvdd;
} }
gpiod_set_value_cansleep(p->enable_gpio, 1);
p->prepared = true; p->prepared = true;
return 0; return 0;
...@@ -252,6 +258,12 @@ static int seiko_panel_probe(struct device *dev, ...@@ -252,6 +258,12 @@ static int seiko_panel_probe(struct device *dev,
if (IS_ERR(panel->avdd)) if (IS_ERR(panel->avdd))
return PTR_ERR(panel->avdd); return PTR_ERR(panel->avdd);
panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
GPIOD_OUT_LOW);
if (IS_ERR(panel->enable_gpio))
return dev_err_probe(dev, PTR_ERR(panel->enable_gpio),
"failed to request GPIO\n");
drm_panel_init(&panel->base, dev, &seiko_panel_funcs, drm_panel_init(&panel->base, dev, &seiko_panel_funcs,
DRM_MODE_CONNECTOR_DPI); DRM_MODE_CONNECTOR_DPI);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment