linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements
@ 2018-04-23 14:10 Philippe Cornu
  2018-04-23 14:10 ` [PATCH 1/4] drm/panel: otm8009a: fix backlight updates Philippe Cornu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Philippe Cornu @ 2018-04-23 14:10 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, Alexandre Torgue

This patch serie fixes 2 backlight issues and adds the new
backlight api support.

Philippe Cornu (4):
  drm/panel: otm8009a: fix backlight updates
  drm/panel: otm8009a: fix glitches by moving backlight enable to
    otm8009a_enable()
  drm/panel: otm8009a: no message if probe success
  drm/panel: otm8009a: use new backlight api

 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 58 ++++++++++++------------
 1 file changed, 30 insertions(+), 28 deletions(-)

-- 
2.15.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] drm/panel: otm8009a: fix backlight updates
  2018-04-23 14:10 [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements Philippe Cornu
@ 2018-04-23 14:10 ` Philippe Cornu
  2018-05-14  8:36   ` Vincent ABRIOU
  2018-04-23 14:10 ` [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable() Philippe Cornu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Cornu @ 2018-04-23 14:10 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, Alexandre Torgue

Backlight updates was not working anymore since the good
implementation of the dsi lpm mode in the dsi host driver.
After a longer analysis, the backlight updates in dsi video
mode require the dsi hs mode.
Note: it is important to keep the dsi lpm mode for the rest
of the driver as init sequence, sleep in/out... dsi commands
work in lp mode.

Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 90f1ae4af93c..0fd2e0144d2b 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -98,6 +98,20 @@ static void otm8009a_dcs_write_buf(struct otm8009a *ctx, const void *data,
 		DRM_WARN("mipi dsi dcs write buffer failed\n");
 }
 
+static void otm8009a_dcs_write_buf_hs(struct otm8009a *ctx, const void *data,
+				      size_t len)
+{
+	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
+
+	/* data will be sent in dsi hs mode (ie. no lpm) */
+	dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+
+	otm8009a_dcs_write_buf(ctx, data, len);
+
+	/* restore back the dsi lpm mode */
+	dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+}
+
 #define dcs_write_seq(ctx, seq...)			\
 ({							\
 	static const u8 d[] = { seq };			\
@@ -387,7 +401,7 @@ static int otm8009a_backlight_update_status(struct backlight_device *bd)
 		 */
 		data[0] = MIPI_DCS_SET_DISPLAY_BRIGHTNESS;
 		data[1] = bd->props.brightness;
-		otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
+		otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
 
 		/* set Brightness Control & Backlight on */
 		data[1] = 0x24;
@@ -399,7 +413,7 @@ static int otm8009a_backlight_update_status(struct backlight_device *bd)
 
 	/* Update Brightness Control & Backlight */
 	data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
-	otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
+	otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
 
 	return 0;
 }
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable()
  2018-04-23 14:10 [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements Philippe Cornu
  2018-04-23 14:10 ` [PATCH 1/4] drm/panel: otm8009a: fix backlight updates Philippe Cornu
@ 2018-04-23 14:10 ` Philippe Cornu
  2018-05-14  8:37   ` Vincent ABRIOU
  2018-04-23 14:10 ` [PATCH 3/4] drm/panel: otm8009a: no message if probe success Philippe Cornu
  2018-04-23 14:10 ` [PATCH 4/4] drm/panel: otm8009a: use new backlight api Philippe Cornu
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Cornu @ 2018-04-23 14:10 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, Alexandre Torgue

The backlight 1st update was in the otm8009a_prepare() function
for a bad reason: backlight was not working in video mode and the
otm8009a_prepare() is in command mode for the init sequence. As the
backlight is now fixed (no lpm), it is good to put it back in the
otm8009a_enable() function, avoiding also image glitches visible
on some "slow" devices.

Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 0fd2e0144d2b..de4a16d5275c 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -330,13 +330,6 @@ static int otm8009a_prepare(struct drm_panel *panel)
 
 	ctx->prepared = true;
 
-	/*
-	 * Power on the backlight. Note: end-user still controls brightness
-	 * Note: ctx->prepared must be true before updating the backlight.
-	 */
-	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
-	backlight_update_status(ctx->bl_dev);
-
 	return 0;
 }
 
@@ -344,6 +337,16 @@ static int otm8009a_enable(struct drm_panel *panel)
 {
 	struct otm8009a *ctx = panel_to_otm8009a(panel);
 
+	if (ctx->enabled)
+		return 0;
+
+	/*
+	 * Power on the backlight. Note: end-user still controls brightness
+	 * Note: ctx->prepared must be true before updating the backlight.
+	 */
+	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
+	backlight_update_status(ctx->bl_dev);
+
 	ctx->enabled = true;
 
 	return 0;
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] drm/panel: otm8009a: no message if probe success
  2018-04-23 14:10 [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements Philippe Cornu
  2018-04-23 14:10 ` [PATCH 1/4] drm/panel: otm8009a: fix backlight updates Philippe Cornu
  2018-04-23 14:10 ` [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable() Philippe Cornu
@ 2018-04-23 14:10 ` Philippe Cornu
  2018-05-14  8:38   ` Vincent ABRIOU
  2018-04-23 14:10 ` [PATCH 4/4] drm/panel: otm8009a: use new backlight api Philippe Cornu
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Cornu @ 2018-04-23 14:10 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, Alexandre Torgue

Remove the message in case of probe success. This comes from
a suggestion followed in the recent integration of the
raydium rm68200 panel.

Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index de4a16d5275c..4c638b7b9943 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -14,8 +14,6 @@
 #include <linux/regulator/consumer.h>
 #include <video/mipi_display.h>
 
-#define DRV_NAME "orisetech_otm8009a"
-
 #define OTM8009A_BACKLIGHT_DEFAULT	240
 #define OTM8009A_BACKLIGHT_MAX		255
 
@@ -461,7 +459,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 	ctx->panel.dev = dev;
 	ctx->panel.funcs = &otm8009a_drm_funcs;
 
-	ctx->bl_dev = backlight_device_register(DRV_NAME "_backlight", dev, ctx,
+	ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
 						&otm8009a_backlight_ops, NULL);
 	if (IS_ERR(ctx->bl_dev)) {
 		dev_err(dev, "failed to register backlight device\n");
@@ -483,11 +481,6 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 		return ret;
 	}
 
-	DRM_INFO(DRV_NAME "_panel %ux%u@%u %ubpp dsi %udl - ready\n",
-		 default_mode.hdisplay, default_mode.vdisplay,
-		 default_mode.vrefresh,
-		 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);
-
 	return 0;
 }
 
@@ -513,7 +506,7 @@ static struct mipi_dsi_driver orisetech_otm8009a_driver = {
 	.probe  = otm8009a_probe,
 	.remove = otm8009a_remove,
 	.driver = {
-		.name = DRV_NAME "_panel",
+		.name = "panel-orisetech-otm8009a",
 		.of_match_table = orisetech_otm8009a_of_match,
 	},
 };
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] drm/panel: otm8009a: use new backlight api
  2018-04-23 14:10 [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements Philippe Cornu
                   ` (2 preceding siblings ...)
  2018-04-23 14:10 ` [PATCH 3/4] drm/panel: otm8009a: no message if probe success Philippe Cornu
@ 2018-04-23 14:10 ` Philippe Cornu
  2018-05-14  8:39   ` Vincent ABRIOU
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Cornu @ 2018-04-23 14:10 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick Fertre, Philippe Cornu, Benjamin Gaignard,
	Vincent Abriou, Alexandre Torgue

Use the new backlight api.

Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 26 ++++++++----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 4c638b7b9943..c2a71bd17e08 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel)
 	if (!ctx->enabled)
 		return 0; /* This is not an issue so we return 0 here */
 
-	/* Power off the backlight. Note: end-user still controls brightness */
-	ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
-	ret = backlight_update_status(ctx->bl_dev);
-	if (ret)
-		return ret;
+	backlight_disable(ctx->bl_dev);
 
 	ret = mipi_dsi_dcs_set_display_off(dsi);
 	if (ret)
@@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel)
 	if (ctx->enabled)
 		return 0;
 
-	/*
-	 * Power on the backlight. Note: end-user still controls brightness
-	 * Note: ctx->prepared must be true before updating the backlight.
-	 */
-	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
-	backlight_update_status(ctx->bl_dev);
+	backlight_enable(ctx->bl_dev);
 
 	ctx->enabled = true;
 
@@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
 	ctx->panel.dev = dev;
 	ctx->panel.funcs = &otm8009a_drm_funcs;
 
-	ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
-						&otm8009a_backlight_ops, NULL);
+	ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev),
+						     dsi->host->dev, ctx,
+						     &otm8009a_backlight_ops,
+						     NULL);
 	if (IS_ERR(ctx->bl_dev)) {
-		dev_err(dev, "failed to register backlight device\n");
-		return PTR_ERR(ctx->bl_dev);
+		ret = PTR_ERR(ctx->bl_dev);
+		dev_err(dev, "failed to register backlight %d\n", ret);
+		return ret;
 	}
 
 	ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX;
@@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi)
 	mipi_dsi_detach(dsi);
 	drm_panel_remove(&ctx->panel);
 
-	backlight_device_unregister(ctx->bl_dev);
-
 	return 0;
 }
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] drm/panel: otm8009a: fix backlight updates
  2018-04-23 14:10 ` [PATCH 1/4] drm/panel: otm8009a: fix backlight updates Philippe Cornu
@ 2018-05-14  8:36   ` Vincent ABRIOU
  0 siblings, 0 replies; 9+ messages in thread
From: Vincent ABRIOU @ 2018-05-14  8:36 UTC (permalink / raw)
  To: Philippe CORNU, Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick FERTRE, Benjamin Gaignard, Alexandre TORGUE

Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abriou@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> Backlight updates was not working anymore since the good
> implementation of the dsi lpm mode in the dsi host driver.
> After a longer analysis, the backlight updates in dsi video
> mode require the dsi hs mode.
> Note: it is important to keep the dsi lpm mode for the rest
> of the driver as init sequence, sleep in/out... dsi commands
> work in lp mode.
> 
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 90f1ae4af93c..0fd2e0144d2b 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -98,6 +98,20 @@ static void otm8009a_dcs_write_buf(struct otm8009a *ctx, const void *data,
>   		DRM_WARN("mipi dsi dcs write buffer failed\n");
>   }
>   
> +static void otm8009a_dcs_write_buf_hs(struct otm8009a *ctx, const void *data,
> +				      size_t len)
> +{
> +	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
> +
> +	/* data will be sent in dsi hs mode (ie. no lpm) */
> +	dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +
> +	otm8009a_dcs_write_buf(ctx, data, len);
> +
> +	/* restore back the dsi lpm mode */
> +	dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> +}
> +
>   #define dcs_write_seq(ctx, seq...)			\
>   ({							\
>   	static const u8 d[] = { seq };			\
> @@ -387,7 +401,7 @@ static int otm8009a_backlight_update_status(struct backlight_device *bd)
>   		 */
>   		data[0] = MIPI_DCS_SET_DISPLAY_BRIGHTNESS;
>   		data[1] = bd->props.brightness;
> -		otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
> +		otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
>   
>   		/* set Brightness Control & Backlight on */
>   		data[1] = 0x24;
> @@ -399,7 +413,7 @@ static int otm8009a_backlight_update_status(struct backlight_device *bd)
>   
>   	/* Update Brightness Control & Backlight */
>   	data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
> -	otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
> +	otm8009a_dcs_write_buf_hs(ctx, data, ARRAY_SIZE(data));
>   
>   	return 0;
>   }
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable()
  2018-04-23 14:10 ` [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable() Philippe Cornu
@ 2018-05-14  8:37   ` Vincent ABRIOU
  0 siblings, 0 replies; 9+ messages in thread
From: Vincent ABRIOU @ 2018-05-14  8:37 UTC (permalink / raw)
  To: Philippe CORNU, Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick FERTRE, Benjamin Gaignard, Alexandre TORGUE

Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abriou@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> The backlight 1st update was in the otm8009a_prepare() function
> for a bad reason: backlight was not working in video mode and the
> otm8009a_prepare() is in command mode for the init sequence. As the
> backlight is now fixed (no lpm), it is good to put it back in the
> otm8009a_enable() function, avoiding also image glitches visible
> on some "slow" devices.
> 
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 17 ++++++++++-------
>   1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 0fd2e0144d2b..de4a16d5275c 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -330,13 +330,6 @@ static int otm8009a_prepare(struct drm_panel *panel)
>   
>   	ctx->prepared = true;
>   
> -	/*
> -	 * Power on the backlight. Note: end-user still controls brightness
> -	 * Note: ctx->prepared must be true before updating the backlight.
> -	 */
> -	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
> -	backlight_update_status(ctx->bl_dev);
> -
>   	return 0;
>   }
>   
> @@ -344,6 +337,16 @@ static int otm8009a_enable(struct drm_panel *panel)
>   {
>   	struct otm8009a *ctx = panel_to_otm8009a(panel);
>   
> +	if (ctx->enabled)
> +		return 0;
> +
> +	/*
> +	 * Power on the backlight. Note: end-user still controls brightness
> +	 * Note: ctx->prepared must be true before updating the backlight.
> +	 */
> +	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
> +	backlight_update_status(ctx->bl_dev);
> +
>   	ctx->enabled = true;
>   
>   	return 0;
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/4] drm/panel: otm8009a: no message if probe success
  2018-04-23 14:10 ` [PATCH 3/4] drm/panel: otm8009a: no message if probe success Philippe Cornu
@ 2018-05-14  8:38   ` Vincent ABRIOU
  0 siblings, 0 replies; 9+ messages in thread
From: Vincent ABRIOU @ 2018-05-14  8:38 UTC (permalink / raw)
  To: Philippe CORNU, Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick FERTRE, Benjamin Gaignard, Alexandre TORGUE

Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abriou@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> Remove the message in case of probe success. This comes from
> a suggestion followed in the recent integration of the
> raydium rm68200 panel.
> 
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 11 ++---------
>   1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index de4a16d5275c..4c638b7b9943 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -14,8 +14,6 @@
>   #include <linux/regulator/consumer.h>
>   #include <video/mipi_display.h>
>   
> -#define DRV_NAME "orisetech_otm8009a"
> -
>   #define OTM8009A_BACKLIGHT_DEFAULT	240
>   #define OTM8009A_BACKLIGHT_MAX		255
>   
> @@ -461,7 +459,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
>   	ctx->panel.dev = dev;
>   	ctx->panel.funcs = &otm8009a_drm_funcs;
>   
> -	ctx->bl_dev = backlight_device_register(DRV_NAME "_backlight", dev, ctx,
> +	ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
>   						&otm8009a_backlight_ops, NULL);
>   	if (IS_ERR(ctx->bl_dev)) {
>   		dev_err(dev, "failed to register backlight device\n");
> @@ -483,11 +481,6 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
>   		return ret;
>   	}
>   
> -	DRM_INFO(DRV_NAME "_panel %ux%u@%u %ubpp dsi %udl - ready\n",
> -		 default_mode.hdisplay, default_mode.vdisplay,
> -		 default_mode.vrefresh,
> -		 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);
> -
>   	return 0;
>   }
>   
> @@ -513,7 +506,7 @@ static struct mipi_dsi_driver orisetech_otm8009a_driver = {
>   	.probe  = otm8009a_probe,
>   	.remove = otm8009a_remove,
>   	.driver = {
> -		.name = DRV_NAME "_panel",
> +		.name = "panel-orisetech-otm8009a",
>   		.of_match_table = orisetech_otm8009a_of_match,
>   	},
>   };
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/4] drm/panel: otm8009a: use new backlight api
  2018-04-23 14:10 ` [PATCH 4/4] drm/panel: otm8009a: use new backlight api Philippe Cornu
@ 2018-05-14  8:39   ` Vincent ABRIOU
  0 siblings, 0 replies; 9+ messages in thread
From: Vincent ABRIOU @ 2018-05-14  8:39 UTC (permalink / raw)
  To: Philippe CORNU, Thierry Reding, David Airlie, dri-devel, linux-kernel
  Cc: Andrzej Hajda, Yannick FERTRE, Benjamin Gaignard, Alexandre TORGUE

Hi Philippe,

Reviewed-by: Vincent Abriou <vincent.abriou@st.com>

BR
Vincent

On 04/23/2018 04:10 PM, Philippe Cornu wrote:
> Use the new backlight api.
> 
> Signed-off-by: Philippe Cornu <philippe.cornu@st.com>
> ---
>   drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 26 ++++++++----------------
>   1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> index 4c638b7b9943..c2a71bd17e08 100644
> --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
> @@ -260,11 +260,7 @@ static int otm8009a_disable(struct drm_panel *panel)
>   	if (!ctx->enabled)
>   		return 0; /* This is not an issue so we return 0 here */
>   
> -	/* Power off the backlight. Note: end-user still controls brightness */
> -	ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
> -	ret = backlight_update_status(ctx->bl_dev);
> -	if (ret)
> -		return ret;
> +	backlight_disable(ctx->bl_dev);
>   
>   	ret = mipi_dsi_dcs_set_display_off(dsi);
>   	if (ret)
> @@ -338,12 +334,7 @@ static int otm8009a_enable(struct drm_panel *panel)
>   	if (ctx->enabled)
>   		return 0;
>   
> -	/*
> -	 * Power on the backlight. Note: end-user still controls brightness
> -	 * Note: ctx->prepared must be true before updating the backlight.
> -	 */
> -	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
> -	backlight_update_status(ctx->bl_dev);
> +	backlight_enable(ctx->bl_dev);
>   
>   	ctx->enabled = true;
>   
> @@ -459,11 +450,14 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
>   	ctx->panel.dev = dev;
>   	ctx->panel.funcs = &otm8009a_drm_funcs;
>   
> -	ctx->bl_dev = backlight_device_register(dev_name(dev), dev, ctx,
> -						&otm8009a_backlight_ops, NULL);
> +	ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev),
> +						     dsi->host->dev, ctx,
> +						     &otm8009a_backlight_ops,
> +						     NULL);
>   	if (IS_ERR(ctx->bl_dev)) {
> -		dev_err(dev, "failed to register backlight device\n");
> -		return PTR_ERR(ctx->bl_dev);
> +		ret = PTR_ERR(ctx->bl_dev);
> +		dev_err(dev, "failed to register backlight %d\n", ret);
> +		return ret;
>   	}
>   
>   	ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX;
> @@ -491,8 +485,6 @@ static int otm8009a_remove(struct mipi_dsi_device *dsi)
>   	mipi_dsi_detach(dsi);
>   	drm_panel_remove(&ctx->panel);
>   
> -	backlight_device_unregister(ctx->bl_dev);
> -
>   	return 0;
>   }
>   
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-05-14  8:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 14:10 [PATCH 0/4] drm/panel: otm8009a: backlight fixes & improvements Philippe Cornu
2018-04-23 14:10 ` [PATCH 1/4] drm/panel: otm8009a: fix backlight updates Philippe Cornu
2018-05-14  8:36   ` Vincent ABRIOU
2018-04-23 14:10 ` [PATCH 2/4] drm/panel: otm8009a: fix glitches by moving backlight enable to otm8009a_enable() Philippe Cornu
2018-05-14  8:37   ` Vincent ABRIOU
2018-04-23 14:10 ` [PATCH 3/4] drm/panel: otm8009a: no message if probe success Philippe Cornu
2018-05-14  8:38   ` Vincent ABRIOU
2018-04-23 14:10 ` [PATCH 4/4] drm/panel: otm8009a: use new backlight api Philippe Cornu
2018-05-14  8:39   ` Vincent ABRIOU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).