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 smartq7_leds[] = {
0031     {
0032         .name           = "smartq7:red",
0033         .active_low     = 1,
0034         .gpio           = S3C64XX_GPN(8),
0035     },
0036     {
0037         .name           = "smartq7:green",
0038         .active_low     = 1,
0039         .gpio           = S3C64XX_GPN(9),
0040     },
0041 };
0042 
0043 static struct gpio_led_platform_data smartq7_led_data = {
0044     .num_leds = ARRAY_SIZE(smartq7_leds),
0045     .leds = smartq7_leds,
0046 };
0047 
0048 static struct platform_device smartq7_leds_device = {
0049     .name           = "leds-gpio",
0050     .id         = -1,
0051     .dev.platform_data  = &smartq7_led_data,
0052 };
0053 
0054 /* Labels according to the SmartQ manual */
0055 static struct gpio_keys_button smartq7_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_FN,
0067         .desc           = "Function",
0068         .active_low     = 1,
0069         .debounce_interval  = 5,
0070         .type                   = EV_KEY,
0071     },
0072     {
0073         .gpio           = S3C64XX_GPN(3),
0074         .code           = KEY_KPMINUS,
0075         .desc           = "Minus",
0076         .active_low     = 1,
0077         .debounce_interval  = 5,
0078         .type                   = EV_KEY,
0079     },
0080     {
0081         .gpio           = S3C64XX_GPN(4),
0082         .code           = KEY_KPPLUS,
0083         .desc           = "Plus",
0084         .active_low     = 1,
0085         .debounce_interval  = 5,
0086         .type                   = EV_KEY,
0087     },
0088     {
0089         .gpio           = S3C64XX_GPN(12),
0090         .code           = KEY_ENTER,
0091         .desc           = "Enter",
0092         .active_low     = 1,
0093         .debounce_interval  = 5,
0094         .type                   = EV_KEY,
0095     },
0096     {
0097         .gpio           = S3C64XX_GPN(15),
0098         .code           = KEY_ESC,
0099         .desc           = "Cancel",
0100         .active_low     = 1,
0101         .debounce_interval  = 5,
0102         .type                   = EV_KEY,
0103     },
0104 };
0105 
0106 static struct gpio_keys_platform_data smartq7_buttons_data  = {
0107     .buttons    = smartq7_buttons,
0108     .nbuttons   = ARRAY_SIZE(smartq7_buttons),
0109 };
0110 
0111 static struct platform_device smartq7_buttons_device  = {
0112     .name       = "gpio-keys",
0113     .id     = 0,
0114     .num_resources  = 0,
0115     .dev        = {
0116         .platform_data  = &smartq7_buttons_data,
0117     }
0118 };
0119 
0120 static struct s3c_fb_pd_win smartq7_fb_win0 = {
0121     .max_bpp    = 32,
0122     .default_bpp    = 16,
0123     .xres       = 800,
0124     .yres       = 480,
0125 };
0126 
0127 static struct fb_videomode smartq7_lcd_timing = {
0128     .left_margin    = 3,
0129     .right_margin   = 5,
0130     .upper_margin   = 1,
0131     .lower_margin   = 20,
0132     .hsync_len  = 10,
0133     .vsync_len  = 3,
0134     .xres       = 800,
0135     .yres       = 480,
0136     .refresh    = 80,
0137 };
0138 
0139 static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
0140     .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
0141     .vtiming    = &smartq7_lcd_timing,
0142     .win[0]     = &smartq7_fb_win0,
0143     .vidcon0    = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
0144     .vidcon1    = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
0145               VIDCON1_INV_VCLK,
0146 };
0147 
0148 static struct platform_device *smartq7_devices[] __initdata = {
0149     &smartq7_leds_device,
0150     &smartq7_buttons_device,
0151 };
0152 
0153 static void __init smartq7_machine_init(void)
0154 {
0155     s3c_fb_set_platdata(&smartq7_lcd_pdata);
0156 
0157     smartq_machine_init();
0158 
0159     platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
0160 }
0161 
0162 MACHINE_START(SMARTQ7, "SmartQ 7")
0163     /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
0164     .atag_offset    = 0x100,
0165     .nr_irqs    = S3C64XX_NR_IRQS,
0166     .init_irq   = s3c6410_init_irq,
0167     .map_io     = smartq_map_io,
0168     .init_machine   = smartq7_machine_init,
0169     .init_time  = s3c64xx_timer_init,
0170 MACHINE_END