All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
	Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Sam Ravnborg <sam@ravnborg.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH v2 24/24] drm/shmobile: Backlight update
Date: Sun, 23 Aug 2020 12:45:32 +0200	[thread overview]
Message-ID: <20200823104532.1024798-25-sam@ravnborg.org> (raw)
In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org>

- Use get/set methods for backlight_properties
- Use macro for backlight initialization

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
 .../gpu/drm/shmobile/shmob_drm_backlight.c    | 20 +++++++------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
index f6628a5ee95f..634b49e50ded 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
@@ -18,13 +18,8 @@ static int shmob_drm_backlight_update(struct backlight_device *bdev)
 	struct shmob_drm_connector *scon = bl_get_data(bdev);
 	struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
 	const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
-	int brightness = bdev->props.brightness;
 
-	if (bdev->props.power != FB_BLANK_UNBLANK ||
-	    bdev->props.state & BL_CORE_SUSPENDED)
-		brightness = 0;
-
-	return bdata->set_brightness(brightness);
+	return bdata->set_brightness(backlight_get_brightness(bdev));
 }
 
 static int shmob_drm_backlight_get_brightness(struct backlight_device *bdev)
@@ -47,9 +42,10 @@ void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode)
 	if (scon->backlight == NULL)
 		return;
 
-	scon->backlight->props.power = mode == DRM_MODE_DPMS_ON
-				     ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
-	backlight_update_status(scon->backlight);
+	if (mode == DRM_MODE_DPMS_ON)
+		backlight_enable(scon->backlight);
+	else
+		backlight_disable(scon->backlight);
 }
 
 int shmob_drm_backlight_init(struct shmob_drm_connector *scon)
@@ -59,21 +55,19 @@ int shmob_drm_backlight_init(struct shmob_drm_connector *scon)
 	struct drm_connector *connector = &scon->connector;
 	struct drm_device *dev = connector->dev;
 	struct backlight_device *backlight;
+	DECLARE_BACKLIGHT_INIT_RAW(props, bdata->max_brightness, bdata->max_brightness);
 
 	if (!bdata->max_brightness)
 		return 0;
 
 	backlight = backlight_device_register(bdata->name, dev->dev, scon,
-					      &shmob_drm_backlight_ops, NULL);
+					      &shmob_drm_backlight_ops, &props);
 	if (IS_ERR(backlight)) {
 		dev_err(dev->dev, "unable to register backlight device: %ld\n",
 			PTR_ERR(backlight));
 		return PTR_ERR(backlight);
 	}
 
-	backlight->props.max_brightness = bdata->max_brightness;
-	backlight->props.brightness = bdata->max_brightness;
-	backlight->props.power = FB_BLANK_POWERDOWN;
 	backlight_update_status(backlight);
 
 	scon->backlight = backlight;
-- 
2.25.1


WARNING: multiple messages have this Message-ID
From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
	Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>
Cc: linux-renesas-soc@vger.kernel.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [PATCH v2 24/24] drm/shmobile: Backlight update
Date: Sun, 23 Aug 2020 12:45:32 +0200	[thread overview]
Message-ID: <20200823104532.1024798-25-sam@ravnborg.org> (raw)
In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org>

- Use get/set methods for backlight_properties
- Use macro for backlight initialization

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org
---
 .../gpu/drm/shmobile/shmob_drm_backlight.c    | 20 +++++++------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
index f6628a5ee95f..634b49e50ded 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c
@@ -18,13 +18,8 @@ static int shmob_drm_backlight_update(struct backlight_device *bdev)
 	struct shmob_drm_connector *scon = bl_get_data(bdev);
 	struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
 	const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
-	int brightness = bdev->props.brightness;
 
-	if (bdev->props.power != FB_BLANK_UNBLANK ||
-	    bdev->props.state & BL_CORE_SUSPENDED)
-		brightness = 0;
-
-	return bdata->set_brightness(brightness);
+	return bdata->set_brightness(backlight_get_brightness(bdev));
 }
 
 static int shmob_drm_backlight_get_brightness(struct backlight_device *bdev)
@@ -47,9 +42,10 @@ void shmob_drm_backlight_dpms(struct shmob_drm_connector *scon, int mode)
 	if (scon->backlight == NULL)
 		return;
 
-	scon->backlight->props.power = mode == DRM_MODE_DPMS_ON
-				     ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
-	backlight_update_status(scon->backlight);
+	if (mode == DRM_MODE_DPMS_ON)
+		backlight_enable(scon->backlight);
+	else
+		backlight_disable(scon->backlight);
 }
 
 int shmob_drm_backlight_init(struct shmob_drm_connector *scon)
@@ -59,21 +55,19 @@ int shmob_drm_backlight_init(struct shmob_drm_connector *scon)
 	struct drm_connector *connector = &scon->connector;
 	struct drm_device *dev = connector->dev;
 	struct backlight_device *backlight;
+	DECLARE_BACKLIGHT_INIT_RAW(props, bdata->max_brightness, bdata->max_brightness);
 
 	if (!bdata->max_brightness)
 		return 0;
 
 	backlight = backlight_device_register(bdata->name, dev->dev, scon,
-					      &shmob_drm_backlight_ops, NULL);
+					      &shmob_drm_backlight_ops, &props);
 	if (IS_ERR(backlight)) {
 		dev_err(dev->dev, "unable to register backlight device: %ld\n",
 			PTR_ERR(backlight));
 		return PTR_ERR(backlight);
 	}
 
-	backlight->props.max_brightness = bdata->max_brightness;
-	backlight->props.brightness = bdata->max_brightness;
-	backlight->props.power = FB_BLANK_POWERDOWN;
 	backlight_update_status(backlight);
 
 	scon->backlight = backlight;
-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-08-23 10:46 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23 10:45 [PATCH v2 0/24] backlight: add init macros and accessors Sam Ravnborg
2020-08-23 10:45 ` Sam Ravnborg
2020-08-23 10:45 ` Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 01/24] backlight: Silently fail backlight_update_status() if no device Sam Ravnborg
2020-09-02 10:50   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 02/24] backlight: Add DECLARE_* macro for device registration Sam Ravnborg
2020-09-02 11:06   ` Daniel Thompson
2020-09-02 11:06     ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 03/24] backlight: Add get/set operations for brightness properties Sam Ravnborg
2020-09-02 11:30   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 04/24] backlight: gpio: Introduce backlight_{enable, disable} Sam Ravnborg
2020-09-02 11:11   ` [PATCH v2 04/24] backlight: gpio: Introduce backlight_{enable,disable} Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 05/24] backlight: gpio: Use dev_err_probe() Sam Ravnborg
2020-09-02 11:17   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 06/24] backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW Sam Ravnborg
2020-09-02 11:21   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 07/24] drm/gma500: Backlight update Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 08/24] drm/panel: asus-z00t-tm5p5-n35596: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 09/24] drm/panel: jdi-lt070me05000: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 10/24] drm/panel: novatek-nt35510: " Sam Ravnborg
2020-08-27 22:33   ` Linus Walleij
2020-08-23 10:45 ` [PATCH v2 11/24] drm/panel: orisetech-otm8009a: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 12/24] drm/panel: raydium-rm67191: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 13/24] drm/panel: samsung-s6e63m0: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 14/24] drm/panel: samsung-s6e63j0x03: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 15/24] drm/panel: samsung-s6e3ha2: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 16/24] drm/panel: sony-acx424akp: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 17/24] drm/panel: sony-acx565akm: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 18/24] drm/bridge: parade-ps8622: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 19/24] drm/tilcdc: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 20/24] drm/radeon: " Sam Ravnborg
2020-08-23 10:45   ` Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 21/24] drm/amdgpu/atom: " Sam Ravnborg
2020-08-23 10:45   ` Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 22/24] drm/i915: " Sam Ravnborg
2020-09-02 12:56   ` Jani Nikula
2020-09-14  7:53   ` [drm/i915] 37bedbd445: suspend-stress.fail kernel test robot
2020-09-14  7:53     ` kernel test robot
2020-09-14  8:25     ` Jani Nikula
2020-09-14  8:25       ` Jani Nikula
2020-08-23 10:45 ` [PATCH v2 23/24] drm/omap: display: Backlight update Sam Ravnborg
2020-08-28 11:55   ` Sebastian Reichel
2020-08-23 10:45 ` Sam Ravnborg [this message]
2020-08-23 10:45   ` [PATCH v2 24/24] drm/shmobile: " Sam Ravnborg
2020-08-28  9:40 ` [PATCH v2 0/24] backlight: add init macros and accessors Linus Walleij
2020-08-28  9:40   ` Linus Walleij
2020-08-28  9:40   ` Linus Walleij
2020-09-02 11:29   ` Daniel Thompson
2020-09-02 11:29     ` Daniel Thompson
2020-09-02 11:29     ` Daniel Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200823104532.1024798-25-sam@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=daniel.thompson@linaro.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --subject='Re: [PATCH v2 24/24] drm/shmobile: Backlight update' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.