Lines Matching refs:device

141 static int call_fext_func(struct acpi_device *device,
154 status = acpi_evaluate_integer(device->handle, "FUNC", &arg_list,
157 acpi_handle_err(device->handle, "Failed to evaluate FUNC\n");
161 acpi_handle_debug(device->handle,
169 static int set_lcd_level(struct acpi_device *device, int level)
171 struct fujitsu_bl *priv = acpi_driver_data(device);
177 if (acpi_has_method(device->handle, "SBL2"))
190 acpi_handle_debug(device->handle, "set lcd level via %s [%d]\n", method,
196 status = acpi_execute_simple_method(device->handle, method, level);
198 acpi_handle_err(device->handle, "Failed to evaluate %s\n",
208 static int get_lcd_level(struct acpi_device *device)
210 struct fujitsu_bl *priv = acpi_driver_data(device);
214 acpi_handle_debug(device->handle, "get lcd level via GBLL\n");
216 status = acpi_evaluate_integer(device->handle, "GBLL", NULL, &state);
225 static int get_max_brightness(struct acpi_device *device)
227 struct fujitsu_bl *priv = acpi_driver_data(device);
231 acpi_handle_debug(device->handle, "get max lcd level via RBLL\n");
233 status = acpi_evaluate_integer(device->handle, "RBLL", NULL, &state);
242 /* Backlight device stuff */
246 struct acpi_device *device = bl_get_data(b);
248 return b->props.power == FB_BLANK_POWERDOWN ? 0 : get_lcd_level(device);
253 struct acpi_device *device = bl_get_data(b);
264 return set_lcd_level(device, b->props.brightness);
272 static ssize_t lid_show(struct device *dev, struct device_attribute *attr,
285 static ssize_t dock_show(struct device *dev, struct device_attribute *attr,
298 static ssize_t radios_show(struct device *dev, struct device_attribute *attr,
332 /* ACPI device for LCD brightness control */
340 static int acpi_fujitsu_bl_input_setup(struct acpi_device *device)
342 struct fujitsu_bl *priv = acpi_driver_data(device);
345 priv->input = devm_input_allocate_device(&device->dev);
350 acpi_device_hid(device));
352 priv->input->name = acpi_device_name(device);
364 static int fujitsu_backlight_register(struct acpi_device *device)
366 struct fujitsu_bl *priv = acpi_driver_data(device);
374 bd = devm_backlight_device_register(&device->dev, "fujitsu-laptop",
375 &device->dev, device,
385 static int acpi_fujitsu_bl_add(struct acpi_device *device)
393 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL);
398 strcpy(acpi_device_name(device), ACPI_FUJITSU_BL_DEVICE_NAME);
399 strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS);
400 device->driver_data = priv;
403 acpi_device_name(device), acpi_device_bid(device));
405 if (get_max_brightness(device) <= 0)
407 get_lcd_level(device);
409 ret = acpi_fujitsu_bl_input_setup(device);
413 return fujitsu_backlight_register(device);
418 static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event)
420 struct fujitsu_bl *priv = acpi_driver_data(device);
424 acpi_handle_info(device->handle, "unsupported event [0x%x]\n",
431 get_lcd_level(device);
434 acpi_handle_debug(device->handle,
441 set_lcd_level(device, newb);
446 /* ACPI device for hotkey handling */
517 static int acpi_fujitsu_laptop_input_setup(struct acpi_device *device)
519 struct fujitsu_laptop *priv = acpi_driver_data(device);
522 priv->input = devm_input_allocate_device(&device->dev);
527 acpi_device_hid(device));
529 priv->input->name = acpi_device_name(device);
541 static int fujitsu_laptop_platform_add(struct acpi_device *device)
543 struct fujitsu_laptop *priv = acpi_driver_data(device);
571 static void fujitsu_laptop_platform_remove(struct acpi_device *device)
573 struct fujitsu_laptop *priv = acpi_driver_data(device);
583 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
593 ret = call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
597 return call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, always);
602 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
605 ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
609 ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
619 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
622 return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
625 return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
631 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
634 if (call_fext_func(device,
644 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
647 return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
650 return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
656 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
659 if (call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
668 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
671 curr = call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0);
673 return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
676 return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
682 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
685 if (call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
691 static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
693 struct fujitsu_laptop *priv = acpi_driver_data(device);
697 if (call_fext_func(device,
699 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
706 ret = devm_led_classdev_register(&device->dev, led);
711 if ((call_fext_func(device,
713 (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) {
714 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
721 ret = devm_led_classdev_register(&device->dev, led);
732 * returned by method S000 of ACPI device FUJ02E3) seems to indicate
736 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
744 ret = devm_led_classdev_register(&device->dev, led);
754 if ((call_fext_func(device, FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) &&
755 (call_fext_func(device,
757 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
764 ret = devm_led_classdev_register(&device->dev, led);
772 static int acpi_fujitsu_laptop_add(struct acpi_device *device)
777 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL);
781 WARN_ONCE(fext, "More than one FUJ02E3 ACPI device was found. Driver may not work as intended.");
782 fext = device;
784 strcpy(acpi_device_name(device), ACPI_FUJITSU_LAPTOP_DEVICE_NAME);
785 strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS);
786 device->driver_data = priv;
796 acpi_device_name(device), acpi_device_bid(device));
798 while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 &&
801 acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n",
804 priv->flags_supported = call_fext_func(device, FUNC_FLAGS, 0x0, 0x0,
813 priv->flags_state = call_fext_func(device, FUNC_FLAGS, 0x4, 0x0,
817 acpi_handle_info(device->handle, "BTNI: [0x%x]\n",
818 call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0));
830 ret = acpi_fujitsu_laptop_input_setup(device);
834 ret = acpi_fujitsu_laptop_leds_register(device);
838 ret = fujitsu_laptop_platform_add(device);
850 static void acpi_fujitsu_laptop_remove(struct acpi_device *device)
852 struct fujitsu_laptop *priv = acpi_driver_data(device);
854 fujitsu_laptop_platform_remove(device);
859 static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode)
861 struct fujitsu_laptop *priv = acpi_driver_data(device);
876 static void acpi_fujitsu_laptop_release(struct acpi_device *device)
878 struct fujitsu_laptop *priv = acpi_driver_data(device);
892 static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
894 struct fujitsu_laptop *priv = acpi_driver_data(device);
900 acpi_handle_info(device->handle, "Unsupported event [0x%x]\n",
907 priv->flags_state = call_fext_func(device, FUNC_FLAGS, 0x4, 0x0,
910 while ((irb = call_fext_func(device,
915 acpi_fujitsu_laptop_press(device, scancode);
917 acpi_fujitsu_laptop_release(device);
919 acpi_handle_info(device->handle,
930 flags = call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0);