[PATCH] w1: Adds a sysfs entry (w1_master_search) that allows you to disable/enable...
[linux-2.6/verdex.git] / include / asm-arm / hardware / clock.h
blob19da861e523d8dbbfe327e4b07d166c61544a623
1 /*
2 * linux/include/asm-arm/hardware/clock.h
4 * Copyright (C) 2004 ARM Limited.
5 * Written by Deep Blue Solutions Limited.
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.
11 #ifndef ASMARM_CLOCK_H
12 #define ASMARM_CLOCK_H
14 struct device;
17 * The base API.
22 * struct clk - an machine class defined object / cookie.
24 struct clk;
26 /**
27 * clk_get - lookup and obtain a reference to a clock producer.
28 * @dev: device for clock "consumer"
29 * @id: clock comsumer ID
31 * Returns a struct clk corresponding to the clock producer, or
32 * valid IS_ERR() condition containing errno. The implementation
33 * uses @dev and @id to determine the clock consumer, and thereby
34 * the clock producer. (IOW, @id may be identical strings, but
35 * clk_get may return different clock producers depending on @dev.)
37 struct clk *clk_get(struct device *dev, const char *id);
39 /**
40 * clk_enable - inform the system when the clock source should be running.
41 * @clk: clock source
43 * If the clock can not be enabled/disabled, this should return success.
45 * Returns success (0) or negative errno.
47 int clk_enable(struct clk *clk);
49 /**
50 * clk_disable - inform the system when the clock source is no longer required.
51 * @clk: clock source
53 void clk_disable(struct clk *clk);
55 /**
56 * clk_use - increment the use count
57 * @clk: clock source
59 * Returns success (0) or negative errno.
61 int clk_use(struct clk *clk);
63 /**
64 * clk_unuse - decrement the use count
65 * @clk: clock source
67 void clk_unuse(struct clk *clk);
69 /**
70 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
71 * This is only valid once the clock source has been enabled.
72 * @clk: clock source
74 unsigned long clk_get_rate(struct clk *clk);
76 /**
77 * clk_put - "free" the clock source
78 * @clk: clock source
80 void clk_put(struct clk *clk);
84 * The remaining APIs are optional for machine class support.
88 /**
89 * clk_round_rate - adjust a rate to the exact rate a clock can provide
90 * @clk: clock source
91 * @rate: desired clock rate in Hz
93 * Returns rounded clock rate in Hz, or negative errno.
95 long clk_round_rate(struct clk *clk, unsigned long rate);
97 /**
98 * clk_set_rate - set the clock rate for a clock source
99 * @clk: clock source
100 * @rate: desired clock rate in Hz
102 * Returns success (0) or negative errno.
104 int clk_set_rate(struct clk *clk, unsigned long rate);
107 * clk_set_parent - set the parent clock source for this clock
108 * @clk: clock source
109 * @parent: parent clock source
111 * Returns success (0) or negative errno.
113 int clk_set_parent(struct clk *clk, struct clk *parent);
116 * clk_get_parent - get the parent clock source for this clock
117 * @clk: clock source
119 * Returns struct clk corresponding to parent clock source, or
120 * valid IS_ERR() condition containing errno.
122 struct clk *clk_get_parent(struct clk *clk);
124 #endif