linux/drivers/clk/x86/clk-lpt.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-only
   2/*
   3 * Intel Low Power Subsystem clocks.
   4 *
   5 * Copyright (C) 2013, Intel Corporation
   6 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
   7 *          Heikki Krogerus <heikki.krogerus@linux.intel.com>
   8 */
   9
  10#include <linux/clk-provider.h>
  11#include <linux/err.h>
  12#include <linux/module.h>
  13#include <linux/platform_data/x86/clk-lpss.h>
  14#include <linux/platform_device.h>
  15
  16static int lpt_clk_probe(struct platform_device *pdev)
  17{
  18        struct lpss_clk_data *drvdata;
  19        struct clk *clk;
  20
  21        drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
  22        if (!drvdata)
  23                return -ENOMEM;
  24
  25        /* LPSS free running clock */
  26        drvdata->name = "lpss_clk";
  27        clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
  28                                      0, 100000000);
  29        if (IS_ERR(clk))
  30                return PTR_ERR(clk);
  31
  32        drvdata->clk = clk;
  33        platform_set_drvdata(pdev, drvdata);
  34        return 0;
  35}
  36
  37static struct platform_driver lpt_clk_driver = {
  38        .driver = {
  39                .name = "clk-lpt",
  40        },
  41        .probe = lpt_clk_probe,
  42};
  43
  44int __init lpt_clk_init(void)
  45{
  46        return platform_driver_register(&lpt_clk_driver);
  47}
  48