mach-smartq5.c 3.3 KB

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