Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Thomas Zimmermann and committed by
Lee Jones
02e224d0 43e1120d

+12 -9
+2 -3
drivers/video/backlight/corgi_lcd.c
··· 17 17 #include <linux/init.h> 18 18 #include <linux/delay.h> 19 19 #include <linux/gpio/consumer.h> 20 - #include <linux/fb.h> 21 20 #include <linux/lcd.h> 22 21 #include <linux/spi/spi.h> 23 22 #include <linux/spi/corgi_lcd.h> ··· 331 332 POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF); 332 333 } 333 334 334 - static int corgi_lcd_set_mode(struct lcd_device *ld, struct fb_videomode *m) 335 + static int corgi_lcd_set_mode(struct lcd_device *ld, u32 xres, u32 yres) 335 336 { 336 337 struct corgi_lcd *lcd = lcd_get_data(ld); 337 338 int mode = CORGI_LCD_MODE_QVGA; 338 339 339 - if (m->xres == 640 || m->xres == 480) 340 + if (xres == 640 || xres == 480) 340 341 mode = CORGI_LCD_MODE_VGA; 341 342 342 343 if (lcd->mode == mode)
+3 -1
drivers/video/backlight/lcd.c
··· 65 65 if (ld->ops->set_power) 66 66 ld->ops->set_power(ld, power); 67 67 } else { 68 + const struct fb_videomode *videomode = evdata->data; 69 + 68 70 if (ld->ops->set_mode) 69 - ld->ops->set_mode(ld, evdata->data); 71 + ld->ops->set_mode(ld, videomode->xres, videomode->yres); 70 72 } 71 73 72 74 return 0;
+2 -3
drivers/video/backlight/tdo24m.c
··· 12 12 #include <linux/device.h> 13 13 #include <linux/spi/spi.h> 14 14 #include <linux/spi/tdo24m.h> 15 - #include <linux/fb.h> 16 15 #include <linux/lcd.h> 17 16 #include <linux/slab.h> 18 17 ··· 307 308 return lcd->power; 308 309 } 309 310 310 - static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m) 311 + static int tdo24m_set_mode(struct lcd_device *ld, u32 xres, u32 yres) 311 312 { 312 313 struct tdo24m *lcd = lcd_get_data(ld); 313 314 int mode = MODE_QVGA; 314 315 315 - if (m->xres == 640 || m->xres == 480) 316 + if (xres == 640 || xres == 480) 316 317 mode = MODE_VGA; 317 318 318 319 if (lcd->mode == mode)
+5 -2
include/linux/lcd.h
··· 51 51 int (*get_contrast)(struct lcd_device *); 52 52 /* Set LCD panel contrast */ 53 53 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); 56 59 57 60 /* 58 61 * Check if the LCD controls the given display device. This