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>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
-#include <linux/fb.h>
#include <linux/lcd.h>
#include <linux/spi/spi.h>
#include <linux/spi/corgi_lcd.h>
POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF);
}
-static int corgi_lcd_set_mode(struct lcd_device *ld, struct fb_videomode *m)
+static int corgi_lcd_set_mode(struct lcd_device *ld, u32 xres, u32 yres)
{
struct corgi_lcd *lcd = lcd_get_data(ld);
int mode = CORGI_LCD_MODE_QVGA;
- if (m->xres == 640 || m->xres == 480)
+ if (xres == 640 || xres == 480)
mode = CORGI_LCD_MODE_VGA;
if (lcd->mode == mode)
if (ld->ops->set_power)
ld->ops->set_power(ld, power);
} else {
+ const struct fb_videomode *videomode = evdata->data;
+
if (ld->ops->set_mode)
- ld->ops->set_mode(ld, evdata->data);
+ ld->ops->set_mode(ld, videomode->xres, videomode->yres);
}
return 0;
#include <linux/device.h>
#include <linux/spi/spi.h>
#include <linux/spi/tdo24m.h>
-#include <linux/fb.h>
#include <linux/lcd.h>
#include <linux/slab.h>
return lcd->power;
}
-static int tdo24m_set_mode(struct lcd_device *ld, struct fb_videomode *m)
+static int tdo24m_set_mode(struct lcd_device *ld, u32 xres, u32 yres)
{
struct tdo24m *lcd = lcd_get_data(ld);
int mode = MODE_QVGA;
- if (m->xres == 640 || m->xres == 480)
+ if (xres == 640 || xres == 480)
mode = MODE_VGA;
if (lcd->mode == mode)
int (*get_contrast)(struct lcd_device *);
/* Set LCD panel contrast */
int (*set_contrast)(struct lcd_device *, int contrast);
- /* Set LCD panel mode (resolutions ...) */
- int (*set_mode)(struct lcd_device *, struct fb_videomode *);
+
+ /*
+ * Set LCD panel mode (resolutions ...)
+ */
+ int (*set_mode)(struct lcd_device *lcd, u32 xres, u32 yres);
/*
* Check if the LCD controls the given display device. This