Lines Matching defs:sinfo

70 #define lcdc_readl(sinfo, reg)		__raw_readl((sinfo)->mmio+(reg))
71 #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
111 struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
112 int power = sinfo->bl_power;
119 if (bl->props.fb_blank != sinfo->bl_power)
121 else if (bl->props.power != sinfo->bl_power)
125 brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
129 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
131 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
134 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
136 bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
143 struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
145 return lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
153 static void init_backlight(struct atmel_lcdfb_info *sinfo)
158 sinfo->bl_power = FB_BLANK_UNBLANK;
160 if (sinfo->backlight)
166 bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
169 dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
173 sinfo->backlight = bl;
180 static void exit_backlight(struct atmel_lcdfb_info *sinfo)
182 if (!sinfo->backlight)
185 if (sinfo->backlight->ops) {
186 sinfo->backlight->props.power = FB_BLANK_POWERDOWN;
187 sinfo->backlight->ops->update_status(sinfo->backlight);
189 backlight_device_unregister(sinfo->backlight);
194 static void init_backlight(struct atmel_lcdfb_info *sinfo)
196 dev_warn(&sinfo->pdev->dev, "backlight control is not available\n");
199 static void exit_backlight(struct atmel_lcdfb_info *sinfo)
205 static void init_contrast(struct atmel_lcdfb_info *sinfo)
207 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
214 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
215 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
218 init_backlight(sinfo);
221 static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on)
224 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
228 else if (sinfo->reg_lcd) {
230 ret = regulator_enable(sinfo->reg_lcd);
232 dev_err(&sinfo->pdev->dev,
235 ret = regulator_disable(sinfo->reg_lcd);
237 dev_err(&sinfo->pdev->dev,
252 static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo,
258 if (!sinfo->config->have_hozval)
261 lcdcon2 = lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2);
279 static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
281 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
284 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
288 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
291 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
294 static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
296 atmel_lcdfb_stop_nowait(sinfo);
299 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
303 static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
305 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
307 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon);
308 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
316 struct atmel_lcdfb_info *sinfo = info->par;
326 lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);
329 static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
331 struct fb_info *info = sinfo->info;
339 * @sinfo: the frame buffer to allocate memory for
344 static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
346 struct fb_info *info = sinfo->info;
352 info->fix.smem_len = max(smem_len, sinfo->smem_len);
408 struct atmel_lcdfb_info *sinfo = info->par;
409 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
412 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
491 if (sinfo->config->have_intensity_bit)
537 static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
541 atmel_lcdfb_stop(sinfo);
542 atmel_lcdfb_start(sinfo);
561 struct atmel_lcdfb_info *sinfo = info->par;
562 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
576 atmel_lcdfb_stop_nowait(sinfo);
595 lcdc_writel(sinfo, ATMEL_LCDC_DMAFRMCFG, value);
600 if (sinfo->config->have_alt_pixclock)
603 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
609 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
614 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1,
643 lcdc_writel(sinfo, ATMEL_LCDC_LCDCON2, value);
650 lcdc_writel(sinfo, ATMEL_LCDC_TIM1, value);
657 lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value);
660 hozval_linesz = compute_hozval(sinfo, info->var.xres);
666 lcdc_writel(sinfo, ATMEL_LCDC_LCDFRMCFG, value);
670 lcdc_writel(sinfo, ATMEL_LCDC_FIFO, value);
673 lcdc_writel(sinfo, ATMEL_LCDC_MVAL, 0);
676 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U);
678 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
681 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
684 atmel_lcdfb_start(sinfo);
727 struct atmel_lcdfb_info *sinfo = info->par;
728 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
753 if (sinfo->config->have_intensity_bit) {
776 lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
784 lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
806 struct atmel_lcdfb_info *sinfo = info->par;
811 atmel_lcdfb_start(sinfo);
817 atmel_lcdfb_stop(sinfo);
842 struct atmel_lcdfb_info *sinfo = info->par;
845 status = lcdc_readl(sinfo, ATMEL_LCDC_ISR);
849 schedule_work(&sinfo->task);
851 lcdc_writel(sinfo, ATMEL_LCDC_ICR, status);
860 struct atmel_lcdfb_info *sinfo =
863 atmel_lcdfb_reset(sinfo);
866 static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
868 struct fb_info *info = sinfo->info;
887 static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
889 clk_prepare_enable(sinfo->bus_clk);
890 clk_prepare_enable(sinfo->lcdc_clk);
893 static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
895 clk_disable_unprepare(sinfo->bus_clk);
896 clk_disable_unprepare(sinfo->lcdc_clk);
940 static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
942 struct fb_info *info = sinfo->info;
943 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
945 struct device *dev = &sinfo->pdev->dev;
956 sinfo->config = (struct atmel_lcdfb_config*)
1046 struct atmel_lcdfb_info *sinfo;
1059 sinfo = info->par;
1060 sinfo->pdev = pdev;
1061 sinfo->info = info;
1070 ret = atmel_lcdfb_of_init(sinfo);
1075 if (!sinfo->config)
1078 sinfo->reg_lcd = devm_regulator_get(&pdev->dev, "lcd");
1079 if (IS_ERR(sinfo->reg_lcd))
1080 sinfo->reg_lcd = NULL;
1084 info->pseudo_palette = sinfo->pseudo_palette;
1088 strcpy(info->fix.id, sinfo->pdev->name);
1091 sinfo->bus_clk = clk_get(dev, "hclk");
1092 if (IS_ERR(sinfo->bus_clk)) {
1093 ret = PTR_ERR(sinfo->bus_clk);
1096 sinfo->lcdc_clk = clk_get(dev, "lcdc_clk");
1097 if (IS_ERR(sinfo->lcdc_clk)) {
1098 ret = PTR_ERR(sinfo->lcdc_clk);
1101 atmel_lcdfb_start_clock(sinfo);
1116 sinfo->irq_base = platform_get_irq(pdev, 0);
1117 if (sinfo->irq_base < 0) {
1118 ret = sinfo->irq_base;
1147 ret = atmel_lcdfb_alloc_video_memory(sinfo);
1164 sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
1165 if (!sinfo->mmio) {
1172 init_contrast(sinfo);
1175 ret = request_irq(sinfo->irq_base, atmel_lcdfb_interrupt, 0, pdev->name, info);
1183 INIT_WORK(&sinfo->task, atmel_lcdfb_task);
1185 ret = atmel_lcdfb_init_fbinfo(sinfo);
1209 atmel_lcdfb_power_control(sinfo, 1);
1212 info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
1220 cancel_work_sync(&sinfo->task);
1221 free_irq(sinfo->irq_base, info);
1223 exit_backlight(sinfo);
1224 iounmap(sinfo->mmio);
1231 atmel_lcdfb_free_video_memory(sinfo);
1237 atmel_lcdfb_stop_clock(sinfo);
1238 clk_put(sinfo->lcdc_clk);
1240 clk_put(sinfo->bus_clk);
1252 struct atmel_lcdfb_info *sinfo;
1256 sinfo = info->par;
1258 cancel_work_sync(&sinfo->task);
1259 exit_backlight(sinfo);
1260 atmel_lcdfb_power_control(sinfo, 0);
1262 atmel_lcdfb_stop_clock(sinfo);
1263 clk_put(sinfo->lcdc_clk);
1264 clk_put(sinfo->bus_clk);
1266 free_irq(sinfo->irq_base, info);
1267 iounmap(sinfo->mmio);
1273 atmel_lcdfb_free_video_memory(sinfo);
1286 struct atmel_lcdfb_info *sinfo = info->par;
1292 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0U);
1294 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
1295 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
1296 atmel_lcdfb_power_control(sinfo, 0);
1297 atmel_lcdfb_stop(sinfo);
1298 atmel_lcdfb_stop_clock(sinfo);
1306 struct atmel_lcdfb_info *sinfo = info->par;
1308 atmel_lcdfb_start_clock(sinfo);
1309 atmel_lcdfb_start(sinfo);
1310 atmel_lcdfb_power_control(sinfo, 1);
1311 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
1314 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI