/* Returns negative errno on error, or zero on success.  */
static int epson1355fb_setcolreg(unsigned regno, unsigned r, unsigned g, unsigned b, unsigned transp, struct fb_info *info)
/* Returns negative errno on error, or zero on success.  */
static int epson1355fb_setcolreg(unsigned regno, unsigned r, unsigned g, unsigned b, unsigned transp, struct fb_info *info)
{
	struct epson1355_par *par = info->par;
	if (info->var.grayscale)
		r = g = b = (19595 * r + 38470 * g + 7471 * b) >> 16;
	switch (info->fix.visual) {
	case FB_VISUAL_TRUECOLOR:
		if (regno >= 16)
			return -EINVAL;
		((u32 *) info->pseudo_palette)[regno] =
		    (r & 0xf800) | (g & 0xfc00) >> 5 | (b & 0xf800) >> 11;
		break;
	case FB_VISUAL_PSEUDOCOLOR:
		if (regno >= 256)
			return -EINVAL;
		set_lut(par, regno, r >> 8, g >> 8, b >> 8);
		break;
	default:
		return -ENOSYS;
	}
	return 0;
}