Lines Matching +full:enforce +full:- +full:video +full:- +full:mode
2 * broadsheetfb.c -- FB driver for E-Ink Broadsheet controller
35 #include <video/broadsheetfb.h>
121 par->board->set_ctl(par, BS_WR, 0); in broadsheet_gpio_issue_data()
122 par->board->set_hdb(par, data); in broadsheet_gpio_issue_data()
123 par->board->set_ctl(par, BS_WR, 1); in broadsheet_gpio_issue_data()
128 par->board->set_ctl(par, BS_DC, 0); in broadsheet_gpio_issue_cmd()
134 par->board->wait_for_rdy(par); in broadsheet_gpio_send_command()
136 par->board->set_ctl(par, BS_CS, 0); in broadsheet_gpio_send_command()
138 par->board->set_ctl(par, BS_DC, 1); in broadsheet_gpio_send_command()
139 par->board->set_ctl(par, BS_CS, 1); in broadsheet_gpio_send_command()
147 par->board->wait_for_rdy(par); in broadsheet_gpio_send_cmdargs()
149 par->board->set_ctl(par, BS_CS, 0); in broadsheet_gpio_send_cmdargs()
151 par->board->set_ctl(par, BS_DC, 1); in broadsheet_gpio_send_cmdargs()
155 par->board->set_ctl(par, BS_CS, 1); in broadsheet_gpio_send_cmdargs()
163 par->board->mmio_write(par, BS_MMIO_CMD, cmd); in broadsheet_mmio_send_cmdargs()
166 par->board->mmio_write(par, BS_MMIO_DATA, argv[i]); in broadsheet_mmio_send_cmdargs()
171 if (par->board->mmio_write) in broadsheet_send_command()
172 par->board->mmio_write(par, BS_MMIO_CMD, data); in broadsheet_send_command()
180 if (par->board->mmio_write) in broadsheet_send_cmdargs()
192 par->board->set_ctl(par, BS_CS, 0); in broadsheet_gpio_burst_write()
193 par->board->set_ctl(par, BS_DC, 1); in broadsheet_gpio_burst_write()
196 par->board->set_ctl(par, BS_WR, 0); in broadsheet_gpio_burst_write()
199 par->board->set_hdb(par, tmp); in broadsheet_gpio_burst_write()
200 par->board->set_ctl(par, BS_WR, 1); in broadsheet_gpio_burst_write()
203 par->board->set_ctl(par, BS_CS, 1); in broadsheet_gpio_burst_write()
215 par->board->mmio_write(par, BS_MMIO_DATA, tmp); in broadsheet_mmio_burst_write()
223 if (par->board->mmio_write) in broadsheet_burst_write()
233 par->board->wait_for_rdy(par); in broadsheet_gpio_get_data()
236 par->board->set_ctl(par, BS_DC, 1); in broadsheet_gpio_get_data()
237 par->board->set_ctl(par, BS_CS, 0); in broadsheet_gpio_get_data()
238 par->board->set_ctl(par, BS_WR, 0); in broadsheet_gpio_get_data()
240 res = par->board->get_hdb(par); in broadsheet_gpio_get_data()
243 par->board->set_ctl(par, BS_WR, 1); in broadsheet_gpio_get_data()
244 par->board->set_ctl(par, BS_CS, 1); in broadsheet_gpio_get_data()
252 if (par->board->mmio_read) in broadsheet_get_data()
253 return par->board->mmio_read(par); in broadsheet_get_data()
262 par->board->wait_for_rdy(par); in broadsheet_gpio_write_reg()
265 par->board->set_ctl(par, BS_CS, 0); in broadsheet_gpio_write_reg()
269 par->board->set_ctl(par, BS_DC, 1); in broadsheet_gpio_write_reg()
274 par->board->set_ctl(par, BS_CS, 1); in broadsheet_gpio_write_reg()
280 par->board->mmio_write(par, BS_MMIO_CMD, BS_CMD_WR_REG); in broadsheet_mmio_write_reg()
281 par->board->mmio_write(par, BS_MMIO_DATA, reg); in broadsheet_mmio_write_reg()
282 par->board->mmio_write(par, BS_MMIO_DATA, data); in broadsheet_mmio_write_reg()
289 if (par->board->mmio_write) in broadsheet_write_reg()
306 par->board->wait_for_rdy(par); in broadsheet_read_reg()
321 /* disable arral saemipu mode */ in broadsheet_setup_plls()
331 return -ETIMEDOUT; in broadsheet_setup_plls()
374 } while (timeout--); in broadsheet_spiflash_wait_for_bit()
376 return -ETIMEDOUT; in broadsheet_spiflash_wait_for_bit()
427 } while (timeout--); in broadsheet_spiflash_wait_for_status()
429 dev_err(par->info->device, "Timed out waiting for spiflash status\n"); in broadsheet_spiflash_wait_for_status()
430 return -ETIMEDOUT; in broadsheet_spiflash_wait_for_status()
450 for (i = 2; i >= 0; i--) { in broadsheet_spiflash_op_on_address()
475 dev_err(par->info->device, "Unexpected flash type\n"); in broadsheet_verify_spiflash()
476 err = -EINVAL; in broadsheet_verify_spiflash()
511 int mode) in broadsheet_spiflash_write_control() argument
516 if (mode) in broadsheet_spiflash_write_control()
622 return -ENOMEM; in broadsheet_spiflash_rewrite_sector()
654 tail_len = sector_size - tail_start_addr; in broadsheet_spiflash_rewrite_sector()
700 maxlen = roundup(cur_addr, sector_size) - cur_addr; in broadsheet_write_spiflash()
709 bytecount -= writecount; in broadsheet_write_spiflash()
739 struct broadsheetfb_par *par = info->par; in broadsheet_loadstore_waveform()
743 return -EINVAL; in broadsheet_loadstore_waveform()
751 /* try to enforce reasonable min max on waveform */ in broadsheet_loadstore_waveform()
752 if ((fw_entry->size < 8*1024) || (fw_entry->size > 64*1024)) { in broadsheet_loadstore_waveform()
754 err = -EINVAL; in broadsheet_loadstore_waveform()
758 mutex_lock(&(par->io_lock)); in broadsheet_loadstore_waveform()
759 err = broadsheet_store_waveform_to_spiflash(par, fw_entry->data, in broadsheet_loadstore_waveform()
760 fw_entry->size); in broadsheet_loadstore_waveform()
762 mutex_unlock(&(par->io_lock)); in broadsheet_loadstore_waveform()
768 dev_info(dev, "Stored broadsheet waveform, size %zd\n", fw_entry->size); in broadsheet_loadstore_waveform()
784 int xres = par->info->var.xres; in broadsheet_init_display()
785 int yres = par->info->var.yres; in broadsheet_init_display()
787 args[0] = panel_table[par->panel_index].w; in broadsheet_init_display()
788 args[1] = panel_table[par->panel_index].h; in broadsheet_init_display()
789 args[2] = panel_table[par->panel_index].sdcfg; in broadsheet_init_display()
790 args[3] = panel_table[par->panel_index].gdcfg; in broadsheet_init_display()
791 args[4] = panel_table[par->panel_index].lutfmt; in broadsheet_init_display()
797 args[0] = panel_table[par->panel_index].fsynclen; in broadsheet_init_display()
798 args[1] = panel_table[par->panel_index].fendfbegin; in broadsheet_init_display()
799 args[2] = panel_table[par->panel_index].lsynclen; in broadsheet_init_display()
800 args[3] = panel_table[par->panel_index].lendlbegin; in broadsheet_init_display()
801 args[4] = panel_table[par->panel_index].pixclk; in broadsheet_init_display()
825 broadsheet_burst_write(par, (panel_table[par->panel_index].w * in broadsheet_init_display()
826 panel_table[par->panel_index].h)/2, in broadsheet_init_display()
827 (u16 *)par->info->screen_buffer); in broadsheet_init_display()
838 par->board->wait_for_rdy(par); in broadsheet_init_display()
844 struct device *dev = par->info->device; in broadsheet_identify()
868 unsigned char *buf = par->info->screen_buffer; in broadsheetfb_dpy_update_pages()
870 mutex_lock(&(par->io_lock)); in broadsheetfb_dpy_update_pages()
873 /* y2 must be a multiple of 4 , but - 1 so up the lower bits */ in broadsheetfb_dpy_update_pages()
879 args[3] = cpu_to_le16(par->info->var.xres); in broadsheetfb_dpy_update_pages()
886 buf += y1 * par->info->var.xres; in broadsheetfb_dpy_update_pages()
887 broadsheet_burst_write(par, ((1 + y2 - y1) * par->info->var.xres)/2, in broadsheetfb_dpy_update_pages()
899 par->board->wait_for_rdy(par); in broadsheetfb_dpy_update_pages()
900 mutex_unlock(&(par->io_lock)); in broadsheetfb_dpy_update_pages()
908 mutex_lock(&(par->io_lock)); in broadsheetfb_dpy_update()
914 broadsheet_burst_write(par, (panel_table[par->panel_index].w * in broadsheetfb_dpy_update()
915 panel_table[par->panel_index].h)/2, in broadsheetfb_dpy_update()
916 (u16 *)par->info->screen_buffer); in broadsheetfb_dpy_update()
927 par->board->wait_for_rdy(par); in broadsheetfb_dpy_update()
928 mutex_unlock(&(par->io_lock)); in broadsheetfb_dpy_update()
938 u16 yres = info->var.yres; in broadsheetfb_dpy_deferred_io()
939 u16 xres = info->var.xres; in broadsheetfb_dpy_deferred_io()
948 y1 = pageref->offset / xres; in broadsheetfb_dpy_deferred_io()
950 } else if ((prev_offset + PAGE_SIZE) == pageref->offset) { in broadsheetfb_dpy_deferred_io()
955 broadsheetfb_dpy_update_pages(info->par, y1, y1 + h); in broadsheetfb_dpy_deferred_io()
957 y1 = pageref->offset / xres; in broadsheetfb_dpy_deferred_io()
960 prev_offset = pageref->offset; in broadsheetfb_dpy_deferred_io()
966 broadsheetfb_dpy_update(info->par); in broadsheetfb_dpy_deferred_io()
968 broadsheetfb_dpy_update_pages(info->par, y1, in broadsheetfb_dpy_deferred_io()
975 struct broadsheetfb_par *par = info->par; in broadsheetfb_defio_damage_range()
983 struct broadsheetfb_par *par = info->par; in broadsheetfb_defio_damage_area()
1007 int retval = -ENOMEM; in broadsheetfb_probe()
1016 board = dev->dev.platform_data; in broadsheetfb_probe()
1018 return -EINVAL; in broadsheetfb_probe()
1021 if (!try_module_get(board->owner)) in broadsheetfb_probe()
1022 return -ENODEV; in broadsheetfb_probe()
1024 info = framebuffer_alloc(sizeof(struct broadsheetfb_par), &dev->dev); in broadsheetfb_probe()
1028 switch (board->get_panel_type()) { in broadsheetfb_probe()
1050 info->screen_buffer = videomemory; in broadsheetfb_probe()
1051 info->fbops = &broadsheetfb_ops; in broadsheetfb_probe()
1057 info->var = broadsheetfb_var; in broadsheetfb_probe()
1060 info->fix = broadsheetfb_fix; in broadsheetfb_probe()
1061 info->fix.smem_len = videomemorysize; in broadsheetfb_probe()
1062 par = info->par; in broadsheetfb_probe()
1063 par->panel_index = panel_index; in broadsheetfb_probe()
1064 par->info = info; in broadsheetfb_probe()
1065 par->board = board; in broadsheetfb_probe()
1066 par->write_reg = broadsheet_write_reg; in broadsheetfb_probe()
1067 par->read_reg = broadsheet_read_reg; in broadsheetfb_probe()
1068 init_waitqueue_head(&par->waitq); in broadsheetfb_probe()
1070 mutex_init(&par->io_lock); in broadsheetfb_probe()
1072 info->flags = FBINFO_VIRTFB; in broadsheetfb_probe()
1074 info->fbdefio = &broadsheetfb_defio; in broadsheetfb_probe()
1077 retval = fb_alloc_cmap(&info->cmap, 16, 0); in broadsheetfb_probe()
1079 dev_err(&dev->dev, "Failed to allocate colormap\n"); in broadsheetfb_probe()
1085 info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/32; in broadsheetfb_probe()
1086 memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*16); in broadsheetfb_probe()
1087 memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*16); in broadsheetfb_probe()
1089 retval = par->board->setup_irq(info); in broadsheetfb_probe()
1094 retval = board->init(par); in broadsheetfb_probe()
1108 retval = device_create_file(&dev->dev, &dev_attr_loadstore_waveform); in broadsheetfb_probe()
1112 fb_info(info, "Broadsheet frame buffer, using %dK of video memory\n", in broadsheetfb_probe()
1121 board->cleanup(par); in broadsheetfb_probe()
1123 fb_dealloc_cmap(&info->cmap); in broadsheetfb_probe()
1129 module_put(board->owner); in broadsheetfb_probe()
1139 struct broadsheetfb_par *par = info->par; in broadsheetfb_remove()
1141 device_remove_file(info->device, &dev_attr_loadstore_waveform); in broadsheetfb_remove()
1144 par->board->cleanup(par); in broadsheetfb_remove()
1145 fb_dealloc_cmap(&info->cmap); in broadsheetfb_remove()
1146 vfree(info->screen_buffer); in broadsheetfb_remove()
1147 module_put(par->board->owner); in broadsheetfb_remove()