Merge branch 'r6040-next'
[linux/fpc-iii.git] / drivers / clk / clk-max77686.c
blob9b6f2772e948ffca489046265a6d2729fddfb85e
1 /*
2 * clk-max77686.c - Clock driver for Maxim 77686
4 * Copyright (C) 2012 Samsung Electornics
5 * Jonghwa Lee <jonghwa3.lee@samsung.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <linux/kernel.h>
24 #include <linux/slab.h>
25 #include <linux/err.h>
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
28 #include <linux/mfd/max77686.h>
29 #include <linux/mfd/max77686-private.h>
30 #include <linux/clk-provider.h>
31 #include <linux/mutex.h>
32 #include <linux/clkdev.h>
34 #include <dt-bindings/clock/maxim,max77686.h>
35 #include "clk-max-gen.h"
37 static struct clk_init_data max77686_clks_init[MAX77686_CLKS_NUM] = {
38 [MAX77686_CLK_AP] = {
39 .name = "32khz_ap",
40 .ops = &max_gen_clk_ops,
42 [MAX77686_CLK_CP] = {
43 .name = "32khz_cp",
44 .ops = &max_gen_clk_ops,
46 [MAX77686_CLK_PMIC] = {
47 .name = "32khz_pmic",
48 .ops = &max_gen_clk_ops,
52 static int max77686_clk_probe(struct platform_device *pdev)
54 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
56 return max_gen_clk_probe(pdev, iodev->regmap, MAX77686_REG_32KHZ,
57 max77686_clks_init, MAX77686_CLKS_NUM);
60 static int max77686_clk_remove(struct platform_device *pdev)
62 return max_gen_clk_remove(pdev, MAX77686_CLKS_NUM);
65 static const struct platform_device_id max77686_clk_id[] = {
66 { "max77686-clk", 0},
67 { },
69 MODULE_DEVICE_TABLE(platform, max77686_clk_id);
71 static struct platform_driver max77686_clk_driver = {
72 .driver = {
73 .name = "max77686-clk",
75 .probe = max77686_clk_probe,
76 .remove = max77686_clk_remove,
77 .id_table = max77686_clk_id,
80 module_platform_driver(max77686_clk_driver);
82 MODULE_DESCRIPTION("MAXIM 77686 Clock Driver");
83 MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>");
84 MODULE_LICENSE("GPL");