Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 2 | /* |
Mika Westerberg | f627217 | 2013-05-13 12:42:44 +0000 | [diff] [blame] | 3 | * Intel Low Power Subsystem clocks. |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 4 | * |
| 5 | * Copyright (C) 2013, Intel Corporation |
| 6 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> |
| 7 | * Heikki Krogerus <heikki.krogerus@linux.intel.com> |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 10 | #include <linux/clk-provider.h> |
| 11 | #include <linux/err.h> |
| 12 | #include <linux/module.h> |
Andy Shevchenko | a9443a6 | 2019-02-18 22:34:15 +0300 | [diff] [blame] | 13 | #include <linux/platform_data/x86/clk-lpss.h> |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 14 | #include <linux/platform_device.h> |
| 15 | |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 16 | static int lpt_clk_probe(struct platform_device *pdev) |
| 17 | { |
Rafael J. Wysocki | b59cc20 | 2013-05-08 11:55:49 +0300 | [diff] [blame] | 18 | struct lpss_clk_data *drvdata; |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 19 | struct clk *clk; |
| 20 | |
Rafael J. Wysocki | b59cc20 | 2013-05-08 11:55:49 +0300 | [diff] [blame] | 21 | drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); |
| 22 | if (!drvdata) |
| 23 | return -ENOMEM; |
| 24 | |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 25 | /* LPSS free running clock */ |
Rafael J. Wysocki | b59cc20 | 2013-05-08 11:55:49 +0300 | [diff] [blame] | 26 | drvdata->name = "lpss_clk"; |
| 27 | clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL, |
Stephen Boyd | 553b485 | 2016-03-01 11:00:06 -0800 | [diff] [blame] | 28 | 0, 100000000); |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 29 | if (IS_ERR(clk)) |
| 30 | return PTR_ERR(clk); |
| 31 | |
Rafael J. Wysocki | b59cc20 | 2013-05-08 11:55:49 +0300 | [diff] [blame] | 32 | drvdata->clk = clk; |
| 33 | platform_set_drvdata(pdev, drvdata); |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 34 | return 0; |
| 35 | } |
| 36 | |
| 37 | static struct platform_driver lpt_clk_driver = { |
| 38 | .driver = { |
| 39 | .name = "clk-lpt", |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 40 | }, |
| 41 | .probe = lpt_clk_probe, |
| 42 | }; |
| 43 | |
Rafael J. Wysocki | f58b082 | 2013-03-06 23:46:20 +0100 | [diff] [blame] | 44 | int __init lpt_clk_init(void) |
Mika Westerberg | 701190f | 2013-01-18 13:46:00 +0000 | [diff] [blame] | 45 | { |
| 46 | return platform_driver_register(&lpt_clk_driver); |
| 47 | } |