Revert "NFS: Make close(2) asynchronous when closing NFS O_DIRECT files"
[linux/fpc-iii.git] / drivers / clk / clk-max77802.c
blob74c49b93a6eba5c40f28342f7d4ab4225c477795
1 /*
2 * clk-max77802.c - Clock driver for Maxim 77802
4 * Copyright (C) 2014 Google, Inc
6 * Copyright (C) 2012 Samsung Electornics
7 * Jonghwa Lee <jonghwa3.lee@samsung.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * This driver is based on clk-max77686.c
22 #include <linux/kernel.h>
23 #include <linux/slab.h>
24 #include <linux/err.h>
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27 #include <linux/mfd/max77686-private.h>
28 #include <linux/clk-provider.h>
29 #include <linux/mutex.h>
30 #include <linux/clkdev.h>
32 #include <dt-bindings/clock/maxim,max77802.h>
33 #include "clk-max-gen.h"
35 #define MAX77802_CLOCK_OPMODE_MASK 0x1
36 #define MAX77802_CLOCK_LOW_JITTER_SHIFT 0x3
38 static struct clk_init_data max77802_clks_init[MAX77802_CLKS_NUM] = {
39 [MAX77802_CLK_32K_AP] = {
40 .name = "32khz_ap",
41 .ops = &max_gen_clk_ops,
42 .flags = CLK_IS_ROOT,
44 [MAX77802_CLK_32K_CP] = {
45 .name = "32khz_cp",
46 .ops = &max_gen_clk_ops,
47 .flags = CLK_IS_ROOT,
51 static int max77802_clk_probe(struct platform_device *pdev)
53 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
54 int ret;
56 ret = max_gen_clk_probe(pdev, iodev->regmap, MAX77802_REG_32KHZ,
57 max77802_clks_init, MAX77802_CLKS_NUM);
59 if (ret) {
60 dev_err(&pdev->dev, "generic probe failed %d\n", ret);
61 return ret;
64 /* Enable low-jitter mode on the 32khz clocks. */
65 ret = regmap_update_bits(iodev->regmap, MAX77802_REG_32KHZ,
66 1 << MAX77802_CLOCK_LOW_JITTER_SHIFT,
67 1 << MAX77802_CLOCK_LOW_JITTER_SHIFT);
68 if (ret < 0)
69 dev_err(&pdev->dev, "failed to enable low-jitter mode\n");
71 return ret;
74 static int max77802_clk_remove(struct platform_device *pdev)
76 return max_gen_clk_remove(pdev, MAX77802_CLKS_NUM);
79 static const struct platform_device_id max77802_clk_id[] = {
80 { "max77802-clk", 0},
81 { },
83 MODULE_DEVICE_TABLE(platform, max77802_clk_id);
85 static struct platform_driver max77802_clk_driver = {
86 .driver = {
87 .name = "max77802-clk",
89 .probe = max77802_clk_probe,
90 .remove = max77802_clk_remove,
91 .id_table = max77802_clk_id,
94 module_platform_driver(max77802_clk_driver);
96 MODULE_DESCRIPTION("MAXIM 77802 Clock Driver");
97 MODULE_AUTHOR("Javier Martinez Canillas <javier.martinez@collabora.co.uk>");
98 MODULE_LICENSE("GPL");