cregit-Linux how code gets into the kernel

Release 4.14 drivers/clk/clk-twl6040.c

Directory: drivers/clk
/*
* TWL6040 clock module driver for OMAP4 McPDM functional clock
*
* Copyright (C) 2012 Texas Instruments Inc.
* Peter Ujfalusi <peter.ujfalusi@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/mfd/twl6040.h>
#include <linux/clk-provider.h>


struct twl6040_pdmclk {
	
struct twl6040 *twl6040;
	
struct device *dev;
	
struct clk_hw pdmclk_hw;
	
int enabled;
};


static int twl6040_pdmclk_is_prepared(struct clk_hw *hw) { struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk, pdmclk_hw); return pdmclk->enabled; }

Contributors

PersonTokensPropCommitsCommitProp
Peter Ujfalusi31100.00%2100.00%
Total31100.00%2100.00%


static int twl6040_pdmclk_prepare(struct clk_hw *hw) { struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk, pdmclk_hw); int ret; ret = twl6040_power(pdmclk->twl6040, 1); if (!ret) pdmclk->enabled = 1; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Peter Ujfalusi54100.00%2100.00%
Total54100.00%2100.00%


static void twl6040_pdmclk_unprepare(struct clk_hw *hw) { struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk, pdmclk_hw); int ret; ret = twl6040_power(pdmclk->twl6040, 0); if (!ret) pdmclk->enabled = 0; }

Contributors

PersonTokensPropCommitsCommitProp
Peter Ujfalusi51100.00%2100.00%
Total51100.00%2100.00%


static unsigned long twl6040_pdmclk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk, pdmclk_hw); return twl6040_get_sysclk(pdmclk->twl6040); }

Contributors

PersonTokensPropCommitsCommitProp
Peter Ujfalusi39100.00%1100.00%
Total39100.00%1100.00%

static const struct clk_ops twl6040_pdmclk_ops = { .is_prepared = twl6040_pdmclk_is_prepared, .prepare = twl6040_pdmclk_prepare, .unprepare = twl6040_pdmclk_unprepare, .recalc_rate = twl6040_pdmclk_recalc_rate, }; static struct clk_init_data twl6040_pdmclk_init = { .name = "pdmclk", .ops = &twl6040_pdmclk_ops, .flags = CLK_GET_RATE_NOCACHE, };
static int twl6040_pdmclk_probe(struct platform_device *pdev) { struct twl6040 *twl6040 = dev_get_drvdata(pdev->dev.parent); struct twl6040_pdmclk *clkdata; int ret; clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL); if (!clkdata) return -ENOMEM; clkdata->dev = &pdev->dev; clkdata->twl6040 = twl6040; clkdata->pdmclk_hw.init = &twl6040_pdmclk_init; ret = devm_clk_hw_register(&pdev->dev, &clkdata->pdmclk_hw); if (ret) return ret; platform_set_drvdata(pdev, clkdata); return of_clk_add_hw_provider(pdev->dev.parent->of_node, of_clk_hw_simple_get, &clkdata->pdmclk_hw); }

Contributors

PersonTokensPropCommitsCommitProp
Peter Ujfalusi12090.91%360.00%
Stephen Boyd118.33%120.00%
Jingoo Han10.76%120.00%
Total132100.00%5100.00%

static struct platform_driver twl6040_pdmclk_driver = { .driver = { .name = "twl6040-pdmclk", }, .probe = twl6040_pdmclk_probe, }; module_platform_driver(twl6040_pdmclk_driver); MODULE_DESCRIPTION("TWL6040 clock driver for McPDM functional clock"); MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>"); MODULE_ALIAS("platform:twl6040-pdmclk"); MODULE_LICENSE("GPL");

Overall Contributors

PersonTokensPropCommitsCommitProp
Peter Ujfalusi43197.29%466.67%
Stephen Boyd112.48%116.67%
Jingoo Han10.23%116.67%
Total443100.00%6100.00%
Directory: drivers/clk
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.