diff --git a/arch/sim/src/sim/sim_framebuffer.c b/arch/sim/src/sim/sim_framebuffer.c index 66c2784164b..6ed5234c096 100644 --- a/arch/sim/src/sim/sim_framebuffer.c +++ b/arch/sim/src/sim/sim_framebuffer.c @@ -100,6 +100,11 @@ static int sim_setcursor(struct fb_vtable_s *vtable, static int sim_openwindow(struct fb_vtable_s *vtable); static int sim_closewindow(struct fb_vtable_s *vtable); +/* Get/set the panel power status (0: full off). */ + +static int sim_getpower(struct fb_vtable_s *vtable); +static int sim_setpower(struct fb_vtable_s *vtable, int power); + /**************************************************************************** * Private Data ****************************************************************************/ @@ -110,6 +115,8 @@ static int sim_closewindow(struct fb_vtable_s *vtable); static uint8_t g_fb[FB_SIZE]; #endif +static int g_fb_power = 100; + /* This structure describes the simulated video controller */ static const struct fb_videoinfo_s g_videoinfo = @@ -168,6 +175,8 @@ static struct fb_vtable_s g_fbobject = .open = sim_openwindow, .close = sim_closewindow, + .getpower = sim_getpower, + .setpower = sim_setpower, }; /**************************************************************************** @@ -372,6 +381,33 @@ static int sim_setcursor(struct fb_vtable_s *vtable, } #endif +/**************************************************************************** + * Name: sim_getpower + ****************************************************************************/ + +static int sim_getpower(struct fb_vtable_s *vtable) +{ + ginfo("vtable=%p power=%d\n", vtable, g_fb_power); + return g_fb_power; +} + +/**************************************************************************** + * Name: sim_setpower + ****************************************************************************/ + +static int sim_setpower(struct fb_vtable_s *vtable, int power) +{ + ginfo("vtable=%p power=%d\n", vtable, power); + if (power < 0) + { + gerr("ERROR: power=%d < 0\n", power); + return -EINVAL; + } + + g_fb_power = power; + return OK; +} + /**************************************************************************** * Public Functions ****************************************************************************/