mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
drivers/lcd : add ioctl passthrough for LCD driver
Some LCD vendors support unit test commands, we should passthrough the ioctl commands to drivers. Signed-off-by: rongyichang <rongyichang@xiaomi.com>
This commit is contained in:
+11
-1
@@ -292,7 +292,17 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
{
|
||||||
|
if (priv->lcd_ptr->ioctl)
|
||||||
|
{
|
||||||
|
ret = priv->lcd_ptr->ioctl(priv->lcd_ptr, cmd, arg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gerr("ERROR: Unsupported IOCTL command: %d\n", cmd);
|
||||||
|
ret = -ENOTTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ static int lcdfb_putcmap(FAR struct fb_vtable_s *vtable,
|
|||||||
|
|
||||||
#ifdef CONFIG_FB_HWCURSOR
|
#ifdef CONFIG_FB_HWCURSOR
|
||||||
static int lcdfb_getcursor(FAR struct fb_vtable_s *vtable,
|
static int lcdfb_getcursor(FAR struct fb_vtable_s *vtable,
|
||||||
FAR struct fb_cursorattrib_s *attrib)
|
FAR struct fb_cursorattrib_s *attrib)
|
||||||
{
|
{
|
||||||
lcdinfo("vtable=%p attrib=%p\n", vtable, attrib);
|
lcdinfo("vtable=%p attrib=%p\n", vtable, attrib);
|
||||||
FAR struct lcdfb_dev_s *priv;
|
FAR struct lcdfb_dev_s *priv;
|
||||||
@@ -435,7 +435,7 @@ static int lcdfb_getcursor(FAR struct fb_vtable_s *vtable,
|
|||||||
|
|
||||||
#ifdef CONFIG_FB_HWCURSOR
|
#ifdef CONFIG_FB_HWCURSOR
|
||||||
static int lcdfb_setcursor(FAR struct fb_vtable_s *vtable,
|
static int lcdfb_setcursor(FAR struct fb_vtable_s *vtable,
|
||||||
FAR struct fb_setcursor_s *settings)
|
FAR struct fb_setcursor_s *settings)
|
||||||
{
|
{
|
||||||
FAR struct lcdfb_dev_s *priv;
|
FAR struct lcdfb_dev_s *priv;
|
||||||
FAR struct lcd_dev_s *lcd;
|
FAR struct lcd_dev_s *lcd;
|
||||||
@@ -492,6 +492,38 @@ static int lcdfb_setpower(FAR struct fb_vtable_s *vtable, FAR int power)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: lcdfb_ioctl
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int lcdfb_ioctl(FAR struct fb_vtable_s *vtable,
|
||||||
|
int cmd, unsigned long arg)
|
||||||
|
{
|
||||||
|
int ret = -EINVAL;
|
||||||
|
FAR struct lcdfb_dev_s *priv;
|
||||||
|
FAR struct lcd_dev_s *lcd;
|
||||||
|
|
||||||
|
DEBUGASSERT(vtable != NULL);
|
||||||
|
|
||||||
|
priv = (FAR struct lcdfb_dev_s *)vtable;
|
||||||
|
|
||||||
|
if (priv != NULL)
|
||||||
|
{
|
||||||
|
lcd = priv->lcd;
|
||||||
|
|
||||||
|
if (lcd->ioctl)
|
||||||
|
{
|
||||||
|
ret = lcd->ioctl(lcd, cmd, arg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = -ENOTTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -548,6 +580,7 @@ int up_fbinitialize(int display)
|
|||||||
#endif
|
#endif
|
||||||
priv->vtable.updatearea = lcdfb_updateearea,
|
priv->vtable.updatearea = lcdfb_updateearea,
|
||||||
priv->vtable.setpower = lcdfb_setpower,
|
priv->vtable.setpower = lcdfb_setpower,
|
||||||
|
priv->vtable.ioctl = lcdfb_ioctl,
|
||||||
|
|
||||||
#ifdef CONFIG_LCD_EXTERNINIT
|
#ifdef CONFIG_LCD_EXTERNINIT
|
||||||
/* Use external graphics driver initialization */
|
/* Use external graphics driver initialization */
|
||||||
|
|||||||
@@ -264,6 +264,10 @@ struct lcd_dev_s
|
|||||||
|
|
||||||
int (*getareaalign)(FAR struct lcd_dev_s *dev,
|
int (*getareaalign)(FAR struct lcd_dev_s *dev,
|
||||||
FAR struct lcddev_area_align_s *align);
|
FAR struct lcddev_area_align_s *align);
|
||||||
|
|
||||||
|
/* Passthrough unknown ioctl commands. */
|
||||||
|
|
||||||
|
int (*ioctl)(FAR struct lcd_dev_s *dev, int cmd, unsigned long arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user