blob: f827083defc4a7e05f6ede023623c67ba0bb4fe8 [file] [log] [blame]
Mika Westerberg701190f2013-01-18 13:46:00 +00001/*
Mika Westerbergf6272172013-05-13 12:42:44 +00002 * Intel Low Power Subsystem clocks.
Mika Westerberg701190f2013-01-18 13:46:00 +00003 *
4 * Copyright (C) 2013, Intel Corporation
5 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
6 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
Mika Westerberg701190f2013-01-18 13:46:00 +000013#include <linux/clk.h>
14#include <linux/clkdev.h>
15#include <linux/clk-provider.h>
16#include <linux/err.h>
17#include <linux/module.h>
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030018#include <linux/platform_data/clk-lpss.h>
Mika Westerberg701190f2013-01-18 13:46:00 +000019#include <linux/platform_device.h>
20
Mika Westerberg701190f2013-01-18 13:46:00 +000021static int lpt_clk_probe(struct platform_device *pdev)
22{
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030023 struct lpss_clk_data *drvdata;
Mika Westerberg701190f2013-01-18 13:46:00 +000024 struct clk *clk;
25
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030026 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
27 if (!drvdata)
28 return -ENOMEM;
29
Mika Westerberg701190f2013-01-18 13:46:00 +000030 /* LPSS free running clock */
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030031 drvdata->name = "lpss_clk";
32 clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
33 CLK_IS_ROOT, 100000000);
Mika Westerberg701190f2013-01-18 13:46:00 +000034 if (IS_ERR(clk))
35 return PTR_ERR(clk);
36
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030037 drvdata->clk = clk;
38 platform_set_drvdata(pdev, drvdata);
Mika Westerberg701190f2013-01-18 13:46:00 +000039 return 0;
40}
41
42static struct platform_driver lpt_clk_driver = {
43 .driver = {
44 .name = "clk-lpt",
Mika Westerberg701190f2013-01-18 13:46:00 +000045 },
46 .probe = lpt_clk_probe,
47};
48
Rafael J. Wysockif58b0822013-03-06 23:46:20 +010049int __init lpt_clk_init(void)
Mika Westerberg701190f2013-01-18 13:46:00 +000050{
51 return platform_driver_register(&lpt_clk_driver);
52}