blob: fbe9fd3ed9480d8b5efc056cc62e4061b28f5c4a [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Mika Westerberg701190f2013-01-18 13:46:00 +00002/*
Mika Westerbergf6272172013-05-13 12:42:44 +00003 * Intel Low Power Subsystem clocks.
Mika Westerberg701190f2013-01-18 13:46:00 +00004 *
5 * Copyright (C) 2013, Intel Corporation
6 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
7 * Heikki Krogerus <heikki.krogerus@linux.intel.com>
Mika Westerberg701190f2013-01-18 13:46:00 +00008 */
9
Mika Westerberg701190f2013-01-18 13:46:00 +000010#include <linux/clk-provider.h>
11#include <linux/err.h>
12#include <linux/module.h>
Andy Shevchenkoa9443a62019-02-18 22:34:15 +030013#include <linux/platform_data/x86/clk-lpss.h>
Mika Westerberg701190f2013-01-18 13:46:00 +000014#include <linux/platform_device.h>
15
Mika Westerberg701190f2013-01-18 13:46:00 +000016static int lpt_clk_probe(struct platform_device *pdev)
17{
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030018 struct lpss_clk_data *drvdata;
Mika Westerberg701190f2013-01-18 13:46:00 +000019 struct clk *clk;
20
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030021 drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
22 if (!drvdata)
23 return -ENOMEM;
24
Mika Westerberg701190f2013-01-18 13:46:00 +000025 /* LPSS free running clock */
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030026 drvdata->name = "lpss_clk";
27 clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
Stephen Boyd553b4852016-03-01 11:00:06 -080028 0, 100000000);
Mika Westerberg701190f2013-01-18 13:46:00 +000029 if (IS_ERR(clk))
30 return PTR_ERR(clk);
31
Rafael J. Wysockib59cc202013-05-08 11:55:49 +030032 drvdata->clk = clk;
33 platform_set_drvdata(pdev, drvdata);
Mika Westerberg701190f2013-01-18 13:46:00 +000034 return 0;
35}
36
37static struct platform_driver lpt_clk_driver = {
38 .driver = {
39 .name = "clk-lpt",
Mika Westerberg701190f2013-01-18 13:46:00 +000040 },
41 .probe = lpt_clk_probe,
42};
43
Rafael J. Wysockif58b0822013-03-06 23:46:20 +010044int __init lpt_clk_init(void)
Mika Westerberg701190f2013-01-18 13:46:00 +000045{
46 return platform_driver_register(&lpt_clk_driver);
47}