All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] fbdev: Use backlight helpers
@ 2022-06-07 19:23 Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt

backlight_properties.fb_blank is deprecated. The states it represents
are handled by other properties; but instead of accessing those
properties directly, drivers should use the helpers provided by
backlight.h, even in cases where fb_blank isn't involved.

This will ultimately allow fb_blank to be removed.

Stephen Kitt (7):
  fbdev: aty128fb: Use backlight helper
  fbdev: atyfb: Use backlight helper
  fbdev: radeon: Use backlight helper
  fbdev: mx3fb: Use backlight helper
  fbdev: nvidia: Use backlight helper
  fbdev: omapfb: panel-dsi-cm: Use backlight helper
  fbdev: riva: Use backlight helper

 drivers/video/fbdev/aty/aty128fb.c                       | 6 ++----
 drivers/video/fbdev/aty/atyfb_base.c                     | 8 +-------
 drivers/video/fbdev/aty/radeon_backlight.c               | 6 +-----
 drivers/video/fbdev/mx3fb.c                              | 7 +------
 drivers/video/fbdev/nvidia/nv_backlight.c                | 8 +-------
 drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 8 +-------
 drivers/video/fbdev/riva/fbdev.c                         | 8 +-------
 7 files changed, 8 insertions(+), 43 deletions(-)


base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
2.30.2


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

* [PATCH 1/7] fbdev: aty128fb: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/aty128fb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index b26c81233b6b..a8f9baac3d3f 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -1765,12 +1765,10 @@ static int aty128_bl_update_status(struct backlight_device *bd)
 	unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
 	int level;
 
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK ||
-	    !par->lcd_on)
+	if (!par->lcd_on)
 		level = 0;
 	else
-		level = bd->props.brightness;
+		level = backlight_get_brightness(bd);
 
 	reg |= LVDS_BL_MOD_EN | LVDS_BLON;
 	if (level > 0) {
-- 
2.30.2


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

* [PATCH 1/7] fbdev: aty128fb: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/aty128fb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index b26c81233b6b..a8f9baac3d3f 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -1765,12 +1765,10 @@ static int aty128_bl_update_status(struct backlight_device *bd)
 	unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL);
 	int level;
 
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK ||
-	    !par->lcd_on)
+	if (!par->lcd_on)
 		level = 0;
 	else
-		level = bd->props.brightness;
+		level = backlight_get_brightness(bd);
 
 	reg |= LVDS_BL_MOD_EN | LVDS_BLON;
 	if (level > 0) {
-- 
2.30.2


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

* [PATCH 2/7] fbdev: atyfb: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/atyfb_base.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index a3e6faed7745..bec2d0c22fb2 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -2218,13 +2218,7 @@ static int aty_bl_update_status(struct backlight_device *bd)
 {
 	struct atyfb_par *par = bl_get_data(bd);
 	unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
-	int level;
-
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
+	int level = backlight_get_brightness(bd);
 
 	reg |= (BLMOD_EN | BIASMOD_EN);
 	if (level > 0) {
-- 
2.30.2


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

* [PATCH 2/7] fbdev: atyfb: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/atyfb_base.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index a3e6faed7745..bec2d0c22fb2 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -2218,13 +2218,7 @@ static int aty_bl_update_status(struct backlight_device *bd)
 {
 	struct atyfb_par *par = bl_get_data(bd);
 	unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par);
-	int level;
-
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
+	int level = backlight_get_brightness(bd);
 
 	reg |= (BLMOD_EN | BIASMOD_EN);
 	if (level > 0) {
-- 
2.30.2


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

* [PATCH 3/7] fbdev: radeon: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/radeon_backlight.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/aty/radeon_backlight.c b/drivers/video/fbdev/aty/radeon_backlight.c
index d2c1263ad260..427adc838f77 100644
--- a/drivers/video/fbdev/aty/radeon_backlight.c
+++ b/drivers/video/fbdev/aty/radeon_backlight.c
@@ -57,11 +57,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
 	 * backlight. This provides some greater power saving and the display
 	 * is useless without backlight anyway.
 	 */
-        if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
+	level = backlight_get_brightness(bd);
 
 	del_timer_sync(&rinfo->lvds_timer);
 	radeon_engine_idle();
-- 
2.30.2


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

* [PATCH 3/7] fbdev: radeon: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/radeon_backlight.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/aty/radeon_backlight.c b/drivers/video/fbdev/aty/radeon_backlight.c
index d2c1263ad260..427adc838f77 100644
--- a/drivers/video/fbdev/aty/radeon_backlight.c
+++ b/drivers/video/fbdev/aty/radeon_backlight.c
@@ -57,11 +57,7 @@ static int radeon_bl_update_status(struct backlight_device *bd)
 	 * backlight. This provides some greater power saving and the display
 	 * is useless without backlight anyway.
 	 */
-        if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
+	level = backlight_get_brightness(bd);
 
 	del_timer_sync(&rinfo->lvds_timer);
 	radeon_engine_idle();
-- 
2.30.2


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

* [PATCH 4/7] fbdev: mx3fb: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/mx3fb.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index b945b68984b9..76771e126d0a 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)
 static int mx3fb_bl_update_status(struct backlight_device *bl)
 {
 	struct mx3fb_data *fbd = bl_get_data(bl);
-	int brightness = bl->props.brightness;
-
-	if (bl->props.power != FB_BLANK_UNBLANK)
-		brightness = 0;
-	if (bl->props.fb_blank != FB_BLANK_UNBLANK)
-		brightness = 0;
+	int brightness = backlight_get_brightness(bl);
 
 	fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;
 
-- 
2.30.2


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

* [PATCH 4/7] fbdev: mx3fb: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/mx3fb.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index b945b68984b9..76771e126d0a 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)
 static int mx3fb_bl_update_status(struct backlight_device *bl)
 {
 	struct mx3fb_data *fbd = bl_get_data(bl);
-	int brightness = bl->props.brightness;
-
-	if (bl->props.power != FB_BLANK_UNBLANK)
-		brightness = 0;
-	if (bl->props.fb_blank != FB_BLANK_UNBLANK)
-		brightness = 0;
+	int brightness = backlight_get_brightness(bl);
 
 	fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;
 
-- 
2.30.2


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

* [PATCH 5/7] fbdev: nvidia: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/nvidia/nv_backlight.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/nvidia/nv_backlight.c b/drivers/video/fbdev/nvidia/nv_backlight.c
index 2ce53529f636..503a7a683855 100644
--- a/drivers/video/fbdev/nvidia/nv_backlight.c
+++ b/drivers/video/fbdev/nvidia/nv_backlight.c
@@ -49,17 +49,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
 {
 	struct nvidia_par *par = bl_get_data(bd);
 	u32 tmp_pcrt, tmp_pmc, fpcontrol;
-	int level;
+	int level = backlight_get_brightness(bd);
 
 	if (!par->FlatPanel)
 		return 0;
 
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
-
 	tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF;
 	tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC;
 	fpcontrol = NV_RD32(par->PRAMDAC, 0x0848) & 0xCFFFFFCC;
-- 
2.30.2


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

* [PATCH 5/7] fbdev: nvidia: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/nvidia/nv_backlight.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/nvidia/nv_backlight.c b/drivers/video/fbdev/nvidia/nv_backlight.c
index 2ce53529f636..503a7a683855 100644
--- a/drivers/video/fbdev/nvidia/nv_backlight.c
+++ b/drivers/video/fbdev/nvidia/nv_backlight.c
@@ -49,17 +49,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
 {
 	struct nvidia_par *par = bl_get_data(bd);
 	u32 tmp_pcrt, tmp_pmc, fpcontrol;
-	int level;
+	int level = backlight_get_brightness(bd);
 
 	if (!par->FlatPanel)
 		return 0;
 
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
-
 	tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF;
 	tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC;
 	fpcontrol = NV_RD32(par->PRAMDAC, 0x0848) & 0xCFFFFFCC;
-- 
2.30.2


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

* [PATCH 6/7] fbdev: omapfb: panel-dsi-cm: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-omap, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-omap@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
index a2c7c5cb1523..236430b5dc52 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
@@ -331,13 +331,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
 	struct omap_dss_device *in = ddata->in;
 	int r;
-	int level;
-
-	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
-			dev->props.power == FB_BLANK_UNBLANK)
-		level = dev->props.brightness;
-	else
-		level = 0;
+	int level = backlight_get_brightness(dev);
 
 	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
 
-- 
2.30.2


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

* [PATCH 6/7] fbdev: omapfb: panel-dsi-cm: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, linux-omap, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-omap@vger.kernel.org
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
index a2c7c5cb1523..236430b5dc52 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
@@ -331,13 +331,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
 	struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
 	struct omap_dss_device *in = ddata->in;
 	int r;
-	int level;
-
-	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
-			dev->props.power == FB_BLANK_UNBLANK)
-		level = dev->props.brightness;
-	else
-		level = 0;
+	int level = backlight_get_brightness(dev);
 
 	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
 
-- 
2.30.2


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

* [PATCH 7/7] fbdev: riva: Use backlight helper
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
@ 2022-06-07 19:23   ` Stephen Kitt
  2022-06-07 19:23   ` Stephen Kitt
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, Stephen Kitt, linux-kernel, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/riva/fbdev.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c
index 84d5e23ad7d3..534722b38053 100644
--- a/drivers/video/fbdev/riva/fbdev.c
+++ b/drivers/video/fbdev/riva/fbdev.c
@@ -292,13 +292,7 @@ static int riva_bl_update_status(struct backlight_device *bd)
 {
 	struct riva_par *par = bl_get_data(bd);
 	U032 tmp_pcrt, tmp_pmc;
-	int level;
-
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
+	int level = backlight_get_brightness(bd);
 
 	tmp_pmc = NV_RD32(par->riva.PMC, 0x10F0) & 0x0000FFFF;
 	tmp_pcrt = NV_RD32(par->riva.PCRTC0, 0x081C) & 0xFFFFFFFC;
-- 
2.30.2


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

* [PATCH 7/7] fbdev: riva: Use backlight helper
@ 2022-06-07 19:23   ` Stephen Kitt
  0 siblings, 0 replies; 18+ messages in thread
From: Stephen Kitt @ 2022-06-07 19:23 UTC (permalink / raw)
  To: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller, Paul Mackerras
  Cc: linux-fbdev, linux-kernel, Stephen Kitt, dri-devel

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/riva/fbdev.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c
index 84d5e23ad7d3..534722b38053 100644
--- a/drivers/video/fbdev/riva/fbdev.c
+++ b/drivers/video/fbdev/riva/fbdev.c
@@ -292,13 +292,7 @@ static int riva_bl_update_status(struct backlight_device *bd)
 {
 	struct riva_par *par = bl_get_data(bd);
 	U032 tmp_pcrt, tmp_pmc;
-	int level;
-
-	if (bd->props.power != FB_BLANK_UNBLANK ||
-	    bd->props.fb_blank != FB_BLANK_UNBLANK)
-		level = 0;
-	else
-		level = bd->props.brightness;
+	int level = backlight_get_brightness(bd);
 
 	tmp_pmc = NV_RD32(par->riva.PMC, 0x10F0) & 0x0000FFFF;
 	tmp_pcrt = NV_RD32(par->riva.PCRTC0, 0x081C) & 0xFFFFFFFC;
-- 
2.30.2


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

* Re: [PATCH 0/7] fbdev: Use backlight helpers
  2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
                   ` (6 preceding siblings ...)
  2022-06-07 19:23   ` Stephen Kitt
@ 2022-06-08 14:40 ` Daniel Thompson
  7 siblings, 0 replies; 18+ messages in thread
From: Daniel Thompson @ 2022-06-08 14:40 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller,
	Paul Mackerras, linux-fbdev, linux-kernel

On Tue, Jun 07, 2022 at 09:23:28PM +0200, Stephen Kitt wrote:
> backlight_properties.fb_blank is deprecated. The states it represents
> are handled by other properties; but instead of accessing those
> properties directly, drivers should use the helpers provided by
> backlight.h, even in cases where fb_blank isn't involved.
> 
> This will ultimately allow fb_blank to be removed.
> 
> Stephen Kitt (7):
>   fbdev: aty128fb: Use backlight helper
>   fbdev: atyfb: Use backlight helper
>   fbdev: radeon: Use backlight helper
>   fbdev: mx3fb: Use backlight helper
>   fbdev: nvidia: Use backlight helper
>   fbdev: omapfb: panel-dsi-cm: Use backlight helper
>   fbdev: riva: Use backlight helper
> 
>  drivers/video/fbdev/aty/aty128fb.c                       | 6 ++----
>  drivers/video/fbdev/aty/atyfb_base.c                     | 8 +-------
>  drivers/video/fbdev/aty/radeon_backlight.c               | 6 +-----
>  drivers/video/fbdev/mx3fb.c                              | 7 +------
>  drivers/video/fbdev/nvidia/nv_backlight.c                | 8 +-------
>  drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 8 +-------
>  drivers/video/fbdev/riva/fbdev.c                         | 8 +-------
>  7 files changed, 8 insertions(+), 43 deletions(-)

FWIW, from a backlight point-of-view, whole series is
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

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

* Re: [PATCH 1/7] fbdev: aty128fb: Use backlight helper
  2022-06-07 19:23   ` Stephen Kitt
@ 2022-06-10 20:29     ` Sam Ravnborg
  -1 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2022-06-10 20:29 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: Antonino Daplas, Benjamin Herrenschmidt, Helge Deller,
	Paul Mackerras, linux-fbdev, linux-kernel, dri-devel

Hi Stepehen,

On Tue, Jun 07, 2022 at 09:23:29PM +0200, Stephen Kitt wrote:
> Instead of retrieving the backlight brightness in struct
> backlight_properties manually, and then checking whether the backlight
> should be on at all, use backlight_get_brightness() which does all
> this and insulates this from future changes.
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org

This and the other 6 patches in this series are all:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I did not receive the cover letter, which is why I reply to this mail.

	Sam

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

* Re: [PATCH 1/7] fbdev: aty128fb: Use backlight helper
@ 2022-06-10 20:29     ` Sam Ravnborg
  0 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2022-06-10 20:29 UTC (permalink / raw)
  To: Stephen Kitt
  Cc: linux-fbdev, Antonino Daplas, Helge Deller, linux-kernel,
	dri-devel, Paul Mackerras

Hi Stepehen,

On Tue, Jun 07, 2022 at 09:23:29PM +0200, Stephen Kitt wrote:
> Instead of retrieving the backlight brightness in struct
> backlight_properties manually, and then checking whether the backlight
> should be on at all, use backlight_get_brightness() which does all
> this and insulates this from future changes.
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org

This and the other 6 patches in this series are all:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I did not receive the cover letter, which is why I reply to this mail.

	Sam

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

end of thread, other threads:[~2022-06-10 20:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
2022-06-07 19:23 ` [PATCH 1/7] fbdev: aty128fb: Use backlight helper Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-10 20:29   ` Sam Ravnborg
2022-06-10 20:29     ` Sam Ravnborg
2022-06-07 19:23 ` [PATCH 2/7] fbdev: atyfb: " Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-07 19:23 ` [PATCH 3/7] fbdev: radeon: " Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-07 19:23 ` [PATCH 4/7] fbdev: mx3fb: " Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-07 19:23 ` [PATCH 5/7] fbdev: nvidia: " Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-07 19:23 ` [PATCH 6/7] fbdev: omapfb: panel-dsi-cm: " Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-07 19:23 ` [PATCH 7/7] fbdev: riva: " Stephen Kitt
2022-06-07 19:23   ` Stephen Kitt
2022-06-08 14:40 ` [PATCH 0/7] fbdev: Use backlight helpers Daniel Thompson

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.