Lines Matching refs:ch
213 struct sh_mobile_lcdc_chan ch[2]; member
401 struct sh_mobile_lcdc_chan *ch = handle; in lcdc_sys_write_index() local
403 lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT); in lcdc_sys_write_index()
404 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_index()
405 lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA | in lcdc_sys_write_index()
406 (lcdc_chan_is_sublcd(ch) ? 2 : 0)); in lcdc_sys_write_index()
407 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_index()
412 struct sh_mobile_lcdc_chan *ch = handle; in lcdc_sys_write_data() local
414 lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT | LDDWDxR_RSW); in lcdc_sys_write_data()
415 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_data()
416 lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA | in lcdc_sys_write_data()
417 (lcdc_chan_is_sublcd(ch) ? 2 : 0)); in lcdc_sys_write_data()
418 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_data()
423 struct sh_mobile_lcdc_chan *ch = handle; in lcdc_sys_read_data() local
425 lcdc_write(ch->lcdc, _LDDRDR, LDDRDR_RSR); in lcdc_sys_read_data()
426 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_read_data()
427 lcdc_write(ch->lcdc, _LDDRAR, LDDRAR_RA | in lcdc_sys_read_data()
428 (lcdc_chan_is_sublcd(ch) ? 2 : 0)); in lcdc_sys_read_data()
430 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_read_data()
432 return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK; in lcdc_sys_read_data()
444 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_sginit() local
445 unsigned int nr_pages_max = ch->fb_size >> PAGE_SHIFT; in sh_mobile_lcdc_sginit()
449 sg_init_table(ch->sglist, nr_pages_max); in sh_mobile_lcdc_sginit()
452 sg_set_page(&ch->sglist[nr_pages++], page, PAGE_SIZE, 0); in sh_mobile_lcdc_sginit()
460 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_deferred_io() local
461 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_deferred_io()
464 sh_mobile_lcdc_clk_on(ch->lcdc); in sh_mobile_lcdc_deferred_io()
485 dma_map_sg(ch->lcdc->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); in sh_mobile_lcdc_deferred_io()
487 panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_deferred_io()
488 lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); in sh_mobile_lcdc_deferred_io()
489 dma_unmap_sg(ch->lcdc->dev, ch->sglist, nr_pages, in sh_mobile_lcdc_deferred_io()
493 panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_deferred_io()
494 lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); in sh_mobile_lcdc_deferred_io()
506 static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_display_on() argument
508 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_display_on()
510 if (ch->tx_dev) { in sh_mobile_lcdc_display_on()
513 ret = ch->tx_dev->ops->display_on(ch->tx_dev); in sh_mobile_lcdc_display_on()
518 ch->info->state = FBINFO_STATE_SUSPENDED; in sh_mobile_lcdc_display_on()
526 static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_display_off() argument
528 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_display_off()
533 if (ch->tx_dev) in sh_mobile_lcdc_display_off()
534 ch->tx_dev->ops->display_off(ch->tx_dev); in sh_mobile_lcdc_display_off()
538 sh_mobile_lcdc_must_reconfigure(struct sh_mobile_lcdc_chan *ch, in sh_mobile_lcdc_must_reconfigure() argument
541 dev_dbg(ch->info->dev, "Old %ux%u, new %ux%u\n", in sh_mobile_lcdc_must_reconfigure()
542 ch->display.mode.xres, ch->display.mode.yres, in sh_mobile_lcdc_must_reconfigure()
546 if (fb_mode_is_equal(&ch->display.mode, new_mode)) in sh_mobile_lcdc_must_reconfigure()
549 dev_dbg(ch->info->dev, "Switching %u -> %u lines\n", in sh_mobile_lcdc_must_reconfigure()
550 ch->display.mode.yres, new_mode->yres); in sh_mobile_lcdc_must_reconfigure()
551 ch->display.mode = *new_mode; in sh_mobile_lcdc_must_reconfigure()
559 static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch, in sh_mobile_lcdc_display_notify() argument
564 struct fb_info *info = ch->info; in sh_mobile_lcdc_display_notify()
575 ch->display.width = monspec->max_x * 10; in sh_mobile_lcdc_display_notify()
576 ch->display.height = monspec->max_y * 10; in sh_mobile_lcdc_display_notify()
578 if (!sh_mobile_lcdc_must_reconfigure(ch, mode) && in sh_mobile_lcdc_display_notify()
584 info->var.width = ch->display.width; in sh_mobile_lcdc_display_notify()
585 info->var.height = ch->display.height; in sh_mobile_lcdc_display_notify()
586 sh_mobile_lcdc_display_on(ch); in sh_mobile_lcdc_display_notify()
722 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_irq() local
735 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_irq()
736 ch = &priv->ch[k]; in sh_mobile_lcdc_irq()
738 if (!ch->enabled) in sh_mobile_lcdc_irq()
743 if (is_sub == lcdc_chan_is_sublcd(ch)) { in sh_mobile_lcdc_irq()
744 ch->frame_end = 1; in sh_mobile_lcdc_irq()
745 wake_up(&ch->frame_end_wait); in sh_mobile_lcdc_irq()
753 complete(&ch->vsync_completion); in sh_mobile_lcdc_irq()
759 static int sh_mobile_lcdc_wait_for_vsync(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_wait_for_vsync() argument
767 ldintr = lcdc_read(ch->lcdc, _LDINTR); in sh_mobile_lcdc_wait_for_vsync()
769 lcdc_write(ch->lcdc, _LDINTR, ldintr); in sh_mobile_lcdc_wait_for_vsync()
771 ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion, in sh_mobile_lcdc_wait_for_vsync()
792 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) in sh_mobile_lcdc_start_stop()
793 if (lcdc_read(priv, _LDCNT2R) & priv->ch[k].enabled) in sh_mobile_lcdc_start_stop()
795 tmp = lcdc_read_chan(&priv->ch[k], LDPMR) in sh_mobile_lcdc_start_stop()
808 static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_geometry() argument
810 const struct fb_var_screeninfo *var = &ch->info->var; in sh_mobile_lcdc_geometry()
811 const struct fb_videomode *mode = &ch->display.mode; in sh_mobile_lcdc_geometry()
815 tmp = ch->ldmt1r_value; in sh_mobile_lcdc_geometry()
818 tmp |= (ch->cfg->flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0; in sh_mobile_lcdc_geometry()
819 tmp |= (ch->cfg->flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0; in sh_mobile_lcdc_geometry()
820 tmp |= (ch->cfg->flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0; in sh_mobile_lcdc_geometry()
821 tmp |= (ch->cfg->flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0; in sh_mobile_lcdc_geometry()
822 tmp |= (ch->cfg->flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0; in sh_mobile_lcdc_geometry()
823 lcdc_write_chan(ch, LDMT1R, tmp); in sh_mobile_lcdc_geometry()
826 lcdc_write_chan(ch, LDMT2R, ch->cfg->sys_bus_cfg.ldmt2r); in sh_mobile_lcdc_geometry()
827 lcdc_write_chan(ch, LDMT3R, ch->cfg->sys_bus_cfg.ldmt3r); in sh_mobile_lcdc_geometry()
833 tmp |= (min(mode->xres, ch->xres) / 8) << 16; /* HDCN */ in sh_mobile_lcdc_geometry()
834 lcdc_write_chan(ch, LDHCNR, tmp); in sh_mobile_lcdc_geometry()
839 lcdc_write_chan(ch, LDHSYNR, tmp); in sh_mobile_lcdc_geometry()
844 tmp |= min(mode->yres, ch->yres) << 16; /* VDLN */ in sh_mobile_lcdc_geometry()
845 lcdc_write_chan(ch, LDVLNR, tmp); in sh_mobile_lcdc_geometry()
849 lcdc_write_chan(ch, LDVSYNR, tmp); in sh_mobile_lcdc_geometry()
856 lcdc_write_chan(ch, LDHAJR, tmp); in sh_mobile_lcdc_geometry()
857 lcdc_write_chan_mirror(ch, LDHAJR, tmp); in sh_mobile_lcdc_geometry()
959 struct sh_mobile_lcdc_chan *ch; in __sh_mobile_lcdc_start() local
966 lcdc_write(priv, _LDCNT2R, priv->ch[0].enabled | priv->ch[1].enabled); in __sh_mobile_lcdc_start()
974 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in __sh_mobile_lcdc_start()
975 ch = &priv->ch[k]; in __sh_mobile_lcdc_start()
976 if (!ch->enabled) in __sh_mobile_lcdc_start()
980 lcdc_write_chan(ch, LDPMR, 0); in __sh_mobile_lcdc_start()
982 m = ch->cfg->clock_divider; in __sh_mobile_lcdc_start()
989 lcdc_write_chan(ch, LDDCKPAT1R, 0); in __sh_mobile_lcdc_start()
990 lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); in __sh_mobile_lcdc_start()
994 tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0); in __sh_mobile_lcdc_start()
1002 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in __sh_mobile_lcdc_start()
1003 ch = &priv->ch[k]; in __sh_mobile_lcdc_start()
1004 if (!ch->enabled) in __sh_mobile_lcdc_start()
1007 sh_mobile_lcdc_geometry(ch); in __sh_mobile_lcdc_start()
1009 tmp = ch->format->lddfr; in __sh_mobile_lcdc_start()
1011 if (ch->format->yuv) { in __sh_mobile_lcdc_start()
1012 switch (ch->colorspace) { in __sh_mobile_lcdc_start()
1022 lcdc_write_chan(ch, LDDFR, tmp); in __sh_mobile_lcdc_start()
1023 lcdc_write_chan(ch, LDMLSR, ch->line_size); in __sh_mobile_lcdc_start()
1024 lcdc_write_chan(ch, LDSA1R, ch->base_addr_y); in __sh_mobile_lcdc_start()
1025 if (ch->format->yuv) in __sh_mobile_lcdc_start()
1026 lcdc_write_chan(ch, LDSA2R, ch->base_addr_c); in __sh_mobile_lcdc_start()
1032 if (ch->ldmt1r_value & LDMT1R_IFM && in __sh_mobile_lcdc_start()
1033 ch->cfg->sys_bus_cfg.deferred_io_msec) { in __sh_mobile_lcdc_start()
1034 lcdc_write_chan(ch, LDSM1R, LDSM1R_OS); in __sh_mobile_lcdc_start()
1037 lcdc_write_chan(ch, LDSM1R, 0); in __sh_mobile_lcdc_start()
1042 switch (priv->ch[0].format->fourcc) { in __sh_mobile_lcdc_start()
1070 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_start() local
1076 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1077 if (priv->ch[k].enabled) in sh_mobile_lcdc_start()
1085 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1088 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1089 if (!ch->enabled) in sh_mobile_lcdc_start()
1092 panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_start()
1094 ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_start()
1101 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1102 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1103 if (!ch->enabled) in sh_mobile_lcdc_start()
1106 ch->base_addr_y = ch->dma_handle; in sh_mobile_lcdc_start()
1107 ch->base_addr_c = ch->dma_handle in sh_mobile_lcdc_start()
1108 + ch->xres_virtual * ch->yres_virtual; in sh_mobile_lcdc_start()
1109 ch->line_size = ch->pitch; in sh_mobile_lcdc_start()
1123 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1124 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1125 if (!ch->enabled) in sh_mobile_lcdc_start()
1128 tmp = ch->cfg->sys_bus_cfg.deferred_io_msec; in sh_mobile_lcdc_start()
1129 if (ch->ldmt1r_value & LDMT1R_IFM && tmp) { in sh_mobile_lcdc_start()
1130 ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; in sh_mobile_lcdc_start()
1131 ch->defio.delay = msecs_to_jiffies(tmp); in sh_mobile_lcdc_start()
1132 ch->info->fbdefio = &ch->defio; in sh_mobile_lcdc_start()
1133 fb_deferred_io_init(ch->info); in sh_mobile_lcdc_start()
1136 sh_mobile_lcdc_display_on(ch); in sh_mobile_lcdc_start()
1138 if (ch->bl) { in sh_mobile_lcdc_start()
1139 ch->bl->props.power = FB_BLANK_UNBLANK; in sh_mobile_lcdc_start()
1140 backlight_update_status(ch->bl); in sh_mobile_lcdc_start()
1149 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_stop() local
1153 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_stop()
1154 ch = &priv->ch[k]; in sh_mobile_lcdc_stop()
1155 if (!ch->enabled) in sh_mobile_lcdc_stop()
1162 if (ch->info && ch->info->fbdefio) { in sh_mobile_lcdc_stop()
1163 ch->frame_end = 0; in sh_mobile_lcdc_stop()
1164 schedule_delayed_work(&ch->info->deferred_work, 0); in sh_mobile_lcdc_stop()
1165 wait_event(ch->frame_end_wait, ch->frame_end); in sh_mobile_lcdc_stop()
1166 fb_deferred_io_cleanup(ch->info); in sh_mobile_lcdc_stop()
1167 ch->info->fbdefio = NULL; in sh_mobile_lcdc_stop()
1171 if (ch->bl) { in sh_mobile_lcdc_stop()
1172 ch->bl->props.power = FB_BLANK_POWERDOWN; in sh_mobile_lcdc_stop()
1173 backlight_update_status(ch->bl); in sh_mobile_lcdc_stop()
1176 sh_mobile_lcdc_display_off(ch); in sh_mobile_lcdc_stop()
1186 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) in sh_mobile_lcdc_stop()
1187 if (priv->ch[k].enabled) in sh_mobile_lcdc_stop()
1767 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_pan() local
1768 struct sh_mobile_lcdc_priv *priv = ch->lcdc; in sh_mobile_lcdc_pan()
1774 if (!ch->format->yuv) { in sh_mobile_lcdc_pan()
1775 y_offset = (var->yoffset * ch->xres_virtual + var->xoffset) in sh_mobile_lcdc_pan()
1776 * ch->format->bpp / 8; in sh_mobile_lcdc_pan()
1779 unsigned int xsub = ch->format->bpp < 24 ? 2 : 1; in sh_mobile_lcdc_pan()
1780 unsigned int ysub = ch->format->bpp < 16 ? 2 : 1; in sh_mobile_lcdc_pan()
1782 y_offset = var->yoffset * ch->xres_virtual + var->xoffset; in sh_mobile_lcdc_pan()
1783 c_offset = var->yoffset / ysub * ch->xres_virtual * 2 / xsub in sh_mobile_lcdc_pan()
1790 if (y_offset == ch->pan_y_offset) in sh_mobile_lcdc_pan()
1794 base_addr_y = ch->dma_handle + y_offset; in sh_mobile_lcdc_pan()
1795 base_addr_c = ch->dma_handle + ch->xres_virtual * ch->yres_virtual in sh_mobile_lcdc_pan()
1798 ch->base_addr_y = base_addr_y; in sh_mobile_lcdc_pan()
1799 ch->base_addr_c = base_addr_c; in sh_mobile_lcdc_pan()
1800 ch->pan_y_offset = y_offset; in sh_mobile_lcdc_pan()
1802 lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y); in sh_mobile_lcdc_pan()
1803 if (ch->format->yuv) in sh_mobile_lcdc_pan()
1804 lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c); in sh_mobile_lcdc_pan()
1807 if (lcdc_chan_is_sublcd(ch)) in sh_mobile_lcdc_pan()
1808 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS); in sh_mobile_lcdc_pan()
1810 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_MRS); in sh_mobile_lcdc_pan()
1821 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_ioctl() local
1826 retval = sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_ioctl()
1838 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_fb_reconfig() local
1844 if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) in sh_mobile_fb_reconfig()
1850 if (fb_mode_is_equal(&ch->display.mode, &mode)) in sh_mobile_fb_reconfig()
1855 fb_videomode_to_var(&var, &ch->display.mode); in sh_mobile_fb_reconfig()
1856 var.width = ch->display.width; in sh_mobile_fb_reconfig()
1857 var.height = ch->display.height; in sh_mobile_fb_reconfig()
1870 event.data = &ch->display.mode; in sh_mobile_fb_reconfig()
1880 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_release() local
1882 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_release()
1883 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count); in sh_mobile_lcdc_release()
1885 ch->use_count--; in sh_mobile_lcdc_release()
1894 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_release()
1901 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_open() local
1903 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_open()
1904 ch->use_count++; in sh_mobile_lcdc_open()
1906 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count); in sh_mobile_lcdc_open()
1907 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_open()
1915 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_check_var() local
1916 struct sh_mobile_lcdc_priv *p = ch->lcdc; in sh_mobile_lcdc_check_var()
1928 for (i = 0; i < ch->cfg->num_modes; ++i) { in sh_mobile_lcdc_check_var()
1929 const struct fb_videomode *mode = &ch->cfg->lcd_modes[i]; in sh_mobile_lcdc_check_var()
1948 if (ch->cfg->num_modes != 0) { in sh_mobile_lcdc_check_var()
1970 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_set_par() local
1973 sh_mobile_lcdc_stop(ch->lcdc); in sh_mobile_lcdc_set_par()
1975 ch->format = sh_mobile_format_info(sh_mobile_format_fourcc(&info->var)); in sh_mobile_lcdc_set_par()
1976 ch->colorspace = info->var.colorspace; in sh_mobile_lcdc_set_par()
1978 ch->xres = info->var.xres; in sh_mobile_lcdc_set_par()
1979 ch->xres_virtual = info->var.xres_virtual; in sh_mobile_lcdc_set_par()
1980 ch->yres = info->var.yres; in sh_mobile_lcdc_set_par()
1981 ch->yres_virtual = info->var.yres_virtual; in sh_mobile_lcdc_set_par()
1983 if (ch->format->yuv) in sh_mobile_lcdc_set_par()
1984 ch->pitch = info->var.xres_virtual; in sh_mobile_lcdc_set_par()
1986 ch->pitch = info->var.xres_virtual * ch->format->bpp / 8; in sh_mobile_lcdc_set_par()
1988 ret = sh_mobile_lcdc_start(ch->lcdc); in sh_mobile_lcdc_set_par()
1992 info->fix.line_length = ch->pitch; in sh_mobile_lcdc_set_par()
2015 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_blank() local
2016 struct sh_mobile_lcdc_priv *p = ch->lcdc; in sh_mobile_lcdc_blank()
2019 if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) { in sh_mobile_lcdc_blank()
2021 .width = ch->xres, in sh_mobile_lcdc_blank()
2022 .height = ch->yres, in sh_mobile_lcdc_blank()
2027 if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) { in sh_mobile_lcdc_blank()
2031 if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) { in sh_mobile_lcdc_blank()
2038 sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_blank()
2039 sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_blank()
2044 ch->blank_status = blank; in sh_mobile_lcdc_blank()
2051 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_mmap() local
2053 return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem, in sh_mobile_lcdc_mmap()
2054 ch->dma_handle, ch->fb_size); in sh_mobile_lcdc_mmap()
2076 sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_unregister() argument
2078 if (ch->info && ch->info->dev) in sh_mobile_lcdc_channel_fb_unregister()
2079 unregister_framebuffer(ch->info); in sh_mobile_lcdc_channel_fb_unregister()
2083 sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_register() argument
2085 struct fb_info *info = ch->info; in sh_mobile_lcdc_channel_fb_register()
2089 ch->sglist = vmalloc(sizeof(struct scatterlist) * in sh_mobile_lcdc_channel_fb_register()
2090 ch->fb_size >> PAGE_SHIFT); in sh_mobile_lcdc_channel_fb_register()
2091 if (!ch->sglist) in sh_mobile_lcdc_channel_fb_register()
2095 info->bl_dev = ch->bl; in sh_mobile_lcdc_channel_fb_register()
2101 dev_info(ch->lcdc->dev, "registered %s/%s as %dx%d %dbpp.\n", in sh_mobile_lcdc_channel_fb_register()
2102 dev_name(ch->lcdc->dev), (ch->cfg->chan == LCDC_CHAN_MAINLCD) ? in sh_mobile_lcdc_channel_fb_register()
2108 sh_mobile_lcdc_clk_off(ch->lcdc); in sh_mobile_lcdc_channel_fb_register()
2114 sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_cleanup() argument
2116 struct fb_info *info = ch->info; in sh_mobile_lcdc_channel_fb_cleanup()
2121 vfree(ch->sglist); in sh_mobile_lcdc_channel_fb_cleanup()
2128 sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, in sh_mobile_lcdc_channel_fb_init() argument
2132 struct sh_mobile_lcdc_priv *priv = ch->lcdc; in sh_mobile_lcdc_channel_fb_init()
2146 ch->info = info; in sh_mobile_lcdc_channel_fb_init()
2151 info->screen_base = ch->fb_mem; in sh_mobile_lcdc_channel_fb_init()
2152 info->pseudo_palette = &ch->pseudo_palette; in sh_mobile_lcdc_channel_fb_init()
2153 info->par = ch; in sh_mobile_lcdc_channel_fb_init()
2167 info->fix.smem_start = ch->dma_handle; in sh_mobile_lcdc_channel_fb_init()
2168 info->fix.smem_len = ch->fb_size; in sh_mobile_lcdc_channel_fb_init()
2169 info->fix.line_length = ch->pitch; in sh_mobile_lcdc_channel_fb_init()
2171 if (ch->format->yuv) in sh_mobile_lcdc_channel_fb_init()
2176 switch (ch->format->fourcc) { in sh_mobile_lcdc_channel_fb_init()
2190 var->width = ch->display.width; in sh_mobile_lcdc_channel_fb_init()
2191 var->height = ch->display.height; in sh_mobile_lcdc_channel_fb_init()
2192 var->xres_virtual = ch->xres_virtual; in sh_mobile_lcdc_channel_fb_init()
2193 var->yres_virtual = ch->yres_virtual; in sh_mobile_lcdc_channel_fb_init()
2199 if (!ch->format->yuv) in sh_mobile_lcdc_channel_fb_init()
2200 var->bits_per_pixel = ch->format->bpp; in sh_mobile_lcdc_channel_fb_init()
2202 var->grayscale = ch->format->fourcc; in sh_mobile_lcdc_channel_fb_init()
2217 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); in sh_mobile_lcdc_update_bl() local
2224 ch->bl_brightness = brightness; in sh_mobile_lcdc_update_bl()
2225 return ch->cfg->bl_info.set_brightness(brightness); in sh_mobile_lcdc_update_bl()
2230 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); in sh_mobile_lcdc_get_brightness() local
2232 return ch->bl_brightness; in sh_mobile_lcdc_get_brightness()
2249 struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_bl_probe() argument
2253 bl = backlight_device_register(ch->cfg->bl_info.name, parent, ch, in sh_mobile_lcdc_bl_probe()
2261 bl->props.max_brightness = ch->cfg->bl_info.max_brightness; in sh_mobile_lcdc_bl_probe()
2328 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_notify() local
2330 if (&ch->lcdc->notifier != nb) in sh_mobile_lcdc_notify()
2338 sh_mobile_lcdc_display_off(ch); in sh_mobile_lcdc_notify()
2339 sh_mobile_lcdc_stop(ch->lcdc); in sh_mobile_lcdc_notify()
2342 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_notify()
2344 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_notify()
2346 sh_mobile_lcdc_display_on(ch); in sh_mobile_lcdc_notify()
2347 sh_mobile_lcdc_start(ch->lcdc); in sh_mobile_lcdc_notify()
2384 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) in sh_mobile_lcdc_remove()
2385 sh_mobile_lcdc_channel_fb_unregister(&priv->ch[i]); in sh_mobile_lcdc_remove()
2399 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { in sh_mobile_lcdc_remove()
2400 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_remove() local
2402 if (ch->tx_dev) { in sh_mobile_lcdc_remove()
2403 ch->tx_dev->lcdc = NULL; in sh_mobile_lcdc_remove()
2404 module_put(ch->cfg->tx_dev->dev.driver->owner); in sh_mobile_lcdc_remove()
2407 sh_mobile_lcdc_channel_fb_cleanup(ch); in sh_mobile_lcdc_remove()
2409 if (ch->fb_mem) in sh_mobile_lcdc_remove()
2410 dma_free_coherent(&pdev->dev, ch->fb_size, in sh_mobile_lcdc_remove()
2411 ch->fb_mem, ch->dma_handle); in sh_mobile_lcdc_remove()
2414 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { in sh_mobile_lcdc_remove()
2415 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_remove() local
2417 if (ch->bl) in sh_mobile_lcdc_remove()
2418 sh_mobile_lcdc_bl_remove(ch->bl); in sh_mobile_lcdc_remove()
2419 mutex_destroy(&ch->open_lock); in sh_mobile_lcdc_remove()
2436 static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_check_interface() argument
2438 int interface_type = ch->cfg->interface_type; in sh_mobile_lcdc_check_interface()
2465 if (lcdc_chan_is_sublcd(ch)) { in sh_mobile_lcdc_check_interface()
2472 ch->ldmt1r_value = interface_type; in sh_mobile_lcdc_check_interface()
2532 sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_init() argument
2535 const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg; in sh_mobile_lcdc_channel_init()
2536 struct device *dev = ch->lcdc->dev; in sh_mobile_lcdc_channel_init()
2543 ch->notify = sh_mobile_lcdc_display_notify; in sh_mobile_lcdc_channel_init()
2592 ch->format = format; in sh_mobile_lcdc_channel_init()
2593 ch->xres = mode->xres; in sh_mobile_lcdc_channel_init()
2594 ch->xres_virtual = mode->xres; in sh_mobile_lcdc_channel_init()
2595 ch->yres = mode->yres; in sh_mobile_lcdc_channel_init()
2596 ch->yres_virtual = mode->yres * 2; in sh_mobile_lcdc_channel_init()
2599 ch->colorspace = V4L2_COLORSPACE_SRGB; in sh_mobile_lcdc_channel_init()
2600 ch->pitch = ch->xres_virtual * format->bpp / 8; in sh_mobile_lcdc_channel_init()
2602 ch->colorspace = V4L2_COLORSPACE_REC709; in sh_mobile_lcdc_channel_init()
2603 ch->pitch = ch->xres_virtual; in sh_mobile_lcdc_channel_init()
2606 ch->display.width = cfg->panel_cfg.width; in sh_mobile_lcdc_channel_init()
2607 ch->display.height = cfg->panel_cfg.height; in sh_mobile_lcdc_channel_init()
2608 ch->display.mode = *mode; in sh_mobile_lcdc_channel_init()
2611 ch->fb_size = max_size * format->bpp / 8 * 2; in sh_mobile_lcdc_channel_init()
2612 ch->fb_mem = dma_alloc_coherent(dev, ch->fb_size, &ch->dma_handle, in sh_mobile_lcdc_channel_init()
2614 if (ch->fb_mem == NULL) { in sh_mobile_lcdc_channel_init()
2626 ch->tx_dev = platform_get_drvdata(cfg->tx_dev); in sh_mobile_lcdc_channel_init()
2627 ch->tx_dev->lcdc = ch; in sh_mobile_lcdc_channel_init()
2628 ch->tx_dev->def_mode = *mode; in sh_mobile_lcdc_channel_init()
2631 return sh_mobile_lcdc_channel_fb_init(ch, mode, num_modes); in sh_mobile_lcdc_channel_init()
2661 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) in sh_mobile_lcdc_probe()
2662 mutex_init(&priv->ch[i].open_lock); in sh_mobile_lcdc_probe()
2675 for (i = 0, num_channels = 0; i < ARRAY_SIZE(pdata->ch); i++) { in sh_mobile_lcdc_probe()
2676 struct sh_mobile_lcdc_chan *ch = priv->ch + num_channels; in sh_mobile_lcdc_probe() local
2678 ch->lcdc = priv; in sh_mobile_lcdc_probe()
2679 ch->cfg = &pdata->ch[i]; in sh_mobile_lcdc_probe()
2681 error = sh_mobile_lcdc_check_interface(ch); in sh_mobile_lcdc_probe()
2686 init_waitqueue_head(&ch->frame_end_wait); in sh_mobile_lcdc_probe()
2687 init_completion(&ch->vsync_completion); in sh_mobile_lcdc_probe()
2690 if (ch->cfg->bl_info.max_brightness) in sh_mobile_lcdc_probe()
2691 ch->bl = sh_mobile_lcdc_bl_probe(&pdev->dev, ch); in sh_mobile_lcdc_probe()
2693 switch (pdata->ch[i].chan) { in sh_mobile_lcdc_probe()
2695 ch->enabled = LDCNT2R_ME; in sh_mobile_lcdc_probe()
2696 ch->reg_offs = lcdc_offs_mainlcd; in sh_mobile_lcdc_probe()
2700 ch->enabled = LDCNT2R_SE; in sh_mobile_lcdc_probe()
2701 ch->reg_offs = lcdc_offs_sublcd; in sh_mobile_lcdc_probe()
2715 priv->forced_fourcc = pdata->ch[0].fourcc; in sh_mobile_lcdc_probe()
2733 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_probe() local
2735 error = sh_mobile_lcdc_channel_init(ch); in sh_mobile_lcdc_probe()
2744 ovl->channel = &priv->ch[0]; in sh_mobile_lcdc_probe()
2758 struct sh_mobile_lcdc_chan *ch = priv->ch + i; in sh_mobile_lcdc_probe() local
2760 error = sh_mobile_lcdc_channel_fb_register(ch); in sh_mobile_lcdc_probe()