Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright (C) 2010 Maurus Cuelenaere
0004 
0005 #include <linux/fb.h>
0006 #include <linux/gpio.h>
0007 #include <linux/gpio_keys.h>
0008 #include <linux/init.h>
0009 #include <linux/input.h>
0010 #include <linux/leds.h>
0011 #include <linux/platform_device.h>
0012 
0013 #include <asm/mach-types.h>
0014 #include <asm/mach/arch.h>
0015 
0016 #include <video/samsung_fimd.h>
0017 #include "irqs.h"
0018 #include "map.h"
0019 #include "regs-gpio.h"
0020 #include "gpio-samsung.h"
0021 
0022 #include "cpu.h"
0023 #include "devs.h"
0024 #include "fb.h"
0025 #include "gpio-cfg.h"
0026 
0027 #include "s3c64xx.h"
0028 #include "mach-smartq.h"
0029 
0030 static struct gpio_led smartq5_leds[] = {
0031     {
0032         .name           = "smartq5:green",
0033         .active_low     = 1,
0034         .gpio           = S3C64XX_GPN(8),
0035     },
0036     {
0037         .name           = "smartq5:red",
0038         .active_low     = 1,
0039         .gpio           = S3C64XX_GPN(9),
0040     },
0041 };
0042 
0043 static struct gpio_led_platform_data smartq5_led_data = {
0044     .num_leds = ARRAY_SIZE(smartq5_leds),
0045     .leds = smartq5_leds,
0046 };
0047 
0048 static struct platform_device smartq5_leds_device = {
0049     .name           = "leds-gpio",
0050     .id         = -1,
0051     .dev.platform_data  = &smartq5_led_data,
0052 };
0053 
0054 /* Labels according to the SmartQ manual */
0055 static struct gpio_keys_button smartq5_buttons[] = {
0056     {
0057         .gpio           = S3C64XX_GPL(14),
0058         .code           = KEY_POWER,
0059         .desc           = "Power",
0060         .active_low     = 1,
0061         .debounce_interval  = 5,
0062         .type                   = EV_KEY,
0063     },
0064     {
0065         .gpio           = S3C64XX_GPN(2),
0066         .code           = KEY_KPMINUS,
0067         .desc           = "Minus",
0068         .active_low     = 1,
0069         .debounce_interval  = 5,
0070         .type                   = EV_KEY,
0071     },
0072     {
0073         .gpio           = S3C64XX_GPN(12),
0074         .code           = KEY_KPPLUS,
0075         .desc           = "Plus",
0076         .active_low     = 1,
0077         .debounce_interval  = 5,
0078         .type                   = EV_KEY,
0079     },
0080     {
0081         .gpio           = S3C64XX_GPN(15),
0082         .code           = KEY_ENTER,
0083         .desc           = "Move",
0084         .active_low     = 1,
0085         .debounce_interval  = 5,
0086         .type                   = EV_KEY,
0087     },
0088 };
0089 
0090 static struct gpio_keys_platform_data smartq5_buttons_data  = {
0091     .buttons    = smartq5_buttons,
0092     .nbuttons   = ARRAY_SIZE(smartq5_buttons),
0093 };
0094 
0095 static struct platform_device smartq5_buttons_device  = {
0096     .name       = "gpio-keys",
0097     .id     = 0,
0098     .num_resources  = 0,
0099     .dev        = {
0100         .platform_data  = &smartq5_buttons_data,
0101     }
0102 };
0103 
0104 static struct s3c_fb_pd_win smartq5_fb_win0 = {
0105     .max_bpp    = 32,
0106     .default_bpp    = 16,
0107     .xres       = 800,
0108     .yres       = 480,
0109 };
0110 
0111 static struct fb_videomode smartq5_lcd_timing = {
0112     .left_margin    = 216,
0113     .right_margin   = 40,
0114     .upper_margin   = 35,
0115     .lower_margin   = 10,
0116     .hsync_len  = 1,
0117     .vsync_len  = 1,
0118     .xres       = 800,
0119     .yres       = 480,
0120     .refresh    = 80,
0121 };
0122 
0123 static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
0124     .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
0125     .vtiming    = &smartq5_lcd_timing,
0126     .win[0]     = &smartq5_fb_win0,
0127     .vidcon0    = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
0128     .vidcon1    = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
0129               VIDCON1_INV_VDEN,
0130 };
0131 
0132 static struct platform_device *smartq5_devices[] __initdata = {
0133     &smartq5_leds_device,
0134     &smartq5_buttons_device,
0135 };
0136 
0137 static void __init smartq5_machine_init(void)
0138 {
0139     s3c_fb_set_platdata(&smartq5_lcd_pdata);
0140 
0141     smartq_machine_init();
0142 
0143     platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
0144 }
0145 
0146 MACHINE_START(SMARTQ5, "SmartQ 5")
0147     /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
0148     .atag_offset    = 0x100,
0149     .nr_irqs    = S3C64XX_NR_IRQS,
0150     .init_irq   = s3c6410_init_irq,
0151     .map_io     = smartq_map_io,
0152     .init_machine   = smartq5_machine_init,
0153     .init_time  = s3c64xx_timer_init,
0154 MACHINE_END