Lines Matching refs:fbi

204 static inline int is_imx1_fb(struct imxfb_info *fbi)  in is_imx1_fb()  argument
206 return fbi->devtype == IMX1_FB; in is_imx1_fb()
262 struct imxfb_info *fbi = info->par; in imxfb_setpalettereg() local
266 if (regno < fbi->palette_size) { in imxfb_setpalettereg()
271 writel(val, fbi->regs + 0x800 + (regno << 2)); in imxfb_setpalettereg()
280 struct imxfb_info *fbi = info->par; in imxfb_setcolreg() local
290 if (fbi->cmap_inverse) { in imxfb_setcolreg()
331 static const struct imx_fb_videomode *imxfb_find_mode(struct imxfb_info *fbi) in imxfb_find_mode() argument
337 return &fbi->mode[0]; in imxfb_find_mode()
339 for (i = 0, m = &fbi->mode[0]; i < fbi->num_modes; i++, m++) { in imxfb_find_mode()
354 struct imxfb_info *fbi = info->par; in imxfb_check_var() local
366 imxfb_mode = imxfb_find_mode(fbi); in imxfb_check_var()
386 lcd_clk = clk_get_rate(fbi->clk_per); in imxfb_check_var()
410 if (is_imx1_fb(fbi)) in imxfb_check_var()
429 fbi->pcr = pcr; in imxfb_check_var()
433 if (!is_imx1_fb(fbi) && imxfb_mode->aus_mode) in imxfb_check_var()
434 fbi->lauscr = LAUSCR_AUS_MODE; in imxfb_check_var()
462 struct imxfb_info *fbi = info->par; in imxfb_set_par() local
467 else if (!fbi->cmap_static) in imxfb_set_par()
479 fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16; in imxfb_set_par()
486 static int imxfb_enable_controller(struct imxfb_info *fbi) in imxfb_enable_controller() argument
490 if (fbi->enabled) in imxfb_enable_controller()
495 writel(fbi->map_dma, fbi->regs + LCDC_SSA); in imxfb_enable_controller()
498 writel(0x00000000, fbi->regs + LCDC_POS); in imxfb_enable_controller()
501 writel(readl(fbi->regs + LCDC_CPOS) & ~(CPOS_CC0 | CPOS_CC1), in imxfb_enable_controller()
502 fbi->regs + LCDC_CPOS); in imxfb_enable_controller()
508 writel(RMCR_LCDC_EN_MX1, fbi->regs + LCDC_RMCR); in imxfb_enable_controller()
510 ret = clk_prepare_enable(fbi->clk_ipg); in imxfb_enable_controller()
514 ret = clk_prepare_enable(fbi->clk_ahb); in imxfb_enable_controller()
518 ret = clk_prepare_enable(fbi->clk_per); in imxfb_enable_controller()
522 fbi->enabled = true; in imxfb_enable_controller()
526 clk_disable_unprepare(fbi->clk_ahb); in imxfb_enable_controller()
528 clk_disable_unprepare(fbi->clk_ipg); in imxfb_enable_controller()
530 writel(0, fbi->regs + LCDC_RMCR); in imxfb_enable_controller()
535 static void imxfb_disable_controller(struct imxfb_info *fbi) in imxfb_disable_controller() argument
537 if (!fbi->enabled) in imxfb_disable_controller()
542 clk_disable_unprepare(fbi->clk_per); in imxfb_disable_controller()
543 clk_disable_unprepare(fbi->clk_ahb); in imxfb_disable_controller()
544 clk_disable_unprepare(fbi->clk_ipg); in imxfb_disable_controller()
545 fbi->enabled = false; in imxfb_disable_controller()
547 writel(0, fbi->regs + LCDC_RMCR); in imxfb_disable_controller()
552 struct imxfb_info *fbi = info->par; in imxfb_blank() local
561 imxfb_disable_controller(fbi); in imxfb_blank()
565 return imxfb_enable_controller(fbi); in imxfb_blank()
588 struct imxfb_info *fbi = info->par; in imxfb_activate_var() local
589 u32 ymax_mask = is_imx1_fb(fbi) ? YMAX_MASK_IMX1 : YMAX_MASK_IMX21; in imxfb_activate_var()
627 fbi->regs + LCDC_VPW); in imxfb_activate_var()
632 fbi->regs + LCDC_HCR); in imxfb_activate_var()
637 fbi->regs + LCDC_VCR); in imxfb_activate_var()
640 fbi->regs + LCDC_SIZE); in imxfb_activate_var()
642 writel(fbi->pcr, fbi->regs + LCDC_PCR); in imxfb_activate_var()
643 if (fbi->pwmr) in imxfb_activate_var()
644 writel(fbi->pwmr, fbi->regs + LCDC_PWMR); in imxfb_activate_var()
645 writel(fbi->lscr1, fbi->regs + LCDC_LSCR1); in imxfb_activate_var()
648 if (fbi->dmacr) in imxfb_activate_var()
649 writel(fbi->dmacr, fbi->regs + LCDC_DMACR); in imxfb_activate_var()
651 if (fbi->lauscr) in imxfb_activate_var()
652 writel(fbi->lauscr, fbi->regs + LCDC_LAUSCR); in imxfb_activate_var()
661 struct imxfb_info *fbi = info->par; in imxfb_init_fbinfo() local
670 memset(fbi, 0, sizeof(struct imxfb_info)); in imxfb_init_fbinfo()
672 fbi->devtype = pdev->id_entry->driver_data; in imxfb_init_fbinfo()
694 fbi->lscr1 = pdata->lscr1; in imxfb_init_fbinfo()
695 fbi->dmacr = pdata->dmacr; in imxfb_init_fbinfo()
696 fbi->pwmr = pdata->pwmr; in imxfb_init_fbinfo()
701 fbi->cmap_inverse = of_property_read_bool(np, "cmap-inverse"); in imxfb_init_fbinfo()
702 fbi->cmap_static = of_property_read_bool(np, "cmap-static"); in imxfb_init_fbinfo()
704 fbi->lscr1 = IMXFB_LSCR1_DEFAULT; in imxfb_init_fbinfo()
706 of_property_read_u32(np, "fsl,lpccr", &fbi->pwmr); in imxfb_init_fbinfo()
708 of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1); in imxfb_init_fbinfo()
710 of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr); in imxfb_init_fbinfo()
760 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); in imxfb_lcd_check_fb() local
762 if (!fi || fi->par == fbi) in imxfb_lcd_check_fb()
770 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); in imxfb_lcd_get_contrast() local
772 return fbi->pwmr & 0xff; in imxfb_lcd_get_contrast()
777 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); in imxfb_lcd_set_contrast() local
779 if (fbi->pwmr && fbi->enabled) { in imxfb_lcd_set_contrast()
785 fbi->pwmr &= ~0xff; in imxfb_lcd_set_contrast()
786 fbi->pwmr |= contrast; in imxfb_lcd_set_contrast()
788 writel(fbi->pwmr, fbi->regs + LCDC_PWMR); in imxfb_lcd_set_contrast()
796 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); in imxfb_lcd_get_power() local
798 if (!IS_ERR(fbi->lcd_pwr) && in imxfb_lcd_get_power()
799 !regulator_is_enabled(fbi->lcd_pwr)) in imxfb_lcd_get_power()
805 static int imxfb_regulator_set(struct imxfb_info *fbi, int enable) in imxfb_regulator_set() argument
809 if (enable == fbi->lcd_pwr_enabled) in imxfb_regulator_set()
813 ret = regulator_enable(fbi->lcd_pwr); in imxfb_regulator_set()
815 ret = regulator_disable(fbi->lcd_pwr); in imxfb_regulator_set()
818 fbi->lcd_pwr_enabled = enable; in imxfb_regulator_set()
825 struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); in imxfb_lcd_set_power() local
827 if (!IS_ERR(fbi->lcd_pwr)) in imxfb_lcd_set_power()
828 return imxfb_regulator_set(fbi, power == FB_BLANK_UNBLANK); in imxfb_lcd_set_power()
863 struct imxfb_info *fbi; in imxfb_probe() local
893 fbi = info->par; in imxfb_probe()
905 fbi->mode = pdata->mode; in imxfb_probe()
906 fbi->num_modes = pdata->num_modes; in imxfb_probe()
922 fbi->num_modes = 1; in imxfb_probe()
924 fbi->mode = devm_kzalloc(&pdev->dev, in imxfb_probe()
926 if (!fbi->mode) { in imxfb_probe()
931 ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode); in imxfb_probe()
938 m = &fbi->mode[0]; in imxfb_probe()
940 for (i = 0; i < fbi->num_modes; i++, m++) in imxfb_probe()
951 fbi->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); in imxfb_probe()
952 if (IS_ERR(fbi->clk_ipg)) { in imxfb_probe()
953 ret = PTR_ERR(fbi->clk_ipg); in imxfb_probe()
967 ret = clk_prepare_enable(fbi->clk_ipg); in imxfb_probe()
970 clk_disable_unprepare(fbi->clk_ipg); in imxfb_probe()
972 fbi->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); in imxfb_probe()
973 if (IS_ERR(fbi->clk_ahb)) { in imxfb_probe()
974 ret = PTR_ERR(fbi->clk_ahb); in imxfb_probe()
978 fbi->clk_per = devm_clk_get(&pdev->dev, "per"); in imxfb_probe()
979 if (IS_ERR(fbi->clk_per)) { in imxfb_probe()
980 ret = PTR_ERR(fbi->clk_per); in imxfb_probe()
984 fbi->regs = ioremap(res->start, resource_size(res)); in imxfb_probe()
985 if (fbi->regs == NULL) { in imxfb_probe()
991 fbi->map_size = PAGE_ALIGN(info->fix.smem_len); in imxfb_probe()
992 info->screen_buffer = dma_alloc_wc(&pdev->dev, fbi->map_size, in imxfb_probe()
993 &fbi->map_dma, GFP_KERNEL); in imxfb_probe()
1000 info->fix.smem_start = fbi->map_dma; in imxfb_probe()
1003 ret = pdata->init(fbi->pdev); in imxfb_probe()
1010 for (i = 0; i < fbi->num_modes; i++) in imxfb_probe()
1011 fb_add_videomode(&fbi->mode[i].mode, &info->modelist); in imxfb_probe()
1034 fbi->lcd_pwr = devm_regulator_get(&pdev->dev, "lcd"); in imxfb_probe()
1035 if (PTR_ERR(fbi->lcd_pwr) == -EPROBE_DEFER) { in imxfb_probe()
1040 lcd = devm_lcd_device_register(&pdev->dev, "imxfb-lcd", &pdev->dev, fbi, in imxfb_probe()
1049 imxfb_enable_controller(fbi); in imxfb_probe()
1050 fbi->pdev = pdev; in imxfb_probe()
1061 pdata->exit(fbi->pdev); in imxfb_probe()
1063 dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer, in imxfb_probe()
1064 fbi->map_dma); in imxfb_probe()
1066 iounmap(fbi->regs); in imxfb_probe()
1082 struct imxfb_info *fbi = info->par; in imxfb_remove() local
1087 imxfb_disable_controller(fbi); in imxfb_remove()
1093 pdata->exit(fbi->pdev); in imxfb_remove()
1094 dma_free_wc(&pdev->dev, fbi->map_size, info->screen_buffer, in imxfb_remove()
1095 fbi->map_dma); in imxfb_remove()
1096 iounmap(fbi->regs); in imxfb_remove()
1107 struct imxfb_info *fbi = info->par; in imxfb_suspend() local
1109 imxfb_disable_controller(fbi); in imxfb_suspend()
1117 struct imxfb_info *fbi = info->par; in imxfb_resume() local
1119 imxfb_enable_controller(fbi); in imxfb_resume()