diff mbox series

[4/7] drm/panel: st7703: Add Panel Rotation Support

Message ID 20240212184950.52210-5-macroalpha82@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add Support for RK3566 Powkiddy RGB10MAX3 | expand

Commit Message

Chris Morgan Feb. 12, 2024, 6:49 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

Add support for panel rotation to ST7703 based devices.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Guido Günther Feb. 13, 2024, 8:05 a.m. UTC | #1
Hi,
On Mon, Feb 12, 2024 at 12:49:47PM -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add support for panel rotation to ST7703 based devices.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>  drivers/gpu/drm/panel/panel-sitronix-st7703.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index 939ba05c9b58..a3e142f156d5 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -62,6 +62,7 @@ struct st7703 {
>  
>  	struct dentry *debugfs;
>  	const struct st7703_panel_desc *desc;
> +	enum drm_panel_orientation orientation;
>  };
>  
>  struct st7703_panel_desc {
> @@ -743,12 +744,20 @@ static int st7703_get_modes(struct drm_panel *panel,
>  	return 1;
>  }
>  
> +static enum drm_panel_orientation st7703_get_orientation(struct drm_panel *panel)
> +{
> +	struct st7703 *st7703 = panel_to_st7703(panel);
> +
> +	return st7703->orientation;
> +}
> +
>  static const struct drm_panel_funcs st7703_drm_funcs = {
>  	.disable   = st7703_disable,
>  	.unprepare = st7703_unprepare,
>  	.prepare   = st7703_prepare,
>  	.enable	   = st7703_enable,
>  	.get_modes = st7703_get_modes,
> +	.get_orientation = st7703_get_orientation,
>  };
>  
>  static int allpixelson_set(void *data, u64 val)
> @@ -817,6 +826,10 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
>  		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
>  				     "Failed to request iovcc regulator\n");
>  
> +	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
> +	if (ret < 0)
> +		return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n");
> +
>  	drm_panel_init(&ctx->panel, dev, &st7703_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DSI);

Reviewed-by: Guido Günther <agx@sigxcpu.org>
Cheers,
 -- Guido

>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 939ba05c9b58..a3e142f156d5 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -62,6 +62,7 @@  struct st7703 {
 
 	struct dentry *debugfs;
 	const struct st7703_panel_desc *desc;
+	enum drm_panel_orientation orientation;
 };
 
 struct st7703_panel_desc {
@@ -743,12 +744,20 @@  static int st7703_get_modes(struct drm_panel *panel,
 	return 1;
 }
 
+static enum drm_panel_orientation st7703_get_orientation(struct drm_panel *panel)
+{
+	struct st7703 *st7703 = panel_to_st7703(panel);
+
+	return st7703->orientation;
+}
+
 static const struct drm_panel_funcs st7703_drm_funcs = {
 	.disable   = st7703_disable,
 	.unprepare = st7703_unprepare,
 	.prepare   = st7703_prepare,
 	.enable	   = st7703_enable,
 	.get_modes = st7703_get_modes,
+	.get_orientation = st7703_get_orientation,
 };
 
 static int allpixelson_set(void *data, u64 val)
@@ -817,6 +826,10 @@  static int st7703_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
 				     "Failed to request iovcc regulator\n");
 
+	ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation);
+	if (ret < 0)
+		return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n");
+
 	drm_panel_init(&ctx->panel, dev, &st7703_drm_funcs,
 		       DRM_MODE_CONNECTOR_DSI);