mach-smartq5.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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/i2c-gpio.h>
  15. #include <linux/init.h>
  16. #include <linux/input.h>
  17. #include <linux/leds.h>
  18. #include <linux/platform_device.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include <mach/map.h>
  22. #include <mach/regs-fb.h>
  23. #include <mach/regs-gpio.h>
  24. #include <mach/s3c6410.h>
  25. #include <plat/cpu.h>
  26. #include <plat/devs.h>
  27. #include <plat/fb.h>
  28. #include <plat/gpio-cfg.h>
  29. #include "mach-smartq.h"
  30. static void __init smartq5_lcd_setup_gpio(void)
  31. {
  32. gpio_request(S3C64XX_GPM(0), "LCD SCEN pin");
  33. gpio_request(S3C64XX_GPM(1), "LCD SCL pin");
  34. gpio_request(S3C64XX_GPM(2), "LCD SDA pin");
  35. gpio_request(S3C64XX_GPM(3), "LCD power");
  36. /* turn power off */
  37. gpio_direction_output(S3C64XX_GPM(0), 1);
  38. gpio_direction_input(S3C64XX_GPM(1));
  39. gpio_direction_input(S3C64XX_GPM(2));
  40. gpio_direction_output(S3C64XX_GPM(3), 0);
  41. }
  42. static struct i2c_gpio_platform_data smartq5_lcd_control = {
  43. .sda_pin = S3C64XX_GPM(2),
  44. .scl_pin = S3C64XX_GPM(1),
  45. };
  46. static struct platform_device smartq5_lcd_control_device = {
  47. .name = "i2c-gpio",
  48. .id = 1,
  49. .dev.platform_data = &smartq5_lcd_control,
  50. };
  51. static struct gpio_led smartq5_leds[] __initdata = {
  52. {
  53. .name = "smartq5:green",
  54. .active_low = 1,
  55. .gpio = S3C64XX_GPN(8),
  56. },
  57. {
  58. .name = "smartq5:red",
  59. .active_low = 1,
  60. .gpio = S3C64XX_GPN(9),
  61. },
  62. };
  63. static struct gpio_led_platform_data smartq5_led_data = {
  64. .num_leds = ARRAY_SIZE(smartq5_leds),
  65. .leds = smartq5_leds,
  66. };
  67. static struct platform_device smartq5_leds_device = {
  68. .name = "leds-gpio",
  69. .id = -1,
  70. .dev.platform_data = &smartq5_led_data,
  71. };
  72. /* Labels according to the SmartQ manual */
  73. static struct gpio_keys_button smartq5_buttons[] = {
  74. {
  75. .gpio = S3C64XX_GPL(14),
  76. .code = KEY_POWER,
  77. .desc = "Power",
  78. .active_low = 1,
  79. .debounce_interval = 5,
  80. .type = EV_KEY,
  81. },
  82. {
  83. .gpio = S3C64XX_GPN(2),
  84. .code = KEY_KPMINUS,
  85. .desc = "Minus",
  86. .active_low = 1,
  87. .debounce_interval = 5,
  88. .type = EV_KEY,
  89. },
  90. {
  91. .gpio = S3C64XX_GPN(12),
  92. .code = KEY_KPPLUS,
  93. .desc = "Plus",
  94. .active_low = 1,
  95. .debounce_interval = 5,
  96. .type = EV_KEY,
  97. },
  98. {
  99. .gpio = S3C64XX_GPN(15),
  100. .code = KEY_ENTER,
  101. .desc = "Move",
  102. .active_low = 1,
  103. .debounce_interval = 5,
  104. .type = EV_KEY,
  105. },
  106. };
  107. static struct gpio_keys_platform_data smartq5_buttons_data = {
  108. .buttons = smartq5_buttons,
  109. .nbuttons = ARRAY_SIZE(smartq5_buttons),
  110. };
  111. static struct platform_device smartq5_buttons_device = {
  112. .name = "gpio-keys",
  113. .id = 0,
  114. .num_resources = 0,
  115. .dev = {
  116. .platform_data = &smartq5_buttons_data,
  117. }
  118. };
  119. static struct s3c_fb_pd_win smartq5_fb_win0 = {
  120. .win_mode = {
  121. .pixclock = 1000000000000ULL /
  122. ((40+1+216+800)*(10+1+35+480)*80),
  123. .left_margin = 40,
  124. .right_margin = 216,
  125. .upper_margin = 10,
  126. .lower_margin = 35,
  127. .hsync_len = 1,
  128. .vsync_len = 1,
  129. .xres = 800,
  130. .yres = 480,
  131. },
  132. .max_bpp = 32,
  133. .default_bpp = 16,
  134. };
  135. static struct s3c_fb_platdata smartq5_lcd_pdata __initdata = {
  136. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  137. .win[0] = &smartq5_fb_win0,
  138. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  139. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  140. VIDCON1_INV_VDEN,
  141. };
  142. static struct platform_device *smartq5_devices[] __initdata = {
  143. &smartq5_leds_device,
  144. &smartq5_buttons_device,
  145. &smartq5_lcd_control_device,
  146. };
  147. static void __init smartq5_machine_init(void)
  148. {
  149. s3c_fb_set_platdata(&smartq5_lcd_pdata);
  150. smartq_machine_init();
  151. smartq5_lcd_setup_gpio();
  152. platform_add_devices(smartq5_devices, ARRAY_SIZE(smartq5_devices));
  153. }
  154. MACHINE_START(SMARTQ5, "SmartQ 5")
  155. /* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
  156. .phys_io = S3C_PA_UART & 0xfff00000,
  157. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  158. .boot_params = S3C64XX_PA_SDRAM + 0x100,
  159. .init_irq = s3c6410_init_irq,
  160. .map_io = smartq_map_io,
  161. .init_machine = smartq5_machine_init,
  162. .timer = &s3c24xx_timer,
  163. MACHINE_END