mach-smartq7.c 3.7 KB

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