Lines Matching refs:sinfo

69 #define lcdc_readl(sinfo, reg)		__raw_readl((sinfo)->mmio+(reg))
70 #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
110 struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
113 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
115 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
118 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
125 struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
127 return lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
135 static void init_backlight(struct atmel_lcdfb_info *sinfo)
140 if (sinfo->backlight)
146 bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
149 dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
153 sinfo->backlight = bl;
160 static void exit_backlight(struct atmel_lcdfb_info *sinfo)
162 if (!sinfo->backlight)
165 if (sinfo->backlight->ops) {
166 sinfo->backlight->props.power = FB_BLANK_POWERDOWN;
167 sinfo->backlight->ops->update_status(sinfo->backlight);
169 backlight_device_unregister(sinfo->backlight);
174 static void init_backlight(struct atmel_lcdfb_info *sinfo)
176 dev_warn(&sinfo->pdev->dev, "backlight control is not available\n");
179 static void exit_backlight(struct atmel_lcdfb_info *sinfo)
185 static void init_contrast(struct atmel_lcdfb_info *sinfo)
187 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
194 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
195 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
198 init_backlight(sinfo);
201 static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on)
204 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
208 else if (sinfo->reg_lcd) {
210 ret = regulator_enable(sinfo->reg_lcd);
212 dev_err(&sinfo->pdev->dev,
215 ret = regulator_disable(sinfo->reg_lcd);
217 dev_err(&sinfo->pdev->dev,
232 static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo,
238 if (!sinfo->config->have_hozval)
241 lcdcon2 = lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2);
259 static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
261 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
264 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
268 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
271 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
274 static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
276 atmel_lcdfb_stop_nowait(sinfo);
279 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
283 static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
285 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
287 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon);
288 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
296 struct atmel_lcdfb_info *sinfo = info->par;
306 lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);
309 static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
311 struct fb_info *info = sinfo->info;
319 * @sinfo: the frame buffer to allocate memory for
324 static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
326 struct fb_info *info = sinfo->info;
332 info->fix.smem_len = max(smem_len, sinfo->smem_len);
388 struct atmel_lcdfb_info *sinfo = info->par;
389 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
392 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
471 if (sinfo->config->have_intensity_bit)
517 static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
521 atmel_lcdfb_stop(sinfo);
522 atmel_lcdfb_start(sinfo);
541 struct atmel_lcdfb_info *sinfo = info->par;
542 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
556 atmel_lcdfb_stop_nowait(sinfo);
575 lcdc_writel(sinfo, ATMEL_LCDC_DMAFRMCFG, value);
580 if (sinfo->config->have_alt_pixclock)
583 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
589 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
594 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1,
623 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON2, value);
630 lcdc_writel(sinfo, ATMEL_LCDC_TIM1, value);
637 lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value);
640 hozval_linesz = compute_hozval(sinfo, info->var.xres);
646 lcdc_writel(sinfo, ATMEL_LCDC_LCDFRMCFG, value);
650 lcdc_writel(sinfo, ATMEL_LCDC_FIFO, value);
653 lcdc_writel(sinfo, ATMEL_LCDC_MVAL, 0);
656 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U);
658 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
661 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
664 atmel_lcdfb_start(sinfo);
707 struct atmel_lcdfb_info *sinfo = info->par;
708 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
733 if (sinfo->config->have_intensity_bit) {
756 lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
764 lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
786 struct atmel_lcdfb_info *sinfo = info->par;
791 atmel_lcdfb_start(sinfo);
797 atmel_lcdfb_stop(sinfo);
820 struct atmel_lcdfb_info *sinfo = info->par;
823 status = lcdc_readl(sinfo, ATMEL_LCDC_ISR);
827 schedule_work(&sinfo->task);
829 lcdc_writel(sinfo, ATMEL_LCDC_ICR, status);
838 struct atmel_lcdfb_info *sinfo =
841 atmel_lcdfb_reset(sinfo);
844 static int atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
846 struct fb_info *info = sinfo->info;
865 static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
867 clk_prepare_enable(sinfo->bus_clk);
868 clk_prepare_enable(sinfo->lcdc_clk);
871 static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
873 clk_disable_unprepare(sinfo->bus_clk);
874 clk_disable_unprepare(sinfo->lcdc_clk);
918 static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
920 struct fb_info *info = sinfo->info;
921 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
923 struct device *dev = &sinfo->pdev->dev;
934 sinfo->config = (struct atmel_lcdfb_config*)
1024 struct atmel_lcdfb_info *sinfo;
1037 sinfo = info->par;
1038 sinfo->pdev = pdev;
1039 sinfo->info = info;
1048 ret = atmel_lcdfb_of_init(sinfo);
1053 if (!sinfo->config)
1056 sinfo->reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
1057 if (IS_ERR(sinfo->reg_lcd))
1058 sinfo->reg_lcd = NULL;
1062 info->pseudo_palette = sinfo->pseudo_palette;
1066 strcpy(info->fix.id, sinfo->pdev->name);
1069 sinfo->bus_clk = clk_get(dev, "hclk");
1070 if (IS_ERR(sinfo->bus_clk)) {
1071 ret = PTR_ERR(sinfo->bus_clk);
1074 sinfo->lcdc_clk = clk_get(dev, "lcdc_clk");
1075 if (IS_ERR(sinfo->lcdc_clk)) {
1076 ret = PTR_ERR(sinfo->lcdc_clk);
1079 atmel_lcdfb_start_clock(sinfo);
1094 sinfo->irq_base = platform_get_irq(pdev, 0);
1095 if (sinfo->irq_base < 0) {
1096 ret = sinfo->irq_base;
1125 ret = atmel_lcdfb_alloc_video_memory(sinfo);
1142 sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
1143 if (!sinfo->mmio) {
1150 init_contrast(sinfo);
1153 ret = request_irq(sinfo->irq_base, atmel_lcdfb_interrupt, 0, pdev->name, info);
1161 INIT_WORK(&sinfo->task, atmel_lcdfb_task);
1163 ret = atmel_lcdfb_init_fbinfo(sinfo);
1187 atmel_lcdfb_power_control(sinfo, 1);
1190 info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
1198 cancel_work_sync(&sinfo->task);
1199 free_irq(sinfo->irq_base, info);
1201 exit_backlight(sinfo);
1202 iounmap(sinfo->mmio);
1209 atmel_lcdfb_free_video_memory(sinfo);
1215 atmel_lcdfb_stop_clock(sinfo);
1216 clk_put(sinfo->lcdc_clk);
1218 clk_put(sinfo->bus_clk);
1230 struct atmel_lcdfb_info *sinfo;
1234 sinfo = info->par;
1236 cancel_work_sync(&sinfo->task);
1237 exit_backlight(sinfo);
1238 atmel_lcdfb_power_control(sinfo, 0);
1240 atmel_lcdfb_stop_clock(sinfo);
1241 clk_put(sinfo->lcdc_clk);
1242 clk_put(sinfo->bus_clk);
1244 free_irq(sinfo->irq_base, info);
1245 iounmap(sinfo->mmio);
1251 atmel_lcdfb_free_video_memory(sinfo);
1262 struct atmel_lcdfb_info *sinfo = info->par;
1268 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U);
1270 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
1271 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
1272 atmel_lcdfb_power_control(sinfo, 0);
1273 atmel_lcdfb_stop(sinfo);
1274 atmel_lcdfb_stop_clock(sinfo);
1282 struct atmel_lcdfb_info *sinfo = info->par;
1284 atmel_lcdfb_start_clock(sinfo);
1285 atmel_lcdfb_start(sinfo);
1286 atmel_lcdfb_power_control(sinfo, 1);
1287 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
1290 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI