mach-smartq7.c 3.6 KB

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