mach-smartq7.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * linux/arch/arm/mach-s3c64xx/mach-smartq7.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/irqs.h>
  22. #include <mach/map.h>
  23. #include <mach/regs-gpio.h>
  24. #include <mach/gpio-samsung.h>
  25. #include <plat/cpu.h>
  26. #include <plat/devs.h>
  27. #include <plat/fb.h>
  28. #include <plat/gpio-cfg.h>
  29. #include <plat/samsung-time.h>
  30. #include "common.h"
  31. #include "mach-smartq.h"
  32. static struct gpio_led smartq7_leds[] = {
  33. {
  34. .name = "smartq7:red",
  35. .active_low = 1,
  36. .gpio = S3C64XX_GPN(8),
  37. },
  38. {
  39. .name = "smartq7:green",
  40. .active_low = 1,
  41. .gpio = S3C64XX_GPN(9),
  42. },
  43. };
  44. static struct gpio_led_platform_data smartq7_led_data = {
  45. .num_leds = ARRAY_SIZE(smartq7_leds),
  46. .leds = smartq7_leds,
  47. };
  48. static struct platform_device smartq7_leds_device = {
  49. .name = "leds-gpio",
  50. .id = -1,
  51. .dev.platform_data = &smartq7_led_data,
  52. };
  53. /* Labels according to the SmartQ manual */
  54. static struct gpio_keys_button smartq7_buttons[] = {
  55. {
  56. .gpio = S3C64XX_GPL(14),
  57. .code = KEY_POWER,
  58. .desc = "Power",
  59. .active_low = 1,
  60. .debounce_interval = 5,
  61. .type = EV_KEY,
  62. },
  63. {
  64. .gpio = S3C64XX_GPN(2),
  65. .code = KEY_FN,
  66. .desc = "Function",
  67. .active_low = 1,
  68. .debounce_interval = 5,
  69. .type = EV_KEY,
  70. },
  71. {
  72. .gpio = S3C64XX_GPN(3),
  73. .code = KEY_KPMINUS,
  74. .desc = "Minus",
  75. .active_low = 1,
  76. .debounce_interval = 5,
  77. .type = EV_KEY,
  78. },
  79. {
  80. .gpio = S3C64XX_GPN(4),
  81. .code = KEY_KPPLUS,
  82. .desc = "Plus",
  83. .active_low = 1,
  84. .debounce_interval = 5,
  85. .type = EV_KEY,
  86. },
  87. {
  88. .gpio = S3C64XX_GPN(12),
  89. .code = KEY_ENTER,
  90. .desc = "Enter",
  91. .active_low = 1,
  92. .debounce_interval = 5,
  93. .type = EV_KEY,
  94. },
  95. {
  96. .gpio = S3C64XX_GPN(15),
  97. .code = KEY_ESC,
  98. .desc = "Cancel",
  99. .active_low = 1,
  100. .debounce_interval = 5,
  101. .type = EV_KEY,
  102. },
  103. };
  104. static struct gpio_keys_platform_data smartq7_buttons_data = {
  105. .buttons = smartq7_buttons,
  106. .nbuttons = ARRAY_SIZE(smartq7_buttons),
  107. };
  108. static struct platform_device smartq7_buttons_device = {
  109. .name = "gpio-keys",
  110. .id = 0,
  111. .num_resources = 0,
  112. .dev = {
  113. .platform_data = &smartq7_buttons_data,
  114. }
  115. };
  116. static struct s3c_fb_pd_win smartq7_fb_win0 = {
  117. .max_bpp = 32,
  118. .default_bpp = 16,
  119. .xres = 800,
  120. .yres = 480,
  121. };
  122. static struct fb_videomode smartq7_lcd_timing = {
  123. .left_margin = 3,
  124. .right_margin = 5,
  125. .upper_margin = 1,
  126. .lower_margin = 20,
  127. .hsync_len = 10,
  128. .vsync_len = 3,
  129. .xres = 800,
  130. .yres = 480,
  131. .refresh = 80,
  132. };
  133. static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
  134. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  135. .vtiming = &smartq7_lcd_timing,
  136. .win[0] = &smartq7_fb_win0,
  137. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  138. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  139. VIDCON1_INV_VCLK,
  140. };
  141. static struct platform_device *smartq7_devices[] __initdata = {
  142. &smartq7_leds_device,
  143. &smartq7_buttons_device,
  144. };
  145. static void __init smartq7_machine_init(void)
  146. {
  147. s3c_fb_set_platdata(&smartq7_lcd_pdata);
  148. smartq_machine_init();
  149. platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
  150. }
  151. MACHINE_START(SMARTQ7, "SmartQ 7")
  152. /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
  153. .atag_offset = 0x100,
  154. .nr_irqs = S3C64XX_NR_IRQS,
  155. .init_irq = s3c6410_init_irq,
  156. .map_io = smartq_map_io,
  157. .init_machine = smartq7_machine_init,
  158. .init_time = samsung_timer_init,
  159. .restart = s3c64xx_restart,
  160. MACHINE_END