^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) // Copyright (C) 2010 Maurus Cuelenaere
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <video/samsung_fimd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "regs-gpio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include "fb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "gpio-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include "s3c64xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include "mach-smartq.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static struct gpio_led smartq5_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) .name = "smartq5:green",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) .gpio = S3C64XX_GPN(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) .name = "smartq5:red",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .gpio = S3C64XX_GPN(9),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static struct gpio_led_platform_data smartq5_led_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .num_leds = ARRAY_SIZE(smartq5_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) .leds = smartq5_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) static struct platform_device smartq5_leds_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .name = "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .dev.platform_data = &smartq5_led_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) /* Labels according to the SmartQ manual */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static struct gpio_keys_button smartq5_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) .gpio = S3C64XX_GPL(14),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .code = KEY_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .desc = "Power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) .debounce_interval = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) .type = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) .gpio = S3C64XX_GPN(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) .code = KEY_KPMINUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) .desc = "Minus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) .debounce_interval = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) .type = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .gpio = S3C64XX_GPN(12),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .code = KEY_KPPLUS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .desc = "Plus",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) .debounce_interval = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) .type = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .gpio = S3C64XX_GPN(15),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .code = KEY_ENTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) .desc = "Move",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .debounce_interval = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .type = EV_KEY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static struct gpio_keys_platform_data smartq5_buttons_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) .buttons = smartq5_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) .nbuttons = ARRAY_SIZE(smartq5_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) static struct platform_device smartq5_buttons_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) .name = "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) .num_resources = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) .platform_data = &smartq5_buttons_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static struct s3c_fb_pd_win smartq5_fb_win0 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) .max_bpp = 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) .default_bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) .xres = 800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) .yres = 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static struct fb_videomode smartq5_lcd_timing = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) .left_margin = 216,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .right_margin = 40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) .upper_margin = 35,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) .lower_margin = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) .hsync_len = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) .vsync_len = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) .xres = 800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) .yres = 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) .refresh = 80,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) .vtiming = &smartq5_lcd_timing,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) .win[0] = &smartq5_fb_win0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) VIDCON1_INV_VDEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static struct platform_device *smartq5_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) &smartq5_leds_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) &smartq5_buttons_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static void __init smartq5_machine_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) s3c_fb_set_platdata(&smartq5_lcd_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) smartq_machine_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) MACHINE_START(SMARTQ5, "SmartQ 5")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) .atag_offset = 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) .nr_irqs = S3C64XX_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) .init_irq = s3c6410_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) .map_io = smartq_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) .init_machine = smartq5_machine_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) .init_time = s3c64xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) MACHINE_END