mach-smartq5.c 3.4 KB

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