mach-smartq7.c 3.8 KB

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