calculationStandardDeviation.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* linux/arch/arm/mach-s3c64xx/mach-crag6410.c
  2. *
  3. * Copyright 2011 Wolfson Microelectronics plc
  4. * Mark Brown <broonie@opensource.wolfsonmicro.com>
  5. *
  6. * Copyright 2011 Simtec Electronics
  7. * Ben Dooks <ben@simtec.co.uk>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/list.h>
  15. #include <linux/serial_core.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/fb.h>
  18. #include <linux/io.h>
  19. #include <linux/init.h>
  20. #include <linux/gpio.h>
  21. #include <linux/leds.h>
  22. #include <linux/delay.h>
  23. #include <linux/mmc/host.h>
  24. #include <linux/regulator/machine.h>
  25. #include <linux/regulator/fixed.h>
  26. #include <linux/pwm_backlight.h>
  27. #include <linux/dm9000.h>
  28. #include <linux/gpio_keys.h>
  29. #include <linux/basic_mmio_gpio.h>
  30. #include <linux/spi/spi.h>
  31. #include <linux/i2c/pca953x.h>
  32. #include <linux/platform_data/s3c-hsotg.h>
  33. #include <video/platform_lcd.h>
  34. #include <linux/mfd/wm831x/core.h>
  35. #include <linux/mfd/wm831x/pdata.h>
  36. #include <linux/mfd/wm831x/irq.h>
  37. #include <linux/mfd/wm831x/gpio.h>
  38. #include <sound/wm1250-ev1.h>
  39. #include <asm/hardware/vic.h>
  40. #include <asm/mach/arch.h>
  41. #include <asm/mach-types.h>
  42. #include <video/samsung_fimd.h>
  43. #include <mach/hardware.h>
  44. #include <mach/map.h>
  45. #include <mach/regs-sys.h>
  46. #include <mach/regs-gpio.h>
  47. #include <mach/regs-modem.h>
  48. #include <mach/crag6410.h>
  49. #include <mach/regs-gpio-memport.h>
  50. #include <plat/regs-serial.h>
  51. #include <plat/fb.h>
  52. #include <plat/sdhci.h>
  53. #include <plat/gpio-cfg.h>
  54. #include <linux/platform_data/spi-s3c64xx.h>
  55. #include <plat/keypad.h>
  56. #include <plat/clock.h>
  57. #include <plat/devs.h>
  58. #include <plat/cpu.h>
  59. #include <plat/adc.h>
  60. #include <linux/platform_data/i2c-s3c2410.h>
  61. #include <plat/pm.h>
  62. #include "common.h"
  63. /* serial port setup */
  64. #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
  65. #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
  66. #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
  67. static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
  68. [0] = {
  69. .hwport = 0,
  70. .flags = 0,
  71. .ucon = UCON,
  72. .ulcon = ULCON,
  73. .ufcon = UFCON,
  74. },
  75. [1] = {
  76. .hwport = 1,
  77. .flags = 0,
  78. .ucon = UCON,
  79. .ulcon = ULCON,
  80. .ufcon = UFCON,
  81. },
  82. [2] = {
  83. .hwport = 2,
  84. .flags = 0,
  85. .ucon = UCON,
  86. .ulcon = ULCON,
  87. .ufcon = UFCON,
  88. },
  89. [3] = {
  90. .hwport = 3,
  91. .flags = 0,
  92. .ucon = UCON,
  93. .ulcon = ULCON,
  94. .ufcon = UFCON,
  95. },
  96. };
  97. static struct platform_pwm_backlight_data crag6410_backlight_data = {
  98. .pwm_id = 0,
  99. .max_brightness = 1000,
  100. .dft_brightness = 600,
  101. .pwm_period_ns = 100000, /* about 1kHz */
  102. };
  103. static struct platform_device crag6410_backlight_device = {
  104. .name = "pwm-backlight",
  105. .id = -1,
  106. .dev = {
  107. .parent = &s3c_device_timer[0].dev,
  108. .platform_data = &crag6410_backlight_data,
  109. },
  110. };
  111. static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
  112. {
  113. pr_debug("%s: setting power %d\n", __func__, power);
  114. if (power) {
  115. gpio_set_value(S3C64XX_GPB(0), 1);
  116. msleep(1);
  117. s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
  118. } else {
  119. gpio_direction_output(S3C64XX_GPF(14), 0);
  120. gpio_set_value(S3C64XX_GPB(0), 0);
  121. }
  122. }
  123. static struct platform_device crag6410_lcd_powerdev = {
  124. .name = "platform-lcd",
  125. .id = -1,
  126. .dev.parent = &s3c_device_fb.dev,
  127. .dev.platform_data = &(struct plat_lcd_data) {
  128. .set_power = crag6410_lcd_power_set,
  129. },
  130. };
  131. /* 640x480 URT */
  132. static struct s3c_fb_pd_win crag6410_fb_win0 = {
  133. .max_bpp = 32,
  134. .default_bpp = 16,
  135. .xres = 640,
  136. .yres = 480,
  137. .virtual_y = 480 * 2,
  138. .virtual_x = 640,
  139. };
  140. static struct fb_videomode crag6410_lcd_timing = {
  141. .left_margin = 150,
  142. .right_margin = 80,
  143. .upper_margin = 40,
  144. .lower_margin = 5,
  145. .hsync_len = 40,
  146. .vsync_len = 5,
  147. .xres = 640,
  148. .yres = 480,
  149. };
  150. /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
  151. static struct s3c_fb_platdata crag6410_lcd_pdata = {
  152. .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
  153. .vtiming = &crag6410_lcd_timing,
  154. .win[0] = &crag6410_fb_win0,
  155. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  156. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  157. };
  158. /* 2x6 keypad */
  159. static uint32_t crag6410_keymap[] = {
  160. /* KEY(row, col, keycode) */
  161. KEY(0, 0, KEY_VOLUMEUP),
  162. KEY(0, 1, KEY_HOME),
  163. KEY(0, 2, KEY_VOLUMEDOWN),
  164. KEY(0, 3, KEY_HELP),
  165. KEY(0, 4, KEY_MENU),
  166. KEY(0, 5, KEY_MEDIA),
  167. KEY(1, 0, 232),
  168. KEY(1, 1, KEY_DOWN),
  169. KEY(1, 2, KEY_LEFT),
  170. KEY(1, 3, KEY_UP),
  171. KEY(1, 4, KEY_RIGHT),