Lines Matching +full:at91sam9rl +full:- +full:pwm
13 #include <linux/dma-mapping.h>
69 #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
70 #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
107 /* some bl->props field just changed */
140 if (sinfo->backlight) in init_backlight()
146 bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo, in init_backlight()
149 dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n", in init_backlight()
153 sinfo->backlight = bl; in init_backlight()
155 bl->props.power = FB_BLANK_UNBLANK; in init_backlight()
156 bl->props.brightness = atmel_bl_get_brightness(bl); in init_backlight()
161 if (!sinfo->backlight) in exit_backlight()
164 if (sinfo->backlight->ops) { in exit_backlight()
165 sinfo->backlight->props.power = FB_BLANK_POWERDOWN; in exit_backlight()
166 sinfo->backlight->ops->update_status(sinfo->backlight); in exit_backlight()
168 backlight_device_unregister(sinfo->backlight); in exit_backlight()
175 dev_warn(&sinfo->pdev->dev, "backlight control is not available\n"); in init_backlight()
186 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in init_contrast()
188 /* contrast pwm can be 'inverted' */ in init_contrast()
189 if (pdata->lcdcon_pol_negative) in init_contrast()
196 if (pdata->lcdcon_is_backlight) in init_contrast()
203 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_power_control()
205 if (pdata->atmel_lcdfb_power_control) in atmel_lcdfb_power_control()
206 pdata->atmel_lcdfb_power_control(pdata, on); in atmel_lcdfb_power_control()
207 else if (sinfo->reg_lcd) { in atmel_lcdfb_power_control()
209 ret = regulator_enable(sinfo->reg_lcd); in atmel_lcdfb_power_control()
211 dev_err(&sinfo->pdev->dev, in atmel_lcdfb_power_control()
214 ret = regulator_disable(sinfo->reg_lcd); in atmel_lcdfb_power_control()
216 dev_err(&sinfo->pdev->dev, in atmel_lcdfb_power_control()
237 if (!sinfo->config->have_hozval) in compute_hozval()
260 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_stop_nowait()
264 pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET); in atmel_lcdfb_stop_nowait()
284 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_start()
286 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon); in atmel_lcdfb_start()
288 (pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET) in atmel_lcdfb_start()
295 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_update_dma()
296 struct fb_fix_screeninfo *fix = &info->fix; in atmel_lcdfb_update_dma()
299 dma_addr = (fix->smem_start + var->yoffset * fix->line_length in atmel_lcdfb_update_dma()
300 + var->xoffset * info->var.bits_per_pixel / 8); in atmel_lcdfb_update_dma()
310 struct fb_info *info = sinfo->info; in atmel_lcdfb_free_video_memory()
312 dma_free_wc(info->device, info->fix.smem_len, info->screen_base, in atmel_lcdfb_free_video_memory()
313 info->fix.smem_start); in atmel_lcdfb_free_video_memory()
317 * atmel_lcdfb_alloc_video_memory - Allocate framebuffer memory
321 * so no locking by fb_info->mm_lock around smem_len setting is needed.
325 struct fb_info *info = sinfo->info; in atmel_lcdfb_alloc_video_memory()
326 struct fb_var_screeninfo *var = &info->var; in atmel_lcdfb_alloc_video_memory()
329 smem_len = (var->xres_virtual * var->yres_virtual in atmel_lcdfb_alloc_video_memory()
330 * ((var->bits_per_pixel + 7) / 8)); in atmel_lcdfb_alloc_video_memory()
331 info->fix.smem_len = max(smem_len, sinfo->smem_len); in atmel_lcdfb_alloc_video_memory()
333 info->screen_base = dma_alloc_wc(info->device, info->fix.smem_len, in atmel_lcdfb_alloc_video_memory()
334 (dma_addr_t *)&info->fix.smem_start, in atmel_lcdfb_alloc_video_memory()
337 if (!info->screen_base) { in atmel_lcdfb_alloc_video_memory()
338 return -ENOMEM; in atmel_lcdfb_alloc_video_memory()
341 memset(info->screen_base, 0, info->fix.smem_len); in atmel_lcdfb_alloc_video_memory()
353 fbmode = fb_find_nearest_mode(&varfbmode, &info->modelist); in atmel_lcdfb_choose_mode()
361 * atmel_lcdfb_check_var - Validates a var passed in.
375 * -EINVAL will be returned by the upper layers. You don't need
386 struct device *dev = info->device; in atmel_lcdfb_check_var()
387 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_check_var()
388 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_check_var()
391 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; in atmel_lcdfb_check_var()
395 if (!(var->pixclock && var->bits_per_pixel)) { in atmel_lcdfb_check_var()
399 return -EINVAL; in atmel_lcdfb_check_var()
403 dev_dbg(dev, " resolution: %ux%u\n", var->xres, var->yres); in atmel_lcdfb_check_var()
404 dev_dbg(dev, " pixclk: %lu KHz\n", PICOS2KHZ(var->pixclock)); in atmel_lcdfb_check_var()
405 dev_dbg(dev, " bpp: %u\n", var->bits_per_pixel); in atmel_lcdfb_check_var()
408 if (PICOS2KHZ(var->pixclock) > clk_value_khz) { in atmel_lcdfb_check_var()
409 dev_err(dev, "%lu KHz pixel clock is too fast\n", PICOS2KHZ(var->pixclock)); in atmel_lcdfb_check_var()
410 return -EINVAL; in atmel_lcdfb_check_var()
414 if (var->xres > var->xres_virtual) in atmel_lcdfb_check_var()
415 var->xres_virtual = var->xres; in atmel_lcdfb_check_var()
417 if (var->yres > var->yres_virtual) in atmel_lcdfb_check_var()
418 var->yres_virtual = var->yres; in atmel_lcdfb_check_var()
421 var->xres = (var->xres + 3) & ~3UL; in atmel_lcdfb_check_var()
422 var->xres_virtual = (var->xres_virtual + 3) & ~3UL; in atmel_lcdfb_check_var()
424 var->red.msb_right = var->green.msb_right = var->blue.msb_right = 0; in atmel_lcdfb_check_var()
425 var->transp.msb_right = 0; in atmel_lcdfb_check_var()
426 var->transp.offset = var->transp.length = 0; in atmel_lcdfb_check_var()
427 var->xoffset = var->yoffset = 0; in atmel_lcdfb_check_var()
429 if (info->fix.smem_len) { in atmel_lcdfb_check_var()
430 unsigned int smem_len = (var->xres_virtual * var->yres_virtual in atmel_lcdfb_check_var()
431 * ((var->bits_per_pixel + 7) / 8)); in atmel_lcdfb_check_var()
432 if (smem_len > info->fix.smem_len) { in atmel_lcdfb_check_var()
434 info->fix.smem_len, smem_len); in atmel_lcdfb_check_var()
435 return -EINVAL; in atmel_lcdfb_check_var()
440 var->vsync_len = min_t(u32, var->vsync_len, in atmel_lcdfb_check_var()
442 var->upper_margin = min_t(u32, var->upper_margin, in atmel_lcdfb_check_var()
444 var->lower_margin = min_t(u32, var->lower_margin, in atmel_lcdfb_check_var()
446 var->right_margin = min_t(u32, var->right_margin, in atmel_lcdfb_check_var()
448 var->hsync_len = min_t(u32, var->hsync_len, in atmel_lcdfb_check_var()
450 var->left_margin = min_t(u32, var->left_margin, in atmel_lcdfb_check_var()
454 var->vsync_len = max_t(u32, var->vsync_len, 1); in atmel_lcdfb_check_var()
455 var->right_margin = max_t(u32, var->right_margin, 1); in atmel_lcdfb_check_var()
456 var->hsync_len = max_t(u32, var->hsync_len, 1); in atmel_lcdfb_check_var()
457 var->left_margin = max_t(u32, var->left_margin, 1); in atmel_lcdfb_check_var()
459 switch (var->bits_per_pixel) { in atmel_lcdfb_check_var()
464 var->red.offset = var->green.offset = var->blue.offset = 0; in atmel_lcdfb_check_var()
465 var->red.length = var->green.length = var->blue.length in atmel_lcdfb_check_var()
466 = var->bits_per_pixel; in atmel_lcdfb_check_var()
470 if (sinfo->config->have_intensity_bit) in atmel_lcdfb_check_var()
471 var->green.length = 5; in atmel_lcdfb_check_var()
473 var->green.length = 6; in atmel_lcdfb_check_var()
475 if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { in atmel_lcdfb_check_var()
477 var->red.offset = var->green.length + 5; in atmel_lcdfb_check_var()
478 var->blue.offset = 0; in atmel_lcdfb_check_var()
481 var->red.offset = 0; in atmel_lcdfb_check_var()
482 var->blue.offset = var->green.length + 5; in atmel_lcdfb_check_var()
484 var->green.offset = 5; in atmel_lcdfb_check_var()
485 var->red.length = var->blue.length = 5; in atmel_lcdfb_check_var()
488 var->transp.offset = 24; in atmel_lcdfb_check_var()
489 var->transp.length = 8; in atmel_lcdfb_check_var()
492 if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { in atmel_lcdfb_check_var()
494 var->red.offset = 16; in atmel_lcdfb_check_var()
495 var->blue.offset = 0; in atmel_lcdfb_check_var()
498 var->red.offset = 0; in atmel_lcdfb_check_var()
499 var->blue.offset = 16; in atmel_lcdfb_check_var()
501 var->green.offset = 8; in atmel_lcdfb_check_var()
502 var->red.length = var->green.length = var->blue.length = 8; in atmel_lcdfb_check_var()
506 var->bits_per_pixel); in atmel_lcdfb_check_var()
507 return -EINVAL; in atmel_lcdfb_check_var()
525 * atmel_lcdfb_set_par - Alters the hardware state.
540 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_set_par()
541 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_set_par()
550 dev_dbg(info->device, "%s:\n", __func__); in atmel_lcdfb_set_par()
551 dev_dbg(info->device, " * resolution: %ux%u (%ux%u virtual)\n", in atmel_lcdfb_set_par()
552 info->var.xres, info->var.yres, in atmel_lcdfb_set_par()
553 info->var.xres_virtual, info->var.yres_virtual); in atmel_lcdfb_set_par()
557 if (info->var.bits_per_pixel == 1) in atmel_lcdfb_set_par()
558 info->fix.visual = FB_VISUAL_MONO01; in atmel_lcdfb_set_par()
559 else if (info->var.bits_per_pixel <= 8) in atmel_lcdfb_set_par()
560 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; in atmel_lcdfb_set_par()
562 info->fix.visual = FB_VISUAL_TRUECOLOR; in atmel_lcdfb_set_par()
564 bits_per_line = info->var.xres_virtual * info->var.bits_per_pixel; in atmel_lcdfb_set_par()
565 info->fix.line_length = DIV_ROUND_UP(bits_per_line, 8); in atmel_lcdfb_set_par()
567 /* Re-initialize the DMA engine... */ in atmel_lcdfb_set_par()
568 dev_dbg(info->device, " * update DMA engine\n"); in atmel_lcdfb_set_par()
569 atmel_lcdfb_update_dma(info, &info->var); in atmel_lcdfb_set_par()
572 value = (info->var.yres * info->var.xres * info->var.bits_per_pixel) / 32; in atmel_lcdfb_set_par()
573 value |= ((ATMEL_LCDC_DMA_BURST_LEN - 1) << ATMEL_LCDC_BLENGTH_OFFSET); in atmel_lcdfb_set_par()
579 if (sinfo->config->have_alt_pixclock) in atmel_lcdfb_set_par()
582 clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; in atmel_lcdfb_set_par()
584 value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock)); in atmel_lcdfb_set_par()
587 dev_notice(info->device, "Bypassing pixel clock divider\n"); in atmel_lcdfb_set_par()
590 value = (value / pix_factor) - 1; in atmel_lcdfb_set_par()
591 dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n", in atmel_lcdfb_set_par()
595 info->var.pixclock = in atmel_lcdfb_set_par()
597 dev_dbg(info->device, " updated pixclk: %lu KHz\n", in atmel_lcdfb_set_par()
598 PICOS2KHZ(info->var.pixclock)); in atmel_lcdfb_set_par()
603 value = pdata->default_lcdcon2; in atmel_lcdfb_set_par()
605 if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) in atmel_lcdfb_set_par()
607 if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) in atmel_lcdfb_set_par()
610 switch (info->var.bits_per_pixel) { in atmel_lcdfb_set_par()
621 dev_dbg(info->device, " * LCDCON2 = %08lx\n", value); in atmel_lcdfb_set_par()
625 value = (info->var.vsync_len - 1) << ATMEL_LCDC_VPW_OFFSET; in atmel_lcdfb_set_par()
626 value |= info->var.upper_margin << ATMEL_LCDC_VBP_OFFSET; in atmel_lcdfb_set_par()
627 value |= info->var.lower_margin; in atmel_lcdfb_set_par()
628 dev_dbg(info->device, " * LCDTIM1 = %08lx\n", value); in atmel_lcdfb_set_par()
632 value = (info->var.right_margin - 1) << ATMEL_LCDC_HFP_OFFSET; in atmel_lcdfb_set_par()
633 value |= (info->var.hsync_len - 1) << ATMEL_LCDC_HPW_OFFSET; in atmel_lcdfb_set_par()
634 value |= (info->var.left_margin - 1); in atmel_lcdfb_set_par()
635 dev_dbg(info->device, " * LCDTIM2 = %08lx\n", value); in atmel_lcdfb_set_par()
639 hozval_linesz = compute_hozval(sinfo, info->var.xres); in atmel_lcdfb_set_par()
642 value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET; in atmel_lcdfb_set_par()
643 value |= info->var.yres - 1; in atmel_lcdfb_set_par()
644 dev_dbg(info->device, " * LCDFRMCFG = %08lx\n", value); in atmel_lcdfb_set_par()
648 value = ATMEL_LCDC_FIFO_SIZE - (2 * ATMEL_LCDC_DMA_BURST_LEN + 3); in atmel_lcdfb_set_par()
665 dev_dbg(info->device, " * DONE\n"); in atmel_lcdfb_set_par()
673 chan >>= 16 - bf->length; in chan_to_field()
674 return chan << bf->offset; in chan_to_field()
678 * atmel_lcdfb_setcolreg - Optional function. Sets a color register.
706 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_setcolreg()
707 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_setcolreg()
712 if (info->var.grayscale) in atmel_lcdfb_setcolreg()
716 switch (info->fix.visual) { in atmel_lcdfb_setcolreg()
719 pal = info->pseudo_palette; in atmel_lcdfb_setcolreg()
721 val = chan_to_field(red, &info->var.red); in atmel_lcdfb_setcolreg()
722 val |= chan_to_field(green, &info->var.green); in atmel_lcdfb_setcolreg()
723 val |= chan_to_field(blue, &info->var.blue); in atmel_lcdfb_setcolreg()
732 if (sinfo->config->have_intensity_bit) { in atmel_lcdfb_setcolreg()
744 if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { in atmel_lcdfb_setcolreg()
776 dev_dbg(info->device, "%s\n", __func__); in atmel_lcdfb_pan_display()
785 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_blank()
799 return -EINVAL; in atmel_lcdfb_blank()
819 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_interrupt()
824 dev_warn(info->device, "FIFO underflow %#x\n", status); in atmel_lcdfb_interrupt()
826 schedule_work(&sinfo->task); in atmel_lcdfb_interrupt()
845 struct fb_info *info = sinfo->info; in atmel_lcdfb_init_fbinfo()
848 info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW; in atmel_lcdfb_init_fbinfo()
850 dev_info(info->device, in atmel_lcdfb_init_fbinfo()
852 (unsigned long)info->fix.smem_len / 1024, in atmel_lcdfb_init_fbinfo()
853 (unsigned long)info->fix.smem_start, in atmel_lcdfb_init_fbinfo()
854 info->screen_base); in atmel_lcdfb_init_fbinfo()
857 ret = fb_alloc_cmap(&info->cmap, 256, 0); in atmel_lcdfb_init_fbinfo()
859 dev_err(info->device, "Alloc color map failed\n"); in atmel_lcdfb_init_fbinfo()
866 clk_prepare_enable(sinfo->bus_clk); in atmel_lcdfb_start_clock()
867 clk_prepare_enable(sinfo->lcdc_clk); in atmel_lcdfb_start_clock()
872 clk_disable_unprepare(sinfo->bus_clk); in atmel_lcdfb_stop_clock()
873 clk_disable_unprepare(sinfo->lcdc_clk); in atmel_lcdfb_stop_clock()
877 { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
878 { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
879 { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
880 { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
881 { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
882 { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
898 err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode); in atmel_lcdfb_get_of_wiring_modes()
906 return -ENODEV; in atmel_lcdfb_get_of_wiring_modes()
913 list_for_each_entry(og, &pdata->pwr_gpios, list) in atmel_lcdfb_power_control_gpio()
914 gpiod_set_value(og->gpiod, on); in atmel_lcdfb_power_control_gpio()
919 struct fb_info *info = sinfo->info; in atmel_lcdfb_of_init()
920 struct atmel_lcdfb_pdata *pdata = &sinfo->pdata; in atmel_lcdfb_of_init()
921 struct fb_var_screeninfo *var = &info->var; in atmel_lcdfb_of_init()
922 struct device *dev = &sinfo->pdev->dev; in atmel_lcdfb_of_init()
923 struct device_node *np =dev->of_node; in atmel_lcdfb_of_init()
933 sinfo->config = (struct atmel_lcdfb_config*) in atmel_lcdfb_of_init()
934 of_match_device(atmel_lcdfb_dt_ids, dev)->data; in atmel_lcdfb_of_init()
939 return -ENOENT; in atmel_lcdfb_of_init()
942 ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel); in atmel_lcdfb_of_init()
944 dev_err(dev, "failed to get property bits-per-pixel\n"); in atmel_lcdfb_of_init()
948 ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time); in atmel_lcdfb_of_init()
950 dev_err(dev, "failed to get property atmel,guard-time\n"); in atmel_lcdfb_of_init()
954 ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2); in atmel_lcdfb_of_init()
960 ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon); in atmel_lcdfb_of_init()
962 dev_err(dev, "failed to get property bits-per-pixel\n"); in atmel_lcdfb_of_init()
966 INIT_LIST_HEAD(&pdata->pwr_gpios); in atmel_lcdfb_of_init()
967 for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) { in atmel_lcdfb_of_init()
968 ret = -ENOMEM; in atmel_lcdfb_of_init()
969 gpiod = devm_gpiod_get_index(dev, "atmel,power-control", in atmel_lcdfb_of_init()
978 og->gpiod = gpiod; in atmel_lcdfb_of_init()
983 dev_err(dev, "set direction output gpio atmel,power-control[%d] failed\n", i); in atmel_lcdfb_of_init()
986 list_add(&og->list, &pdata->pwr_gpios); in atmel_lcdfb_of_init()
990 pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio; in atmel_lcdfb_of_init()
994 dev_err(dev, "invalid atmel,lcd-wiring-mode\n"); in atmel_lcdfb_of_init()
997 pdata->lcd_wiring_mode = ret; in atmel_lcdfb_of_init()
999 pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight"); in atmel_lcdfb_of_init()
1000 pdata->lcdcon_pol_negative = of_property_read_bool(display_np, "atmel,lcdcon-backlight-inverted"); in atmel_lcdfb_of_init()
1012 fb_add_videomode(&fb_vm, &info->modelist); in atmel_lcdfb_of_init()
1021 struct device *dev = &pdev->dev; in atmel_lcdfb_probe()
1031 ret = -ENOMEM; in atmel_lcdfb_probe()
1036 sinfo = info->par; in atmel_lcdfb_probe()
1037 sinfo->pdev = pdev; in atmel_lcdfb_probe()
1038 sinfo->info = info; in atmel_lcdfb_probe()
1040 INIT_LIST_HEAD(&info->modelist); in atmel_lcdfb_probe()
1042 if (!pdev->dev.of_node) { in atmel_lcdfb_probe()
1051 ret = -ENODEV; in atmel_lcdfb_probe()
1052 if (!sinfo->config) in atmel_lcdfb_probe()
1055 sinfo->reg_lcd = devm_regulator_get(&pdev->dev, "lcd"); in atmel_lcdfb_probe()
1056 if (IS_ERR(sinfo->reg_lcd)) in atmel_lcdfb_probe()
1057 sinfo->reg_lcd = NULL; in atmel_lcdfb_probe()
1059 info->flags = FBINFO_PARTIAL_PAN_OK | in atmel_lcdfb_probe()
1061 info->pseudo_palette = sinfo->pseudo_palette; in atmel_lcdfb_probe()
1062 info->fbops = &atmel_lcdfb_ops; in atmel_lcdfb_probe()
1064 info->fix = atmel_lcdfb_fix; in atmel_lcdfb_probe()
1065 strcpy(info->fix.id, sinfo->pdev->name); in atmel_lcdfb_probe()
1068 sinfo->bus_clk = clk_get(dev, "hclk"); in atmel_lcdfb_probe()
1069 if (IS_ERR(sinfo->bus_clk)) { in atmel_lcdfb_probe()
1070 ret = PTR_ERR(sinfo->bus_clk); in atmel_lcdfb_probe()
1073 sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); in atmel_lcdfb_probe()
1074 if (IS_ERR(sinfo->lcdc_clk)) { in atmel_lcdfb_probe()
1075 ret = PTR_ERR(sinfo->lcdc_clk); in atmel_lcdfb_probe()
1080 modelist = list_first_entry(&info->modelist, in atmel_lcdfb_probe()
1082 fb_videomode_to_var(&info->var, &modelist->mode); in atmel_lcdfb_probe()
1084 atmel_lcdfb_check_var(&info->var, info); in atmel_lcdfb_probe()
1089 ret = -ENXIO; in atmel_lcdfb_probe()
1093 sinfo->irq_base = platform_get_irq(pdev, 0); in atmel_lcdfb_probe()
1094 if (sinfo->irq_base < 0) { in atmel_lcdfb_probe()
1095 ret = sinfo->irq_base; in atmel_lcdfb_probe()
1102 /* use a pre-allocated memory buffer */ in atmel_lcdfb_probe()
1103 info->fix.smem_start = map->start; in atmel_lcdfb_probe()
1104 info->fix.smem_len = resource_size(map); in atmel_lcdfb_probe()
1105 if (!request_mem_region(info->fix.smem_start, in atmel_lcdfb_probe()
1106 info->fix.smem_len, pdev->name)) { in atmel_lcdfb_probe()
1107 ret = -EBUSY; in atmel_lcdfb_probe()
1111 info->screen_base = ioremap_wc(info->fix.smem_start, in atmel_lcdfb_probe()
1112 info->fix.smem_len); in atmel_lcdfb_probe()
1113 if (!info->screen_base) { in atmel_lcdfb_probe()
1114 ret = -ENOMEM; in atmel_lcdfb_probe()
1119 * Don't clear the framebuffer -- someone may have set in atmel_lcdfb_probe()
1132 info->fix.mmio_start = regs->start; in atmel_lcdfb_probe()
1133 info->fix.mmio_len = resource_size(regs); in atmel_lcdfb_probe()
1135 if (!request_mem_region(info->fix.mmio_start, in atmel_lcdfb_probe()
1136 info->fix.mmio_len, pdev->name)) { in atmel_lcdfb_probe()
1137 ret = -EBUSY; in atmel_lcdfb_probe()
1141 sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len); in atmel_lcdfb_probe()
1142 if (!sinfo->mmio) { in atmel_lcdfb_probe()
1144 ret = -ENOMEM; in atmel_lcdfb_probe()
1148 /* Initialize PWM for contrast or backlight ("off") */ in atmel_lcdfb_probe()
1152 ret = request_irq(sinfo->irq_base, atmel_lcdfb_interrupt, 0, pdev->name, info); in atmel_lcdfb_probe()
1160 INIT_WORK(&sinfo->task, atmel_lcdfb_task); in atmel_lcdfb_probe()
1189 info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base); in atmel_lcdfb_probe()
1195 fb_dealloc_cmap(&info->cmap); in atmel_lcdfb_probe()
1197 cancel_work_sync(&sinfo->task); in atmel_lcdfb_probe()
1198 free_irq(sinfo->irq_base, info); in atmel_lcdfb_probe()
1201 iounmap(sinfo->mmio); in atmel_lcdfb_probe()
1203 release_mem_region(info->fix.mmio_start, info->fix.mmio_len); in atmel_lcdfb_probe()
1206 iounmap(info->screen_base); in atmel_lcdfb_probe()
1212 release_mem_region(info->fix.smem_start, info->fix.smem_len); in atmel_lcdfb_probe()
1215 clk_put(sinfo->lcdc_clk); in atmel_lcdfb_probe()
1217 clk_put(sinfo->bus_clk); in atmel_lcdfb_probe()
1227 struct device *dev = &pdev->dev; in atmel_lcdfb_remove()
1231 if (!info || !info->par) in atmel_lcdfb_remove()
1233 sinfo = info->par; in atmel_lcdfb_remove()
1235 cancel_work_sync(&sinfo->task); in atmel_lcdfb_remove()
1240 clk_put(sinfo->lcdc_clk); in atmel_lcdfb_remove()
1241 clk_put(sinfo->bus_clk); in atmel_lcdfb_remove()
1242 fb_dealloc_cmap(&info->cmap); in atmel_lcdfb_remove()
1243 free_irq(sinfo->irq_base, info); in atmel_lcdfb_remove()
1244 iounmap(sinfo->mmio); in atmel_lcdfb_remove()
1245 release_mem_region(info->fix.mmio_start, info->fix.mmio_len); in atmel_lcdfb_remove()
1247 iounmap(info->screen_base); in atmel_lcdfb_remove()
1248 release_mem_region(info->fix.smem_start, info->fix.smem_len); in atmel_lcdfb_remove()
1261 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_suspend()
1269 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR); in atmel_lcdfb_suspend()
1281 struct atmel_lcdfb_info *sinfo = info->par; in atmel_lcdfb_resume()
1286 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); in atmel_lcdfb_resume()