mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
feature: driver: add interface for fb driver
CHAMPION-99 add get and set panel power interface for fb driver. add get and set framerate interface for fb driver. add panel information at videoinfo for fb driver. Signed-off-by: liushuai25 <liushuai25@xiaomi.com> Change-Id: I4121411280027b12e7ab68c56a68d1efbbcc7641
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -429,7 +443,7 @@ struct fb_cursorsize_s
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The following are used to get/get the cursor attributes via IOCTL
|
||||
/* The following are used to get/set the cursor attributes via IOCTL
|
||||
* command.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user