Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * File: arch/arm/plat-omap/fb.c
0004  *
0005  * Framebuffer device registration for TI OMAP platforms
0006  *
0007  * Copyright (C) 2006 Nokia Corporation
0008  * Author: Imre Deak <imre.deak@nokia.com>
0009  */
0010 
0011 #include <linux/module.h>
0012 #include <linux/kernel.h>
0013 #include <linux/mm.h>
0014 #include <linux/init.h>
0015 #include <linux/platform_device.h>
0016 #include <linux/memblock.h>
0017 #include <linux/io.h>
0018 #include <linux/omapfb.h>
0019 #include <linux/dma-mapping.h>
0020 #include <linux/irq.h>
0021 
0022 #include <asm/mach/map.h>
0023 
0024 #include "irqs.h"
0025 
0026 #if IS_ENABLED(CONFIG_FB_OMAP)
0027 
0028 static bool omapfb_lcd_configured;
0029 static struct omapfb_platform_data omapfb_config;
0030 
0031 static u64 omap_fb_dma_mask = ~(u32)0;
0032 
0033 static struct resource omap_fb_resources[] = {
0034     {
0035         .name  = "irq",
0036         .start = INT_LCD_CTRL,
0037         .flags = IORESOURCE_IRQ,
0038     },
0039     {
0040         .name  = "irq",
0041         .start = INT_SOSSI_MATCH,
0042         .flags = IORESOURCE_IRQ,
0043     },
0044 };
0045 
0046 static struct platform_device omap_fb_device = {
0047     .name       = "omapfb",
0048     .id     = -1,
0049     .dev = {
0050         .dma_mask       = &omap_fb_dma_mask,
0051         .coherent_dma_mask  = DMA_BIT_MASK(32),
0052         .platform_data      = &omapfb_config,
0053     },
0054     .num_resources = ARRAY_SIZE(omap_fb_resources),
0055     .resource = omap_fb_resources,
0056 };
0057 
0058 void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
0059 {
0060     omapfb_config.lcd = *config;
0061     omapfb_lcd_configured = true;
0062 }
0063 
0064 static int __init omap_init_fb(void)
0065 {
0066     /*
0067      * If the board file has not set the lcd config with
0068      * omapfb_set_lcd_config(), don't bother registering the omapfb device
0069      */
0070     if (!omapfb_lcd_configured)
0071         return 0;
0072 
0073     return platform_device_register(&omap_fb_device);
0074 }
0075 
0076 arch_initcall(omap_init_fb);
0077 
0078 #else
0079 
0080 void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
0081 {
0082 }
0083 
0084 #endif