sim: add set/get_power for sim_framebuffer.c
add set/get_power operation for sim_framebuffer to avoid assert in fb_ioctl(cmd= FBIOSET_POWER/FBIOGET_POWER) Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
8db4abd5dd
commit
cbb594dcbc
@ -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_openwindow(struct fb_vtable_s *vtable);
|
||||||
static int sim_closewindow(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
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -110,6 +115,8 @@ static int sim_closewindow(struct fb_vtable_s *vtable);
|
|||||||
static uint8_t g_fb[FB_SIZE];
|
static uint8_t g_fb[FB_SIZE];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int g_fb_power = 100;
|
||||||
|
|
||||||
/* This structure describes the simulated video controller */
|
/* This structure describes the simulated video controller */
|
||||||
|
|
||||||
static const struct fb_videoinfo_s g_videoinfo =
|
static const struct fb_videoinfo_s g_videoinfo =
|
||||||
@ -168,6 +175,8 @@ static struct fb_vtable_s g_fbobject =
|
|||||||
|
|
||||||
.open = sim_openwindow,
|
.open = sim_openwindow,
|
||||||
.close = sim_closewindow,
|
.close = sim_closewindow,
|
||||||
|
.getpower = sim_getpower,
|
||||||
|
.setpower = sim_setpower,
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -372,6 +381,33 @@ static int sim_setcursor(struct fb_vtable_s *vtable,
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user