Lines Matching refs:cdev
252 struct thermal_cooling_device *cdev, int trip) in get_thermal_instance() argument
258 mutex_lock(&cdev->lock); in get_thermal_instance()
261 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in get_thermal_instance()
267 mutex_unlock(&cdev->lock); in get_thermal_instance()
275 struct thermal_cooling_device *cdev, int ret) in print_bind_err_msg() argument
278 tz->type, cdev->type, ret); in print_bind_err_msg()
282 struct thermal_cooling_device *cdev, in __bind() argument
298 ret = thermal_zone_bind_cooling_device(tz, i, cdev, in __bind()
302 print_bind_err_msg(tz, cdev, ret); in __bind()
308 struct thermal_cooling_device *cdev) in __unbind() argument
314 thermal_zone_unbind_cooling_device(tz, i, cdev); in __unbind()
317 static void bind_cdev(struct thermal_cooling_device *cdev) in bind_cdev() argument
330 ret = pos->ops->bind(pos, cdev); in bind_cdev()
332 print_bind_err_msg(pos, cdev, ret); in bind_cdev()
341 if (tzp->tbp[i].cdev || !tzp->tbp[i].match) in bind_cdev()
343 if (tzp->tbp[i].match(pos, cdev)) in bind_cdev()
345 tzp->tbp[i].cdev = cdev; in bind_cdev()
346 __bind(pos, tzp->tbp[i].trip_mask, cdev, in bind_cdev()
381 if (tzp->tbp[i].cdev || !tzp->tbp[i].match) in bind_tz()
385 tzp->tbp[i].cdev = pos; in bind_tz()
780 struct thermal_cooling_device *cdev = NULL; in passive_store() local
794 list_for_each_entry(cdev, &thermal_cdev_list, node) { in passive_store()
795 if (!strncmp("Processor", cdev->type, in passive_store()
798 THERMAL_TRIPS_NONE, cdev, in passive_store()
808 list_for_each_entry(cdev, &thermal_cdev_list, node) { in passive_store()
809 if (!strncmp("Processor", cdev->type, in passive_store()
813 cdev); in passive_store()
1030 int power_actor_get_max_power(struct thermal_cooling_device *cdev, in power_actor_get_max_power() argument
1033 if (!cdev_is_power_actor(cdev)) in power_actor_get_max_power()
1036 return cdev->ops->state2power(cdev, tz, 0, max_power); in power_actor_get_max_power()
1051 int power_actor_get_min_power(struct thermal_cooling_device *cdev, in power_actor_get_min_power() argument
1057 if (!cdev_is_power_actor(cdev)) in power_actor_get_min_power()
1060 ret = cdev->ops->get_max_state(cdev, &max_state); in power_actor_get_min_power()
1064 return cdev->ops->state2power(cdev, tz, max_state, min_power); in power_actor_get_min_power()
1078 int power_actor_set_power(struct thermal_cooling_device *cdev, in power_actor_set_power() argument
1084 if (!cdev_is_power_actor(cdev)) in power_actor_set_power()
1087 ret = cdev->ops->power2state(cdev, instance->tz, power, &state); in power_actor_set_power()
1092 cdev->updated = false; in power_actor_set_power()
1093 thermal_cdev_update(cdev); in power_actor_set_power()
1113 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_type_show() local
1115 return sprintf(buf, "%s\n", cdev->type); in thermal_cooling_device_type_show()
1122 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_max_state_show() local
1126 ret = cdev->ops->get_max_state(cdev, &state); in thermal_cooling_device_max_state_show()
1136 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_cur_state_show() local
1140 ret = cdev->ops->get_cur_state(cdev, &state); in thermal_cooling_device_cur_state_show()
1151 struct thermal_cooling_device *cdev = to_cooling_device(dev); in thermal_cooling_device_cur_state_store() local
1161 result = cdev->ops->set_cur_state(cdev, state); in thermal_cooling_device_cur_state_store()
1260 struct thermal_cooling_device *cdev, in thermal_zone_bind_cooling_device() argument
1279 if (pos2 == cdev) in thermal_zone_bind_cooling_device()
1283 if (tz != pos1 || cdev != pos2) in thermal_zone_bind_cooling_device()
1286 ret = cdev->ops->get_max_state(cdev, &max_state); in thermal_zone_bind_cooling_device()
1302 dev->cdev = cdev; in thermal_zone_bind_cooling_device()
1315 sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name); in thermal_zone_bind_cooling_device()
1339 mutex_lock(&cdev->lock); in thermal_zone_bind_cooling_device()
1341 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_bind_cooling_device()
1347 list_add_tail(&dev->cdev_node, &cdev->thermal_instances); in thermal_zone_bind_cooling_device()
1350 mutex_unlock(&cdev->lock); in thermal_zone_bind_cooling_device()
1385 struct thermal_cooling_device *cdev) in thermal_zone_unbind_cooling_device() argument
1390 mutex_lock(&cdev->lock); in thermal_zone_unbind_cooling_device()
1392 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_unbind_cooling_device()
1395 mutex_unlock(&cdev->lock); in thermal_zone_unbind_cooling_device()
1400 mutex_unlock(&cdev->lock); in thermal_zone_unbind_cooling_device()
1418 struct thermal_cooling_device *cdev; in thermal_release() local
1426 cdev = to_cooling_device(dev); in thermal_release()
1427 kfree(cdev); in thermal_release()
1457 struct thermal_cooling_device *cdev; in __thermal_cooling_device_register() local
1468 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); in __thermal_cooling_device_register()
1469 if (!cdev) in __thermal_cooling_device_register()
1472 result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); in __thermal_cooling_device_register()
1474 kfree(cdev); in __thermal_cooling_device_register()
1478 strlcpy(cdev->type, type ? : "", sizeof(cdev->type)); in __thermal_cooling_device_register()
1479 mutex_init(&cdev->lock); in __thermal_cooling_device_register()
1480 INIT_LIST_HEAD(&cdev->thermal_instances); in __thermal_cooling_device_register()
1481 cdev->np = np; in __thermal_cooling_device_register()
1482 cdev->ops = ops; in __thermal_cooling_device_register()
1483 cdev->updated = false; in __thermal_cooling_device_register()
1484 cdev->device.class = &thermal_class; in __thermal_cooling_device_register()
1485 cdev->device.groups = cooling_device_attr_groups; in __thermal_cooling_device_register()
1486 cdev->devdata = devdata; in __thermal_cooling_device_register()
1487 dev_set_name(&cdev->device, "cooling_device%d", cdev->id); in __thermal_cooling_device_register()
1488 result = device_register(&cdev->device); in __thermal_cooling_device_register()
1490 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); in __thermal_cooling_device_register()
1491 kfree(cdev); in __thermal_cooling_device_register()
1497 list_add(&cdev->node, &thermal_cdev_list); in __thermal_cooling_device_register()
1501 bind_cdev(cdev); in __thermal_cooling_device_register()
1509 return cdev; in __thermal_cooling_device_register()
1564 void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) in thermal_cooling_device_unregister() argument
1571 if (!cdev) in thermal_cooling_device_unregister()
1576 if (pos == cdev) in thermal_cooling_device_unregister()
1578 if (pos != cdev) { in thermal_cooling_device_unregister()
1583 list_del(&cdev->node); in thermal_cooling_device_unregister()
1588 tz->ops->unbind(tz, cdev); in thermal_cooling_device_unregister()
1597 if (tzp->tbp[i].cdev == cdev) { in thermal_cooling_device_unregister()
1598 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_cooling_device_unregister()
1599 tzp->tbp[i].cdev = NULL; in thermal_cooling_device_unregister()
1606 if (cdev->type[0]) in thermal_cooling_device_unregister()
1607 device_remove_file(&cdev->device, &dev_attr_cdev_type); in thermal_cooling_device_unregister()
1608 device_remove_file(&cdev->device, &dev_attr_max_state); in thermal_cooling_device_unregister()
1609 device_remove_file(&cdev->device, &dev_attr_cur_state); in thermal_cooling_device_unregister()
1611 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); in thermal_cooling_device_unregister()
1612 device_unregister(&cdev->device); in thermal_cooling_device_unregister()
1617 void thermal_cdev_update(struct thermal_cooling_device *cdev) in thermal_cdev_update() argument
1623 if (cdev->updated) in thermal_cdev_update()
1626 mutex_lock(&cdev->lock); in thermal_cdev_update()
1628 list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { in thermal_cdev_update()
1629 dev_dbg(&cdev->device, "zone%d->target=%lu\n", in thermal_cdev_update()
1636 mutex_unlock(&cdev->lock); in thermal_cdev_update()
1637 cdev->ops->set_cur_state(cdev, target); in thermal_cdev_update()
1638 cdev->updated = true; in thermal_cdev_update()
1639 trace_cdev_update(cdev, target); in thermal_cdev_update()
1640 dev_dbg(&cdev->device, "set to state %lu\n", target); in thermal_cdev_update()
1966 struct thermal_cooling_device *cdev; in thermal_zone_device_unregister() local
1986 list_for_each_entry(cdev, &thermal_cdev_list, node) { in thermal_zone_device_unregister()
1988 tz->ops->unbind(tz, cdev); in thermal_zone_device_unregister()
1996 if (tzp->tbp[i].cdev == cdev) { in thermal_zone_device_unregister()
1997 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_zone_device_unregister()
1998 tzp->tbp[i].cdev = NULL; in thermal_zone_device_unregister()