Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
clock.c
Go to the documentation of this file.
1 /*
2  * linux/arch/arm/plat-versatile/clock.c
3  *
4  * Copyright (C) 2004 ARM Limited.
5  * Written by Deep Blue Solutions Limited.
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 version 2 as
9  * published by the Free Software Foundation.
10  */
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/clk.h>
15 #include <linux/mutex.h>
16 
17 #include <asm/hardware/icst.h>
18 
19 #include <mach/clkdev.h>
20 
21 int clk_enable(struct clk *clk)
22 {
23  return 0;
24 }
26 
27 void clk_disable(struct clk *clk)
28 {
29 }
31 
32 unsigned long clk_get_rate(struct clk *clk)
33 {
34  return clk->rate;
35 }
37 
38 long clk_round_rate(struct clk *clk, unsigned long rate)
39 {
40  long ret = -EIO;
41  if (clk->ops && clk->ops->round)
42  ret = clk->ops->round(clk, rate);
43  return ret;
44 }
46 
47 int clk_set_rate(struct clk *clk, unsigned long rate)
48 {
49  int ret = -EIO;
50  if (clk->ops && clk->ops->set)
51  ret = clk->ops->set(clk, rate);
52  return ret;
53 }
55 
56 long icst_clk_round(struct clk *clk, unsigned long rate)
57 {
58  struct icst_vco vco;
59  vco = icst_hz_to_vco(clk->params, rate);
60  return icst_hz(clk->params, vco);
61 }
63 
64 int icst_clk_set(struct clk *clk, unsigned long rate)
65 {
66  struct icst_vco vco;
67 
68  vco = icst_hz_to_vco(clk->params, rate);
69  clk->rate = icst_hz(clk->params, vco);
70  clk->ops->setvco(clk, vco);
71 
72  return 0;
73 }