/** \brief install notify handler for acpi device * \param device acpi device * \param handler_type type of handler * \param handler pointer of notify handler * \param context context for the handler * \return status */ unsigned int ATI_API_CALL KCL_ACPI_InstallHandler(KCL_ACPI_DevHandle device, unsigned int handler_type, KCL_ACPI_CallbackHandle handler, KCL_ACPI_ContextHandle context) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) return acpi_install_notify_handler(device, handler_type, (acpi_notify_handler)handler, context); #else KCL_ACPI_DevHandle dummy_handle; //register notifier chain for video switching events if ((KCL_ACPI_GetDevHandle(device, "_DOD", &dummy_handle) == KCL_ACPI_OK) || (KCL_ACPI_GetDevHandle(device, "_DOS", &dummy_handle) == KCL_ACPI_OK)) { return register_acpi_notifier(&firegl_acpi_video_notifier); } //register notifier chain for ac adapter events if (KCL_ACPI_GetDevHandle(device, "_PSR", &dummy_handle) == KCL_ACPI_OK) { return register_acpi_notifier(&firegl_acpi_ac_notifier); } return 0; #endif }
/** \brief install notify handler for acpi device * \param device acpi device * \param handler_type type of handler * \param handler pointer of notify handler * \param context context for the handler * \return status */ unsigned int ATI_API_CALL KCL_ACPI_InstallHandler(KCL_ACPI_DevHandle device, unsigned int handler_type, KCL_ACPI_CallbackHandle handler, KCL_ACPI_ContextHandle context, KCL_NOTIFIER_BLOCKER *nb) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) return acpi_install_notify_handler(device, handler_type, (acpi_notify_handler)handler, context); #else KCL_ACPI_DevHandle dummy_handle; //register notifier chain for video switching events if ((KCL_ACPI_GetDevHandle(device, "_DOD", &dummy_handle) == KCL_ACPI_OK) || (KCL_ACPI_GetDevHandle(device, "_DOS", &dummy_handle) == KCL_ACPI_OK)) { *nb = kmalloc(sizeof(struct notifier_block), GFP_KERNEL); if (!*nb) { KCL_DEBUG_ERROR ("Could not allocate enough memory for video notifier_block\n"); return -ENOMEM; } ((struct notifier_block*)(*nb))->notifier_call = firegl_acpi_video_event; return register_acpi_notifier((struct notifier_block*)(*nb)); } //register notifier chain for ac adapter events if (KCL_ACPI_GetDevHandle(device, "_PSR", &dummy_handle) == KCL_ACPI_OK) { *nb = kmalloc(sizeof(struct notifier_block), GFP_KERNEL); if (!*nb) { KCL_DEBUG_ERROR ("Could not allocate enough memory for ac notifier_block\n"); return -ENOMEM; } ((struct notifier_block*)(*nb))->notifier_call = firegl_acpi_ac_event; return register_acpi_notifier((struct notifier_block*)(*nb)); } return 0; #endif }
int nouveau_pm_init(struct drm_device *dev) { struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_pm_engine *pm = &dev_priv->engine.pm; char info[256]; int ret, i; nouveau_mem_timing_init(dev); nouveau_volt_init(dev); nouveau_perf_init(dev); nouveau_temp_init(dev); NV_INFO(dev, "%d available performance level(s)\n", pm->nr_perflvl); for (i = 0; i < pm->nr_perflvl; i++) { nouveau_pm_perflvl_info(&pm->perflvl[i], info, sizeof(info)); NV_INFO(dev, "%d:%s", pm->perflvl[i].id, info); } /* determine current ("boot") performance level */ ret = nouveau_pm_perflvl_get(dev, &pm->boot); if (ret == 0) { strncpy(pm->boot.name, "boot", 4); pm->cur = &pm->boot; nouveau_pm_perflvl_info(&pm->boot, info, sizeof(info)); NV_INFO(dev, "c:%s", info); } /* switch performance levels now if requested */ if (nouveau_perflvl != NULL) { ret = nouveau_pm_profile_set(dev, nouveau_perflvl); if (ret) { NV_ERROR(dev, "error setting perflvl \"%s\": %d\n", nouveau_perflvl, ret); } } nouveau_sysfs_init(dev); nouveau_hwmon_init(dev); #if defined(CONFIG_ACPI) && defined(CONFIG_POWER_SUPPLY) pm->acpi_nb.notifier_call = nouveau_pm_acpi_event; register_acpi_notifier(&pm->acpi_nb); #endif return 0; }
void psb_intel_opregion_init(struct drm_device *dev) { struct drm_psb_private *dev_priv = dev->dev_private; struct psb_intel_opregion *opregion = &dev_priv->opregion; if (!opregion->header) return; if (opregion->acpi) { /* Notify BIOS we are ready to handle ACPI video ext notifs. * Right now, all the events are handled by the ACPI video * module. We don't actually need to do anything with them. */ opregion->acpi->csts = 0; opregion->acpi->drdy = 1; system_opregion = opregion; register_acpi_notifier(&psb_intel_opregion_notifier); } }