11 #include <linux/module.h>
12 #include <linux/kernel.h>
51 par->
board->set_hdb(par, data);
58 auok190x_issue_data(par, data);
70 dev_err(dev,
"issue_pixels: size %d must be a multiple of 4\n",
75 for (i = 0; i < (size >> 1); i++) {
81 tmp = (data[2*
i] & 0xF0) >> 4;
82 tmp |= (data[2*
i] & 0xF000) >> 8;
83 tmp |= (data[2*i+1] & 0xF0) << 4;
84 tmp |= (data[2*i+1] & 0xF000);
86 par->
board->set_hdb(par, tmp);
98 data = par->
board->get_hdb(par);
111 auok190x_issue_cmd(par, data);
122 auok190x_issue_cmd(par, cmd);
124 for (i = 0; i <
argc; i++)
125 auok190x_issue_data(par, argv[i]);
134 ret = par->
board->wait_for_rdy(par);
148 ret = par->
board->wait_for_rdy(par);
162 ret = par->
board->wait_for_rdy(par);
167 auok190x_issue_cmd(par, cmd);
169 for (i = 0; i <
argc; i++)
170 argv[i] = auok190x_read_data(par);
184 auok190x_issue_cmd(par, cmd);
186 for (i = 0; i <
argc; i++)
187 auok190x_issue_data(par, argv[i]);
189 auok190x_issue_pixels(par, size, data);
200 ret = par->
board->wait_for_rdy(par);
214 static void auok190xfb_dpy_first_io(
struct fb_info *
info)
217 pm_runtime_get(info->
device);
221 static void auok190xfb_dpy_deferred_io(
struct fb_info *
info,
224 struct fb_deferred_io *fbdefio = info->fbdefio;
226 u16 yres = info->
var.yres;
227 u16 xres = info->
var.xres;
234 if (!list_empty(pagelist))
244 pm_runtime_get_sync(info->
device);
265 if (prev_index < 0) {
271 h += h_inc * (cur->
index - prev_index);
280 prev_index = cur->
index;
291 pm_runtime_mark_last_busy(info->
device);
292 pm_runtime_put_autosuspend(info->
device);
304 size_t count, loff_t *ppos)
307 unsigned long p = *ppos;
315 total_size = info->
fix.smem_len;
320 if (count > total_size) {
325 if (count + p > total_size) {
329 count = total_size -
p;
342 return (err) ? err :
count;
345 static void auok190xfb_fillrect(
struct fb_info *info,
355 static void auok190xfb_copyarea(
struct fb_info *info,
365 static void auok190xfb_imageblit(
struct fb_info *info,
381 pr_info(
"%s: Resolution not supported: X%u x Y%u\n",
391 pr_info(
"%s: Memory Limit requested yres_virtual = %u\n",
399 static struct fb_ops auok190xfb_ops = {
402 .fb_write = auok190xfb_write,
403 .fb_fillrect = auok190xfb_fillrect,
404 .fb_copyarea = auok190xfb_copyarea,
405 .fb_imageblit = auok190xfb_imageblit,
406 .fb_check_var = auok190xfb_check_var,
419 pm_runtime_get_sync(dev);
427 pm_runtime_mark_last_busy(dev);
428 pm_runtime_put_autosuspend(dev);
435 return (255 - temp + 1) * (-1);
445 pm_runtime_get_sync(dev);
462 dev_dbg(dev,
"panel %d.%din, model 0x%x, EPD 0x%x TCON-rev 0x%x, LUT-rev 0x%x",
466 pm_runtime_mark_last_busy(dev);
467 pm_runtime_put_autosuspend(dev);
485 const char *buf,
size_t count)
514 const char *buf,
size_t count)
539 temp = auok190x_read_temperature(par);
540 return sprintf(buf,
"%d\n", temp);
544 static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
547 static struct attribute *auok190x_attributes[] = {
548 &dev_attr_update_mode.attr,
549 &dev_attr_flash.attr,
555 .attrs = auok190x_attributes,
590 auok190x_power(par, 0);
592 auok190x_power(par, 1);
597 par->
board->wait_for_rdy(par);
605 static int auok190x_runtime_suspend(
struct device *dev)
608 struct fb_info *info = platform_get_drvdata(pdev);
619 dev_warn(dev,
"already in standby, runtime-pm pairing mismatch\n");
629 dev_dbg(dev,
"runtime suspend without standby\n");
635 dev_dbg(dev,
"runtime suspend with additional empty param\n");
640 dev_dbg(dev,
"runtime suspend without param\n");
652 static int auok190x_runtime_resume(
struct device *dev)
655 struct fb_info *info = platform_get_drvdata(pdev);
660 dev_warn(dev,
"not in standby, runtime-pm pairing mismatch\n");
665 dev_dbg(dev,
"runtime resume without standby\n");
670 dev_dbg(dev,
"runtime resume from standby\n");
686 static int auok190x_suspend(
struct device *dev)
689 struct fb_info *info = platform_get_drvdata(pdev);
697 dev_dbg(dev,
"suspend with broken standby\n");
699 auok190x_power(par, 0);
701 dev_dbg(dev,
"suspend using sleep\n");
708 if (!pm_runtime_status_suspended(dev)) {
709 ret = auok190x_runtime_suspend(dev);
711 dev_err(dev,
"auok190x_runtime_suspend failed with %d\n",
726 static int auok190x_resume(
struct device *dev)
729 struct fb_info *info = platform_get_drvdata(pdev);
735 dev_dbg(dev,
"resume with broken standby\n");
737 auok190x_power(par, 1);
741 dev_dbg(dev,
"resume from sleep\n");
751 auok190x_runtime_resume(dev);
756 auok190x_runtime_suspend(dev);
783 int videomemorysize,
ret;
784 unsigned char *videomemory;
799 par->
recover = auok190x_recover;
818 ret = board->
init(par);
833 dev_err(info->
device,
"could not set sleep gpio, %d\n", ret);
846 dev_err(info->
device,
"could not set reset gpio, %d\n", ret);
850 ret = auok190x_power(par, 1);
863 dev_err(info->
device,
"could not setup ready-irq, %d\n", ret);
868 par->
board->wait_for_rdy(par);
879 info->
fix.xpanstep = 0;
880 info->
fix.ypanstep = 0;
881 info->
fix.ywrapstep = 0;
884 info->
var.bits_per_pixel = 8;
885 info->
var.grayscale = 1;
886 info->
var.red.length = 8;
887 info->
var.green.length = 8;
888 info->
var.blue.length = 8;
894 info->
var.xres = panel->
h;
895 info->
var.yres = panel->
w;
896 info->
var.xres_virtual = panel->
h;
897 info->
var.yres_virtual = panel->
w;
898 info->
fix.line_length = panel->
h;
900 info->
var.xres = panel->
w;
901 info->
var.yres = panel->
h;
902 info->
var.xres_virtual = panel->
w;
903 info->
var.yres_virtual = panel->
h;
904 info->
fix.line_length = panel->
w;
913 videomemory =
vmalloc(videomemorysize);
919 memset(videomemory, 0, videomemorysize);
921 info->
fix.smem_len = videomemorysize;
924 info->
fbops = &auok190xfb_ops;
929 sizeof(
struct fb_deferred_io),
931 if (!info->fbdefio) {
938 info->fbdefio->delay =
HZ / board->
fps;
939 info->fbdefio->first_io = auok190xfb_dpy_first_io,
940 info->fbdefio->deferred_io = auok190xfb_dpy_deferred_io,
955 auok190x_identify(par);
957 platform_set_drvdata(pdev, info);
969 videomemorysize >> 10);
977 pm_runtime_set_active(info->
device);
980 pm_runtime_use_autosuspend(info->
device);
993 auok190x_power(par, 0);
1011 struct fb_info *info = platform_get_drvdata(pdev);
1015 pm_runtime_disable(info->
device);
1027 auok190x_power(par, 0);