summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2016-05-30 04:55:11 -0400
committerStephen Boyd <sboyd@codeaurora.org>2016-08-15 15:09:54 -0400
commit7e37deb7fae8437c0487d9fc3f13c7415770efd7 (patch)
tree733050917445338acb23b995ae37e57519886fc6
parent994deaae37a05bfe59aded7bb176092fb849c5b4 (diff)
clk: twl6040: Rename the driver and use consistent names in the code
The driver is to provide the functional clock to OMAP4/5 McPDM. The clock is named as pdmclk in the documentations so change the function names, structure names and variables to align with this. At the same time rename the driver from "twl6040-clk" to "twl6040-pdmclk". This can be done w/o regression since the clock driver is not in use at the moment, the MFD core driver is not even registering the device for it. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/clk-twl6040.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/drivers/clk/clk-twl6040.c b/drivers/clk/clk-twl6040.c
index 6a2dbe6a1627..c98b1ec76f54 100644
--- a/drivers/clk/clk-twl6040.c
+++ b/drivers/clk/clk-twl6040.c
@@ -26,60 +26,73 @@
26#include <linux/mfd/twl6040.h> 26#include <linux/mfd/twl6040.h>
27#include <linux/clk-provider.h> 27#include <linux/clk-provider.h>
28 28
29struct twl6040_clk { 29struct twl6040_pdmclk {
30 struct twl6040 *twl6040; 30 struct twl6040 *twl6040;
31 struct device *dev; 31 struct device *dev;
32 struct clk_hw mcpdm_fclk; 32 struct clk_hw pdmclk_hw;
33 struct clk *clk; 33 struct clk *clk;
34 int enabled; 34 int enabled;
35}; 35};
36 36
37static int twl6040_bitclk_is_prepared(struct clk_hw *hw) 37static int twl6040_pdmclk_is_prepared(struct clk_hw *hw)
38{ 38{
39 struct twl6040_clk *twl6040_clk = container_of(hw, struct twl6040_clk, 39 struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk,
40 mcpdm_fclk); 40 pdmclk_hw);
41 return twl6040_clk->enabled; 41
42 return pdmclk->enabled;
42} 43}
43 44
44static int twl6040_bitclk_prepare(struct clk_hw *hw) 45static int twl6040_pdmclk_prepare(struct clk_hw *hw)
45{ 46{
46 struct twl6040_clk *twl6040_clk = container_of(hw, struct twl6040_clk, 47 struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk,
47 mcpdm_fclk); 48 pdmclk_hw);
48 int ret; 49 int ret;
49 50
50 ret = twl6040_power(twl6040_clk->twl6040, 1); 51 ret = twl6040_power(pdmclk->twl6040, 1);
51 if (!ret) 52 if (!ret)
52 twl6040_clk->enabled = 1; 53 pdmclk->enabled = 1;
53 54
54 return ret; 55 return ret;
55} 56}
56 57
57static void twl6040_bitclk_unprepare(struct clk_hw *hw) 58static void twl6040_pdmclk_unprepare(struct clk_hw *hw)
58{ 59{
59 struct twl6040_clk *twl6040_clk = container_of(hw, struct twl6040_clk, 60 struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk,
60 mcpdm_fclk); 61 pdmclk_hw);
61 int ret; 62 int ret;
62 63
63 ret = twl6040_power(twl6040_clk->twl6040, 0); 64 ret = twl6040_power(pdmclk->twl6040, 0);
64 if (!ret) 65 if (!ret)
65 twl6040_clk->enabled = 0; 66 pdmclk->enabled = 0;
67
68}
69
70static unsigned long twl6040_pdmclk_recalc_rate(struct clk_hw *hw,
71 unsigned long parent_rate)
72{
73 struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk,
74 pdmclk_hw);
75
76 return twl6040_get_sysclk(pdmclk->twl6040);
66} 77}
67 78
68static const struct clk_ops twl6040_mcpdm_ops = { 79static const struct clk_ops twl6040_pdmclk_ops = {
69 .is_prepared = twl6040_bitclk_is_prepared, 80 .is_prepared = twl6040_pdmclk_is_prepared,
70 .prepare = twl6040_bitclk_prepare, 81 .prepare = twl6040_pdmclk_prepare,
71 .unprepare = twl6040_bitclk_unprepare, 82 .unprepare = twl6040_pdmclk_unprepare,
83 .recalc_rate = twl6040_pdmclk_recalc_rate,
72}; 84};
73 85
74static struct clk_init_data wm831x_clkout_init = { 86static struct clk_init_data twl6040_pdmclk_init = {
75 .name = "mcpdm_fclk", 87 .name = "pdmclk",
76 .ops = &twl6040_mcpdm_ops, 88 .ops = &twl6040_pdmclk_ops,
89 .flags = CLK_GET_RATE_NOCACHE,
77}; 90};
78 91
79static int twl6040_clk_probe(struct platform_device *pdev) 92static int twl6040_pdmclk_probe(struct platform_device *pdev)
80{ 93{
81 struct twl6040 *twl6040 = dev_get_drvdata(pdev->dev.parent); 94 struct twl6040 *twl6040 = dev_get_drvdata(pdev->dev.parent);
82 struct twl6040_clk *clkdata; 95 struct twl6040_pdmclk *clkdata;
83 96
84 clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL); 97 clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL);
85 if (!clkdata) 98 if (!clkdata)
@@ -88,8 +101,8 @@ static int twl6040_clk_probe(struct platform_device *pdev)
88 clkdata->dev = &pdev->dev; 101 clkdata->dev = &pdev->dev;
89 clkdata->twl6040 = twl6040; 102 clkdata->twl6040 = twl6040;
90 103
91 clkdata->mcpdm_fclk.init = &wm831x_clkout_init; 104 clkdata->pdmclk_hw.init = &twl6040_pdmclk_init;
92 clkdata->clk = devm_clk_register(&pdev->dev, &clkdata->mcpdm_fclk); 105 clkdata->clk = devm_clk_register(&pdev->dev, &clkdata->pdmclk_hw);
93 if (IS_ERR(clkdata->clk)) 106 if (IS_ERR(clkdata->clk))
94 return PTR_ERR(clkdata->clk); 107 return PTR_ERR(clkdata->clk);
95 108
@@ -99,16 +112,16 @@ static int twl6040_clk_probe(struct platform_device *pdev)
99 of_clk_src_simple_get, clkdata->clk); 112 of_clk_src_simple_get, clkdata->clk);
100} 113}
101 114
102static struct platform_driver twl6040_clk_driver = { 115static struct platform_driver twl6040_pdmclk_driver = {
103 .driver = { 116 .driver = {
104 .name = "twl6040-clk", 117 .name = "twl6040-pdmclk",
105 }, 118 },
106 .probe = twl6040_clk_probe, 119 .probe = twl6040_pdmclk_probe,
107}; 120};
108 121
109module_platform_driver(twl6040_clk_driver); 122module_platform_driver(twl6040_pdmclk_driver);
110 123
111MODULE_DESCRIPTION("TWL6040 clock driver for McPDM functional clock"); 124MODULE_DESCRIPTION("TWL6040 clock driver for McPDM functional clock");
112MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>"); 125MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
113MODULE_ALIAS("platform:twl6040-clk"); 126MODULE_ALIAS("platform:twl6040-pdmclk");
114MODULE_LICENSE("GPL"); 127MODULE_LICENSE("GPL");