Lines Matching full:ch
213 struct sh_mobile_lcdc_chan ch[2]; member
398 struct sh_mobile_lcdc_chan *ch = handle; in lcdc_sys_write_index() local
400 lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT); in lcdc_sys_write_index()
401 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_index()
402 lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA | in lcdc_sys_write_index()
403 (lcdc_chan_is_sublcd(ch) ? 2 : 0)); in lcdc_sys_write_index()
404 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_index()
409 struct sh_mobile_lcdc_chan *ch = handle; in lcdc_sys_write_data() local
411 lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT | LDDWDxR_RSW); in lcdc_sys_write_data()
412 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_data()
413 lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA | in lcdc_sys_write_data()
414 (lcdc_chan_is_sublcd(ch) ? 2 : 0)); in lcdc_sys_write_data()
415 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_write_data()
420 struct sh_mobile_lcdc_chan *ch = handle; in lcdc_sys_read_data() local
422 lcdc_write(ch->lcdc, _LDDRDR, LDDRDR_RSR); in lcdc_sys_read_data()
423 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_read_data()
424 lcdc_write(ch->lcdc, _LDDRAR, LDDRAR_RA | in lcdc_sys_read_data()
425 (lcdc_chan_is_sublcd(ch) ? 2 : 0)); in lcdc_sys_read_data()
427 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0); in lcdc_sys_read_data()
429 return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK; in lcdc_sys_read_data()
440 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_sginit() local
441 unsigned int nr_pages_max = ch->fb_size >> PAGE_SHIFT; in sh_mobile_lcdc_sginit()
445 sg_init_table(ch->sglist, nr_pages_max); in sh_mobile_lcdc_sginit()
448 sg_set_page(&ch->sglist[nr_pages++], pageref->page, PAGE_SIZE, 0); in sh_mobile_lcdc_sginit()
456 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_deferred_io() local
457 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_deferred_io()
460 sh_mobile_lcdc_clk_on(ch->lcdc); in sh_mobile_lcdc_deferred_io()
481 dma_map_sg(ch->lcdc->dev, ch->sglist, nr_pages, DMA_TO_DEVICE); in sh_mobile_lcdc_deferred_io()
483 panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_deferred_io()
484 lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); in sh_mobile_lcdc_deferred_io()
485 dma_unmap_sg(ch->lcdc->dev, ch->sglist, nr_pages, in sh_mobile_lcdc_deferred_io()
489 panel->start_transfer(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_deferred_io()
490 lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG); in sh_mobile_lcdc_deferred_io()
502 static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_display_on() argument
504 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_display_on()
506 if (ch->tx_dev) { in sh_mobile_lcdc_display_on()
509 ret = ch->tx_dev->ops->display_on(ch->tx_dev); in sh_mobile_lcdc_display_on()
514 ch->info->state = FBINFO_STATE_SUSPENDED; in sh_mobile_lcdc_display_on()
522 static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_display_off() argument
524 const struct sh_mobile_lcdc_panel_cfg *panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_display_off()
529 if (ch->tx_dev) in sh_mobile_lcdc_display_off()
530 ch->tx_dev->ops->display_off(ch->tx_dev); in sh_mobile_lcdc_display_off()
635 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_irq() local
648 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_irq()
649 ch = &priv->ch[k]; in sh_mobile_lcdc_irq()
651 if (!ch->enabled) in sh_mobile_lcdc_irq()
656 if (is_sub == lcdc_chan_is_sublcd(ch)) { in sh_mobile_lcdc_irq()
657 ch->frame_end = 1; in sh_mobile_lcdc_irq()
658 wake_up(&ch->frame_end_wait); in sh_mobile_lcdc_irq()
666 complete(&ch->vsync_completion); in sh_mobile_lcdc_irq()
672 static int sh_mobile_lcdc_wait_for_vsync(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_wait_for_vsync() argument
680 ldintr = lcdc_read(ch->lcdc, _LDINTR); in sh_mobile_lcdc_wait_for_vsync()
682 lcdc_write(ch->lcdc, _LDINTR, ldintr); in sh_mobile_lcdc_wait_for_vsync()
684 ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion, in sh_mobile_lcdc_wait_for_vsync()
705 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) in sh_mobile_lcdc_start_stop()
706 if (lcdc_read(priv, _LDCNT2R) & priv->ch[k].enabled) in sh_mobile_lcdc_start_stop()
708 tmp = lcdc_read_chan(&priv->ch[k], LDPMR) in sh_mobile_lcdc_start_stop()
721 static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_geometry() argument
723 const struct fb_var_screeninfo *var = &ch->info->var; in sh_mobile_lcdc_geometry()
724 const struct fb_videomode *mode = &ch->display.mode; in sh_mobile_lcdc_geometry()
728 tmp = ch->ldmt1r_value; in sh_mobile_lcdc_geometry()
731 tmp |= (ch->cfg->flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0; in sh_mobile_lcdc_geometry()
732 tmp |= (ch->cfg->flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0; in sh_mobile_lcdc_geometry()
733 tmp |= (ch->cfg->flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0; in sh_mobile_lcdc_geometry()
734 tmp |= (ch->cfg->flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0; in sh_mobile_lcdc_geometry()
735 tmp |= (ch->cfg->flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0; in sh_mobile_lcdc_geometry()
736 lcdc_write_chan(ch, LDMT1R, tmp); in sh_mobile_lcdc_geometry()
739 lcdc_write_chan(ch, LDMT2R, ch->cfg->sys_bus_cfg.ldmt2r); in sh_mobile_lcdc_geometry()
740 lcdc_write_chan(ch, LDMT3R, ch->cfg->sys_bus_cfg.ldmt3r); in sh_mobile_lcdc_geometry()
746 tmp |= (min(mode->xres, ch->xres) / 8) << 16; /* HDCN */ in sh_mobile_lcdc_geometry()
747 lcdc_write_chan(ch, LDHCNR, tmp); in sh_mobile_lcdc_geometry()
752 lcdc_write_chan(ch, LDHSYNR, tmp); in sh_mobile_lcdc_geometry()
757 tmp |= min(mode->yres, ch->yres) << 16; /* VDLN */ in sh_mobile_lcdc_geometry()
758 lcdc_write_chan(ch, LDVLNR, tmp); in sh_mobile_lcdc_geometry()
762 lcdc_write_chan(ch, LDVSYNR, tmp); in sh_mobile_lcdc_geometry()
769 lcdc_write_chan(ch, LDHAJR, tmp); in sh_mobile_lcdc_geometry()
770 lcdc_write_chan_mirror(ch, LDHAJR, tmp); in sh_mobile_lcdc_geometry()
872 struct sh_mobile_lcdc_chan *ch; in __sh_mobile_lcdc_start() local
879 lcdc_write(priv, _LDCNT2R, priv->ch[0].enabled | priv->ch[1].enabled); in __sh_mobile_lcdc_start()
887 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in __sh_mobile_lcdc_start()
888 ch = &priv->ch[k]; in __sh_mobile_lcdc_start()
889 if (!ch->enabled) in __sh_mobile_lcdc_start()
893 lcdc_write_chan(ch, LDPMR, 0); in __sh_mobile_lcdc_start()
895 m = ch->cfg->clock_divider; in __sh_mobile_lcdc_start()
902 lcdc_write_chan(ch, LDDCKPAT1R, 0); in __sh_mobile_lcdc_start()
903 lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); in __sh_mobile_lcdc_start()
907 tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0); in __sh_mobile_lcdc_start()
915 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in __sh_mobile_lcdc_start()
916 ch = &priv->ch[k]; in __sh_mobile_lcdc_start()
917 if (!ch->enabled) in __sh_mobile_lcdc_start()
920 sh_mobile_lcdc_geometry(ch); in __sh_mobile_lcdc_start()
922 tmp = ch->format->lddfr; in __sh_mobile_lcdc_start()
924 if (ch->format->yuv) { in __sh_mobile_lcdc_start()
925 switch (ch->colorspace) { in __sh_mobile_lcdc_start()
935 lcdc_write_chan(ch, LDDFR, tmp); in __sh_mobile_lcdc_start()
936 lcdc_write_chan(ch, LDMLSR, ch->line_size); in __sh_mobile_lcdc_start()
937 lcdc_write_chan(ch, LDSA1R, ch->base_addr_y); in __sh_mobile_lcdc_start()
938 if (ch->format->yuv) in __sh_mobile_lcdc_start()
939 lcdc_write_chan(ch, LDSA2R, ch->base_addr_c); in __sh_mobile_lcdc_start()
945 if (ch->ldmt1r_value & LDMT1R_IFM && in __sh_mobile_lcdc_start()
946 ch->cfg->sys_bus_cfg.deferred_io_msec) { in __sh_mobile_lcdc_start()
947 lcdc_write_chan(ch, LDSM1R, LDSM1R_OS); in __sh_mobile_lcdc_start()
950 lcdc_write_chan(ch, LDSM1R, 0); in __sh_mobile_lcdc_start()
955 switch (priv->ch[0].format->fourcc) { in __sh_mobile_lcdc_start()
983 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_start() local
989 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
990 if (priv->ch[k].enabled) in sh_mobile_lcdc_start()
998 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1001 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1002 if (!ch->enabled) in sh_mobile_lcdc_start()
1005 panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_start()
1007 ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_start()
1014 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1015 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1016 if (!ch->enabled) in sh_mobile_lcdc_start()
1019 ch->base_addr_y = ch->dma_handle; in sh_mobile_lcdc_start()
1020 ch->base_addr_c = ch->dma_handle in sh_mobile_lcdc_start()
1021 + ch->xres_virtual * ch->yres_virtual; in sh_mobile_lcdc_start()
1022 ch->line_size = ch->pitch; in sh_mobile_lcdc_start()
1036 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1037 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1038 if (!ch->enabled) in sh_mobile_lcdc_start()
1041 tmp = ch->cfg->sys_bus_cfg.deferred_io_msec; in sh_mobile_lcdc_start()
1042 if (ch->ldmt1r_value & LDMT1R_IFM && tmp) { in sh_mobile_lcdc_start()
1043 ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; in sh_mobile_lcdc_start()
1044 ch->defio.delay = msecs_to_jiffies(tmp); in sh_mobile_lcdc_start()
1045 ch->info->fbdefio = &ch->defio; in sh_mobile_lcdc_start()
1046 fb_deferred_io_init(ch->info); in sh_mobile_lcdc_start()
1049 sh_mobile_lcdc_display_on(ch); in sh_mobile_lcdc_start()
1051 if (ch->bl) { in sh_mobile_lcdc_start()
1052 ch->bl->props.power = BACKLIGHT_POWER_ON; in sh_mobile_lcdc_start()
1053 backlight_update_status(ch->bl); in sh_mobile_lcdc_start()
1062 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_stop() local
1066 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_stop()
1067 ch = &priv->ch[k]; in sh_mobile_lcdc_stop()
1068 if (!ch->enabled) in sh_mobile_lcdc_stop()
1075 if (ch->info && ch->info->fbdefio) { in sh_mobile_lcdc_stop()
1076 ch->frame_end = 0; in sh_mobile_lcdc_stop()
1077 schedule_delayed_work(&ch->info->deferred_work, 0); in sh_mobile_lcdc_stop()
1078 wait_event(ch->frame_end_wait, ch->frame_end); in sh_mobile_lcdc_stop()
1079 fb_deferred_io_cleanup(ch->info); in sh_mobile_lcdc_stop()
1080 ch->info->fbdefio = NULL; in sh_mobile_lcdc_stop()
1084 if (ch->bl) { in sh_mobile_lcdc_stop()
1085 ch->bl->props.power = BACKLIGHT_POWER_OFF; in sh_mobile_lcdc_stop()
1086 backlight_update_status(ch->bl); in sh_mobile_lcdc_stop()
1089 sh_mobile_lcdc_display_off(ch); in sh_mobile_lcdc_stop()
1099 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) in sh_mobile_lcdc_stop()
1100 if (priv->ch[k].enabled) in sh_mobile_lcdc_stop()
1681 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_pan() local
1682 struct sh_mobile_lcdc_priv *priv = ch->lcdc; in sh_mobile_lcdc_pan()
1688 if (!ch->format->yuv) { in sh_mobile_lcdc_pan()
1689 y_offset = (var->yoffset * ch->xres_virtual + var->xoffset) in sh_mobile_lcdc_pan()
1690 * ch->format->bpp / 8; in sh_mobile_lcdc_pan()
1693 unsigned int xsub = ch->format->bpp < 24 ? 2 : 1; in sh_mobile_lcdc_pan()
1694 unsigned int ysub = ch->format->bpp < 16 ? 2 : 1; in sh_mobile_lcdc_pan()
1696 y_offset = var->yoffset * ch->xres_virtual + var->xoffset; in sh_mobile_lcdc_pan()
1697 c_offset = var->yoffset / ysub * ch->xres_virtual * 2 / xsub in sh_mobile_lcdc_pan()
1704 if (y_offset == ch->pan_y_offset) in sh_mobile_lcdc_pan()
1708 base_addr_y = ch->dma_handle + y_offset; in sh_mobile_lcdc_pan()
1709 base_addr_c = ch->dma_handle + ch->xres_virtual * ch->yres_virtual in sh_mobile_lcdc_pan()
1712 ch->base_addr_y = base_addr_y; in sh_mobile_lcdc_pan()
1713 ch->base_addr_c = base_addr_c; in sh_mobile_lcdc_pan()
1714 ch->pan_y_offset = y_offset; in sh_mobile_lcdc_pan()
1716 lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y); in sh_mobile_lcdc_pan()
1717 if (ch->format->yuv) in sh_mobile_lcdc_pan()
1718 lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c); in sh_mobile_lcdc_pan()
1721 if (lcdc_chan_is_sublcd(ch)) in sh_mobile_lcdc_pan()
1722 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS); in sh_mobile_lcdc_pan()
1724 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_MRS); in sh_mobile_lcdc_pan()
1735 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_ioctl() local
1740 retval = sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_ioctl()
1752 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_fb_reconfig() local
1756 if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) in sh_mobile_fb_reconfig()
1762 if (fb_mode_is_equal(&ch->display.mode, &mode)) in sh_mobile_fb_reconfig()
1767 fb_videomode_to_var(&var, &ch->display.mode); in sh_mobile_fb_reconfig()
1768 var.width = ch->display.width; in sh_mobile_fb_reconfig()
1769 var.height = ch->display.height; in sh_mobile_fb_reconfig()
1785 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_release() local
1787 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_release()
1788 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count); in sh_mobile_lcdc_release()
1790 ch->use_count--; in sh_mobile_lcdc_release()
1799 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_release()
1806 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_open() local
1808 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_open()
1809 ch->use_count++; in sh_mobile_lcdc_open()
1811 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count); in sh_mobile_lcdc_open()
1812 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_open()
1820 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_check_var() local
1821 struct sh_mobile_lcdc_priv *p = ch->lcdc; in sh_mobile_lcdc_check_var()
1833 for (i = 0; i < ch->cfg->num_modes; ++i) { in sh_mobile_lcdc_check_var()
1834 const struct fb_videomode *mode = &ch->cfg->lcd_modes[i]; in sh_mobile_lcdc_check_var()
1853 if (ch->cfg->num_modes != 0) { in sh_mobile_lcdc_check_var()
1875 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_set_par() local
1878 sh_mobile_lcdc_stop(ch->lcdc); in sh_mobile_lcdc_set_par()
1880 ch->format = sh_mobile_format_info(sh_mobile_format_fourcc(&info->var)); in sh_mobile_lcdc_set_par()
1881 ch->colorspace = info->var.colorspace; in sh_mobile_lcdc_set_par()
1883 ch->xres = info->var.xres; in sh_mobile_lcdc_set_par()
1884 ch->xres_virtual = info->var.xres_virtual; in sh_mobile_lcdc_set_par()
1885 ch->yres = info->var.yres; in sh_mobile_lcdc_set_par()
1886 ch->yres_virtual = info->var.yres_virtual; in sh_mobile_lcdc_set_par()
1888 if (ch->format->yuv) in sh_mobile_lcdc_set_par()
1889 ch->pitch = info->var.xres_virtual; in sh_mobile_lcdc_set_par()
1891 ch->pitch = info->var.xres_virtual * ch->format->bpp / 8; in sh_mobile_lcdc_set_par()
1893 ret = sh_mobile_lcdc_start(ch->lcdc); in sh_mobile_lcdc_set_par()
1897 info->fix.line_length = ch->pitch; in sh_mobile_lcdc_set_par()
1920 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_blank() local
1921 struct sh_mobile_lcdc_priv *p = ch->lcdc; in sh_mobile_lcdc_blank()
1924 if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) { in sh_mobile_lcdc_blank()
1926 .width = ch->xres, in sh_mobile_lcdc_blank()
1927 .height = ch->yres, in sh_mobile_lcdc_blank()
1932 if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) { in sh_mobile_lcdc_blank()
1936 if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) { in sh_mobile_lcdc_blank()
1943 sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_blank()
1944 sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_blank()
1949 ch->blank_status = blank; in sh_mobile_lcdc_blank()
1956 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_mmap() local
1963 return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem, in sh_mobile_lcdc_mmap()
1964 ch->dma_handle, ch->fb_size); in sh_mobile_lcdc_mmap()
1985 sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_unregister() argument
1987 if (ch->info && ch->info->dev) in sh_mobile_lcdc_channel_fb_unregister()
1988 unregister_framebuffer(ch->info); in sh_mobile_lcdc_channel_fb_unregister()
1992 sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_register() argument
1994 struct fb_info *info = ch->info; in sh_mobile_lcdc_channel_fb_register()
1998 ch->sglist = vmalloc(sizeof(struct scatterlist) * in sh_mobile_lcdc_channel_fb_register()
1999 ch->fb_size >> PAGE_SHIFT); in sh_mobile_lcdc_channel_fb_register()
2000 if (!ch->sglist) in sh_mobile_lcdc_channel_fb_register()
2004 info->bl_dev = ch->bl; in sh_mobile_lcdc_channel_fb_register()
2010 dev_info(ch->lcdc->dev, "registered %s/%s as %dx%d %dbpp.\n", in sh_mobile_lcdc_channel_fb_register()
2011 dev_name(ch->lcdc->dev), (ch->cfg->chan == LCDC_CHAN_MAINLCD) ? in sh_mobile_lcdc_channel_fb_register()
2017 sh_mobile_lcdc_clk_off(ch->lcdc); in sh_mobile_lcdc_channel_fb_register()
2023 sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_cleanup() argument
2025 struct fb_info *info = ch->info; in sh_mobile_lcdc_channel_fb_cleanup()
2030 vfree(ch->sglist); in sh_mobile_lcdc_channel_fb_cleanup()
2037 sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, in sh_mobile_lcdc_channel_fb_init() argument
2041 struct sh_mobile_lcdc_priv *priv = ch->lcdc; in sh_mobile_lcdc_channel_fb_init()
2053 ch->info = info; in sh_mobile_lcdc_channel_fb_init()
2058 info->screen_buffer = ch->fb_mem; in sh_mobile_lcdc_channel_fb_init()
2059 info->pseudo_palette = &ch->pseudo_palette; in sh_mobile_lcdc_channel_fb_init()
2060 info->par = ch; in sh_mobile_lcdc_channel_fb_init()
2074 info->fix.smem_start = ch->dma_handle; in sh_mobile_lcdc_channel_fb_init()
2075 info->fix.smem_len = ch->fb_size; in sh_mobile_lcdc_channel_fb_init()
2076 info->fix.line_length = ch->pitch; in sh_mobile_lcdc_channel_fb_init()
2078 if (ch->format->yuv) in sh_mobile_lcdc_channel_fb_init()
2083 switch (ch->format->fourcc) { in sh_mobile_lcdc_channel_fb_init()
2098 var->width = ch->display.width; in sh_mobile_lcdc_channel_fb_init()
2099 var->height = ch->display.height; in sh_mobile_lcdc_channel_fb_init()
2100 var->xres_virtual = ch->xres_virtual; in sh_mobile_lcdc_channel_fb_init()
2101 var->yres_virtual = ch->yres_virtual; in sh_mobile_lcdc_channel_fb_init()
2107 if (!ch->format->yuv) in sh_mobile_lcdc_channel_fb_init()
2108 var->bits_per_pixel = ch->format->bpp; in sh_mobile_lcdc_channel_fb_init()
2110 var->grayscale = ch->format->fourcc; in sh_mobile_lcdc_channel_fb_init()
2125 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); in sh_mobile_lcdc_update_bl() local
2128 ch->bl_brightness = brightness; in sh_mobile_lcdc_update_bl()
2129 return ch->cfg->bl_info.set_brightness(brightness); in sh_mobile_lcdc_update_bl()
2134 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); in sh_mobile_lcdc_get_brightness() local
2136 return ch->bl_brightness; in sh_mobile_lcdc_get_brightness()
2146 struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_bl_probe() argument
2150 bl = backlight_device_register(ch->cfg->bl_info.name, parent, ch, in sh_mobile_lcdc_bl_probe()
2158 bl->props.max_brightness = ch->cfg->bl_info.max_brightness; in sh_mobile_lcdc_bl_probe()
2248 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) in sh_mobile_lcdc_remove()
2249 sh_mobile_lcdc_channel_fb_unregister(&priv->ch[i]); in sh_mobile_lcdc_remove()
2263 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { in sh_mobile_lcdc_remove()
2264 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_remove() local
2266 if (ch->tx_dev) { in sh_mobile_lcdc_remove()
2267 ch->tx_dev->lcdc = NULL; in sh_mobile_lcdc_remove()
2268 module_put(ch->cfg->tx_dev->dev.driver->owner); in sh_mobile_lcdc_remove()
2271 sh_mobile_lcdc_channel_fb_cleanup(ch); in sh_mobile_lcdc_remove()
2273 if (ch->fb_mem) in sh_mobile_lcdc_remove()
2274 dma_free_coherent(&pdev->dev, ch->fb_size, in sh_mobile_lcdc_remove()
2275 ch->fb_mem, ch->dma_handle); in sh_mobile_lcdc_remove()
2278 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { in sh_mobile_lcdc_remove()
2279 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_remove() local
2281 if (ch->bl) in sh_mobile_lcdc_remove()
2282 sh_mobile_lcdc_bl_remove(ch->bl); in sh_mobile_lcdc_remove()
2283 mutex_destroy(&ch->open_lock); in sh_mobile_lcdc_remove()
2299 static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_check_interface() argument
2301 int interface_type = ch->cfg->interface_type; in sh_mobile_lcdc_check_interface()
2328 if (lcdc_chan_is_sublcd(ch)) { in sh_mobile_lcdc_check_interface()
2335 ch->ldmt1r_value = interface_type; in sh_mobile_lcdc_check_interface()
2395 sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_init() argument
2398 const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg; in sh_mobile_lcdc_channel_init()
2399 struct device *dev = ch->lcdc->dev; in sh_mobile_lcdc_channel_init()
2453 ch->format = format; in sh_mobile_lcdc_channel_init()
2454 ch->xres = mode->xres; in sh_mobile_lcdc_channel_init()
2455 ch->xres_virtual = mode->xres; in sh_mobile_lcdc_channel_init()
2456 ch->yres = mode->yres; in sh_mobile_lcdc_channel_init()
2457 ch->yres_virtual = mode->yres * 2; in sh_mobile_lcdc_channel_init()
2460 ch->colorspace = V4L2_COLORSPACE_SRGB; in sh_mobile_lcdc_channel_init()
2461 ch->pitch = ch->xres_virtual * format->bpp / 8; in sh_mobile_lcdc_channel_init()
2463 ch->colorspace = V4L2_COLORSPACE_REC709; in sh_mobile_lcdc_channel_init()
2464 ch->pitch = ch->xres_virtual; in sh_mobile_lcdc_channel_init()
2467 ch->display.width = cfg->panel_cfg.width; in sh_mobile_lcdc_channel_init()
2468 ch->display.height = cfg->panel_cfg.height; in sh_mobile_lcdc_channel_init()
2469 ch->display.mode = *mode; in sh_mobile_lcdc_channel_init()
2472 ch->fb_size = max_size * format->bpp / 8 * 2; in sh_mobile_lcdc_channel_init()
2473 ch->fb_mem = dma_alloc_coherent(dev, ch->fb_size, &ch->dma_handle, in sh_mobile_lcdc_channel_init()
2475 if (ch->fb_mem == NULL) { in sh_mobile_lcdc_channel_init()
2487 ch->tx_dev = platform_get_drvdata(cfg->tx_dev); in sh_mobile_lcdc_channel_init()
2488 ch->tx_dev->lcdc = ch; in sh_mobile_lcdc_channel_init()
2489 ch->tx_dev->def_mode = *mode; in sh_mobile_lcdc_channel_init()
2492 return sh_mobile_lcdc_channel_fb_init(ch, mode, num_modes); in sh_mobile_lcdc_channel_init()
2522 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) in sh_mobile_lcdc_probe()
2523 mutex_init(&priv->ch[i].open_lock); in sh_mobile_lcdc_probe()
2536 for (i = 0, num_channels = 0; i < ARRAY_SIZE(pdata->ch); i++) { in sh_mobile_lcdc_probe()
2537 struct sh_mobile_lcdc_chan *ch = priv->ch + num_channels; in sh_mobile_lcdc_probe() local
2539 ch->lcdc = priv; in sh_mobile_lcdc_probe()
2540 ch->cfg = &pdata->ch[i]; in sh_mobile_lcdc_probe()
2542 error = sh_mobile_lcdc_check_interface(ch); in sh_mobile_lcdc_probe()
2547 init_waitqueue_head(&ch->frame_end_wait); in sh_mobile_lcdc_probe()
2548 init_completion(&ch->vsync_completion); in sh_mobile_lcdc_probe()
2551 if (ch->cfg->bl_info.max_brightness) in sh_mobile_lcdc_probe()
2552 ch->bl = sh_mobile_lcdc_bl_probe(&pdev->dev, ch); in sh_mobile_lcdc_probe()
2554 switch (pdata->ch[i].chan) { in sh_mobile_lcdc_probe()
2556 ch->enabled = LDCNT2R_ME; in sh_mobile_lcdc_probe()
2557 ch->reg_offs = lcdc_offs_mainlcd; in sh_mobile_lcdc_probe()
2561 ch->enabled = LDCNT2R_SE; in sh_mobile_lcdc_probe()
2562 ch->reg_offs = lcdc_offs_sublcd; in sh_mobile_lcdc_probe()
2576 priv->forced_fourcc = pdata->ch[0].fourcc; in sh_mobile_lcdc_probe()
2594 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_probe() local
2596 error = sh_mobile_lcdc_channel_init(ch); in sh_mobile_lcdc_probe()
2605 ovl->channel = &priv->ch[0]; in sh_mobile_lcdc_probe()
2619 struct sh_mobile_lcdc_chan *ch = priv->ch + i; in sh_mobile_lcdc_probe() local
2621 error = sh_mobile_lcdc_channel_fb_register(ch); in sh_mobile_lcdc_probe()