2 * drivers/misc/therm_est.c
4 * Copyright (c) 2010-2014, NVIDIA CORPORATION. All rights reserved.
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <linux/platform_device.h>
18 #include <linux/kernel.h>
19 #include <linux/cpufreq.h>
20 #include <linux/delay.h>
21 #include <linux/mutex.h>
22 #include <linux/init.h>
23 #include <linux/err.h>
24 #include <linux/clk.h>
25 #include <linux/debugfs.h>
26 #include <linux/seq_file.h>
27 #include <linux/uaccess.h>
28 #include <linux/slab.h>
29 #include <linux/syscalls.h>
30 #include <linux/therm_est.h>
31 #include <linux/thermal.h>
32 #include <linux/module.h>
33 #include <linux/hwmon-sysfs.h>
34 #include <linux/suspend.h>
36 struct therm_estimator {
37 struct thermal_zone_device *thz;
39 struct thermal_trip_info *trips;
40 struct thermal_zone_params *tzp;
43 struct therm_est_timer_trip_info *timer_trips;
44 struct delayed_work timer_trip_work;
45 struct mutex timer_trip_lock;
47 struct thermal_cooling_device *cdev; /* activation device */
48 struct workqueue_struct *workqueue;
49 struct delayed_work therm_est_work;
60 struct therm_est_subdevice *devs;
64 struct notifier_block pm_nb;
68 #define TIMER_TRIP_INACTIVE -2
70 #define TIMER_TRIP_STATE_NONE 0
71 #define TIMER_TRIP_STATE_START BIT(0)
72 #define TIMER_TRIP_STATE_STOP BIT(1)
73 #define TIMER_TRIP_STATE_UP BIT(2)
74 #define TIMER_TRIP_STATE_DOWN BIT(3)
76 static int __get_trip_temp(struct thermal_zone_device *thz, int trip,
79 static struct therm_est_timer_trip_info *
80 __find_timer_trip(struct therm_estimator *est, int trip)
84 /* Find matched timer trip info with trip. */
85 for (i = 0; i < est->num_timer_trips; i++) {
86 if (est->timer_trips[i].trip == trip)
87 return &est->timer_trips[i];
92 static int __get_timer_trip_delay(struct therm_est_timer_trip_info *timer_info,
95 int cur = timer_info->cur;
96 int next = (cur + 1 < timer_info->num_timers) ? cur + 1 : cur;
98 if (cur == next) /* No more timer on this trip. */
101 *delay = timer_info->timers[next].time_after -
102 (now - timer_info->last_tripped);
106 static int therm_est_subdev_match(struct thermal_zone_device *thz, void *data)
108 return strcmp((char *)data, thz->type) == 0;
111 static int therm_est_subdev_get_temp(struct thermal_zone_device *thz,
114 if (!thz || thz->ops->get_temp(thz, temp))
120 static void therm_est_update_limits(struct therm_estimator *est)
122 const int MAX_HIGH_TEMP = 128000;
123 long low_temp = 0, high_temp = MAX_HIGH_TEMP;
124 long trip_temp, passive_low_temp = MAX_HIGH_TEMP;
125 enum thermal_trip_type trip_type;
126 struct thermal_trip_info *trip_state;
129 for (i = 0; i < est->num_trips; i++) {
130 trip_state = &est->trips[i];
131 __get_trip_temp(est->thz, i, &trip_temp);
132 est->thz->ops->get_trip_type(est->thz, i, &trip_type);
134 if (!trip_state->tripped) { /* not tripped? update high */
135 if (trip_temp < high_temp)
136 high_temp = trip_temp;
137 } else { /* tripped? update low */
138 if (trip_type != THERMAL_TRIP_PASSIVE) {
139 /* get highest ACTIVE */
140 if (trip_temp > low_temp)
141 low_temp = trip_temp;
143 /* get lowest PASSIVE */
144 if (trip_temp < passive_low_temp)
145 passive_low_temp = trip_temp;
150 if (passive_low_temp != MAX_HIGH_TEMP)
151 low_temp = max(low_temp, passive_low_temp);
153 est->low_limit = low_temp;
154 est->high_limit = high_temp;
157 static void therm_est_update_timer_trips(struct therm_estimator *est)
159 struct thermal_trip_info *trip_state;
160 struct therm_est_timer_trip_info *timer_info;
161 s64 now, delay, min_delay;
164 mutex_lock(&est->timer_trip_lock);
165 min_delay = LLONG_MAX;
166 now = ktime_to_ms(ktime_get());
168 for (i = 0; i < est->num_timer_trips; i++) {
169 timer_info = &est->timer_trips[i];
170 trip_state = &est->trips[timer_info->trip];
172 pr_debug("%s: i %d, trip %d, tripped %d, cur %d\n",
173 __func__, i, timer_info->trip, trip_state->tripped,
175 if ((timer_info->cur == TIMER_TRIP_INACTIVE) ||
176 (__get_timer_trip_delay(timer_info, now, &delay) < 0))
180 min_delay = min(min_delay, delay);
181 pr_debug("%s: delay %lld, min_delay %lld\n",
182 __func__, delay, min_delay);
184 mutex_unlock(&est->timer_trip_lock);
186 cancel_delayed_work(&est->timer_trip_work);
187 if (min_delay != LLONG_MAX)
188 queue_delayed_work(est->workqueue, &est->timer_trip_work,
189 msecs_to_jiffies(min_delay));
192 static void therm_est_timer_trip_work_func(struct work_struct *work)
194 struct therm_estimator *est = container_of(work, struct therm_estimator,
195 timer_trip_work.work);
196 struct thermal_trip_info *trip_state;
197 struct therm_est_timer_trip_info *timer_info;
199 int timer_trip_state, i;
201 mutex_lock(&est->timer_trip_lock);
202 timer_trip_state = TIMER_TRIP_STATE_NONE;
203 now = ktime_to_ms(ktime_get());
205 for (i = 0; i < est->num_timer_trips; i++) {
206 timer_info = &est->timer_trips[i];
207 trip_state = &est->trips[timer_info->trip];
209 pr_debug("%s: i %d, trip %d, tripped %d, cur %d\n",
210 __func__, i, timer_info->trip, trip_state->tripped,
212 if ((timer_info->cur == TIMER_TRIP_INACTIVE) ||
213 (__get_timer_trip_delay(timer_info, now, &delay) < 0))
216 if (delay <= 0) { /* Timer on this trip has expired. */
217 if (timer_info->cur + 1 < timer_info->num_timers) {
218 timer_info->last_tripped = now;
220 timer_trip_state |= TIMER_TRIP_STATE_UP;
224 /* If delay > 0, timer on this trip has not yet expired.
225 * So need to restart timer with remaining delay. */
226 timer_trip_state |= TIMER_TRIP_STATE_START;
227 pr_debug("%s: new_cur %d, delay %lld, timer_trip_state 0x%x\n",
228 __func__, timer_info->cur, delay, timer_trip_state);
230 mutex_unlock(&est->timer_trip_lock);
232 if (timer_trip_state & (TIMER_TRIP_STATE_START | TIMER_TRIP_STATE_UP)) {
233 therm_est_update_timer_trips(est);
234 therm_est_update_limits(est);
238 static void therm_est_work_func(struct work_struct *work)
240 int i, j, index, sum = 0;
242 struct delayed_work *dwork = container_of(work,
243 struct delayed_work, work);
244 struct therm_estimator *est = container_of(dwork,
245 struct therm_estimator,
248 for (i = 0; i < est->ndevs; i++) {
249 if (therm_est_subdev_get_temp(est->devs[i].sub_thz, &temp))
251 est->devs[i].hist[(est->ntemp % HIST_LEN)] = temp;
254 for (i = 0; i < est->ndevs; i++) {
255 for (j = 0; j < HIST_LEN; j++) {
256 index = (est->ntemp - j + HIST_LEN) % HIST_LEN;
257 sum += est->devs[i].hist[index] *
258 est->devs[i].coeffs[j];
262 est->cur_temp = sum / 100 + est->toffset;
265 if (est->thz && ((est->cur_temp < est->low_limit) ||
266 (est->cur_temp >= est->high_limit))) {
267 thermal_zone_device_update(est->thz);
268 therm_est_update_timer_trips(est);
269 therm_est_update_limits(est);
272 if (est->polling_enabled > 0 || !est->use_activator) {
273 queue_delayed_work(est->workqueue, &est->therm_est_work,
274 msecs_to_jiffies(est->polling_period));
278 static int therm_est_bind(struct thermal_zone_device *thz,
279 struct thermal_cooling_device *cdev)
281 struct therm_estimator *est = thz->devdata;
282 struct thermal_trip_info *trip_state;
285 for (i = 0; i < est->num_trips; i++) {
286 trip_state = &est->trips[i];
287 if (trip_state->cdev_type &&
288 !strncmp(trip_state->cdev_type, cdev->type,
289 THERMAL_NAME_LENGTH))
290 thermal_zone_bind_cooling_device(thz, i, cdev,
298 static int therm_est_unbind(struct thermal_zone_device *thz,
299 struct thermal_cooling_device *cdev)
301 struct therm_estimator *est = thz->devdata;
302 struct thermal_trip_info *trip_state;
305 for (i = 0; i < est->num_trips; i++) {
306 trip_state = &est->trips[i];
307 if (trip_state->cdev_type &&
308 !strncmp(trip_state->cdev_type, cdev->type,
309 THERMAL_NAME_LENGTH))
310 thermal_zone_unbind_cooling_device(thz, i, cdev);
316 static int therm_est_get_trip_type(struct thermal_zone_device *thz,
317 int trip, enum thermal_trip_type *type)
319 struct therm_estimator *est = thz->devdata;
321 *type = est->trips[trip].trip_type;
325 static int __get_trip_temp(struct thermal_zone_device *thz, int trip,
328 struct therm_estimator *est = thz->devdata;
329 struct thermal_trip_info *trip_state = &est->trips[trip];
330 struct therm_est_timer_trip_info *timer_info;
331 long zone_temp, trip_temp, hysteresis;
332 int cur = TIMER_TRIP_INACTIVE;
333 int ret = TIMER_TRIP_STATE_NONE;
335 zone_temp = thz->temperature;
336 trip_temp = trip_state->trip_temp;
337 hysteresis = trip_state->hysteresis;
339 timer_info = __find_timer_trip(est, trip);
341 cur = timer_info->cur;
342 /* If timer trip is available, use trip_temp and hysteresis in
343 * the timer trip to trip_temp for this trip. */
344 if (timer_info->cur >= 0) {
345 trip_temp = timer_info->timers[cur].trip_temp;
346 hysteresis = timer_info->timers[cur].hysteresis;
350 if (zone_temp >= trip_temp) {
351 trip_temp -= hysteresis;
352 if (timer_info && !trip_state->tripped)
353 ret = TIMER_TRIP_STATE_START;
354 trip_state->tripped = true;
355 } else if (trip_state->tripped) {
356 trip_temp -= hysteresis;
357 if (zone_temp < trip_temp) {
359 trip_state->tripped = false;
361 if (cur == TIMER_TRIP_INACTIVE)
362 trip_state->tripped = false;
364 ret = TIMER_TRIP_STATE_DOWN;
373 static int therm_est_get_trip_temp(struct thermal_zone_device *thz,
374 int trip, unsigned long *temp)
376 struct therm_estimator *est = thz->devdata;
377 struct therm_est_timer_trip_info *timer_info;
380 ret = __get_trip_temp(thz, trip, temp);
381 if (ret & (TIMER_TRIP_STATE_START | TIMER_TRIP_STATE_DOWN)) {
382 timer_info = __find_timer_trip(est, trip);
384 mutex_lock(&est->timer_trip_lock);
385 timer_info->last_tripped = ktime_to_ms(ktime_get());
387 if (ret & TIMER_TRIP_STATE_START) {
388 timer_info->cur = TIMER_TRIP_INACTIVE + 1;
389 } else if (ret & TIMER_TRIP_STATE_DOWN) {
390 if (--timer_info->cur < TIMER_TRIP_INACTIVE)
391 timer_info->cur = TIMER_TRIP_INACTIVE;
393 mutex_unlock(&est->timer_trip_lock);
395 /* Update limits, because trip temp was changed by timer trip
397 therm_est_update_limits(est);
403 static int therm_est_set_trip_temp(struct thermal_zone_device *thz,
404 int trip, unsigned long temp)
406 struct therm_estimator *est = thz->devdata;
408 est->trips[trip].trip_temp = temp;
410 /* Update limits, because trip temp was changed. */
411 therm_est_update_limits(est);
415 static int therm_est_get_temp(struct thermal_zone_device *thz,
418 struct therm_estimator *est = thz->devdata;
420 *temp = est->cur_temp;
424 static int therm_est_get_trend(struct thermal_zone_device *thz,
425 int trip, enum thermal_trend *trend)
427 struct therm_estimator *est = thz->devdata;
428 struct thermal_trip_info *trip_state = &est->trips[trip];
433 __get_trip_temp(thz, trip, &trip_temp);
435 cur_temp = thz->temperature;
436 new_trend = (est->tc1 * (cur_temp - thz->last_temperature)) +
437 (est->tc2 * (cur_temp - trip_temp));
439 switch (trip_state->trip_type) {
440 case THERMAL_TRIP_ACTIVE:
441 /* aggressive active cooling */
442 *trend = THERMAL_TREND_RAISING;
444 case THERMAL_TRIP_PASSIVE:
446 *trend = THERMAL_TREND_RAISING;
447 else if (new_trend < 0)
448 *trend = THERMAL_TREND_DROPPING;
450 *trend = THERMAL_TREND_STABLE;
458 static void therm_est_init_timer_trips(struct therm_estimator *est)
462 for (i = 0; i < est->num_timer_trips; i++)
463 est->timer_trips[i].cur = TIMER_TRIP_INACTIVE;
466 static int therm_est_init_history(struct therm_estimator *est)
469 struct therm_est_subdevice *dev;
472 for (i = 0; i < est->ndevs; i++) {
475 if (therm_est_subdev_get_temp(dev->sub_thz, &temp))
478 for (j = 0; j < HIST_LEN; j++)
485 static int therm_est_polling(struct therm_estimator *est,
488 est->polling_enabled = polling > 0;
490 if (est->polling_enabled > 0) {
493 therm_est_init_history(est);
494 therm_est_init_timer_trips(est);
495 queue_delayed_work(est->workqueue,
496 &est->therm_est_work,
497 msecs_to_jiffies(est->polling_period));
499 est->cur_temp = 25000;
500 cancel_delayed_work_sync(&est->therm_est_work);
505 static struct thermal_zone_device_ops therm_est_ops = {
506 .bind = therm_est_bind,
507 .unbind = therm_est_unbind,
508 .get_trip_type = therm_est_get_trip_type,
509 .get_trip_temp = therm_est_get_trip_temp,
510 .set_trip_temp = therm_est_set_trip_temp,
511 .get_temp = therm_est_get_temp,
512 .get_trend = therm_est_get_trend,
515 static ssize_t show_coeff(struct device *dev,
516 struct device_attribute *da,
519 struct therm_estimator *est = dev_get_drvdata(dev);
520 ssize_t len, total_len = 0;
522 for (i = 0; i < est->ndevs; i++) {
523 len = snprintf(buf + total_len,
524 PAGE_SIZE - total_len, "[%d]", i);
526 for (j = 0; j < HIST_LEN; j++) {
527 len = snprintf(buf + total_len,
528 PAGE_SIZE - total_len, " %ld",
529 est->devs[i].coeffs[j]);
532 len = snprintf(buf + total_len, PAGE_SIZE - total_len, "\n");
538 static ssize_t set_coeff(struct device *dev,
539 struct device_attribute *da,
540 const char *buf, size_t count)
542 struct therm_estimator *est = dev_get_drvdata(dev);
549 scount = sscanf(buf, "[%d] %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld " \
550 "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld",
573 if (scount != HIST_LEN + 1)
576 if (devid < 0 || devid >= est->ndevs)
579 /* This has obvious locking issues but don't worry about it */
580 memcpy(est->devs[devid].coeffs, coeff, sizeof(coeff[0]) * HIST_LEN);
585 static ssize_t show_offset(struct device *dev,
586 struct device_attribute *da,
589 struct therm_estimator *est = dev_get_drvdata(dev);
590 snprintf(buf, PAGE_SIZE, "%ld\n", est->toffset);
594 static ssize_t set_offset(struct device *dev,
595 struct device_attribute *da,
596 const char *buf, size_t count)
598 struct therm_estimator *est = dev_get_drvdata(dev);
601 if (kstrtoint(buf, 0, &offset))
604 est->toffset = offset;
609 static ssize_t show_temps(struct device *dev,
610 struct device_attribute *da,
613 struct therm_estimator *est = dev_get_drvdata(dev);
614 ssize_t total_len = 0;
618 /* This has obvious locking issues but don't worry about it */
619 for (i = 0; i < est->ndevs; i++) {
620 total_len += snprintf(buf + total_len,
621 PAGE_SIZE - total_len, "[%d]", i);
622 for (j = 0; j < HIST_LEN; j++) {
623 index = (est->ntemp - j + HIST_LEN) % HIST_LEN;
624 total_len += snprintf(buf + total_len,
625 PAGE_SIZE - total_len, " %ld",
626 est->devs[i].hist[index]);
628 total_len += snprintf(buf + total_len,
629 PAGE_SIZE - total_len, "\n");
634 static ssize_t show_tc1(struct device *dev,
635 struct device_attribute *da,
638 struct therm_estimator *est = dev_get_drvdata(dev);
639 snprintf(buf, PAGE_SIZE, "%d\n", est->tc1);
643 static ssize_t set_tc1(struct device *dev,
644 struct device_attribute *da,
645 const char *buf, size_t count)
647 struct therm_estimator *est = dev_get_drvdata(dev);
650 if (kstrtoint(buf, 0, &tc1))
658 static ssize_t show_tc2(struct device *dev,
659 struct device_attribute *da,
662 struct therm_estimator *est = dev_get_drvdata(dev);
663 snprintf(buf, PAGE_SIZE, "%d\n", est->tc2);
667 static ssize_t set_tc2(struct device *dev,
668 struct device_attribute *da,
669 const char *buf, size_t count)
671 struct therm_estimator *est = dev_get_drvdata(dev);
674 if (kstrtoint(buf, 0, &tc2))
682 static struct sensor_device_attribute therm_est_nodes[] = {
683 SENSOR_ATTR(coeff, S_IRUGO | S_IWUSR, show_coeff, set_coeff, 0),
684 SENSOR_ATTR(offset, S_IRUGO | S_IWUSR, show_offset, set_offset, 0),
685 SENSOR_ATTR(tc1, S_IRUGO | S_IWUSR, show_tc1, set_tc1, 0),
686 SENSOR_ATTR(tc2, S_IRUGO | S_IWUSR, show_tc2, set_tc2, 0),
687 SENSOR_ATTR(temps, S_IRUGO, show_temps, 0, 0),
691 static int therm_est_pm_notify(struct notifier_block *nb,
692 unsigned long event, void *data)
694 struct therm_estimator *est = container_of(
696 struct therm_estimator,
700 case PM_SUSPEND_PREPARE:
701 cancel_delayed_work_sync(&est->therm_est_work);
702 cancel_delayed_work_sync(&est->timer_trip_work);
704 case PM_POST_SUSPEND:
707 therm_est_init_history(est);
708 therm_est_init_timer_trips(est);
709 queue_delayed_work(est->workqueue,
710 &est->therm_est_work,
711 msecs_to_jiffies(est->polling_period));
720 thermal_est_activation_get_max_state(struct thermal_cooling_device *cdev,
721 unsigned long *max_state)
728 thermal_est_activation_get_cur_state(struct thermal_cooling_device *cdev,
729 unsigned long *cur_state)
731 struct therm_estimator *est = cdev->devdata;
732 *cur_state = est->polling_enabled;
737 thermal_est_activation_set_cur_state(struct thermal_cooling_device *cdev,
738 unsigned long cur_state)
740 struct therm_estimator *est = cdev->devdata;
741 if (est->use_activator)
742 therm_est_polling(est, cur_state > 0);
747 static struct thermal_cooling_device_ops thermal_est_activation_device_ops = {
748 .get_max_state = thermal_est_activation_get_max_state,
749 .get_cur_state = thermal_est_activation_get_cur_state,
750 .set_cur_state = thermal_est_activation_set_cur_state,
753 struct thermal_cooling_device *thermal_est_activation_device_register(
754 struct therm_estimator *est,
757 struct thermal_cooling_device *cdev;
759 cdev = thermal_cooling_device_register(
762 &thermal_est_activation_device_ops);
767 pr_debug("Therm_est: Cooling-device REGISTERED\n");
772 static int therm_est_probe(struct platform_device *pdev)
775 struct therm_estimator *est;
776 struct therm_est_data *data;
777 struct thermal_zone_device *thz;
779 est = kzalloc(sizeof(struct therm_estimator), GFP_KERNEL);
780 if (IS_ERR_OR_NULL(est))
783 platform_set_drvdata(pdev, est);
785 data = pdev->dev.platform_data;
787 for (i = 0; i < data->ndevs; i++) {
788 thz = thermal_zone_device_find(data->devs[i].dev_data,
789 therm_est_subdev_match);
792 data->devs[i].sub_thz = thz;
795 est->devs = data->devs;
796 est->ndevs = data->ndevs;
797 est->toffset = data->toffset;
798 est->polling_period = data->polling_period;
799 est->polling_enabled = 0; /* By default polling is switched off */
800 est->tc1 = data->tc1;
801 est->tc2 = data->tc2;
802 est->use_activator = data->use_activator;
804 /* initialize history */
805 therm_est_init_history(est);
807 /* initialize timer trips */
808 est->num_timer_trips = data->num_timer_trips;
809 est->timer_trips = data->timer_trips;
810 therm_est_init_timer_trips(est);
811 mutex_init(&est->timer_trip_lock);
812 INIT_DELAYED_WORK(&est->timer_trip_work,
813 therm_est_timer_trip_work_func);
815 est->workqueue = alloc_workqueue(dev_name(&pdev->dev),
816 WQ_HIGHPRI | WQ_UNBOUND, 1);
820 INIT_DELAYED_WORK(&est->therm_est_work, therm_est_work_func);
822 est->cdev = thermal_est_activation_device_register(est,
825 est->num_trips = data->num_trips;
826 est->trips = data->trips;
827 est->tzp = data->tzp;
829 est->thz = thermal_zone_device_register(dev_name(&pdev->dev),
831 (1ULL << est->num_trips) - 1,
837 if (IS_ERR_OR_NULL(est->thz))
840 for (i = 0; i < ARRAY_SIZE(therm_est_nodes); i++)
841 device_create_file(&pdev->dev, &therm_est_nodes[i].dev_attr);
844 est->pm_nb.notifier_call = therm_est_pm_notify,
845 register_pm_notifier(&est->pm_nb);
848 if (!est->use_activator)
849 queue_delayed_work(est->workqueue, &est->therm_est_work,
850 msecs_to_jiffies(est->polling_period));
856 destroy_workqueue(est->workqueue);
861 static int therm_est_remove(struct platform_device *pdev)
863 struct therm_estimator *est = platform_get_drvdata(pdev);
866 cancel_delayed_work_sync(&est->therm_est_work);
867 cancel_delayed_work_sync(&est->timer_trip_work);
870 unregister_pm_notifier(&est->pm_nb);
872 for (i = 0; i < ARRAY_SIZE(therm_est_nodes); i++)
873 device_remove_file(&pdev->dev, &therm_est_nodes[i].dev_attr);
874 thermal_zone_device_unregister(est->thz);
875 thermal_cooling_device_unregister(est->cdev);
877 destroy_workqueue(est->workqueue);
882 static void therm_est_shutdown(struct platform_device *pdev)
884 struct therm_estimator *est = platform_get_drvdata(pdev);
886 cancel_delayed_work_sync(&est->therm_est_work);
887 cancel_delayed_work_sync(&est->timer_trip_work);
888 thermal_zone_device_unregister(est->thz);
889 thermal_cooling_device_unregister(est->cdev);
892 static struct platform_driver therm_est_driver = {
894 .owner = THIS_MODULE,
897 .probe = therm_est_probe,
898 .remove = therm_est_remove,
899 .shutdown = therm_est_shutdown,
902 static int __init therm_est_driver_init(void)
904 return platform_driver_register(&therm_est_driver);
906 module_init(therm_est_driver_init);