diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 1a017abd64..5da6fd2e7f 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -29,6 +29,10 @@ config FB_OVERLAY bool "Framebuffer overlay support" default n +config FB_MODULEINFO + bool "Framebuffer module information support" + default n + config FB_OVERLAY_BLIT bool "Framebuffer overlay blit support" depends on FB_OVERLAY diff --git a/drivers/video/fb.c b/drivers/video/fb.c index e97ec5af2d..3e294dd73a 100644 --- a/drivers/video/fb.c +++ b/drivers/video/fb.c @@ -516,6 +516,44 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg) #endif #endif /* CONFIG_FB_OVERLAY */ + case FBIOSET_POWER: + { + DEBUGASSERT(fb->vtable != NULL && + fb->vtable->setpower != NULL); + ret = fb->vtable->setpower(fb->vtable, (int)arg); + } + break; + + case FBIOGET_POWER: + { + FAR int *power = (FAR int *)((uintptr_t)arg); + + DEBUGASSERT(power != NULL && fb->vtable != NULL && + fb->vtable->getpower != NULL); + *(power) = fb->vtable->getpower(fb->vtable); + ret = OK; + } + break; + + case FBIOGET_FRAMERATE: + { + FAR int *rate = (FAR int *)((uintptr_t)arg); + + DEBUGASSERT(rate != NULL && fb->vtable != NULL && + fb->vtable->getframerate != NULL); + *(rate) = fb->vtable->getframerate(fb->vtable); + ret = OK; + } + break; + + case FBIOSET_FRAMERATE: + { + DEBUGASSERT(fb->vtable != NULL && + fb->vtable->setframerate != NULL); + ret = fb->vtable->setframerate(fb->vtable, (int)arg); + } + break; + default: gerr("ERROR: Unsupported IOCTL command: %d\n", cmd); ret = -ENOTTY; diff --git a/include/nuttx/video/fb.h b/include/nuttx/video/fb.h index 5064db4966..0291fd81cb 100644 --- a/include/nuttx/video/fb.h +++ b/include/nuttx/video/fb.h @@ -272,6 +272,17 @@ #endif #endif /* CONFIG_FB_OVERLAY */ +/* Specific Controls ********************************************************/ + +#define FBIOSET_POWER _FBIOC(0x0012) /* Set panel power + * Argument: int */ +#define FBIOGET_POWER _FBIOC(0x0013) /* Get panel current power + * Argument: int* */ +#define FBIOSET_FRAMERATE _FBIOC(0x0014) /* Set frame rate + * Argument: int */ +#define FBIOGET_FRAMERATE _FBIOC(0x0015) /* Get frame rate + * Argument: int* */ + /**************************************************************************** * Public Types ****************************************************************************/ @@ -286,12 +297,15 @@ typedef uint16_t fb_coord_t; struct fb_videoinfo_s { - uint8_t fmt; /* see FB_FMT_* */ - fb_coord_t xres; /* Horizontal resolution in pixel columns */ - fb_coord_t yres; /* Vertical resolution in pixel rows */ - uint8_t nplanes; /* Number of color planes supported */ + uint8_t fmt; /* see FB_FMT_* */ + fb_coord_t xres; /* Horizontal resolution in pixel columns */ + fb_coord_t yres; /* Vertical resolution in pixel rows */ + uint8_t nplanes; /* Number of color planes supported */ #ifdef CONFIG_FB_OVERLAY - uint8_t noverlays; /* Number of overlays supported */ + uint8_t noverlays; /* Number of overlays supported */ +#endif +#ifdef CONFIG_FB_MODULEINFO + uint8_t moduleinfo[128]; /* Module information filled by vendor */ #endif }; @@ -569,6 +583,24 @@ struct fb_vtable_s FAR const struct fb_overlayblend_s *blend); # endif #endif + + /* Specific Controls ******************************************************/ + + /* Set the frequency of the framebuffer update panel (0: disable refresh) */ + + int (*setframerate)(FAR struct fb_vtable_s *vtable, int rate); + + /* Get the frequency of the framebuffer update panel (0: disable refresh) */ + + int (*getframerate)(FAR struct fb_vtable_s *vtable); + + /* Get the panel power status (0: full off). */ + + int (*getpower)(FAR struct fb_vtable_s *vtable); + + /* Enable/disable panel power (0: full off). */ + + int (*setpower)(FAR struct fb_vtable_s *vtable, int power); }; /****************************************************************************