| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
|
| 3 |
#include <linux/clk.h> |
| 4 |
|
| 5 |
/* |
| 6 |
* The "inline" implementation of below helpers are only available when |
| 7 |
* CONFIG_HAVE_CLK or CONFIG_HAVE_CLK_PREPARE aren't set. |
| 8 |
*/ |
| 9 |
#ifndef CONFIG_HAVE_CLK |
| 10 |
struct clk *rust_helper_clk_get(struct device *dev, const char *id) |
| 11 |
{ |
| 12 |
return clk_get(dev, id); |
| 13 |
} |
| 14 |
|
| 15 |
void rust_helper_clk_put(struct clk *clk) |
| 16 |
{ |
| 17 |
clk_put(clk); |
| 18 |
} |
| 19 |
|
| 20 |
int rust_helper_clk_enable(struct clk *clk) |
| 21 |
{ |
| 22 |
return clk_enable(clk); |
| 23 |
} |
| 24 |
|
| 25 |
void rust_helper_clk_disable(struct clk *clk) |
| 26 |
{ |
| 27 |
clk_disable(clk); |
| 28 |
} |
| 29 |
|
| 30 |
unsigned long rust_helper_clk_get_rate(struct clk *clk) |
| 31 |
{ |
| 32 |
return clk_get_rate(clk); |
| 33 |
} |
| 34 |
|
| 35 |
int rust_helper_clk_set_rate(struct clk *clk, unsigned long rate) |
| 36 |
{ |
| 37 |
return clk_set_rate(clk, rate); |
| 38 |
} |
| 39 |
#endif |
| 40 |
|
| 41 |
#ifndef CONFIG_HAVE_CLK_PREPARE |
| 42 |
int rust_helper_clk_prepare(struct clk *clk) |
| 43 |
{ |
| 44 |
return clk_prepare(clk); |
| 45 |
} |
| 46 |
|
| 47 |
void rust_helper_clk_unprepare(struct clk *clk) |
| 48 |
{ |
| 49 |
clk_unprepare(clk); |
| 50 |
} |
| 51 |
#endif |
| 52 |
|
| 53 |
struct clk *rust_helper_clk_get_optional(struct device *dev, const char *id) |
| 54 |
{ |
| 55 |
return clk_get_optional(dev, id); |
| 56 |
} |
| 57 |
|
| 58 |
int rust_helper_clk_prepare_enable(struct clk *clk) |
| 59 |
{ |
| 60 |
return clk_prepare_enable(clk); |
| 61 |
} |
| 62 |
|
| 63 |
void rust_helper_clk_disable_unprepare(struct clk *clk) |
| 64 |
{ |
| 65 |
clk_disable_unprepare(clk); |
| 66 |
} |