mach-smartq7.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 smartq7_leds[] = {
  26. {
  27. .name = "smartq7:red",
  28. .active_low = 1,
  29. .gpio = S3C64XX_GPN(8),
  30. },
  31. {
  32. .name = "smartq7:green",
  33. .active_low = 1,
  34. .gpio = S3C64XX_GPN(9),
  35. },
  36. };
  37. static struct gpio_led_platform_data smartq7_led_data = {
  38. .num_leds = ARRAY_SIZE(smartq7_leds),
  39. .leds = smartq7_leds,
  40. };
  41. static struct platform_device smartq7_leds_device = {
  42. .name = "leds-gpio",
  43. .id = -1,
  44. .dev.platform_data = &smartq7_led_data,
  45. };
  46. /* Labels according to the SmartQ manual */
  47. static struct gpio_keys_button smartq7_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_FN,
  59. .desc = "Function",
  60. .active_low = 1,
  61. .debounce_interval = 5,
  62. .type = EV_KEY,
  63. },
  64. {
  65. .gpio = S3C64XX_GPN(3),
  66. .code = KEY_KPMINUS,
  67. .desc = "Minus",
  68. .active_low = 1,
  69. .debounce_interval = 5,
  70. .type = EV_KEY,
  71. },
  72. {
  73. .gpio = S3C64XX_GPN(4),
  74. .code = KEY_KPPLUS,
  75. .desc = "Plus",
  76. .active_low = 1,
  77. .debounce_interval = 5,
  78. .type = EV_KEY,
  79. },
  80. {
  81. .gpio = S3C64XX_GPN(12),
  82. .code = KEY_ENTER,
  83. .desc = "Enter",
  84. .active_low = 1,
  85. .debounce_interval = 5,
  86. .type = EV_KEY,
  87. },
  88. {
  89. .gpio = S3C64XX_GPN(15),
  90. .code = KEY_ESC,
  91. .desc = "Cancel",
  92. .active_low = 1,
  93. .debounce_interval = 5,
  94. .type = EV_KEY,
  95. },
  96. };
  97. static struct gpio_keys_platform_data smartq7_buttons_data = {
  98. .buttons = smartq7_buttons,
  99. .nbuttons = ARRAY_SIZE(smartq7_buttons),
  100. };
  101. static struct platform_device smartq7_buttons_device = {
  102. .name = "gpio-keys",
  103. .id = 0,
  104. .num_resources = 0,
  105. .dev = {
  106. .platform_data = &smartq7_buttons_data,
  107. }
  108. };
  109. static struct s3c_fb_pd_win smartq7_fb_win0 = {
  110. .max_bpp = 32,
  111. .default_bpp = 16,
  112. .xres = 800,
  113. .yres = 480,
  114. };
  115. static struct fb_videomode smartq7_lcd_timing = {
  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. static struct s3c_fb_platdata smartq7_lcd_pdata __initdata = {
  127. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  128. .vtiming = &smartq7_lcd_timing,
  129. .win[0] = &smartq7_fb_win0,
  130. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  131. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  132. VIDCON1_INV_VCLK,
  133. };
  134. static struct platform_device *smartq7_devices[] __initdata = {
  135. &smartq7_leds_device,
  136. &smartq7_buttons_device,
  137. };
  138. static void __init smartq7_machine_init(void)
  139. {
  140. s3c_fb_set_platdata(&smartq7_lcd_pdata);
  141. smartq_machine_init();
  142. platform_add_devices(smartq7_devices, ARRAY_SIZE(smartq7_devices));
  143. }
  144. MACHINE_START(SMARTQ7, "SmartQ 7")
  145. /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
  146. .atag_offset = 0x100,
  147. .nr_irqs = S3C64XX_NR_IRQS,
  148. .init_irq = s3c6410_init_irq,
  149. .map_io = smartq_map_io,
  150. .init_machine = smartq7_machine_init,
  151. .init_time = samsung_timer_init,
  152. .restart = s3c64xx_restart,
  153. MACHINE_END