FreeBSD/sys/dev/drm2/radeon/radeon_acpi.c
/* Call all ACPI methods here */
/**
 * radeon_acpi_init - init driver acpi support
 *
 * @rdev: radeon_device pointer
 *
 * Verifies the AMD ACPI interfaces and registers with the acpi
 * notifier chain (all asics).
 * Returns 0 on success, error on failure.
 */
Call all ACPI methods here
radeon_acpi_init - init driver acpi support



Verifies the AMD ACPI interfaces and registers with the acpi
notifier chain (all asics).
Returns 0 on success, error on failure.
Call all ACPI methods here radeon_acpi_init - init driver acpi support Verifies the AMD ACPI interfaces and registers with the acpi notifier chain ( all asics ) . Returns 0 on success error on failure .
int radeon_acpi_init(struct radeon_device *rdev)
{
	ACPI_HANDLE handle;
	struct radeon_atif *atif = &rdev->atif;
	struct radeon_atcs *atcs = &rdev->atcs;
	int ret;
	handle = acpi_get_handle(rdev->dev);
	if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle)
		return 0;
	ret = radeon_atcs_verify_interface(handle, atcs);
	if (ret) {
		DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret);
	}
	ret = radeon_atif_verify_interface(handle, atif);
	if (ret) {
		DRM_DEBUG_DRIVER("Call to ATIF verify_interface failed: %d\n", ret);
		goto out;
	}
	if (atif->notifications.brightness_change) {
		struct drm_encoder *tmp;
		struct radeon_encoder *target = NULL;
		list_for_each_entry(tmp, &rdev->ddev->mode_config.encoder_list,
				head) {
			struct radeon_encoder *enc = to_radeon_encoder(tmp);
			if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
			    enc->enc_priv) {
				if (rdev->is_atom_bios) {
					struct radeon_encoder_atom_dig *dig = enc->enc_priv;
					if (dig->bl_dev) {
						target = enc;
						break;
					}
				} else {
					struct radeon_encoder_lvds *dig = enc->enc_priv;
					if (dig->bl_dev) {
						target = enc;
						break;
					}
				}
			}
		}
		atif->encoder_for_bl = target;
		if (!target) {
			DRM_ERROR("Cannot find a backlight controller\n");
		}
	}
	if (atif->functions.sbios_requests && !atif->functions.system_params) {
		atif->functions.system_params = true;
	}
	if (atif->functions.system_params) {
		ret = radeon_atif_get_notification_params(handle,
				&atif->notification_cfg);
		if (ret) {
			DRM_DEBUG_DRIVER("Call to GET_SYSTEM_PARAMS failed: %d\n",
					ret);
			atif->notification_cfg.enabled = false;
		}
	}
out:
	rdev->acpi.handle = handle;
	rdev->acpi.notifier_call = radeon_acpi_event;
	AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY,
	    rdev->acpi.notifier_call, rdev);
	return ret;
}
int radeon_acpi_init ( struct radeon_device * rdev ) { ACPI_HANDLE handle ; struct radeon_atif * atif = & rdev -> atif ; struct radeon_atcs * atcs = & rdev -> atcs ; int ret ; handle = acpi_get_handle ( rdev -> dev ) ; if ( ! ASIC_IS_AVIVO ( rdev ) || ! rdev -> bios || ! handle ) return 0 ; ret = radeon_atcs_verify_interface ( handle , atcs ) ; if ( ret ) { DRM_DEBUG_DRIVER ( " \n " , ret ) ; } ret = radeon_atif_verify_interface ( handle , atif ) ; if ( ret ) { DRM_DEBUG_DRIVER ( " \n " , ret ) ; goto out ; } if ( atif -> notifications . brightness_change ) { struct drm_encoder * tmp ; struct radeon_encoder * target = NULL ; list_for_each_entry ( tmp , & rdev -> ddev -> mode_config . encoder_list , head ) { struct radeon_encoder * enc = to_radeon_encoder ( tmp ) ; if ( ( enc -> devices & ( ATOM_DEVICE_LCD_SUPPORT ) ) && enc -> enc_priv ) { if ( rdev -> is_atom_bios ) { struct radeon_encoder_atom_dig * dig = enc -> enc_priv ; if ( dig -> bl_dev ) { target = enc ; break ; } } else { struct radeon_encoder_lvds * dig = enc -> enc_priv ; if ( dig -> bl_dev ) { target = enc ; break ; } } } } atif -> encoder_for_bl = target ; if ( ! target ) { DRM_ERROR ( " \n " ) ; } } if ( atif -> functions . sbios_requests && ! atif -> functions . system_params ) { atif -> functions . system_params = true ; } if ( atif -> functions . system_params ) { ret = radeon_atif_get_notification_params ( handle , & atif -> notification_cfg ) ; if ( ret ) { DRM_DEBUG_DRIVER ( " \n " , ret ) ; atif -> notification_cfg . enabled = false ; } } out : rdev -> acpi . handle = handle ; rdev -> acpi . notifier_call = radeon_acpi_event ; AcpiInstallNotifyHandler ( handle , ACPI_DEVICE_NOTIFY , rdev -> acpi . notifier_call , rdev ) ; return ret ; }
Call all ACPI methods here
 radeon_acpi_init - init driver acpi support
Call all ACPI methods here radeon_acpi_init - init driver acpi support
/* Get the device handle */ /* No need to proceed if we're sure that ATIF is not supported */ /* Call the ATCS method */ /* Call the ATIF method */ /* Find the encoder controlling the brightness */ /* Brightness change notification is enabled, but we
			 * didn't find a backlight controller, this should
			 * never happen.
			 */ /* XXX check this workraround, if sbios request function is
		 * present we have to see how it's configured in the system
		 * params
		 */ /* Disable notification */