mach-smartq5.c 3.5 KB

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