clock.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 CLK_FIRST_AVAILABLE_FLAG 0x00000100
  22. #define CLKFLAG_AUTO_OFF 0x00000200
  23. #define CLKFLAG_MIN 0x00000400
  24. #define CLKFLAG_MAX 0x00000800
  25. struct clk_ops {
  26. int (*enable)(unsigned id);
  27. void (*disable)(unsigned id);
  28. void (*auto_off)(unsigned id);
  29. int (*reset)(unsigned id, enum clk_reset_action action);
  30. int (*set_rate)(unsigned id, unsigned rate);
  31. int (*set_min_rate)(unsigned id, unsigned rate);
  32. int (*set_max_rate)(unsigned id, unsigned rate);
  33. unsigned (*get_rate)(unsigned id);
  34. unsigned (*is_enabled)(unsigned id);
  35. long (*round_rate)(unsigned id, unsigned rate);
  36. bool (*is_local)(unsigned id);
  37. };
  38. struct clk {
  39. uint32_t id;
  40. uint32_t remote_id;
  41. uint32_t count;
  42. uint32_t flags;
  43. struct clk_ops *ops;
  44. const char *dbg_name;
  45. struct list_head list;
  46. };
  47. #define OFF CLKFLAG_AUTO_OFF
  48. #define CLK_MIN CLKFLAG_MIN
  49. #define CLK_MAX CLKFLAG_MAX
  50. #define CLK_MINMAX (CLK_MIN | CLK_MAX)
  51. #ifdef CONFIG_DEBUG_FS
  52. int __init clock_debug_init(void);
  53. int __init clock_debug_add(struct clk *clock);
  54. #else
  55. static inline int __init clock_debug_init(void) { return 0; }
  56. static inline int __init clock_debug_add(struct clk *clock) { return 0; }
  57. #endif
  58. #endif