• Home
  • Raw
  • Download

Lines Matching refs:ch

214 	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()
642 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_irq() local
655 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_irq()
656 ch = &priv->ch[k]; in sh_mobile_lcdc_irq()
658 if (!ch->enabled) in sh_mobile_lcdc_irq()
663 if (is_sub == lcdc_chan_is_sublcd(ch)) { in sh_mobile_lcdc_irq()
664 ch->frame_end = 1; in sh_mobile_lcdc_irq()
665 wake_up(&ch->frame_end_wait); in sh_mobile_lcdc_irq()
673 complete(&ch->vsync_completion); in sh_mobile_lcdc_irq()
679 static int sh_mobile_lcdc_wait_for_vsync(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_wait_for_vsync() argument
687 ldintr = lcdc_read(ch->lcdc, _LDINTR); in sh_mobile_lcdc_wait_for_vsync()
689 lcdc_write(ch->lcdc, _LDINTR, ldintr); in sh_mobile_lcdc_wait_for_vsync()
691 ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion, in sh_mobile_lcdc_wait_for_vsync()
712 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) in sh_mobile_lcdc_start_stop()
713 if (lcdc_read(priv, _LDCNT2R) & priv->ch[k].enabled) in sh_mobile_lcdc_start_stop()
715 tmp = lcdc_read_chan(&priv->ch[k], LDPMR) in sh_mobile_lcdc_start_stop()
728 static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_geometry() argument
730 const struct fb_var_screeninfo *var = &ch->info->var; in sh_mobile_lcdc_geometry()
731 const struct fb_videomode *mode = &ch->display.mode; in sh_mobile_lcdc_geometry()
735 tmp = ch->ldmt1r_value; in sh_mobile_lcdc_geometry()
738 tmp |= (ch->cfg->flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0; in sh_mobile_lcdc_geometry()
739 tmp |= (ch->cfg->flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0; in sh_mobile_lcdc_geometry()
740 tmp |= (ch->cfg->flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0; in sh_mobile_lcdc_geometry()
741 tmp |= (ch->cfg->flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0; in sh_mobile_lcdc_geometry()
742 tmp |= (ch->cfg->flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0; in sh_mobile_lcdc_geometry()
743 lcdc_write_chan(ch, LDMT1R, tmp); in sh_mobile_lcdc_geometry()
746 lcdc_write_chan(ch, LDMT2R, ch->cfg->sys_bus_cfg.ldmt2r); in sh_mobile_lcdc_geometry()
747 lcdc_write_chan(ch, LDMT3R, ch->cfg->sys_bus_cfg.ldmt3r); in sh_mobile_lcdc_geometry()
753 tmp |= (min(mode->xres, ch->xres) / 8) << 16; /* HDCN */ in sh_mobile_lcdc_geometry()
754 lcdc_write_chan(ch, LDHCNR, tmp); in sh_mobile_lcdc_geometry()
759 lcdc_write_chan(ch, LDHSYNR, tmp); in sh_mobile_lcdc_geometry()
764 tmp |= min(mode->yres, ch->yres) << 16; /* VDLN */ in sh_mobile_lcdc_geometry()
765 lcdc_write_chan(ch, LDVLNR, tmp); in sh_mobile_lcdc_geometry()
769 lcdc_write_chan(ch, LDVSYNR, tmp); in sh_mobile_lcdc_geometry()
776 lcdc_write_chan(ch, LDHAJR, tmp); in sh_mobile_lcdc_geometry()
777 lcdc_write_chan_mirror(ch, LDHAJR, tmp); in sh_mobile_lcdc_geometry()
879 struct sh_mobile_lcdc_chan *ch; in __sh_mobile_lcdc_start() local
886 lcdc_write(priv, _LDCNT2R, priv->ch[0].enabled | priv->ch[1].enabled); in __sh_mobile_lcdc_start()
894 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in __sh_mobile_lcdc_start()
895 ch = &priv->ch[k]; in __sh_mobile_lcdc_start()
896 if (!ch->enabled) in __sh_mobile_lcdc_start()
900 lcdc_write_chan(ch, LDPMR, 0); in __sh_mobile_lcdc_start()
902 m = ch->cfg->clock_divider; in __sh_mobile_lcdc_start()
909 lcdc_write_chan(ch, LDDCKPAT1R, 0); in __sh_mobile_lcdc_start()
910 lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); in __sh_mobile_lcdc_start()
914 tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0); in __sh_mobile_lcdc_start()
922 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in __sh_mobile_lcdc_start()
923 ch = &priv->ch[k]; in __sh_mobile_lcdc_start()
924 if (!ch->enabled) in __sh_mobile_lcdc_start()
927 sh_mobile_lcdc_geometry(ch); in __sh_mobile_lcdc_start()
929 tmp = ch->format->lddfr; in __sh_mobile_lcdc_start()
931 if (ch->format->yuv) { in __sh_mobile_lcdc_start()
932 switch (ch->colorspace) { in __sh_mobile_lcdc_start()
942 lcdc_write_chan(ch, LDDFR, tmp); in __sh_mobile_lcdc_start()
943 lcdc_write_chan(ch, LDMLSR, ch->line_size); in __sh_mobile_lcdc_start()
944 lcdc_write_chan(ch, LDSA1R, ch->base_addr_y); in __sh_mobile_lcdc_start()
945 if (ch->format->yuv) in __sh_mobile_lcdc_start()
946 lcdc_write_chan(ch, LDSA2R, ch->base_addr_c); in __sh_mobile_lcdc_start()
952 if (ch->ldmt1r_value & LDMT1R_IFM && in __sh_mobile_lcdc_start()
953 ch->cfg->sys_bus_cfg.deferred_io_msec) { in __sh_mobile_lcdc_start()
954 lcdc_write_chan(ch, LDSM1R, LDSM1R_OS); in __sh_mobile_lcdc_start()
957 lcdc_write_chan(ch, LDSM1R, 0); in __sh_mobile_lcdc_start()
962 switch (priv->ch[0].format->fourcc) { in __sh_mobile_lcdc_start()
990 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_start() local
996 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
997 if (priv->ch[k].enabled) in sh_mobile_lcdc_start()
1005 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1008 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1009 if (!ch->enabled) in sh_mobile_lcdc_start()
1012 panel = &ch->cfg->panel_cfg; in sh_mobile_lcdc_start()
1014 ret = panel->setup_sys(ch, &sh_mobile_lcdc_sys_bus_ops); in sh_mobile_lcdc_start()
1021 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1022 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1023 if (!ch->enabled) in sh_mobile_lcdc_start()
1026 ch->base_addr_y = ch->dma_handle; in sh_mobile_lcdc_start()
1027 ch->base_addr_c = ch->dma_handle in sh_mobile_lcdc_start()
1028 + ch->xres_virtual * ch->yres_virtual; in sh_mobile_lcdc_start()
1029 ch->line_size = ch->pitch; in sh_mobile_lcdc_start()
1043 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_start()
1044 ch = &priv->ch[k]; in sh_mobile_lcdc_start()
1045 if (!ch->enabled) in sh_mobile_lcdc_start()
1048 tmp = ch->cfg->sys_bus_cfg.deferred_io_msec; in sh_mobile_lcdc_start()
1049 if (ch->ldmt1r_value & LDMT1R_IFM && tmp) { in sh_mobile_lcdc_start()
1050 ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; in sh_mobile_lcdc_start()
1051 ch->defio.delay = msecs_to_jiffies(tmp); in sh_mobile_lcdc_start()
1052 ch->info->fbdefio = &ch->defio; in sh_mobile_lcdc_start()
1053 fb_deferred_io_init(ch->info); in sh_mobile_lcdc_start()
1056 sh_mobile_lcdc_display_on(ch); in sh_mobile_lcdc_start()
1058 if (ch->bl) { in sh_mobile_lcdc_start()
1059 ch->bl->props.power = FB_BLANK_UNBLANK; in sh_mobile_lcdc_start()
1060 backlight_update_status(ch->bl); in sh_mobile_lcdc_start()
1069 struct sh_mobile_lcdc_chan *ch; in sh_mobile_lcdc_stop() local
1073 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { in sh_mobile_lcdc_stop()
1074 ch = &priv->ch[k]; in sh_mobile_lcdc_stop()
1075 if (!ch->enabled) in sh_mobile_lcdc_stop()
1082 if (ch->info && ch->info->fbdefio) { in sh_mobile_lcdc_stop()
1083 ch->frame_end = 0; in sh_mobile_lcdc_stop()
1084 schedule_delayed_work(&ch->info->deferred_work, 0); in sh_mobile_lcdc_stop()
1085 wait_event(ch->frame_end_wait, ch->frame_end); in sh_mobile_lcdc_stop()
1086 fb_deferred_io_cleanup(ch->info); in sh_mobile_lcdc_stop()
1087 ch->info->fbdefio = NULL; in sh_mobile_lcdc_stop()
1091 if (ch->bl) { in sh_mobile_lcdc_stop()
1092 ch->bl->props.power = FB_BLANK_POWERDOWN; in sh_mobile_lcdc_stop()
1093 backlight_update_status(ch->bl); in sh_mobile_lcdc_stop()
1096 sh_mobile_lcdc_display_off(ch); in sh_mobile_lcdc_stop()
1106 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) in sh_mobile_lcdc_stop()
1107 if (priv->ch[k].enabled) in sh_mobile_lcdc_stop()
1686 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_pan() local
1687 struct sh_mobile_lcdc_priv *priv = ch->lcdc; in sh_mobile_lcdc_pan()
1693 if (!ch->format->yuv) { in sh_mobile_lcdc_pan()
1694 y_offset = (var->yoffset * ch->xres_virtual + var->xoffset) in sh_mobile_lcdc_pan()
1695 * ch->format->bpp / 8; in sh_mobile_lcdc_pan()
1698 unsigned int xsub = ch->format->bpp < 24 ? 2 : 1; in sh_mobile_lcdc_pan()
1699 unsigned int ysub = ch->format->bpp < 16 ? 2 : 1; in sh_mobile_lcdc_pan()
1701 y_offset = var->yoffset * ch->xres_virtual + var->xoffset; in sh_mobile_lcdc_pan()
1702 c_offset = var->yoffset / ysub * ch->xres_virtual * 2 / xsub in sh_mobile_lcdc_pan()
1709 if (y_offset == ch->pan_y_offset) in sh_mobile_lcdc_pan()
1713 base_addr_y = ch->dma_handle + y_offset; in sh_mobile_lcdc_pan()
1714 base_addr_c = ch->dma_handle + ch->xres_virtual * ch->yres_virtual in sh_mobile_lcdc_pan()
1717 ch->base_addr_y = base_addr_y; in sh_mobile_lcdc_pan()
1718 ch->base_addr_c = base_addr_c; in sh_mobile_lcdc_pan()
1719 ch->pan_y_offset = y_offset; in sh_mobile_lcdc_pan()
1721 lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y); in sh_mobile_lcdc_pan()
1722 if (ch->format->yuv) in sh_mobile_lcdc_pan()
1723 lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c); in sh_mobile_lcdc_pan()
1726 if (lcdc_chan_is_sublcd(ch)) in sh_mobile_lcdc_pan()
1727 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS); in sh_mobile_lcdc_pan()
1729 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_MRS); in sh_mobile_lcdc_pan()
1740 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_ioctl() local
1745 retval = sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_ioctl()
1757 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_fb_reconfig() local
1761 if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par)) in sh_mobile_fb_reconfig()
1767 if (fb_mode_is_equal(&ch->display.mode, &mode)) in sh_mobile_fb_reconfig()
1772 fb_videomode_to_var(&var, &ch->display.mode); in sh_mobile_fb_reconfig()
1773 var.width = ch->display.width; in sh_mobile_fb_reconfig()
1774 var.height = ch->display.height; in sh_mobile_fb_reconfig()
1790 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_release() local
1792 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_release()
1793 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count); in sh_mobile_lcdc_release()
1795 ch->use_count--; in sh_mobile_lcdc_release()
1804 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_release()
1811 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_open() local
1813 mutex_lock(&ch->open_lock); in sh_mobile_lcdc_open()
1814 ch->use_count++; in sh_mobile_lcdc_open()
1816 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count); in sh_mobile_lcdc_open()
1817 mutex_unlock(&ch->open_lock); in sh_mobile_lcdc_open()
1825 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_check_var() local
1826 struct sh_mobile_lcdc_priv *p = ch->lcdc; in sh_mobile_lcdc_check_var()
1838 for (i = 0; i < ch->cfg->num_modes; ++i) { in sh_mobile_lcdc_check_var()
1839 const struct fb_videomode *mode = &ch->cfg->lcd_modes[i]; in sh_mobile_lcdc_check_var()
1858 if (ch->cfg->num_modes != 0) { in sh_mobile_lcdc_check_var()
1880 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_set_par() local
1883 sh_mobile_lcdc_stop(ch->lcdc); in sh_mobile_lcdc_set_par()
1885 ch->format = sh_mobile_format_info(sh_mobile_format_fourcc(&info->var)); in sh_mobile_lcdc_set_par()
1886 ch->colorspace = info->var.colorspace; in sh_mobile_lcdc_set_par()
1888 ch->xres = info->var.xres; in sh_mobile_lcdc_set_par()
1889 ch->xres_virtual = info->var.xres_virtual; in sh_mobile_lcdc_set_par()
1890 ch->yres = info->var.yres; in sh_mobile_lcdc_set_par()
1891 ch->yres_virtual = info->var.yres_virtual; in sh_mobile_lcdc_set_par()
1893 if (ch->format->yuv) in sh_mobile_lcdc_set_par()
1894 ch->pitch = info->var.xres_virtual; in sh_mobile_lcdc_set_par()
1896 ch->pitch = info->var.xres_virtual * ch->format->bpp / 8; in sh_mobile_lcdc_set_par()
1898 ret = sh_mobile_lcdc_start(ch->lcdc); in sh_mobile_lcdc_set_par()
1902 info->fix.line_length = ch->pitch; in sh_mobile_lcdc_set_par()
1925 struct sh_mobile_lcdc_chan *ch = info->par; in sh_mobile_lcdc_blank() local
1926 struct sh_mobile_lcdc_priv *p = ch->lcdc; in sh_mobile_lcdc_blank()
1929 if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) { in sh_mobile_lcdc_blank()
1931 .width = ch->xres, in sh_mobile_lcdc_blank()
1932 .height = ch->yres, in sh_mobile_lcdc_blank()
1937 if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) { in sh_mobile_lcdc_blank()
1941 if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) { in sh_mobile_lcdc_blank()
1948 sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_blank()
1949 sh_mobile_lcdc_wait_for_vsync(ch); in sh_mobile_lcdc_blank()
1954 ch->blank_status = blank; in sh_mobile_lcdc_blank()
1961 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()
1986 sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_unregister() argument
1988 if (ch->info && ch->info->dev) in sh_mobile_lcdc_channel_fb_unregister()
1989 unregister_framebuffer(ch->info); in sh_mobile_lcdc_channel_fb_unregister()
1993 sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_register() argument
1995 struct fb_info *info = ch->info; in sh_mobile_lcdc_channel_fb_register()
1999 ch->sglist = vmalloc(sizeof(struct scatterlist) * in sh_mobile_lcdc_channel_fb_register()
2000 ch->fb_size >> PAGE_SHIFT); in sh_mobile_lcdc_channel_fb_register()
2001 if (!ch->sglist) in sh_mobile_lcdc_channel_fb_register()
2005 info->bl_dev = ch->bl; in sh_mobile_lcdc_channel_fb_register()
2011 dev_info(ch->lcdc->dev, "registered %s/%s as %dx%d %dbpp.\n", in sh_mobile_lcdc_channel_fb_register()
2012 dev_name(ch->lcdc->dev), (ch->cfg->chan == LCDC_CHAN_MAINLCD) ? in sh_mobile_lcdc_channel_fb_register()
2018 sh_mobile_lcdc_clk_off(ch->lcdc); in sh_mobile_lcdc_channel_fb_register()
2024 sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_fb_cleanup() argument
2026 struct fb_info *info = ch->info; in sh_mobile_lcdc_channel_fb_cleanup()
2031 vfree(ch->sglist); in sh_mobile_lcdc_channel_fb_cleanup()
2038 sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, in sh_mobile_lcdc_channel_fb_init() argument
2042 struct sh_mobile_lcdc_priv *priv = ch->lcdc; in sh_mobile_lcdc_channel_fb_init()
2054 ch->info = info; in sh_mobile_lcdc_channel_fb_init()
2059 info->screen_buffer = ch->fb_mem; in sh_mobile_lcdc_channel_fb_init()
2060 info->pseudo_palette = &ch->pseudo_palette; in sh_mobile_lcdc_channel_fb_init()
2061 info->par = ch; in sh_mobile_lcdc_channel_fb_init()
2075 info->fix.smem_start = ch->dma_handle; in sh_mobile_lcdc_channel_fb_init()
2076 info->fix.smem_len = ch->fb_size; in sh_mobile_lcdc_channel_fb_init()
2077 info->fix.line_length = ch->pitch; in sh_mobile_lcdc_channel_fb_init()
2079 if (ch->format->yuv) in sh_mobile_lcdc_channel_fb_init()
2084 switch (ch->format->fourcc) { in sh_mobile_lcdc_channel_fb_init()
2099 var->width = ch->display.width; in sh_mobile_lcdc_channel_fb_init()
2100 var->height = ch->display.height; in sh_mobile_lcdc_channel_fb_init()
2101 var->xres_virtual = ch->xres_virtual; in sh_mobile_lcdc_channel_fb_init()
2102 var->yres_virtual = ch->yres_virtual; in sh_mobile_lcdc_channel_fb_init()
2108 if (!ch->format->yuv) in sh_mobile_lcdc_channel_fb_init()
2109 var->bits_per_pixel = ch->format->bpp; in sh_mobile_lcdc_channel_fb_init()
2111 var->grayscale = ch->format->fourcc; in sh_mobile_lcdc_channel_fb_init()
2126 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); in sh_mobile_lcdc_update_bl() local
2133 ch->bl_brightness = brightness; in sh_mobile_lcdc_update_bl()
2134 return ch->cfg->bl_info.set_brightness(brightness); in sh_mobile_lcdc_update_bl()
2139 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); in sh_mobile_lcdc_get_brightness() local
2141 return ch->bl_brightness; in sh_mobile_lcdc_get_brightness()
2158 struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_bl_probe() argument
2162 bl = backlight_device_register(ch->cfg->bl_info.name, parent, ch, in sh_mobile_lcdc_bl_probe()
2170 bl->props.max_brightness = ch->cfg->bl_info.max_brightness; in sh_mobile_lcdc_bl_probe()
2260 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) in sh_mobile_lcdc_remove()
2261 sh_mobile_lcdc_channel_fb_unregister(&priv->ch[i]); in sh_mobile_lcdc_remove()
2275 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { in sh_mobile_lcdc_remove()
2276 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_remove() local
2278 if (ch->tx_dev) { in sh_mobile_lcdc_remove()
2279 ch->tx_dev->lcdc = NULL; in sh_mobile_lcdc_remove()
2280 module_put(ch->cfg->tx_dev->dev.driver->owner); in sh_mobile_lcdc_remove()
2283 sh_mobile_lcdc_channel_fb_cleanup(ch); in sh_mobile_lcdc_remove()
2285 if (ch->fb_mem) in sh_mobile_lcdc_remove()
2286 dma_free_coherent(&pdev->dev, ch->fb_size, in sh_mobile_lcdc_remove()
2287 ch->fb_mem, ch->dma_handle); in sh_mobile_lcdc_remove()
2290 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { in sh_mobile_lcdc_remove()
2291 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_remove() local
2293 if (ch->bl) in sh_mobile_lcdc_remove()
2294 sh_mobile_lcdc_bl_remove(ch->bl); in sh_mobile_lcdc_remove()
2295 mutex_destroy(&ch->open_lock); in sh_mobile_lcdc_remove()
2312 static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_check_interface() argument
2314 int interface_type = ch->cfg->interface_type; in sh_mobile_lcdc_check_interface()
2341 if (lcdc_chan_is_sublcd(ch)) { in sh_mobile_lcdc_check_interface()
2348 ch->ldmt1r_value = interface_type; in sh_mobile_lcdc_check_interface()
2408 sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) in sh_mobile_lcdc_channel_init() argument
2411 const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg; in sh_mobile_lcdc_channel_init()
2412 struct device *dev = ch->lcdc->dev; in sh_mobile_lcdc_channel_init()
2466 ch->format = format; in sh_mobile_lcdc_channel_init()
2467 ch->xres = mode->xres; in sh_mobile_lcdc_channel_init()
2468 ch->xres_virtual = mode->xres; in sh_mobile_lcdc_channel_init()
2469 ch->yres = mode->yres; in sh_mobile_lcdc_channel_init()
2470 ch->yres_virtual = mode->yres * 2; in sh_mobile_lcdc_channel_init()
2473 ch->colorspace = V4L2_COLORSPACE_SRGB; in sh_mobile_lcdc_channel_init()
2474 ch->pitch = ch->xres_virtual * format->bpp / 8; in sh_mobile_lcdc_channel_init()
2476 ch->colorspace = V4L2_COLORSPACE_REC709; in sh_mobile_lcdc_channel_init()
2477 ch->pitch = ch->xres_virtual; in sh_mobile_lcdc_channel_init()
2480 ch->display.width = cfg->panel_cfg.width; in sh_mobile_lcdc_channel_init()
2481 ch->display.height = cfg->panel_cfg.height; in sh_mobile_lcdc_channel_init()
2482 ch->display.mode = *mode; in sh_mobile_lcdc_channel_init()
2485 ch->fb_size = max_size * format->bpp / 8 * 2; in sh_mobile_lcdc_channel_init()
2486 ch->fb_mem = dma_alloc_coherent(dev, ch->fb_size, &ch->dma_handle, in sh_mobile_lcdc_channel_init()
2488 if (ch->fb_mem == NULL) { in sh_mobile_lcdc_channel_init()
2500 ch->tx_dev = platform_get_drvdata(cfg->tx_dev); in sh_mobile_lcdc_channel_init()
2501 ch->tx_dev->lcdc = ch; in sh_mobile_lcdc_channel_init()
2502 ch->tx_dev->def_mode = *mode; in sh_mobile_lcdc_channel_init()
2505 return sh_mobile_lcdc_channel_fb_init(ch, mode, num_modes); in sh_mobile_lcdc_channel_init()
2535 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) in sh_mobile_lcdc_probe()
2536 mutex_init(&priv->ch[i].open_lock); in sh_mobile_lcdc_probe()
2549 for (i = 0, num_channels = 0; i < ARRAY_SIZE(pdata->ch); i++) { in sh_mobile_lcdc_probe()
2550 struct sh_mobile_lcdc_chan *ch = priv->ch + num_channels; in sh_mobile_lcdc_probe() local
2552 ch->lcdc = priv; in sh_mobile_lcdc_probe()
2553 ch->cfg = &pdata->ch[i]; in sh_mobile_lcdc_probe()
2555 error = sh_mobile_lcdc_check_interface(ch); in sh_mobile_lcdc_probe()
2560 init_waitqueue_head(&ch->frame_end_wait); in sh_mobile_lcdc_probe()
2561 init_completion(&ch->vsync_completion); in sh_mobile_lcdc_probe()
2564 if (ch->cfg->bl_info.max_brightness) in sh_mobile_lcdc_probe()
2565 ch->bl = sh_mobile_lcdc_bl_probe(&pdev->dev, ch); in sh_mobile_lcdc_probe()
2567 switch (pdata->ch[i].chan) { in sh_mobile_lcdc_probe()
2569 ch->enabled = LDCNT2R_ME; in sh_mobile_lcdc_probe()
2570 ch->reg_offs = lcdc_offs_mainlcd; in sh_mobile_lcdc_probe()
2574 ch->enabled = LDCNT2R_SE; in sh_mobile_lcdc_probe()
2575 ch->reg_offs = lcdc_offs_sublcd; in sh_mobile_lcdc_probe()
2589 priv->forced_fourcc = pdata->ch[0].fourcc; in sh_mobile_lcdc_probe()
2607 struct sh_mobile_lcdc_chan *ch = &priv->ch[i]; in sh_mobile_lcdc_probe() local
2609 error = sh_mobile_lcdc_channel_init(ch); in sh_mobile_lcdc_probe()
2618 ovl->channel = &priv->ch[0]; in sh_mobile_lcdc_probe()
2632 struct sh_mobile_lcdc_chan *ch = priv->ch + i; in sh_mobile_lcdc_probe() local
2634 error = sh_mobile_lcdc_channel_fb_register(ch); in sh_mobile_lcdc_probe()