blob: 24a9658348d7861470354af7246ae632f25815cf [file] [log] [blame]
Chanwoo Choi07222492015-11-03 19:04:16 +09001/*
2 * Generic Exynos Bus frequency driver with DEVFREQ Framework
3 *
Chanwoo Choi403e0682015-11-05 18:29:27 +09004 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
Chanwoo Choi07222492015-11-03 19:04:16 +09005 * Author : Chanwoo Choi <cw00.choi@samsung.com>
6 *
7 * This driver support Exynos Bus frequency feature by using
8 * DEVFREQ framework and is based on drivers/devfreq/exynos/exynos4_bus.c.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/clk.h>
16#include <linux/devfreq.h>
17#include <linux/devfreq-event.h>
18#include <linux/device.h>
19#include <linux/export.h>
20#include <linux/module.h>
21#include <linux/of_device.h>
22#include <linux/pm_opp.h>
23#include <linux/platform_device.h>
24#include <linux/regulator/consumer.h>
25#include <linux/slab.h>
26
27#define DEFAULT_SATURATION_RATIO 40
28#define DEFAULT_VOLTAGE_TOLERANCE 2
29
30struct exynos_bus {
31 struct device *dev;
32
33 struct devfreq *devfreq;
34 struct devfreq_event_dev **edev;
35 unsigned int edev_count;
36 struct mutex lock;
37
Viresh Kumarc8ce82b2016-12-01 15:55:40 +053038 unsigned long curr_freq;
Chanwoo Choi07222492015-11-03 19:04:16 +090039
40 struct regulator *regulator;
41 struct clk *clk;
42 unsigned int voltage_tolerance;
43 unsigned int ratio;
44};
45
46/*
47 * Control the devfreq-event device to get the current state of bus
48 */
49#define exynos_bus_ops_edev(ops) \
50static int exynos_bus_##ops(struct exynos_bus *bus) \
51{ \
52 int i, ret; \
53 \
54 for (i = 0; i < bus->edev_count; i++) { \
55 if (!bus->edev[i]) \
56 continue; \
57 ret = devfreq_event_##ops(bus->edev[i]); \
58 if (ret < 0) \
59 return ret; \
60 } \
61 \
62 return 0; \
63}
64exynos_bus_ops_edev(enable_edev);
65exynos_bus_ops_edev(disable_edev);
66exynos_bus_ops_edev(set_event);
67
68static int exynos_bus_get_event(struct exynos_bus *bus,
69 struct devfreq_event_data *edata)
70{
71 struct devfreq_event_data event_data;
72 unsigned long load_count = 0, total_count = 0;
73 int i, ret = 0;
74
75 for (i = 0; i < bus->edev_count; i++) {
76 if (!bus->edev[i])
77 continue;
78
79 ret = devfreq_event_get_event(bus->edev[i], &event_data);
80 if (ret < 0)
81 return ret;
82
83 if (i == 0 || event_data.load_count > load_count) {
84 load_count = event_data.load_count;
85 total_count = event_data.total_count;
86 }
87 }
88
89 edata->load_count = load_count;
90 edata->total_count = total_count;
91
92 return ret;
93}
94
95/*
Chanwoo Choi403e0682015-11-05 18:29:27 +090096 * Must necessary function for devfreq simple-ondemand governor
Chanwoo Choi07222492015-11-03 19:04:16 +090097 */
98static int exynos_bus_target(struct device *dev, unsigned long *freq, u32 flags)
99{
100 struct exynos_bus *bus = dev_get_drvdata(dev);
101 struct dev_pm_opp *new_opp;
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530102 unsigned long old_freq, new_freq, new_volt, tol;
Chanwoo Choi07222492015-11-03 19:04:16 +0900103 int ret = 0;
104
105 /* Get new opp-bus instance according to new bus clock */
Chanwoo Choi07222492015-11-03 19:04:16 +0900106 new_opp = devfreq_recommended_opp(dev, freq, flags);
107 if (IS_ERR(new_opp)) {
108 dev_err(dev, "failed to get recommended opp instance\n");
Chanwoo Choi07222492015-11-03 19:04:16 +0900109 return PTR_ERR(new_opp);
110 }
111
112 new_freq = dev_pm_opp_get_freq(new_opp);
113 new_volt = dev_pm_opp_get_voltage(new_opp);
Viresh Kumar8a31d9d92017-01-23 10:11:47 +0530114 dev_pm_opp_put(new_opp);
115
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530116 old_freq = bus->curr_freq;
Chanwoo Choi07222492015-11-03 19:04:16 +0900117
118 if (old_freq == new_freq)
119 return 0;
120 tol = new_volt * bus->voltage_tolerance / 100;
121
122 /* Change voltage and frequency according to new OPP level */
123 mutex_lock(&bus->lock);
124
125 if (old_freq < new_freq) {
126 ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
127 if (ret < 0) {
128 dev_err(bus->dev, "failed to set voltage\n");
129 goto out;
130 }
131 }
132
133 ret = clk_set_rate(bus->clk, new_freq);
134 if (ret < 0) {
135 dev_err(dev, "failed to change clock of bus\n");
136 clk_set_rate(bus->clk, old_freq);
137 goto out;
138 }
139
140 if (old_freq > new_freq) {
141 ret = regulator_set_voltage_tol(bus->regulator, new_volt, tol);
142 if (ret < 0) {
143 dev_err(bus->dev, "failed to set voltage\n");
144 goto out;
145 }
146 }
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530147 bus->curr_freq = new_freq;
Chanwoo Choi07222492015-11-03 19:04:16 +0900148
Chanwoo Choi7b702462016-12-01 19:42:17 +0900149 dev_dbg(dev, "Set the frequency of bus (%luHz -> %luHz, %luHz)\n",
150 old_freq, new_freq, clk_get_rate(bus->clk));
Chanwoo Choi07222492015-11-03 19:04:16 +0900151out:
152 mutex_unlock(&bus->lock);
153
154 return ret;
155}
156
157static int exynos_bus_get_dev_status(struct device *dev,
158 struct devfreq_dev_status *stat)
159{
160 struct exynos_bus *bus = dev_get_drvdata(dev);
161 struct devfreq_event_data edata;
162 int ret;
163
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530164 stat->current_frequency = bus->curr_freq;
Chanwoo Choi07222492015-11-03 19:04:16 +0900165
166 ret = exynos_bus_get_event(bus, &edata);
167 if (ret < 0) {
168 stat->total_time = stat->busy_time = 0;
169 goto err;
170 }
171
172 stat->busy_time = (edata.load_count * 100) / bus->ratio;
173 stat->total_time = edata.total_count;
174
175 dev_dbg(dev, "Usage of devfreq-event : %lu/%lu\n", stat->busy_time,
176 stat->total_time);
177
178err:
179 ret = exynos_bus_set_event(bus);
180 if (ret < 0) {
181 dev_err(dev, "failed to set event to devfreq-event devices\n");
182 return ret;
183 }
184
185 return ret;
186}
187
188static void exynos_bus_exit(struct device *dev)
189{
190 struct exynos_bus *bus = dev_get_drvdata(dev);
191 int ret;
192
193 ret = exynos_bus_disable_edev(bus);
194 if (ret < 0)
195 dev_warn(dev, "failed to disable the devfreq-event devices\n");
196
Chanwoo Choi07222492015-11-03 19:04:16 +0900197 dev_pm_opp_of_remove_table(dev);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900198 clk_disable_unprepare(bus->clk);
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200199 if (bus->regulator)
200 regulator_disable(bus->regulator);
Chanwoo Choi07222492015-11-03 19:04:16 +0900201}
202
Chanwoo Choi403e0682015-11-05 18:29:27 +0900203/*
204 * Must necessary function for devfreq passive governor
205 */
206static int exynos_bus_passive_target(struct device *dev, unsigned long *freq,
207 u32 flags)
208{
209 struct exynos_bus *bus = dev_get_drvdata(dev);
210 struct dev_pm_opp *new_opp;
211 unsigned long old_freq, new_freq;
212 int ret = 0;
213
214 /* Get new opp-bus instance according to new bus clock */
Chanwoo Choi403e0682015-11-05 18:29:27 +0900215 new_opp = devfreq_recommended_opp(dev, freq, flags);
216 if (IS_ERR(new_opp)) {
217 dev_err(dev, "failed to get recommended opp instance\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900218 return PTR_ERR(new_opp);
219 }
220
221 new_freq = dev_pm_opp_get_freq(new_opp);
Viresh Kumar8a31d9d92017-01-23 10:11:47 +0530222 dev_pm_opp_put(new_opp);
223
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530224 old_freq = bus->curr_freq;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900225
226 if (old_freq == new_freq)
227 return 0;
228
229 /* Change the frequency according to new OPP level */
230 mutex_lock(&bus->lock);
231
232 ret = clk_set_rate(bus->clk, new_freq);
233 if (ret < 0) {
234 dev_err(dev, "failed to set the clock of bus\n");
235 goto out;
236 }
237
238 *freq = new_freq;
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530239 bus->curr_freq = new_freq;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900240
Chanwoo Choi7b702462016-12-01 19:42:17 +0900241 dev_dbg(dev, "Set the frequency of bus (%luHz -> %luHz, %luHz)\n",
242 old_freq, new_freq, clk_get_rate(bus->clk));
Chanwoo Choi403e0682015-11-05 18:29:27 +0900243out:
244 mutex_unlock(&bus->lock);
245
246 return ret;
247}
248
249static void exynos_bus_passive_exit(struct device *dev)
250{
251 struct exynos_bus *bus = dev_get_drvdata(dev);
252
253 dev_pm_opp_of_remove_table(dev);
254 clk_disable_unprepare(bus->clk);
255}
256
257static int exynos_bus_parent_parse_of(struct device_node *np,
258 struct exynos_bus *bus)
Chanwoo Choi07222492015-11-03 19:04:16 +0900259{
260 struct device *dev = bus->dev;
Chanwoo Choi07222492015-11-03 19:04:16 +0900261 int i, ret, count, size;
262
Chanwoo Choi07222492015-11-03 19:04:16 +0900263 /* Get the regulator to provide each bus with the power */
264 bus->regulator = devm_regulator_get(dev, "vdd");
265 if (IS_ERR(bus->regulator)) {
266 dev_err(dev, "failed to get VDD regulator\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900267 return PTR_ERR(bus->regulator);
Chanwoo Choi07222492015-11-03 19:04:16 +0900268 }
269
270 ret = regulator_enable(bus->regulator);
271 if (ret < 0) {
272 dev_err(dev, "failed to enable VDD regulator\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900273 return ret;
Chanwoo Choi07222492015-11-03 19:04:16 +0900274 }
275
276 /*
277 * Get the devfreq-event devices to get the current utilization of
278 * buses. This raw data will be used in devfreq ondemand governor.
279 */
280 count = devfreq_event_get_edev_count(dev);
281 if (count < 0) {
282 dev_err(dev, "failed to get the count of devfreq-event dev\n");
283 ret = count;
284 goto err_regulator;
285 }
286 bus->edev_count = count;
287
288 size = sizeof(*bus->edev) * count;
289 bus->edev = devm_kzalloc(dev, size, GFP_KERNEL);
290 if (!bus->edev) {
291 ret = -ENOMEM;
292 goto err_regulator;
293 }
294
295 for (i = 0; i < count; i++) {
296 bus->edev[i] = devfreq_event_get_edev_by_phandle(dev, i);
297 if (IS_ERR(bus->edev[i])) {
298 ret = -EPROBE_DEFER;
299 goto err_regulator;
300 }
301 }
302
303 /*
304 * Optionally, Get the saturation ratio according to Exynos SoC
305 * When measuring the utilization of each AXI bus with devfreq-event
306 * devices, the measured real cycle might be much lower than the
307 * total cycle of bus during sampling rate. In result, the devfreq
308 * simple-ondemand governor might not decide to change the current
309 * frequency due to too utilization (= real cycle/total cycle).
310 * So, this property is used to adjust the utilization when calculating
311 * the busy_time in exynos_bus_get_dev_status().
312 */
313 if (of_property_read_u32(np, "exynos,saturation-ratio", &bus->ratio))
314 bus->ratio = DEFAULT_SATURATION_RATIO;
315
316 if (of_property_read_u32(np, "exynos,voltage-tolerance",
317 &bus->voltage_tolerance))
318 bus->voltage_tolerance = DEFAULT_VOLTAGE_TOLERANCE;
319
320 return 0;
321
322err_regulator:
323 regulator_disable(bus->regulator);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900324
325 return ret;
326}
327
328static int exynos_bus_parse_of(struct device_node *np,
329 struct exynos_bus *bus)
330{
331 struct device *dev = bus->dev;
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530332 struct dev_pm_opp *opp;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900333 unsigned long rate;
334 int ret;
335
336 /* Get the clock to provide each bus with source clock */
337 bus->clk = devm_clk_get(dev, "bus");
338 if (IS_ERR(bus->clk)) {
339 dev_err(dev, "failed to get bus clock\n");
340 return PTR_ERR(bus->clk);
341 }
342
343 ret = clk_prepare_enable(bus->clk);
344 if (ret < 0) {
345 dev_err(dev, "failed to get enable clock\n");
346 return ret;
347 }
348
349 /* Get the freq and voltage from OPP table to scale the bus freq */
Chanwoo Choi403e0682015-11-05 18:29:27 +0900350 ret = dev_pm_opp_of_add_table(dev);
351 if (ret < 0) {
352 dev_err(dev, "failed to get OPP table\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900353 goto err_clk;
354 }
355
356 rate = clk_get_rate(bus->clk);
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530357
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530358 opp = devfreq_recommended_opp(dev, &rate, 0);
359 if (IS_ERR(opp)) {
Chanwoo Choi403e0682015-11-05 18:29:27 +0900360 dev_err(dev, "failed to find dev_pm_opp\n");
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530361 ret = PTR_ERR(opp);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900362 goto err_opp;
363 }
Viresh Kumarc8ce82b2016-12-01 15:55:40 +0530364 bus->curr_freq = dev_pm_opp_get_freq(opp);
Viresh Kumar8a31d9d92017-01-23 10:11:47 +0530365 dev_pm_opp_put(opp);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900366
367 return 0;
368
Chanwoo Choi07222492015-11-03 19:04:16 +0900369err_opp:
370 dev_pm_opp_of_remove_table(dev);
371err_clk:
372 clk_disable_unprepare(bus->clk);
373
374 return ret;
375}
376
377static int exynos_bus_probe(struct platform_device *pdev)
378{
379 struct device *dev = &pdev->dev;
Peter Chend8150d12016-07-01 17:42:01 +0800380 struct device_node *np = dev->of_node, *node;
Chanwoo Choi07222492015-11-03 19:04:16 +0900381 struct devfreq_dev_profile *profile;
382 struct devfreq_simple_ondemand_data *ondemand_data;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900383 struct devfreq_passive_data *passive_data;
384 struct devfreq *parent_devfreq;
Chanwoo Choi07222492015-11-03 19:04:16 +0900385 struct exynos_bus *bus;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900386 int ret, max_state;
387 unsigned long min_freq, max_freq;
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200388 bool passive = false;
Chanwoo Choi07222492015-11-03 19:04:16 +0900389
390 if (!np) {
391 dev_err(dev, "failed to find devicetree node\n");
392 return -EINVAL;
393 }
394
395 bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
396 if (!bus)
397 return -ENOMEM;
398 mutex_init(&bus->lock);
399 bus->dev = &pdev->dev;
400 platform_set_drvdata(pdev, bus);
401
Chanwoo Choi07222492015-11-03 19:04:16 +0900402 profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL);
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200403 if (!profile)
404 return -ENOMEM;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900405
Peter Chend8150d12016-07-01 17:42:01 +0800406 node = of_parse_phandle(dev->of_node, "devfreq", 0);
407 if (node) {
408 of_node_put(node);
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200409 passive = true;
Peter Chend8150d12016-07-01 17:42:01 +0800410 } else {
Chanwoo Choi403e0682015-11-05 18:29:27 +0900411 ret = exynos_bus_parent_parse_of(np, bus);
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200412 if (ret < 0)
413 return ret;
Peter Chend8150d12016-07-01 17:42:01 +0800414 }
Chanwoo Choi403e0682015-11-05 18:29:27 +0900415
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200416 /* Parse the device-tree to get the resource information */
417 ret = exynos_bus_parse_of(np, bus);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900418 if (ret < 0)
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200419 goto err_reg;
420
421 if (passive)
422 goto passive;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900423
MyungJoo Ham83cb0e42016-04-29 16:13:03 +0900424 /* Initialize the struct profile and governor data for parent device */
Chanwoo Choi07222492015-11-03 19:04:16 +0900425 profile->polling_ms = 50;
426 profile->target = exynos_bus_target;
427 profile->get_dev_status = exynos_bus_get_dev_status;
428 profile->exit = exynos_bus_exit;
429
430 ondemand_data = devm_kzalloc(dev, sizeof(*ondemand_data), GFP_KERNEL);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900431 if (!ondemand_data) {
432 ret = -ENOMEM;
433 goto err;
434 }
Chanwoo Choi07222492015-11-03 19:04:16 +0900435 ondemand_data->upthreshold = 40;
436 ondemand_data->downdifferential = 5;
437
438 /* Add devfreq device to monitor and handle the exynos bus */
Chanwoo Choiaa7c3522017-10-23 10:32:12 +0900439 bus->devfreq = devm_devfreq_add_device(dev, profile,
440 DEVFREQ_GOV_SIMPLE_ONDEMAND,
Chanwoo Choi07222492015-11-03 19:04:16 +0900441 ondemand_data);
442 if (IS_ERR(bus->devfreq)) {
443 dev_err(dev, "failed to add devfreq device\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900444 ret = PTR_ERR(bus->devfreq);
445 goto err;
Chanwoo Choi07222492015-11-03 19:04:16 +0900446 }
447
448 /* Register opp_notifier to catch the change of OPP */
449 ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq);
450 if (ret < 0) {
451 dev_err(dev, "failed to register opp notifier\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900452 goto err;
Chanwoo Choi07222492015-11-03 19:04:16 +0900453 }
454
455 /*
456 * Enable devfreq-event to get raw data which is used to determine
457 * current bus load.
458 */
459 ret = exynos_bus_enable_edev(bus);
460 if (ret < 0) {
461 dev_err(dev, "failed to enable devfreq-event devices\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900462 goto err;
Chanwoo Choi07222492015-11-03 19:04:16 +0900463 }
464
465 ret = exynos_bus_set_event(bus);
466 if (ret < 0) {
467 dev_err(dev, "failed to set event to devfreq-event devices\n");
Chanwoo Choi403e0682015-11-05 18:29:27 +0900468 goto err;
Chanwoo Choi07222492015-11-03 19:04:16 +0900469 }
470
Chanwoo Choi403e0682015-11-05 18:29:27 +0900471 goto out;
472passive:
MyungJoo Ham83cb0e42016-04-29 16:13:03 +0900473 /* Initialize the struct profile and governor data for passive device */
Chanwoo Choi403e0682015-11-05 18:29:27 +0900474 profile->target = exynos_bus_passive_target;
475 profile->exit = exynos_bus_passive_exit;
476
477 /* Get the instance of parent devfreq device */
478 parent_devfreq = devfreq_get_devfreq_by_phandle(dev, 0);
479 if (IS_ERR(parent_devfreq)) {
480 ret = -EPROBE_DEFER;
481 goto err;
482 }
483
484 passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL);
485 if (!passive_data) {
486 ret = -ENOMEM;
487 goto err;
488 }
489 passive_data->parent = parent_devfreq;
490
491 /* Add devfreq device for exynos bus with passive governor */
Chanwoo Choiaa7c3522017-10-23 10:32:12 +0900492 bus->devfreq = devm_devfreq_add_device(dev, profile, DEVFREQ_GOV_PASSIVE,
Chanwoo Choi403e0682015-11-05 18:29:27 +0900493 passive_data);
494 if (IS_ERR(bus->devfreq)) {
495 dev_err(dev,
496 "failed to add devfreq dev with passive governor\n");
Chanwoo Choi32dd7732016-12-28 20:52:36 +0900497 ret = PTR_ERR(bus->devfreq);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900498 goto err;
499 }
500
501out:
502 max_state = bus->devfreq->profile->max_state;
503 min_freq = (bus->devfreq->profile->freq_table[0] / 1000);
504 max_freq = (bus->devfreq->profile->freq_table[max_state - 1] / 1000);
505 pr_info("exynos-bus: new bus device registered: %s (%6ld KHz ~ %6ld KHz)\n",
506 dev_name(dev), min_freq, max_freq);
507
Chanwoo Choi07222492015-11-03 19:04:16 +0900508 return 0;
Chanwoo Choi403e0682015-11-05 18:29:27 +0900509
510err:
511 dev_pm_opp_of_remove_table(dev);
512 clk_disable_unprepare(bus->clk);
Kamil Koniecznyd51268d2019-08-07 15:38:35 +0200513err_reg:
514 if (!passive)
515 regulator_disable(bus->regulator);
Chanwoo Choi403e0682015-11-05 18:29:27 +0900516
517 return ret;
Chanwoo Choi07222492015-11-03 19:04:16 +0900518}
519
520#ifdef CONFIG_PM_SLEEP
521static int exynos_bus_resume(struct device *dev)
522{
523 struct exynos_bus *bus = dev_get_drvdata(dev);
524 int ret;
525
526 ret = exynos_bus_enable_edev(bus);
527 if (ret < 0) {
528 dev_err(dev, "failed to enable the devfreq-event devices\n");
529 return ret;
530 }
531
532 return 0;
533}
534
535static int exynos_bus_suspend(struct device *dev)
536{
537 struct exynos_bus *bus = dev_get_drvdata(dev);
538 int ret;
539
540 ret = exynos_bus_disable_edev(bus);
541 if (ret < 0) {
542 dev_err(dev, "failed to disable the devfreq-event devices\n");
543 return ret;
544 }
545
546 return 0;
547}
548#endif
549
550static const struct dev_pm_ops exynos_bus_pm = {
551 SET_SYSTEM_SLEEP_PM_OPS(exynos_bus_suspend, exynos_bus_resume)
552};
553
554static const struct of_device_id exynos_bus_of_match[] = {
555 { .compatible = "samsung,exynos-bus", },
556 { /* sentinel */ },
557};
558MODULE_DEVICE_TABLE(of, exynos_bus_of_match);
559
560static struct platform_driver exynos_bus_platdrv = {
561 .probe = exynos_bus_probe,
562 .driver = {
563 .name = "exynos-bus",
564 .pm = &exynos_bus_pm,
565 .of_match_table = of_match_ptr(exynos_bus_of_match),
566 },
567};
568module_platform_driver(exynos_bus_platdrv);
569
570MODULE_DESCRIPTION("Generic Exynos Bus frequency driver");
571MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
572MODULE_LICENSE("GPL v2");