mach-smartq5.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/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 smartq5_leds[] = {
  33. {
  34. .name = "smartq5:green",
  35. .active_low = 1,
  36. .gpio = S3C64XX_GPN(8),
  37. },
  38. {
  39. .name = "smartq5:red",
  40. .active_low = 1,
  41. .gpio = S3C64XX_GPN(9),
  42. },
  43. };
  44. static struct gpio_led_platform_data smartq5_led_data = {
  45. .num_leds = ARRAY_SIZE(smartq5_leds),
  46. .leds = smartq5_leds,
  47. };
  48. static struct platform_device smartq5_leds_device = {
  49. .name = "leds-gpio",
  50. .id = -1,
  51. .dev.platform_data = &smartq5_led_data,
  52. };
  53. /* Labels according to the SmartQ manual */
  54. static struct gpio_keys_button smartq5_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_KPMINUS,
  66. .desc = "Minus",
  67. .active_low = 1,
  68. .debounce_interval = 5,
  69. .type = EV_KEY,
  70. },
  71. {
  72. .gpio = S3C64XX_GPN(12),
  73. .code = KEY_KPPLUS,
  74. .desc = "Plus",
  75. .active_low = 1,
  76. .debounce_interval = 5,
  77. .type = EV_KEY,
  78. },
  79. {
  80. .gpio = S3C64XX_GPN(15),
  81. .code = KEY_ENTER,
  82. .desc = "Move",
  83. .active_low = 1,
  84. .debounce_interval = 5,
  85. .type = EV_KEY,
  86. },
  87. };
  88. static struct gpio_keys_platform_data smartq5_buttons_data = {
  89. .buttons = smartq5_buttons,
  90. .nbuttons = ARRAY_SIZE(smartq5_buttons),
  91. };
  92. static struct platform_device smartq5_buttons_device = {
  93. .name = "gpio-keys",
  94. .id = 0,
  95. .num_resources = 0,
  96. .dev = {
  97. .platform_data = &smartq5_buttons_data,
  98. }
  99. };
  100. static struct s3c_fb_pd_win smartq5_fb_win0 = {
  101. .max_bpp = 32,
  102. .default_bpp = 16,
  103. .xres = 800,
  104. .yres = 480,
  105. };
  106. static struct fb_videomode smartq5_lcd_timing = {
  107. .left_margin = 216,
  108. .right_margin = 40,
  109. .upper_margin = 35,
  110. .lower_margin = 10,
  111. .hsync_len = 1,
  112. .vsync_len = 1,
  113. .xres = 800,
  114. .yres = 480,
  115. .refresh = 80,
  116. };
  117. static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
  118. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  119. .vtiming = &smartq5_lcd_timing,
  120. .win[0] = &smartq5_fb_win0,
  121. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  122. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  123. VIDCON1_INV_VDEN,
  124. };
  125. static struct platform_device *smartq5_devices[] __initdata = {
  126. &smartq5_leds_device,
  127. &smartq5_buttons_device,
  128. };
  129. static void __init smartq5_machine_init(void)
  130. {
  131. s3c_fb_set_platdata(&smartq5_lcd_pdata);
  132. smartq_machine_init();
  133. platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
  134. }
  135. MACHINE_START(SMARTQ5, "SmartQ 5")
  136. /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
  137. .atag_offset = 0x100,
  138. .nr_irqs = S3C64XX_NR_IRQS,
  139. .init_irq = s3c6410_init_irq,
  140. .map_io = smartq_map_io,
  141. .init_machine = smartq5_machine_init,
  142. .init_time = samsung_timer_init,
  143. .restart = s3c64xx_restart,
  144. MACHINE_END