Lines Matching refs:sinfo

29 #define lcdc_readl(sinfo, reg)		__raw_readl((sinfo)->mmio+(reg))
30 #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
42 static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
54 static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
66 lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg);
69 lcdc_writel(sinfo, ATMEL_LCDC_DMACON,
70 lcdc_readl(sinfo, ATMEL_LCDC_DMACON)
84 struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
85 int power = sinfo->bl_power;
92 if (bl->props.fb_blank != sinfo->bl_power)
94 else if (bl->props.power != sinfo->bl_power)
98 brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
102 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
104 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
107 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
109 bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
116 struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
118 return lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
126 static void init_backlight(struct atmel_lcdfb_info *sinfo)
131 sinfo->bl_power = FB_BLANK_UNBLANK;
133 if (sinfo->backlight)
139 bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
142 dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
146 sinfo->backlight = bl;
153 static void exit_backlight(struct atmel_lcdfb_info *sinfo)
155 if (sinfo->backlight)
156 backlight_device_unregister(sinfo->backlight);
161 static void init_backlight(struct atmel_lcdfb_info *sinfo)
163 dev_warn(&sinfo->pdev->dev, "backlight control is not available\n");
166 static void exit_backlight(struct atmel_lcdfb_info *sinfo)
172 static void init_contrast(struct atmel_lcdfb_info *sinfo)
175 if (sinfo->lcdcon_pol_negative)
179 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
180 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
182 if (sinfo->lcdcon_is_backlight)
183 init_backlight(sinfo);
221 static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
224 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
225 sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
228 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
231 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
234 static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
236 atmel_lcdfb_stop_nowait(sinfo);
239 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
243 static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
245 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
246 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
247 (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
254 struct atmel_lcdfb_info *sinfo = info->par;
264 lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);
266 atmel_lcdfb_update_dma2d(sinfo, var, info);
269 static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
271 struct fb_info *info = sinfo->info;
279 * @sinfo: the frame buffer to allocate memory for
284 static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
286 struct fb_info *info = sinfo->info;
292 info->fix.smem_len = max(smem_len, sinfo->smem_len);
347 struct atmel_lcdfb_info *sinfo = info->par;
350 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
425 if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
443 if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
467 static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
471 atmel_lcdfb_stop(sinfo);
472 atmel_lcdfb_start(sinfo);
491 struct atmel_lcdfb_info *sinfo = info->par;
505 atmel_lcdfb_stop_nowait(sinfo);
524 lcdc_writel(sinfo, ATMEL_LCDC_DMAFRMCFG, value);
532 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
538 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
543 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1,
553 value = sinfo->default_lcdcon2;
572 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON2, value);
579 lcdc_writel(sinfo, ATMEL_LCDC_TIM1, value);
586 lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value);
590 lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2));
596 lcdc_writel(sinfo, ATMEL_LCDC_LCDFRMCFG, value);
600 lcdc_writel(sinfo, ATMEL_LCDC_FIFO, value);
603 lcdc_writel(sinfo, ATMEL_LCDC_MVAL, 0);
606 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
608 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
611 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
614 atmel_lcdfb_start(sinfo);
657 struct atmel_lcdfb_info *sinfo = info->par;
695 if (sinfo->lcd_wiring_mode ==
707 lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
715 lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
737 struct atmel_lcdfb_info *sinfo = info->par;
742 atmel_lcdfb_start(sinfo);
748 atmel_lcdfb_stop(sinfo);
773 struct atmel_lcdfb_info *sinfo = info->par;
776 status = lcdc_readl(sinfo, ATMEL_LCDC_ISR);
780 schedule_work(&sinfo->task);
782 lcdc_writel(sinfo, ATMEL_LCDC_ICR, status);
791 struct atmel_lcdfb_info *sinfo =
794 atmel_lcdfb_reset(sinfo);
797 static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
799 struct fb_info *info = sinfo->info;
818 static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
820 if (sinfo->bus_clk)
821 clk_enable(sinfo->bus_clk);
822 clk_enable(sinfo->lcdc_clk);
825 static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
827 if (sinfo->bus_clk)
828 clk_disable(sinfo->bus_clk);
829 clk_disable(sinfo->lcdc_clk);
837 struct atmel_lcdfb_info *sinfo;
853 sinfo = info->par;
857 sinfo->default_bpp = pdata_sinfo->default_bpp;
858 sinfo->default_dmacon = pdata_sinfo->default_dmacon;
859 sinfo->default_lcdcon2 = pdata_sinfo->default_lcdcon2;
860 sinfo->default_monspecs = pdata_sinfo->default_monspecs;
861 sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
862 sinfo->guard_time = pdata_sinfo->guard_time;
863 sinfo->smem_len = pdata_sinfo->smem_len;
864 sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
865 sinfo->lcdcon_pol_negative = pdata_sinfo->lcdcon_pol_negative;
866 sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode;
871 sinfo->info = info;
872 sinfo->pdev = pdev;
874 strcpy(info->fix.id, sinfo->pdev->name);
876 info->pseudo_palette = sinfo->pseudo_palette;
879 memcpy(&info->monspecs, sinfo->default_monspecs, sizeof(info->monspecs));
885 sinfo->bus_clk = clk_get(dev, "hck1");
886 if (IS_ERR(sinfo->bus_clk)) {
887 ret = PTR_ERR(sinfo->bus_clk);
891 sinfo->lcdc_clk = clk_get(dev, "lcdc_clk");
892 if (IS_ERR(sinfo->lcdc_clk)) {
893 ret = PTR_ERR(sinfo->lcdc_clk);
896 atmel_lcdfb_start_clock(sinfo);
900 sinfo->default_bpp);
914 sinfo->irq_base = platform_get_irq(pdev, 0);
915 if (sinfo->irq_base < 0) {
917 ret = sinfo->irq_base;
943 ret = atmel_lcdfb_alloc_video_memory(sinfo);
960 sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
961 if (!sinfo->mmio) {
967 init_contrast(sinfo);
970 ret = request_irq(sinfo->irq_base, atmel_lcdfb_interrupt, 0, pdev->name, info);
978 INIT_WORK(&sinfo->task, atmel_lcdfb_task);
980 ret = atmel_lcdfb_init_fbinfo(sinfo);
1014 if (sinfo->atmel_lcdfb_power_control)
1015 sinfo->atmel_lcdfb_power_control(1);
1018 info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
1027 cancel_work_sync(&sinfo->task);
1028 free_irq(sinfo->irq_base, info);
1030 exit_backlight(sinfo);
1031 iounmap(sinfo->mmio);
1038 atmel_lcdfb_free_video_memory(sinfo);
1044 atmel_lcdfb_stop_clock(sinfo);
1045 clk_put(sinfo->lcdc_clk);
1047 if (sinfo->bus_clk)
1048 clk_put(sinfo->bus_clk);
1060 struct atmel_lcdfb_info *sinfo;
1064 sinfo = info->par;
1066 cancel_work_sync(&sinfo->task);
1067 exit_backlight(sinfo);
1068 if (sinfo->atmel_lcdfb_power_control)
1069 sinfo->atmel_lcdfb_power_control(0);
1071 atmel_lcdfb_stop_clock(sinfo);
1072 clk_put(sinfo->lcdc_clk);
1073 if (sinfo->bus_clk)
1074 clk_put(sinfo->bus_clk);
1076 free_irq(sinfo->irq_base, info);
1077 iounmap(sinfo->mmio);
1083 atmel_lcdfb_free_video_memory(sinfo);
1097 struct atmel_lcdfb_info *sinfo = info->par;
1103 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
1105 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
1106 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
1107 if (sinfo->atmel_lcdfb_power_control)
1108 sinfo->atmel_lcdfb_power_control(0);
1110 atmel_lcdfb_stop(sinfo);
1111 atmel_lcdfb_stop_clock(sinfo);
1119 struct atmel_lcdfb_info *sinfo = info->par;
1121 atmel_lcdfb_start_clock(sinfo);
1122 atmel_lcdfb_start(sinfo);
1123 if (sinfo->atmel_lcdfb_power_control)
1124 sinfo->atmel_lcdfb_power_control(1);
1125 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
1128 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI