calculationOfAverageCurrent.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* linux/arch/arm/plat-s3c24xx/pwm-clock.c
  2. *
  3. * Copyright (c) 2007 Simtec Electronics
  4. * Copyright (c) 2007, 2008 Ben Dooks
  5. * Ben Dooks <ben-linux@fluff.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/list.h>
  15. #include <linux/errno.h>
  16. #include <linux/log2.h>
  17. #include <linux/clk.h>
  18. #include <linux/err.h>
  19. #include <linux/io.h>
  20. #include <mach/hardware.h>
  21. #include <mach/map.h>
  22. #include <asm/irq.h>
  23. #include <plat/clock.h>
  24. #include <plat/cpu.h>
  25. #include <plat/regs-timer.h>
  26. #include <plat/pwm-clock.h>
  27. /* Each of the timers 0 through 5 go through the following
  28. * clock tree, with the inputs depending on the timers.
  29. *
  30. * pclk ---- [ prescaler 0 ] -+---> timer 0
  31. * +---> timer 1
  32. *
  33. * pclk ---- [ prescaler 1 ] -+---> timer 2
  34. * +---> timer 3
  35. * \---> timer 4
  36. *
  37. * Which are fed into the timers as so:
  38. *
  39. * prescaled 0 ---- [ div 2,4,8,16 ] ---\
  40. * [mux] -> timer 0
  41. * tclk 0 ------------------------------/
  42. *
  43. * prescaled 0 ---- [ div 2,4,8,16 ] ---\
  44. * [mux] -> timer 1
  45. * tclk 0 ------------------------------/
  46. *
  47. *
  48. * prescaled 1 ---- [ div 2,4,8,16 ] ---\
  49. * [mux] -> timer 2
  50. * tclk 1 ------------------------------/
  51. *
  52. * prescaled 1 ---- [ div 2,4,8,16 ] ---\
  53. * [mux] -> timer 3
  54. * tclk 1 ------------------------------/
  55. *
  56. * prescaled 1 ---- [ div 2,4,8, 16 ] --\
  57. * [mux] -> timer 4
  58. * tclk 1 ------------------------------/
  59. *
  60. * Since the mux and the divider are tied together in the
  61. * same register space, it is impossible to set the parent
  62. * and the rate at the same time. To avoid this, we add an