clock.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/list.h>
  19. #include <mach/clk.h>
  20. #define CLKFLAG_INVERT 0x00000001
  21. #define CLKFLAG_NOINVERT 0x00000002
  22. #define CLKFLAG_NONEST 0x00000004
  23. #define CLKFLAG_NORESET 0x00000008
  24. #define CLK_FIRST_AVAILABLE_FLAG 0x00000100
  25. #define CLKFLAG_AUTO_OFF 0x00000200
  26. #define CLKFLAG_MIN 0x00000400
  27. #define CLKFLAG_MAX 0x00000800
  28. struct clk_ops {
  29. int (*enable)(unsigned id);
  30. void (*disable)(unsigned id);
  31. void (*auto_off)(unsigned id);
  32. int (*reset)(unsigned id, enum clk_reset_action action);
  33. int (*set_rate)(unsigned id, unsigned rate);
  34. int (*set_min_rate)(unsigned id, unsigned rate);
  35. int (*set_max_rate)(unsigned id, unsigned rate);
  36. int (*set_flags)(unsigned id, unsigned flags);
  37. unsigned (*get_rate)(unsigned id);
  38. unsigned (*is_enabled)(unsigned id);
  39. long (*round_rate)(unsigned id, unsigned rate);
  40. };
  41. struct clk {
  42. uint32_t id;
  43. uint32_t remote_id;
  44. uint32_t count;
  45. uint32_t flags;
  46. const char *name;
  47. struct clk_ops *ops;
  48. const char *dbg_name;
  49. struct list_head list;
  50. struct device *dev;
  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. #endif