clock.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. };
  42. struct clk {
  43. uint32_t id;
  44. uint32_t remote_id;
  45. uint32_t count;
  46. uint32_t flags;
  47. const char *name;
  48. struct clk_ops *ops;
  49. const char *dbg_name;
  50. struct list_head list;
  51. struct device *dev;
  52. };
  53. #define OFF CLKFLAG_AUTO_OFF
  54. #define CLK_MIN CLKFLAG_MIN
  55. #define CLK_MAX CLKFLAG_MAX
  56. #define CLK_MINMAX (CLK_MIN | CLK_MAX)
  57. #ifdef CONFIG_DEBUG_FS
  58. int __init clock_debug_init(void);
  59. int __init clock_debug_add(struct clk *clock);
  60. #else
  61. static inline int __init clock_debug_init(void) { return 0; }
  62. static inline int __init clock_debug_add(struct clk *clock) { return 0; }
  63. #endif
  64. #endif