Skip to content

Commit 02e224d

Browse files
Thomas Zimmermannlag-linaro
authored andcommitted
backlight: lcd: Remove struct fb_videomode from set_mode callback
Implementations of struct lcd_ops.set_mode only require the resolution from struct fb_videomode. Pass the xres and yres fields, but remove the dependency on the fbdev data structure. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240906075439.98476-28-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 43e1120 commit 02e224d

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

drivers/video/backlight/corgi_lcd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/init.h>
1818
#include <linux/delay.h>
1919
#include <linux/gpio/consumer.h>
20-
#include <linux/fb.h>
2120
#include <linux/lcd.h>
2221
#include <linux/spi/spi.h>
2322
#include <linux/spi/corgi_lcd.h>
@@ -332,12 +331,12 @@ static void corgi_lcd_power_off(struct corgi_lcd *lcd)
332331
POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF);
333332
}
334333

335-
static int corgi_lcd_set_mode(struct lcd_device *ld, struct fb_videomode *m)
334+
static int corgi_lcd_set_mode(struct lcd_device *ld, u32 xres, u32 yres)
336335
{
337336
struct corgi_lcd *lcd = lcd_get_data(ld);
338337
int mode = CORGI_LCD_MODE_QVGA;
339338

340-
if (m->xres == 640 || m->xres == 480)
339+
if (xres == 640 || xres == 480)
341340
mode = CORGI_LCD_MODE_VGA;
342341

343342
if (lcd->mode == mode)

drivers/video/backlight/lcd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ static int fb_notifier_callback(struct notifier_block *self,
6565
if (ld->ops->set_power)
6666
ld->ops->set_power(ld, power);
6767
} else {
68+
const struct fb_videomode *videomode = evdata->data;
69+
6870
if (ld->ops->set_mode)
69-
ld->ops->set_mode(ld, evdata->data);
71+
ld->ops->set_mode(ld, videomode->xres, videomode->yres);
7072
}
7173

7274
return 0;

drivers/video/backlight/tdo24m.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/device.h>
1313
#include <linux/spi/spi.h>
1414
#include <linux/spi/tdo24m.h>
15-
#include <linux/fb.h>
1615
#include <linux/lcd.h>
1716
#include <linux/slab.h>
1817

@@ -308,12 +307,12 @@ static int tdo24m_get_power(struct lcd_device *ld)
308307
return lcd->power;
309308
}
310309

311-
static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m)
310+
static int tdo24m_set_mode(struct lcd_device *ld, u32 xres, u32 yres)
312311
{
313312
struct tdo24m *lcd = lcd_get_data(ld);
314313
int mode = MODE_QVGA;
315314

316-
if (m->xres == 640 || m->xres == 480)
315+
if (xres == 640 || xres == 480)
317316
mode = MODE_VGA;
318317

319318
if (lcd->mode == mode)

include/linux/lcd.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ struct lcd_ops {
5151
int (*get_contrast)(struct lcd_device *);
5252
/* Set LCD panel contrast */
5353
int (*set_contrast)(struct lcd_device *, int contrast);
54-
/* Set LCD panel mode (resolutions ...) */
55-
int (*set_mode)(struct lcd_device *, struct fb_videomode *);
54+
55+
/*
56+
* Set LCD panel mode (resolutions ...)
57+
*/
58+
int (*set_mode)(struct lcd_device *lcd, u32 xres, u32 yres);
5659

5760
/*
5861
* Check if the LCD controls the given display device. This

0 commit comments

Comments
 (0)