upload tizen1.0 source
[kernel/linux-2.6.36.git] / arch / arm / mach-s5pv310 / setup-fimg2d.c
1 /* linux/arch/arm/mach-s5pv310/setup-fimg2d.c
2  *
3  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com/
5  *
6  * Inki Dae <inki.dae@samsung.com>
7  *
8  * clock configuration for FIMG2D
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13 */
14
15 #include <linux/io.h>
16 #include <linux/clk.h>
17 #include <linux/err.h>
18 #include <linux/kernel.h>
19 #include <linux/types.h>
20 #include <linux/device.h>
21
22 int universal_fimg2d_setup_clock(const char *sclk_name, const char *pclk_name)
23 {
24         struct clk *sclk = NULL;
25         struct clk *pclk = NULL;
26
27         sclk = clk_get(NULL, sclk_name);
28         if (IS_ERR(sclk)) {
29                 dev_err(NULL, "failed to get %s clock.\n", sclk_name);
30                 goto err_clk;
31         }
32
33         pclk = clk_get(NULL, pclk_name);
34         if (IS_ERR(pclk)) {
35                 dev_err(NULL, "failed to get %s clock.\n", pclk_name);
36                 goto err_clk;
37         }
38
39         clk_set_parent(sclk, pclk);
40
41         dev_dbg(NULL, "set parent clock of %s to %s\n", sclk_name, pclk_name);
42
43         clk_put(sclk);
44         clk_put(pclk);
45
46         return 0;
47
48 err_clk:
49         clk_put(sclk);
50         clk_put(pclk);
51
52         return -EINVAL;
53
54 }