예제 #1
0
static int pega_rfkill_init(struct asus_laptop *asus)
{
	int ret = 0;

	if(!asus->is_pega_lucid)
		return -ENODEV;

	ret = pega_rfkill_setup(asus, &asus->wlan, "pega-wlan",
				PEGA_WLAN, RFKILL_TYPE_WLAN);
	if(ret)
		goto exit;

	ret = pega_rfkill_setup(asus, &asus->bluetooth, "pega-bt",
				PEGA_BLUETOOTH, RFKILL_TYPE_BLUETOOTH);
	if(ret)
		goto exit;

	ret = pega_rfkill_setup(asus, &asus->wwan, "pega-wwan",
				PEGA_WWAN, RFKILL_TYPE_WWAN);

exit:
	if (ret)
		asus_rfkill_exit(asus);

	return ret;
}
예제 #2
0
static int asus_rfkill_init(struct asus_laptop *asus)
{
	int result = 0;

	if (asus->is_pega_lucid)
		return -ENODEV;

	if (!acpi_check_handle(asus->handle, METHOD_GPS_ON, NULL) &&
	    !acpi_check_handle(asus->handle, METHOD_GPS_OFF, NULL) &&
	    !acpi_check_handle(asus->handle, METHOD_GPS_STATUS, NULL))
		result = asus_rfkill_setup(asus, &asus->gps, "asus-gps",
					   -1, RFKILL_TYPE_GPS,
					   &asus_gps_rfkill_ops);
	if (result)
		goto exit;


	if (!acpi_check_handle(asus->handle, METHOD_WLAN, NULL) &&
	    asus->wled_type == TYPE_RFKILL)
		result = asus_rfkill_setup(asus, &asus->wlan, "asus-wlan",
					   WL_RSTS, RFKILL_TYPE_WLAN,
					   &asus_rfkill_ops);
	if (result)
		goto exit;

	if (!acpi_check_handle(asus->handle, METHOD_BLUETOOTH, NULL) &&
	    asus->bled_type == TYPE_RFKILL)
		result = asus_rfkill_setup(asus, &asus->bluetooth,
					   "asus-bluetooth", BT_RSTS,
					   RFKILL_TYPE_BLUETOOTH,
					   &asus_rfkill_ops);
	if (result)
		goto exit;

	if (!acpi_check_handle(asus->handle, METHOD_WWAN, NULL))
		result = asus_rfkill_setup(asus, &asus->wwan, "asus-wwan",
					   WW_RSTS, RFKILL_TYPE_WWAN,
					   &asus_rfkill_ops);
	if (result)
		goto exit;

	if (!acpi_check_handle(asus->handle, METHOD_WIMAX, NULL))
		result = asus_rfkill_setup(asus, &asus->wimax, "asus-wimax",
					   WM_RSTS, RFKILL_TYPE_WIMAX,
					   &asus_rfkill_ops);
	if (result)
		goto exit;

exit:
	if (result)
		asus_rfkill_exit(asus);

	return result;
}
예제 #3
0
static int asus_acpi_remove(struct acpi_device *device, int type)
{
	struct asus_laptop *asus = acpi_driver_data(device);

	asus_backlight_exit(asus);
	asus_rfkill_exit(asus);
	asus_led_exit(asus);
	asus_input_exit(asus);
	asus_platform_exit(asus);

	kfree(asus->name);
	kfree(asus);
	return 0;
}
예제 #4
0
static int __devinit asus_acpi_add(struct acpi_device *device)
{
	struct asus_laptop *asus;
	int result;

	pr_notice("Asus Laptop Support version %s\n",
		  ASUS_LAPTOP_VERSION);
	asus = kzalloc(sizeof(struct asus_laptop), GFP_KERNEL);
	if (!asus)
		return -ENOMEM;
	asus->handle = device->handle;
	strcpy(acpi_device_name(device), ASUS_LAPTOP_DEVICE_NAME);
	strcpy(acpi_device_class(device), ASUS_LAPTOP_CLASS);
	device->driver_data = asus;
	asus->device = device;

	asus_dmi_check();

	result = asus_acpi_init(asus);
	if (result)
		goto fail_platform;

	asus->is_pega_lucid = asus_check_pega_lucid(asus);
	result = asus_platform_init(asus);
	if (result)
		goto fail_platform;

	if (!acpi_video_backlight_support()) {
		result = asus_backlight_init(asus);
		if (result)
			goto fail_backlight;
	} else
		pr_info("Backlight controlled by ACPI video driver\n");

	result = asus_input_init(asus);
	if (result)
		goto fail_input;

	result = asus_led_init(asus);
	if (result)
		goto fail_led;

	result = asus_rfkill_init(asus);
	if (result && result != -ENODEV)
		goto fail_rfkill;

	result = pega_accel_init(asus);
	if (result && result != -ENODEV)
		goto fail_pega_accel;

	result = pega_rfkill_init(asus);
	if (result && result != -ENODEV)
		goto fail_pega_rfkill;

	asus_device_present = true;
	return 0;

fail_pega_rfkill:
	pega_accel_exit(asus);
fail_pega_accel:
	asus_rfkill_exit(asus);
fail_rfkill:
	asus_led_exit(asus);
fail_led:
	asus_input_exit(asus);
fail_input:
	asus_backlight_exit(asus);
fail_backlight:
	asus_platform_exit(asus);
fail_platform:
	kfree(asus->name);
	kfree(asus);

	return result;
}