clock.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* arch/arm/mach-msm/clock.h
  2. *
  3. * Copyright (C) 2007 Google, Inc.
  4. * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef __ARCH_ARM_MACH_MSM_CLOCK_H
  17. #define __ARCH_ARM_MACH_MSM_CLOCK_H
  18. #include <linux/init.h>
  19. #include <linux/list.h>
  20. #include <mach/clk.h>
  21. #define CLKFLAG_INVERT 0x00000001
  22. #define CLKFLAG_NOINVERT 0x00000002
  23. #define CLKFLAG_NONEST 0x00000004
  24. #define CLKFLAG_NORESET 0x00000008
  25. #define CLK_FIRST_AVAILABLE_FLAG 0x00000100
  26. #define CLKFLAG_AUTO_OFF 0x00000200
  27. #define CLKFLAG_MIN 0x00000400
  28. #define CLKFLAG_MAX 0x00000800
  29. struct clk_ops {
  30. int (*enable)(unsigned id);
  31. void (*disable)(unsigned id);
  32. void (*auto_off)(unsigned id);
  33. int (*reset)(unsigned id, enum clk_reset_action action);
  34. int (*set_rate)(unsigned id, unsigned rate);
  35. int (*set_min_rate)(unsigned id, unsigned rate);
  36. int (*set_max_rate)(unsigned id, unsigned rate);
  37. int (*set_flags)(unsigned id, unsigned flags);
  38. unsigned (*get_rate)(unsigned id);
  39. unsigned (*is_enabled)(unsigned id);
  40. long (*round_rate)(unsigned id, unsigned rate);
  41. bool (*is_local)(unsigned id);
  42. };
  43. struct clk {
  44. uint32_t id;
  45. uint32_t remote_id;
  46. uint32_t count;
  47. uint32_t flags;
  48. struct clk_ops *ops;
  49. const char *dbg_name;
  50. struct list_head list;
  51. };
  52. #define OFF CLKFLAG_AUTO_OFF
  53. #define CLK_MIN CLKFLAG_MIN
  54. #define CLK_MAX CLKFLAG_MAX
  55. #define CLK_MINMAX (CLK_MIN | CLK_MAX)
  56. #ifdef CONFIG_DEBUG_FS
  57. int __init clock_debug_init(void);
  58. int __init clock_debug_add(struct clk *clock);
  59. #else
  60. static inline int __init clock_debug_init(void) { return 0; }
  61. static inline int __init clock_debug_add(struct clk *clock) { return 0; }
  62. #endif
  63. #endif