mach-smartq5.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright (C) 2010 Maurus Cuelenaere
  4. #include <linux/fb.h>
  5. #include <linux/gpio.h>
  6. #include <linux/gpio_keys.h>
  7. #include <linux/init.h>
  8. #include <linux/input.h>
  9. #include <linux/leds.h>
  10. #include <linux/platform_device.h>
  11. #include <asm/mach-types.h>
  12. #include <asm/mach/arch.h>
  13. #include <video/samsung_fimd.h>
  14. #include <mach/irqs.h>
  15. #include <mach/map.h>
  16. #include <mach/regs-gpio.h>
  17. #include <mach/gpio-samsung.h>
  18. #include <plat/cpu.h>
  19. #include <plat/devs.h>
  20. #include <plat/fb.h>
  21. #include <plat/gpio-cfg.h>
  22. #include <plat/samsung-time.h>
  23. #include "common.h"
  24. #include "mach-smartq.h"
  25. static struct gpio_led smartq5_leds[] = {
  26. {
  27. .name = "smartq5:green",
  28. .active_low = 1,
  29. .gpio = S3C64XX_GPN(8),
  30. },
  31. {
  32. .name = "smartq5:red",
  33. .active_low = 1,
  34. .gpio = S3C64XX_GPN(9),
  35. },
  36. };
  37. static struct gpio_led_platform_data smartq5_led_data = {
  38. .num_leds = ARRAY_SIZE(smartq5_leds),
  39. .leds = smartq5_leds,
  40. };
  41. static struct platform_device smartq5_leds_device = {
  42. .name = "leds-gpio",
  43. .id = -1,
  44. .dev.platform_data = &smartq5_led_data,
  45. };
  46. /* Labels according to the SmartQ manual */
  47. static struct gpio_keys_button smartq5_buttons[] = {
  48. {
  49. .gpio = S3C64XX_GPL(14),
  50. .code = KEY_POWER,
  51. .desc = "Power",
  52. .active_low = 1,
  53. .debounce_interval = 5,
  54. .type = EV_KEY,
  55. },
  56. {
  57. .gpio = S3C64XX_GPN(2),
  58. .code = KEY_KPMINUS,
  59. .desc = "Minus",
  60. .active_low = 1,
  61. .debounce_interval = 5,
  62. .type = EV_KEY,
  63. },
  64. {
  65. .gpio = S3C64XX_GPN(12),
  66. .code = KEY_KPPLUS,
  67. .desc = "Plus",
  68. .active_low = 1,
  69. .debounce_interval = 5,
  70. .type = EV_KEY,
  71. },
  72. {
  73. .gpio = S3C64XX_GPN(15),
  74. .code = KEY_ENTER,
  75. .desc = "Move",
  76. .active_low = 1,
  77. .debounce_interval = 5,
  78. .type = EV_KEY,
  79. },
  80. };
  81. static struct gpio_keys_platform_data smartq5_buttons_data = {
  82. .buttons = smartq5_buttons,
  83. .nbuttons = ARRAY_SIZE(smartq5_buttons),
  84. };
  85. static struct platform_device smartq5_buttons_device = {
  86. .name = "gpio-keys",
  87. .id = 0,
  88. .num_resources = 0,
  89. .dev = {
  90. .platform_data = &smartq5_buttons_data,
  91. }
  92. };
  93. static struct s3c_fb_pd_win smartq5_fb_win0 = {
  94. .max_bpp = 32,
  95. .default_bpp = 16,
  96. .xres = 800,
  97. .yres = 480,
  98. };
  99. static struct fb_videomode smartq5_lcd_timing = {
  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. static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
  111. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  112. .vtiming = &smartq5_lcd_timing,
  113. .win[0] = &smartq5_fb_win0,
  114. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  115. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  116. VIDCON1_INV_VDEN,
  117. };
  118. static struct platform_device *smartq5_devices[] __initdata = {
  119. &smartq5_leds_device,
  120. &smartq5_buttons_device,
  121. };
  122. static void __init smartq5_machine_init(void)
  123. {
  124. s3c_fb_set_platdata(&smartq5_lcd_pdata);
  125. smartq_machine_init();
  126. platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
  127. }
  128. MACHINE_START(SMARTQ5, "SmartQ 5")
  129. /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
  130. .atag_offset = 0x100,
  131. .nr_irqs = S3C64XX_NR_IRQS,
  132. .init_irq = s3c6410_init_irq,
  133. .map_io = smartq_map_io,
  134. .init_machine = smartq5_machine_init,
  135. .init_time = samsung_timer_init,
  136. .restart = s3c64xx_restart,
  137. MACHINE_END